/* -------------------------------------------------------------------
   jemdoc.css - Modern, Professional Style for Academic Websites
   Author: Gemini (based on user's improved version)
   Description: A clean, responsive, and highly readable stylesheet.
   ------------------------------------------------------------------- */

/* --- FONT IMPORT --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Source+Code+Pro:wght@400;600&display=swap');

/* --- CSS VARIABLES & THEME --- */
:root {
	/* Fonts */
	--font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-code: 'Source Code Pro', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
	
	/* Colors - Professional & Accessible Palette */
	--color-primary: #1a237e;      /* A deep, academic navy blue */
	--color-primary-light: #e8eaf6; /* A very light, subtle accent */
	--color-primary-dark: #000051;  /* For hover states */
	
	--color-text: #212529;          /* High contrast dark gray for body */
	--color-text-light: #5a6268;    /* Lighter gray for secondary text */
	--color-text-muted: #6c757d;    /* For footer and subtle notes */
	
	--color-bg: #f9f9f9;            /* Slightly off-white background */
	--color-bg-alt: #ffffff;        /* For cards and menu */
	--color-bg-code: #282c34;       /* One Dark Pro theme for code blocks */
	--color-text-code: #abb2bf;      /* Light text for code */
	
	--border-color: #dee2e6;
	--border-radius: 8px;
	--shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
	--shadow-light: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* --- GLOBAL RESETS & DEFAULTS --- */
*, *::before, *::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	font-family: var(--font-main);
	font-size: 11pt;
	line-height: 1.75; /* Increased for better readability */
	background: var(--color-bg);
	color: var(--color-text);
	margin: 0;
	padding: 2.5em;
	display: flex; /* Using Flexbox for layout */
	gap: 2.5em;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* --- LAYOUT --- */
#layout-menu {
	width: 14em;
	flex-shrink: 0; /* Prevents menu from shrinking */
	background: var(--color-bg-alt);
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius);
	box-shadow: var(--shadow-light);
	padding: 1.5em;
	height: fit-content; /* Menu height adjusts to content */
	position: sticky; /* Menu stays visible on scroll */
	top: 2.5em;
	text-align: right;
}

#layout-content {
	flex-grow: 1; /* Content area takes remaining space */
	max-width: 800px; /* Optimal reading width */
	min-width: 0; /* Fixes flexbox overflow issues */
}

/* --- MENU NAVIGATION --- */
div.menu-category {
	font-weight: 700;
	color: var(--color-text);
	font-size: 1.1em;
	margin-top: 1.2em;
	padding-bottom: 0.5em;
	border-bottom: 1px solid var(--border-color);
}
div.menu-category:first-child {
	margin-top: 0;
}

div.menu-item a {
	display: block;
	text-decoration: none;
	color: var(--color-text-light);
	padding: 0.5em 0.8em;
	margin: 0.3em 0;
	border-radius: 6px;
	transition: all 0.2s ease-in-out;
}

div.menu-item a:hover {
	color: var(--color-primary-dark);
	background-color: var(--color-primary-light);
	transform: translateX(4px); /* Shifts right on hover */
}

div.menu-item a.current {
	font-weight: 700;
	color: var(--color-primary);
	background-color: var(--color-primary-light);
	box-shadow: inset 3px 0 0 var(--color-primary); /* Active indicator */
}

/* --- TYPOGRAPHY --- */
h1, h2, h3 {
	color: var(--color-primary);
	font-weight: 700;
	line-height: 1.3;
}

h1 {
	font-size: 2.5em;
	margin-bottom: 0.5em;
}

h2 {
	font-size: 1.8em;
	margin-top: 2.5em;
	margin-bottom: 1.2em;
	padding-bottom: 0.5em;
	border-bottom: 2px solid var(--color-primary-light);
}

h3 {
	font-size: 1.3em;
	font-weight: 700;
	margin-top: 2em;
	margin-bottom: 0.8em;
}

p {
	margin-bottom: 1.25em;
	text-align: left; /* Justify can create "rivers", left-align is more readable */
}

ul, ol {
	padding-left: 1.8em;
	margin-bottom: 1.25em;
}

li {
	margin-bottom: 0.7em;
}

/* --- LINKS --- */
a {
	text-decoration: none;
	color: var(--color-primary);
	font-weight: 500;
	transition: color 0.2s ease, text-decoration-color 0.2s ease;
	text-decoration: underline;
	text-decoration-color: var(--color-primary-light);
	text-underline-offset: 3px;
}

a:hover, a:focus {
	color: var(--color-primary-dark);
	text-decoration-color: var(--color-primary-dark);
}

/* --- CODE BLOCKS & INLINE CODE --- */
pre, code, tt {
	font-family: var(--font-code);
	font-size: 0.95em;
}

/* Inline code */
code, tt {
	background-color: var(--color-primary-light);
	color: var(--color-primary-dark);
	padding: 0.2em 0.4em;
	border-radius: 4px;
	font-weight: 600;
}

/* Block code */
pre {
	background: var(--color-bg-code);
	color: var(--color-text-code);
	border: 1px solid #444;
	border-radius: var(--border-radius);
	padding: 1.2em;
	overflow-x: auto;
	box-shadow: var(--shadow-light);
}
pre code {
	background: none;
	color: inherit;
	padding: 0;
	border-radius: 0;
	font-weight: 400;
}

/* --- TABLES & IMAGES --- */
table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 1.5em;
}
td, th {
	padding: 0.8em;
	text-align: left;
	border-bottom: 1px solid var(--border-color);
}
th {
	font-weight: 700;
	color: var(--color-text);
}
table.imgtable td, table.imgtable th {
	border: none;
	text-align: left;
	padding: 0.5em 1.5em 0.5em 0;
	vertical-align: top;
}

img {
	max-width: 100%;
	height: auto;
	border-radius: var(--border-radius);
}

/* --- FOOTER --- */
#footer {
	border-top: 1px solid var(--border-color);
	margin-top: 4em;
	padding-top: 1.5em;
	font-size: 0.9em;
	color: var(--color-text-muted);
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 1024px) {
	body {
		flex-direction: column; /* Stack menu on top of content */
		padding: 1.5em;
	}
	#layout-menu {
		position: static;
		width: 100%;
		text-align: left;
		top: auto;
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		padding: 0.5em;
	}
	div.menu-category {
		display: none; /* Hide categories on small screens for a cleaner nav bar */
	}
	div.menu-item a {
		margin: 0.2em;
	}
	div.menu-item a.current {
		box-shadow: inset 0 -3px 0 var(--color-primary); /* Underline active on mobile */
	}
	div.menu-item a:hover {
		transform: none; /* Disable transform on mobile */
	}
	#layout-content {
		max-width: none;
	}
	h1 { font-size: 2.2em; }
	h2 { font-size: 1.6em; }
}

@media (max-width: 600px) {
	body {
		font-size: 10pt;
		padding: 1em;
	}
	#layout-menu {
		flex-direction: column;
		align-items: center;
	}
	div.menu-item a {
		width: 100%;
		text-align: center;
	}
}
