:root {
  --bg: #000000;          /* true black */
  --surface: #0d0d0d;     /* near-black panel */
  --surface-2: #141414;   /* slightly elevated */
  --border: #2a2a2a;      /* neutral border */

  /* ── Semantic color system ─────────────────────────────────
     Each color carries a fixed meaning throughout the document:
     cyan  → definitions, information, forward-pass direction
     amber → parameters (θ, w, b) and learning rate (α)
     rose  → gradients, error signals, backward-pass, divergence
     green → optimal states, convergence, global minimum
  ──────────────────────────────────────────────────────────── */
  --cyan: #06b6d4;
  --cyan-dim: #0891b2;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --green: #10b981;

  --text: #ffffff;        /* pure white */
  --dim: #b0b0b0;         /* secondary prose */
  --muted: #737373;       /* captions, labels */

  --display: "Playfair Display", Georgia, serif;
  --body: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scroll progress bar */
#scroll-progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--cyan), #67e8f9);
  z-index: 100;
  box-shadow: 0 0 12px var(--cyan);
  transition: width 80ms linear;
}

/* Side nav */
#side-nav {
  position: fixed; right: 24px; top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex; flex-direction: column; gap: 10px;
}
#side-nav a {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); border: 1px solid var(--border);
  display: block; transition: all 200ms ease;
  position: relative;
}
#side-nav a:hover { background: var(--muted); transform: scale(1.4); }
#side-nav a.active {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
#side-nav a::after {
  content: attr(data-label);
  position: absolute; right: 18px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease;
}
#side-nav a:hover::after { opacity: 1; }

/* Section base */
section {
  position: relative;
  padding: 120px 8vw 120px;
  max-width: 1400px;
  margin: 0 auto;
}
section.full { max-width: none; padding-left: 0; padding-right: 0; }

.section-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 18px;
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(6,182,212,0.08);
  border: 1px solid rgba(6,182,212,0.25);
  padding: 5px 14px 5px 10px;
  border-radius: 20px;
}
.section-num::before {
  content: ""; width: 16px; height: 1px;
  background: var(--cyan);
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }

h2 {
  font-size: clamp(36px, 4.5vw, 64px);
  line-height: 1.05;
  margin-bottom: 28px;
  letter-spacing: -0.02em;
  color: #ffffff;
}
h3 {
  font-size: 24px;
  margin-bottom: 12px;
  color: #ffffff;
}

.lede {
  font-size: 20px;
  color: var(--dim);
  max-width: 720px;
  margin-bottom: 48px;
  line-height: 1.55;
}

p { margin-bottom: 18px; max-width: 720px; color: var(--dim); }
p.wide { max-width: 920px; }

.mono { font-family: var(--mono); color: var(--amber); font-size: 0.92em; }
em.term { font-style: normal; font-family: var(--mono); color: var(--amber); font-size: 0.92em; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 800ms ease, transform 800ms cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }

/* Surface card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 28px;
  position: relative;
}
.card .corner {
  position: absolute; top: 10px; right: 14px;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  letter-spacing: 0.15em; text-transform: uppercase;
}

/* Hero */
#hero {
  height: 100vh;
  min-height: 700px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 0; max-width: none;
}
#hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#hero .hero-content {
  position: relative; z-index: 2;
  text-align: center;
  padding: 40px;
}
#hero h1 {
  font-size: clamp(48px, 8vw, 128px);
  line-height: 0.95;
  font-weight: 400;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  color: #ffffff;
}
#hero .sub {
  font-family: var(--mono);
  font-size: clamp(11px, 1.2vw, 14px);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 28px;
}
#hero .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
#hero .scroll-cue {
  position: absolute; bottom: 32px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); letter-spacing: 0.3em;
  text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 2;
}
#hero .scroll-cue .line {
  width: 1px; height: 32px;
  background: linear-gradient(180deg, var(--cyan), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(1.2); }
}

/* Section 1: GD intro */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}
.canvas-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
}
.canvas-frame canvas { width: 100%; height: 100%; display: block; }
.canvas-frame .label {
  position: absolute; top: 12px; left: 14px;
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); letter-spacing: 0.2em;
  text-transform: uppercase;
}
.canvas-frame .controls {
  position: absolute; bottom: 12px; left: 14px; right: 14px;
  display: flex; gap: 8px; align-items: center;
  font-family: var(--mono); font-size: 11px;
}
.btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 3px;
  transition: all 180ms ease;
}
.btn:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 10px rgba(6,182,212,0.3); }
.btn.primary { border-color: var(--cyan); color: var(--cyan); }
.btn.primary:hover { background: rgba(6,182,212,0.1); }

