@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,300;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --navy:       #0d1b2a;
  --navy-mid:   #142233;
  --navy-light: #1e3248;
  --amber:      #e8a020;
  --amber-pale: #f5c96b;
  --cream:      #f5f0e8;
  --warm-white: #fdfaf4;
  --text-main:  #1a1a2e;
  --text-muted: #5a6070;
  --border:     #ddd5c8;
  --card-bg:    #ffffff;
  --code-bg:    #0d1b2a;
  --code-text:  #e8d5a0;
  --success:    #2a7a5e;
  --link:       #1a4a8a;
  --link-hover: #e8a020;
  
  --radius: 6px;
  --shadow: 0 2px 16px rgba(13,27,42,0.10);
  --shadow-card: 0 4px 24px rgba(13,27,42,0.12);
  --max-width: 1080px;
  --gap: 2rem;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 17px; scroll-behavior: smooth; }

body {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 300;
  color: var(--text-main);
  background: var(--warm-white);
  line-height: 1.75;
}

/* ── Site Header ───────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.site-header .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}

.site-header .brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--amber);
  text-decoration: none;
  letter-spacing: 0.05em;
}

.site-header nav {
  display: flex;
  gap: 0;
}

.site-header nav a {
  display: block;
  padding: 0 1rem;
  height: 58px;
  line-height: 58px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-family: 'Source Serif 4', serif;
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  transition: color 0.2s, background 0.2s;
  border-bottom: 3px solid transparent;
}

.site-header nav a:hover,
.site-header nav a.active {
  color: #fff;
  border-bottom-color: var(--amber);
  background: rgba(255,255,255,0.05);
}

/* ── Hero Banner ───────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 60%, #1a3a5c 100%);
  color: #fff;
  padding: 4rem 2rem 3.5rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 40px,
    rgba(232,160,32,0.04) 40px,
    rgba(232,160,32,0.04) 41px
  );
}

.hero .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
}

.hero .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--amber);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hero .eyebrow::after {
  content: '';
  display: inline-block;
  width: 40px;
  height: 1px;
  background: var(--amber);
  opacity: 0.6;
}

.hero h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.15;
  max-width: 700px;
  letter-spacing: -0.01em;
}

.hero .subtitle {
  margin-top: 1rem;
  font-size: 1.05rem;
  color: rgba(255,255,255,0.7);
  font-weight: 300;
  font-style: italic;
  max-width: 600px;
}

/* ── Objectives Strip ──────────────────────────────────────── */
.objectives {
  background: var(--navy-mid);
  color: #fff;
  padding: 1.75rem 2rem;
  border-top: 1px solid rgba(232,160,32,0.25);
}

.objectives .inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.objectives h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 1rem;
}

.objectives ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2.5rem;
  padding: 0;
}

.objectives ul li {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.82);
  font-weight: 300;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.5;
}

.objectives ul li::before {
  content: '◆';
  color: var(--amber);
  font-size: 0.55rem;
  flex-shrink: 0;
  margin-top: 0.35em;
}

/* ── Main Layout ───────────────────────────────────────────── */
.page-body {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 820px) {
  .page-body { grid-template-columns: 1fr; }
}

main { min-width: 0; }

/* ── Section Headings ──────────────────────────────────────── */
main h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--navy);
  margin: 2.5rem 0 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--amber);
  display: inline-block;
}

main h2:first-of-type { margin-top: 0; }

main h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--navy-light);
  margin: 1.75rem 0 0.5rem;
}

main p {
  margin-bottom: 1.1rem;
  color: #2a2a3e;
  font-size: 0.97rem;
}

/* ── Code & Math ───────────────────────────────────────────── */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: #eee8dc;
  color: var(--navy);
  padding: 0.15em 0.45em;
  border-radius: 3px;
  font-weight: 500;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.25rem 0;
  line-height: 1.6;
  border-left: 3px solid var(--amber);
}

/* ── Definition Box ────────────────────────────────────────── */
.definition {
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber);
  background: #fffcf5;
  padding: 1.1rem 1.4rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
}

.definition .def-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.definition p {
  margin: 0;
  font-size: 0.95rem;
}

/* ── Example Box ───────────────────────────────────────────── */
.example-box {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.example-box .ex-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--amber);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
}

.example-box p, .example-box li {
  color: rgba(255,255,255,0.88);
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
}

.example-box ul {
  padding-left: 1.25rem;
}

/* ── Figure / Image ────────────────────────────────────────── */
figure {
  margin: 1.75rem 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
  margin: 0 auto;
}

figcaption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
  font-style: italic;
  line-height: 1.4;
}

figcaption a {
  color: var(--text-muted);
}

/* ── Sidebar ───────────────────────────────────────────────── */
aside { position: sticky; top: 80px; }

.sidebar-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow-card);
}

.sidebar-card h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.sidebar-card ul {
  list-style: none;
  padding: 0;
}

.sidebar-card ul li {
  margin-bottom: 0.6rem;
}

.sidebar-card ul li a {
  color: var(--link);
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  transition: color 0.15s;
  font-weight: 400;
}

.sidebar-card ul li a::before {
  content: '→';
  flex-shrink: 0;
  color: var(--amber);
  font-style: normal;
}

.sidebar-card ul li a:hover { color: var(--link-hover); }

/* topic nav in sidebar */
.topic-nav a {
  display: block;
  padding: 0.4rem 0;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s, padding-left 0.15s;
}

.topic-nav a:last-child { border-bottom: none; }
.topic-nav a:hover { color: var(--link-hover); padding-left: 0.3rem; }
.topic-nav a.current { color: var(--navy); font-weight: 600; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.55);
  text-align: center;
  padding: 1.75rem 2rem;
  font-size: 0.8rem;
  margin-top: 3rem;
}

.site-footer a { color: rgba(255,255,255,0.7); text-decoration: none; }
.site-footer a:hover { color: var(--amber); }

/* ── Utility ───────────────────────────────────────────────── */
.tag {
  display: inline-block;
  background: #eee8dc;
  color: var(--navy);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  margin: 0.15rem;
  letter-spacing: 0.04em;
}

.reading-time {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.55);
  margin-top: 1rem;
}

hr.section-break {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero .inner > * {
  animation: fadeUp 0.5s ease both;
}
.hero .eyebrow  { animation-delay: 0.05s; }
.hero h1        { animation-delay: 0.15s; }
.hero .subtitle { animation-delay: 0.25s; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .site-header nav { display: none; }
  .hero { padding: 2.5rem 1.25rem 2rem; }
  .page-body { padding: 2rem 1.25rem 3rem; gap: 2rem; }
  .objectives ul { flex-direction: column; }
}