/* Equation block (KaTeX) */
.eq {
  text-align: center;
  padding: 40px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 24px 0 36px;
  position: relative;
  overflow-x: auto;
}
.eq.left { text-align: left; }
.eq .corner-label {
  position: absolute; top: 10px; left: 14px;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  letter-spacing: 0.2em; text-transform: uppercase;
}
.eq .corner-actions {
  position: absolute; top: 8px; right: 10px;
  display: flex; gap: 8px;
}

/* KaTeX overrides for dark theme */
.katex { color: #e2e8f0 !important; font-size: 1.18em !important; }
.katex .mord, .katex .mop, .katex .mbin, .katex .mrel { color: inherit; }

/* Interactive equation tokens — added by equations.js via \htmlClass{} */
.eq-tok {
  cursor: help;
  border-radius: 3px;
  padding: 0 2px;
  transition: background 160ms ease, text-shadow 160ms ease, transform 160ms ease;
}
.eq-tok.eq-hl { background: rgba(255,255,255,0.06); }
.tk-theta, .tk-theta * { color: #06b6d4 !important; }
.tk-alpha, .tk-alpha * { color: #f59e0b !important; }
.tk-grad,  .tk-grad *  { color: #f43f5e !important; }
.tk-z,     .tk-z *     { color: #f59e0b !important; }
.tk-a,     .tk-a *     { color: #e2e8f0 !important; }
.tk-act,   .tk-act *   { color: #06b6d4 !important; }
.tk-w,     .tk-w *     { color: #06b6d4 !important; }
.tk-b,     .tk-b *     { color: #f43f5e !important; }
.tk-sigma, .tk-sigma * { color: #c084fc !important; }
.tk-delta, .tk-delta * { color: #f43f5e !important; }
.tk-loss,  .tk-loss *  { color: #67e8f9 !important; }
.tk-yhat,  .tk-yhat *  { color: #06b6d4 !important; }
.tk-y,     .tk-y *     { color: #f59e0b !important; }
.tk-mom,   .tk-mom *   { color: #06b6d4 !important; }
.tk-rms,   .tk-rms *   { color: #f59e0b !important; }
.eq-tok.eq-hl {
  text-shadow: 0 0 10px currentColor;
  background: rgba(255,255,255,0.04);
}

/* Reveal-on-scroll for equations */
.eq.reveal-eq .katex { opacity: 0; transform: translateY(8px); transition: opacity 700ms ease, transform 700ms ease; display: inline-block; }
.eq.reveal-eq.in .katex { opacity: 1; transform: none; }

/* Chain rule step-through builder */
.chain-builder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 36px 32px 28px;
  margin: 24px 0 36px;
  position: relative;
}
.chain-builder .corner-label {
  position: absolute; top: 10px; left: 14px;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  letter-spacing: 0.2em; text-transform: uppercase;
}
.chain-builder .cb-step-counter {
  position: absolute; top: 10px; right: 14px;
  font-family: var(--mono); font-size: 10px; color: var(--cyan);
  letter-spacing: 0.2em; text-transform: uppercase;
}
.chain-builder .cb-eq {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 80px;
  padding: 20px 0;
}
.chain-builder .cb-chunk {
  opacity: 0;
  transform: translateY(14px) scale(0.92);
  transition: opacity 500ms ease, transform 500ms cubic-bezier(.2,.7,.2,1), filter 500ms ease;
  filter: drop-shadow(0 0 0 transparent);
}
.chain-builder .cb-chunk.visible {
  opacity: 1;
  transform: none;
}
.chain-builder .cb-chunk.just-added {
  filter: drop-shadow(0 0 14px rgba(6,182,212,0.6));
}
.chain-builder .cb-controls {
  display: flex; gap: 10px; justify-content: center;
  margin-top: 20px;
}
.chain-builder .cb-hint {
  text-align: center;
  font-family: var(--body);
  font-size: 14px;
  color: var(--muted);
  margin-top: 14px;
  font-style: italic;
  min-height: 22px;
  transition: color 200ms ease;
}
.chain-builder .cb-hint.active { color: var(--dim); }

/* Optimizer equation cards with KaTeX */
.opt-eq-card .formula { font-family: var(--mono); font-size: 14px; line-height: 1.8; color: var(--dim); }
.opt-eq-card .katex-display { margin: 0.4em 0 !important; }
.opt-eq-card .katex { font-size: 0.95em !important; }

/* Tooltip */
.tooltip {
  position: fixed;
  background: #0a0a0a;
  border: 1px solid var(--cyan);
  padding: 14px 18px;
  border-radius: 4px;
  font-family: var(--body);
  font-size: 13px;
  max-width: 280px;
  color: var(--text);
  box-shadow: 0 4px 20px rgba(6,182,212,0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 200;
  line-height: 1.5;
}
.tooltip.show { opacity: 1; }
.tooltip .tt-label {
  font-family: var(--mono); font-size: 10px;
  color: var(--cyan); letter-spacing: 0.2em;
  text-transform: uppercase; margin-bottom: 6px; display: block;
}

/* Intuition card */
.intuition {
  background: rgba(255,255,255,0.02);
  border-left: 2px solid var(--cyan);
  padding: 24px 28px;
  margin: 32px 0;
  font-family: var(--display);
  font-style: italic;
  font-size: 19px;
  color: var(--dim);
  max-width: 720px;
}
.intuition::before {
  content: "❝";
  font-size: 32px;
  color: var(--cyan);
  display: block;
  line-height: 1;
  margin-bottom: 8px;
  font-style: normal;
}

/* Section 2: Landscape */
#landscape-wrap { position: relative; }
#landscape-wrap .legend {
  position: absolute; top: 20px; right: 20px;
  background: rgba(13,17,23,0.85);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 11px;
  display: flex; flex-direction: column; gap: 8px;
  backdrop-filter: blur(8px);
}
#landscape-wrap .legend div { display: flex; align-items: center; gap: 8px; }
#landscape-wrap .legend .dot {
  width: 10px; height: 10px; border-radius: 50%;
}

/* Section 3: GD Types */
.gd-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}
.gd-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 24px;
  position: relative;
}
.gd-card h3 { font-size: 20px; margin-bottom: 4px; }
.gd-card .tag {
  font-family: var(--mono); font-size: 10px;
  color: var(--cyan); letter-spacing: 0.2em;
  text-transform: uppercase; margin-bottom: 16px;
}
.gd-card canvas { width: 100%; aspect-ratio: 1.2; display: block; border-radius: 3px; background: #000; }
.gd-card .desc { font-size: 14px; color: var(--muted); margin-top: 14px; line-height: 1.5; }

/* Comparison table */
.compare {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 13px;
  margin-top: 24px;
}
.compare th, .compare td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.compare th {
  color: var(--cyan);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 11px;
}
.compare td:first-child { color: var(--muted); }
.compare .bar {
  display: inline-block;
  height: 6px;
  background: var(--cyan);
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 8px;
  width: 0;
  transition: width 1.2s cubic-bezier(.2,.7,.2,1);
}
.compare .bar.amber { background: var(--amber); }
.compare .bar.rose { background: var(--rose); }

/* Section 4: Learning rate */
.lr-wrap { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; }
.lr-canvas { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; aspect-ratio: 4/3; }
.slider-block { padding: 0 8px; }
.slider-block .lr-value {
  font-family: var(--mono);
  font-size: 56px;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.slider-block .lr-label {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); letter-spacing: 0.2em;
  text-transform: uppercase; margin-bottom: 24px;
}
.slider-block .lr-state {
  font-family: var(--mono); font-size: 13px;
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 32px; padding: 8px 12px;
  display: inline-block;
  border-radius: 3px;
}
.slider-block .lr-state.slow { color: var(--muted); background: rgba(115,115,115,0.1); border: 1px solid rgba(115,115,115,0.3); }
.slider-block .lr-state.ok  { color: var(--green); background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); }
.slider-block .lr-state.bad { color: var(--rose);  background: rgba(244,63,94,0.1);  border: 1px solid rgba(244,63,94,0.3); }

.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px;
  background: linear-gradient(90deg, #1e40af 0%, #16a34a 35%, #ca8a04 65%, var(--rose) 100%);
  border-radius: 4px;
  outline: none;
  margin-bottom: 16px;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px;
  background: #fff;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 0 12px var(--cyan);
}
.slider::-moz-range-thumb {
  width: 20px; height: 20px;
  background: #fff;
  border: 2px solid var(--cyan);
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 0 12px var(--cyan);
}
.slider-ticks {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); letter-spacing: 0.1em;
}

/* Section 5: Optimizers */
.opt-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.opt-race { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; aspect-ratio: 1.3; position: relative; }
.opt-chart { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; aspect-ratio: 1.3; position: relative; }
.opt-legend {
  position: absolute; bottom: 60px; right: 16px;
  font-family: var(--mono); font-size: 11px;
  display: flex; flex-direction: column; gap: 6px;
  z-index: 2;
  background: rgba(13,17,23,0.85);
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
}
.opt-legend div { display: flex; align-items: center; gap: 8px; }
.opt-legend .dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }

.opt-eqs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.opt-eq-card { background: var(--surface); border: 1px solid var(--border); padding: 18px; border-radius: 4px; }
.opt-eq-card .name { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 10px; }
.opt-eq-card .formula { font-family: var(--mono); font-size: 13px; line-height: 1.8; color: var(--dim); }
.opt-eq-card .formula .hl { color: var(--amber); }
.opt-eq-card .formula .hl2 { color: var(--cyan); }

/* Section 6-9: Neural net */
.nn-wrap {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  aspect-ratio: 2/1;
  overflow: hidden;
}
.nn-wrap svg { width: 100%; height: 100%; display: block; }
.nn-controls {
  display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap;
  align-items: center;
}
.nn-controls .status {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); letter-spacing: 0.15em;
  text-transform: uppercase; margin-left: auto;
}
.nn-controls .status .live { color: var(--cyan); }

/* Backprop chain */
.chain {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; padding: 32px 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 18px;
}
.chain .node {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  transition: all 400ms ease;
  cursor: help;
  position: relative;
}
.chain .node.lit {
  color: var(--rose);
  border-color: var(--rose);
  box-shadow: 0 0 20px rgba(244,63,94,0.4);
}
.chain .arrow { color: var(--muted); }
.chain .arrow.lit { color: var(--rose); text-shadow: 0 0 10px var(--rose); }

/* Training loop */
.loop-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.loop-diagram { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; aspect-ratio: 1; position: relative; overflow: hidden; }
.loop-chart { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; aspect-ratio: 1; position: relative; overflow: hidden; }
.loop-diagram canvas, .loop-chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.loop-readout {
  position: absolute; top: 14px; left: 16px;
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); letter-spacing: 0.15em; text-transform: uppercase;
}
.loop-readout .val { color: var(--cyan); font-size: 24px; display: block; margin-top: 4px; letter-spacing: 0; }

/* Playground */
.play-wrap {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  align-items: start;
}
.play-canvas { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; aspect-ratio: 1; position: relative; }
.play-controls { display: flex; flex-direction: column; gap: 20px; }
.ctl-group label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); display: block; margin-bottom: 8px;
}
.ctl-group select {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); padding: 10px 12px;
  font-family: var(--mono); font-size: 13px; border-radius: 3px;
  cursor: pointer;
}
.ctl-group select:focus { outline: 1px solid var(--cyan); }
.play-loss { width: 100%; aspect-ratio: 2.4; background: #000; border: 1px solid var(--border); border-radius: 4px; }
.readout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  font-family: var(--mono); font-size: 11px;
}
.readout div { background: var(--surface); border: 1px solid var(--border); padding: 12px; border-radius: 3px; }
.readout span { color: var(--muted); letter-spacing: 0.15em; text-transform: uppercase; display: block; font-size: 10px; margin-bottom: 4px; }
.readout strong { color: var(--cyan); font-size: 22px; font-weight: 400; }

/* ── Color key legend ─────────────────────────────────────── */
.color-key {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.ck-label {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  white-space: nowrap;
  padding-right: 16px;
  border-right: 1px solid var(--border);
}
.ck-item {
  display: flex;
  align-items: center;
  gap: 7px;
}
.ck-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.ck-dot.cyan  { background: var(--cyan);  box-shadow: 0 0 6px var(--cyan);  }
.ck-dot.amber { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.ck-dot.rose  { background: var(--rose);  box-shadow: 0 0 6px var(--rose);  }
.ck-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* Footer */
footer {
  padding: 80px 8vw 60px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
}

/* Responsive */
@media (max-width: 900px) {
  .two-col, .lr-wrap, .opt-wrap, .loop-wrap, .play-wrap { grid-template-columns: 1fr; gap: 32px; }
  .gd-grid { grid-template-columns: 1fr; }
  .opt-eqs { grid-template-columns: 1fr; }
  .text-two { grid-template-columns: 1fr; gap: 24px; }
  section { padding: 80px 6vw; }
  #side-nav { display: none; }
  h2 { font-size: clamp(32px, 6vw, 48px); }
  .lede { font-size: 18px; }
  .nn-wrap { aspect-ratio: 16/10; }
  .abstract { padding: 28px 24px; }
  .insight { font-size: 18px; padding: 24px 24px; }
  .defbox { padding: 18px 22px; }
  .callout { grid-template-columns: 1fr; gap: 8px; }
  .callout .tag { padding-top: 0; }
  .nn-controls { gap: 8px; }
  .nn-controls .status { width: 100%; margin-left: 0; margin-top: 8px; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  section { padding: 60px 5vw; }
  h2 { font-size: clamp(28px, 7vw, 40px); margin-bottom: 18px; }
  .lede { font-size: 16px; margin-bottom: 32px; }
  p { font-size: 15px; }
  #hero h1 { font-size: clamp(40px, 13vw, 80px); }
  #hero .sub, #hero .meta { font-size: 10px; letter-spacing: 0.25em; }
  .compare th, .compare td { padding: 10px 6px; font-size: 11px; }
  .nn-wrap { aspect-ratio: 4/3; }
  .nn-controls .btn { font-size: 10px; padding: 6px 10px; }
  .chain-builder { padding: 28px 18px 22px; }
  .chain-builder .cb-eq { font-size: 12px; }
  .eq { padding: 24px 12px; }
  .play-controls { gap: 14px; }
  .opt-eq-card { padding: 14px; }
  .gd-card { padding: 18px; }
  .slider-block .lr-value { font-size: 40px; }
  .abstract { padding: 22px 18px; }
  .abstract p { font-size: 15px; }
  .intuition { font-size: 16px; padding: 18px 22px; }
  .insight { font-size: 16px; padding: 22px 18px; }
  .insight::before { left: 12px; }
  footer { font-size: 9px; padding: 50px 5vw 40px; }
}

/* Section divider */
.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 0;
}

/* Definition / key-term box */
.defbox {
  background: rgba(6,182,212,0.04);
  border: 1px solid rgba(6,182,212,0.2);
  border-left: 3px solid var(--cyan);
  padding: 22px 26px;
  margin: 28px 0;
  border-radius: 4px;
  max-width: 820px;
}
.defbox .label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}
.defbox h4 {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}
.defbox p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--dim);
  margin: 0;
}

/* Callout — "in practice", "why it matters", etc */
.callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 20px 24px;
  margin: 24px 0;
  max-width: 820px;
}
.callout .tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--amber);
  padding-top: 2px;
  white-space: nowrap;
}
.callout.cyan .tag { color: var(--cyan); }
.callout.rose .tag { color: var(--rose); }
.callout p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--dim); }
.callout p + p { margin-top: 10px; }

/* Two-column text block */
.text-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  max-width: 1100px;
  margin: 36px 0;
}
.text-two h4 {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 10px;
  color: var(--text);
}
.text-two .lab {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}
.text-two p { font-size: 15px; line-height: 1.6; }
@media (max-width: 900px) {
  .text-two { grid-template-columns: 1fr; gap: 24px; }
}

/* Inline glossary term — hover shows definition */
.gloss {
  border-bottom: 1px dashed var(--cyan);
  cursor: help;
  color: var(--text);
}

/* Key insight */
.insight {
  font-family: var(--display);
  font-style: italic;
  font-size: 22px;
  line-height: 1.5;
  color: #ffffff;
  padding: 32px 36px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 36px 0;
  max-width: 880px;
  position: relative;
}
.insight::before {
  content: "KEY INSIGHT";
  position: absolute;
  top: -8px; left: 24px;
  font-family: var(--mono);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.3em;
  background: var(--bg);
  padding: 0 12px;
  color: var(--cyan);
}

/* Mini abstract section */
.abstract {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 40px 44px;
  margin: 24px 0 48px;
  max-width: 1000px;
}
.abstract .lab {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: block;
}
.abstract p { font-size: 17px; line-height: 1.65; max-width: none; color: var(--dim); }
.abstract ul {
  list-style: none;
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.abstract li {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  padding-left: 16px;
  position: relative;
}
.abstract li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--cyan);
}
.abstract li strong { color: var(--text); font-weight: 500; }
