/* Layout: one reading column (~68ch) with figures allowed wider; four numbered stages per page (See, Try, Prove, Apply). */
:root {
  /* Palette from the Hexa Valuation brand (brand.py, engine.py, vfx.py), 2026-11-06.
     Brand blue #01337E and gold #FCC010 split the hexagon as in the HV mark: Math left, Quant right. */
  --paper: #f6f7fa;
  --surface: #ffffff;
  --ink: #0a1633;
  --muted: #5f6b85;
  --rule: #dee3ee;
  --grid: rgba(1, 51, 126, 0.06);
  --accent: #01337e;
  --accent-soft: rgba(1, 51, 126, 0.09);
  --ok: #11804e;
  --ok-soft: rgba(22, 150, 92, 0.13);
  --bad: #d63a3a;
  --bad-soft: rgba(214, 58, 58, 0.11);
  --mark: rgba(252, 192, 16, 0.34);
  --live-bg: #e1e9f7;
  --live-line: rgba(1, 51, 126, 0.55);
  --live-shadow: rgba(10, 22, 51, 0.28);
  --quiet: rgba(10, 22, 51, 0.045);
  --ink-2: #2e3a56;
  --math: #01337e;
  --quant: #8a6100;
  --math-fill: #01337e;
  --quant-fill: #fcc010;
  --before: #11804e;
  --after: #b4307a;

  --font-display: "Poppins", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --step--1: 0.9375rem;
  --step-0: 1.125rem;
  --step-1: 1.2rem;
  --step-2: 1.55rem;
  --step-3: 2.2rem;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #061029; --surface: #10224e; --ink: #ffffff; --muted: #b2bed8; --rule: #24376a;
    --grid: rgba(143, 180, 255, 0.06); --accent: #8fb4ff; --accent-soft: rgba(143, 180, 255, 0.14);
    --ok: #34d378; --ok-soft: rgba(52, 211, 120, 0.15); --bad: #f26464; --bad-soft: rgba(238, 76, 76, 0.15);
    --mark: rgba(250, 190, 30, 0.24); color-scheme: dark;
    --live-bg: rgba(143, 180, 255, 0.12); --live-line: rgba(143, 180, 255, 0.62); --live-shadow: rgba(0, 0, 0, 0.6);
    --quiet: rgba(255, 255, 255, 0.045); --ink-2: #c2cce0; --math: #8fb4ff; --quant: #fabe1e; --math-fill: #8fb4ff; --quant-fill: #fabe1e; --before: #34d378; --after: #f08bc0;
  }
}
:root[data-theme="dark"] {
  --paper: #061029; --surface: #10224e; --ink: #ffffff; --muted: #b2bed8; --rule: #24376a;
    --grid: rgba(143, 180, 255, 0.06); --accent: #8fb4ff; --accent-soft: rgba(143, 180, 255, 0.14);
    --ok: #34d378; --ok-soft: rgba(52, 211, 120, 0.15); --bad: #f26464; --bad-soft: rgba(238, 76, 76, 0.15);
    --mark: rgba(250, 190, 30, 0.24); color-scheme: dark;
    --live-bg: rgba(143, 180, 255, 0.12); --live-line: rgba(143, 180, 255, 0.62); --live-shadow: rgba(0, 0, 0, 0.6);
    --quiet: rgba(255, 255, 255, 0.045); --ink-2: #c2cce0; --math: #8fb4ff; --quant: #fabe1e; --math-fill: #8fb4ff; --quant-fill: #fabe1e; --before: #34d378; --after: #f08bc0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.7 var(--font-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- site chrome ---------- */
.site-head {
  max-width: var(--col); margin: 0 auto; padding-block: 18px 10px;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px;
  border-bottom: 1px solid var(--rule);
}
.brand { font: 600 var(--step-1)/1.2 var(--font-display); color: var(--ink); text-decoration: none; letter-spacing: 0.01em; }
.brand .bt { color: var(--ink); }
.brand .bt span { color: var(--accent); }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--step--1); }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a { padding: 2px 0; border-bottom: 2px solid transparent; }
.site-nav a[aria-current="page"], .site-nav a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.site-nav a:hover { color: var(--ink); }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); text-decoration: underline; }
.crumb .sep { margin: 0 8px; }

/* One centred column: text, figures and boxes share the same edges (about 80 characters a line at 18 px).
   Hub pages with card grids and the map use wider columns; header and footer follow the page's column. */
:root { --col: 760px; }
body:has(main.hub) { --col: 1000px; }
/* The home hexagon scales with the reader's text size, so its column is in rem (1000 px at 16 px). */
body:has(main.home) { --col: 62.5rem; }
body:has(main.wide) { --col: 1240px; }
main { max-width: var(--col); margin: 0 auto; padding-block: 28px 64px; }
.prose { max-width: none; }
main.hub .prose, main.wide .prose { max-width: 760px; }
.prose p, .prose li { text-wrap: pretty; }

.crumb { font: 500 var(--step--1)/1.3 var(--font-ui); color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
h1 { font: 600 var(--step-3)/1.18 var(--font-display); letter-spacing: -0.015em; margin: 6px 0 12px; text-wrap: balance; }
h2 { font: 600 var(--step-2)/1.2 var(--font-ui); margin: 0 0 10px; text-wrap: balance; }
h3 { font: 600 var(--step-1)/1.3 var(--font-ui); margin: 22px 0 8px; text-wrap: balance; }
.lede { font-size: var(--step-1); color: var(--ink); margin: 0 0 18px; line-height: 1.55; }

.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: var(--step--1); color: var(--muted); margin-bottom: 14px; }
.meta b { color: var(--ink); font-weight: 600; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
.badge {
  font: 500 0.78rem/1 var(--font-ui); letter-spacing: 0.02em;
  padding: 2px 0; color: var(--muted);
}
.badges { gap: 4px 16px; }
.badge.done { color: var(--ok); }
.badge.done::before { content: "✓ "; }
.badge.pending::before { content: "○ "; }

/* ---------- stages ---------- */
.stage { padding-block: 30px 8px; border-top: 1px solid var(--rule); margin-top: 26px; }
.stage-label {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 4px;
  font: 600 0.78rem/1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.stage-label .n {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--muted); font-size: 0.75rem; letter-spacing: 0;
}

/* ---------- figures ---------- */
.figure {
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 12px; margin: 14px 0;
}
.figure svg, .figure canvas { display: block; width: 100%; height: auto; max-width: 100%; }
.figure figcaption, .caption { font-size: var(--step--1); color: var(--muted); margin-top: 6px; }
.svg-text { font: 12px var(--font-ui); fill: var(--muted); font-variant-numeric: tabular-nums; }
.svg-axis { stroke: var(--muted); stroke-width: 1; }
.svg-gridline { stroke: var(--rule); stroke-width: 1; }

.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 18px; margin: 10px 0; }
.control { display: grid; gap: 4px; min-width: 0; }
.control label, .control .label { font-size: var(--step--1); color: var(--muted); }
.control-row { display: flex; align-items: center; gap: 10px; }
.control-row input[type="range"] { flex: 1; min-width: 0; }
.control-row input[type="number"] { width: 6.5em; }

input[type="number"], input[type="text"], input[type="search"], select {
  font: 500 var(--step-0)/1.2 var(--font-ui); color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--live-line); border-radius: var(--radius); padding: 6px 8px;
  box-shadow: inset 0 1px 2px var(--quiet);
}
input[type="number"]:focus, input[type="text"]:focus, input[type="search"]:focus, select:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
/* Every button is raised and blue-edged: if it looks like this, it responds. */
button, .btn {
  font: 600 var(--step--1)/1.1 var(--font-ui); color: var(--accent); background: var(--live-bg);
  border: 1.5px solid var(--live-line); border-radius: var(--radius); padding: 9px 14px; cursor: pointer;
  box-shadow: 0 2px 0 var(--live-shadow); text-decoration: none; display: inline-block;
  transition: background-color 0.12s, transform 0.06s, box-shadow 0.06s;
}
button:hover:not(:disabled), .btn:hover { border-color: var(--accent); background: var(--accent-soft); }
button:active:not(:disabled), .btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--live-shadow); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
button.primary:hover:not(:disabled), .btn.primary:hover { background: var(--accent); filter: brightness(1.08); }
button:disabled { opacity: 0.55; cursor: default; box-shadow: none; transform: none; }
/* Range sliders: a large blue knob on a visible track. */
input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; height: 30px; cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--live-line); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--live-line); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--accent), 0 2px 4px var(--live-shadow); cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface);
  box-shadow: 0 0 0 1.5px var(--accent), 0 2px 4px var(--live-shadow); cursor: grab;
}
input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.1); }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border-radius: 999px; }
.chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--paper); }

.status { font: 500 var(--step--1)/1.4 var(--font-ui); padding: 8px 10px; border-radius: var(--radius); margin-top: 8px; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.bad { background: var(--bad-soft); color: var(--bad); }
.status.info { background: var(--quiet); color: var(--ink); }

/* ---------- prediction ---------- */
.predict { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; margin: 16px 0; }
.predict .q { font-weight: 600; margin: 0 0 10px; }
.predict .tag { font: 600 0.72rem/1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.options { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; border: 0; }
.options label {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1.5px solid var(--live-line);
  border-radius: var(--radius); cursor: pointer; background: var(--live-bg); box-shadow: 0 2px 0 var(--live-shadow);
}
.options label:hover { border-color: var(--accent); }
.options label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.options input { margin-top: 0.3em; accent-color: var(--accent); }
.options label.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.options label.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.feedback { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--rule); background: var(--quiet); border-radius: var(--radius); }
.feedback.ok { border-color: var(--ok); background: var(--ok-soft); }
.feedback.bad { border-color: var(--bad); background: var(--bad-soft); }

/* ---------- proof ---------- */
.theorem { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; margin: 14px 0; }
.theorem .kind { font: 600 0.75rem/1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.assume { font-size: var(--step--1); color: var(--muted); }
.proof { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; }
.proof li {
  display: grid; grid-template-columns: 2.2em minmax(0, 1fr); gap: 0 10px; align-items: baseline;
  padding: 8px 10px; border-radius: var(--radius); border: 1px solid transparent;
}
.proof li.linked { cursor: pointer; border: 1.5px dashed var(--live-line); background: var(--live-bg); }
.proof li.linked:hover { border-color: var(--accent); border-style: solid; }
.proof li.active { background: var(--mark); border-color: transparent; }
.proof .ln { font: 500 var(--step--1)/1.6 var(--font-ui); color: var(--muted); }
.proof .stmt { min-width: 0; overflow-x: auto; }
.proof .why { display: block; font-size: var(--step--1); color: var(--muted); margin-top: 2px; }
.proof .see { font: 500 0.72rem/1 var(--font-ui); color: var(--accent); margin-left: 6px; white-space: nowrap; }
.qed { text-align: right; font-size: var(--step-1); padding-right: 10px; color: var(--ink); }
.scratch { font-size: var(--step--1); color: var(--muted); border: 1px dashed var(--rule); border-radius: var(--radius); padding: 10px 12px; }

/* ---------- problems ---------- */
.problem { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; margin: 14px 0; }
.problem .pid { font: 600 0.75rem/1 var(--font-ui); letter-spacing: 0.06em; color: var(--muted); }
.problem .answer-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.problem .answer-row input[type="text"], .problem .answer-row input[type="number"] { width: 12em; max-width: 100%; }
.hint { font-size: var(--step--1); margin-top: 8px; padding: 8px 10px; background: var(--quiet); border-radius: var(--radius); }
.solution { margin-top: 10px; padding: 10px 12px; border-top: 1px solid var(--rule); }
.solved-tag { font: 600 0.72rem/1 var(--font-ui); color: var(--ok); margin-left: 8px; }

/* ---------- misc ---------- */
.reading { font-size: var(--step--1); }
.reading li { margin-bottom: 4px; }
.disclaimer { font-size: var(--step--1); color: var(--muted); border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 30px; }
.table-wrap { overflow-x: auto; }
.mono { font-family: var(--font-mono); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 18px; }
.card {
  display: grid; gap: 8px; align-content: start; padding: 16px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.card:hover { border-color: var(--accent); }
.card .subject { font: 600 0.72rem/1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.card h2 { font-size: var(--step-1); margin: 0; }
.card p { margin: 0; color: var(--muted); font-size: var(--step--1); }
.site-foot { max-width: var(--col); margin: 0 auto; padding-block: 18px 30px; border-top: 1px solid var(--rule); font-size: var(--step--1); color: var(--muted); }
.site-foot p { margin: 8px 0 0; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.foot-nav a { color: var(--muted); }
.foot-nav a:hover { color: var(--ink); }
/* info pages (about, privacy, terms, ...) */
.info h2 { margin-top: 32px; }
.info .updated { font-size: var(--step--1); color: var(--muted); }
.info table { border-collapse: collapse; font-size: var(--step--1); width: 100%; }
.info th, .info td { border-bottom: 1px solid var(--rule); padding: 6px 12px 6px 0; text-align: left; vertical-align: top; }
mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; max-width: 100%; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- readability components ---------- */
/* Big idea: the page's question and short answer, shown before anything else. */
.big-idea { border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); padding: 14px 18px; margin: 6px 0 20px; }
.big-idea .q { font: 600 var(--step-2)/1.3 var(--font-ui); margin: 0 0 6px; text-wrap: balance; }
.big-idea .a { font-size: var(--step-1); line-height: 1.55; margin: 0; }

/* Guided steps: one figure, a short caption per step, Back/Next. */
.steps { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; margin: 14px 0; }
.steps-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.steps-count { font: 600 0.78rem/1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.steps-dots { display: flex; gap: 6px; }
.steps-dots button { width: 14px; height: 14px; padding: 0; border-radius: 50%; border: 1.5px solid var(--accent); background: transparent; box-shadow: none; }
.steps-dots button[aria-current="step"] { background: var(--accent); }
.steps-title { font: 600 var(--step-1)/1.3 var(--font-ui); margin: 10px 0 4px; }
.steps-text { margin: 0; }
.steps-nav { display: flex; gap: 8px; margin-top: 12px; }

/* Key numbers shown large instead of inside sentences. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { border: 1px solid var(--rule); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); min-width: 0; }
.stat .label { font-size: var(--step--1); color: var(--muted); display: block; }
.stat .value { font: 600 1.6rem/1.2 var(--font-ui); font-variant-numeric: tabular-nums; display: block; margin-top: 2px; }
.stat.ok .value { color: var(--ok); }
.stat.bad .value { color: var(--bad); }

/* Plain-language takeaway at the end of a stage. */
.takeaway { background: var(--quiet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; }
.takeaway b:first-child { display: block; font: 600 0.78rem/1.4 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ok); margin-bottom: 2px; }

/* Optional detail, closed by default. */
details.more { border: 1px solid var(--rule); border-radius: var(--radius); margin: 12px 0; background: var(--surface); }
details.more > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; list-style: none; color: var(--accent); border-radius: var(--radius); }
details.more > summary:hover { background: var(--live-bg); }
details.more { border-color: var(--live-line); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; display: inline-block; width: 1.2em; color: var(--accent); font-family: var(--font-ui); }
details.more[open] > summary::before { content: "−"; }
details.more > .more-body { padding: 0 14px 12px; }

/* Page footer block for review badges and prerequisites. */
.page-notes { margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: var(--step--1); color: var(--muted); }

/* ---------- interaction components ---------- */
/* Live goal with a status line (MM.challenge). */
.challenge { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 12px 16px; margin: 14px 0; }
.challenge.is-done { border-color: var(--ok); }
.challenge-count { font: 600 0.78rem/1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.challenge-text { margin: 6px 0 4px; font-weight: 600; }

/* One-click guess (MM.quickGuess). */
.quick-guess { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: 12px 16px; margin: 12px 0; }
.quick-guess .q { font-weight: 600; margin: 0 0 8px; }
.guess-options { display: flex; flex-wrap: wrap; gap: 8px; }

/* Proof built from choices (MM.choiceProof). */
.choice-prompt { font-weight: 600; margin: 12px 0 8px; }
.choice-options { display: grid; gap: 8px; }
.choice-options button, .guess-options button { color: var(--ink); }
.choice-options button { text-align: left; font-weight: 400; line-height: 1.5; padding: 10px 12px; max-width: 100%; overflow-x: auto; }

.guess-options button.is-correct, .choice-options button.is-correct { border-color: var(--ok); background: var(--ok-soft); opacity: 1; }
.guess-options button.is-wrong, .choice-options button.is-wrong { border-color: var(--bad); background: var(--bad-soft); opacity: 1; }
details.more.prereq-box > summary .prereq-sub { font-weight: 400; color: var(--muted); }
.prereq-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.prereq-item { border-top: 1px solid var(--rule); padding-top: 12px; }
.prereq-item:first-child { border-top: 0; padding-top: 0; }
.prereq-topic { display: block; font-family: var(--font-ui); font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.prereq-item .q { font-weight: 600; margin: 0 0 8px; }
details.prereq-refresher { margin-top: 8px; padding: 8px 12px; background: var(--quiet); border-radius: var(--radius); }
details.prereq-refresher > summary { cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; }
details.prereq-refresher > summary::-webkit-details-marker { display: none; }
details.prereq-refresher > summary::before { content: "+"; display: inline-block; width: 1.2em; font-family: var(--font-ui); }
details.prereq-refresher[open] > summary::before { content: "−"; }
details.prereq-refresher > .more-body { padding: 6px 0 2px; }
.prereq > .status { margin-top: 12px; }

/* ---------- path navigation (generated by tools/site_nav.py) ---------- */
.path-nav { margin: 36px 0 0; padding-top: 16px; border-top: 1px solid var(--rule); }
.path-pos { font-family: var(--font-ui); font-size: 0.85rem; color: var(--muted); margin: 0 0 10px; }
.path-links { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.path-links a { display: block; flex: 1 1 220px; border: 1px solid var(--rule); border-radius: var(--radius); padding: 10px 14px; text-decoration: none; color: var(--ink); background: var(--surface); }
.path-links a:hover { border-color: var(--accent); }
.path-links a span { display: block; font-family: var(--font-ui); font-size: 0.8rem; color: var(--muted); }
.path-links .path-prev span::before { content: "← "; }
.path-links .path-next { text-align: right; }
.path-links .path-next span::after { content: " →"; }

.path-list { margin: 28px 0; }
.path-list h2 { margin-bottom: 4px; }
.path-list > p { color: var(--muted); }
ol.steps { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--rule); }
ol.steps li { border-bottom: 1px solid var(--rule); }
ol.steps li > a, ol.steps li.soon { display: grid; grid-template-columns: 2.5em 1fr auto; gap: 12px; align-items: baseline; padding: 10px 4px; text-decoration: none; color: var(--ink); }
ol.steps.plain li > a { grid-template-columns: 1fr auto; }
ol.steps li > a:hover .t { color: var(--accent); text-decoration: underline; }
ol.steps .step { font-family: var(--font-ui); color: var(--muted); text-align: right; }
ol.steps .subject { font-size: 0.85rem; color: var(--muted); }
ol.steps li.soon .t { color: var(--muted); }
@media (max-width: 520px) {
  ol.steps li > a, ol.steps li.soon { grid-template-columns: 2em 1fr; }
  ol.steps.plain li > a { grid-template-columns: 1fr; }
  ol.steps .subject { grid-column: 2; }
  ol.steps.plain .subject { grid-column: 1; }
}

/* Inline formulas cannot wrap. On narrow screens a long one scrolls inside its box instead of widening the page. */
.scratch, .feedback, .more-body, .theorem, .takeaway, .big-idea, .problem, .predict, .quick-guess,
.choice-proof, ol.proof .stmt, .prereq-item, .status, .caption, figcaption { overflow-x: auto; overflow-y: hidden; }

/* The hidden attribute always wins over component display rules (grid, flex). */
[hidden] { display: none !important; }

/* ---------- one part of a page at a time (common.js page shell) ---------- */
.page-head h1 { margin-bottom: 4px; }
.stage-tabs {
  position: sticky; top: 0; z-index: 5; background: var(--paper);
  margin: 10px 0 0; padding-block: 8px; border-bottom: 1px solid var(--rule);
}
.stage-tabs ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.stage-tabs ol::-webkit-scrollbar { display: none; }
.stage-tabs a {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font: 600 var(--step--1)/1 var(--font-ui); color: var(--ink-2); text-decoration: none;
  padding: 9px 14px; border-radius: 999px; border: 1.5px solid var(--rule);
}
.stage-tabs a .n {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  font-size: 0.72rem; border: 1.5px solid currentColor;
}
.stage-tabs a:hover { border-color: var(--live-line); color: var(--accent); }
.stage-tabs a[aria-current="step"] { background: var(--accent); border-color: var(--accent); color: var(--paper); }
main > .stage { border-top: 0; margin-top: 0; padding-top: 22px; }
.stage-start > .prose { padding-top: 4px; }
.stage-foot { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--rule); }
.stage-foot a { font: 600 var(--step--1)/1.2 var(--font-ui); text-decoration: none; }
.stage-back { color: var(--muted); align-self: center; }
.stage-back:hover { color: var(--accent); }
.stage-next {
  margin-left: auto; color: var(--paper); background: var(--accent); border-radius: var(--radius);
  padding: 10px 16px; box-shadow: 0 2px 0 var(--live-shadow);
}
.stage-next span { display: block; font-size: 0.72rem; font-weight: 500; opacity: 0.85; letter-spacing: 0.06em; text-transform: uppercase; }

/* Figures: a figure only follows the controls; saying so beats a click that does nothing. */
.figure { position: relative; }
.fig-hint {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2;
  font: 500 var(--step--1)/1.4 var(--font-ui); color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--accent); border-radius: var(--radius); padding: 8px 12px; box-shadow: 0 4px 14px var(--live-shadow);
}
.fig-tag {
  position: absolute; top: 8px; right: 10px; z-index: 1;
  font: 600 0.72rem/1 var(--font-ui); letter-spacing: 0.04em; color: var(--accent);
  background: var(--live-bg); border: 1.5px solid var(--live-line); border-radius: 999px; padding: 5px 9px;
}
.fig-hands-on { border-color: var(--live-line); }
.handle { cursor: grab; }
.handle:active { cursor: grabbing; }
.pulse { animation: mm-pulse 0.6s ease-in-out 3; border-radius: var(--radius); }
@keyframes mm-pulse { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 5px var(--accent-soft), 0 0 0 7px var(--live-line); } }

/* ---------- home: the hexagon index ---------- */
/* Math is violet and Quant is gold everywhere on the home page; a raised tile means "press here". */
main.home { padding-top: 8px; }
.hexa { position: relative; margin: 10px 0 8px; }
.hexa-fig { position: relative; }
.hexa-fig svg.hexa-wide, .hexa-fig svg.hexa-narrow { display: block; width: 100%; height: auto; }
.hexa-narrow { display: none !important; }
.hx-half { stroke: none; }
.hx-math { fill: var(--math-fill); fill-opacity: 0.10; }
.hx-quant { fill: var(--quant-fill); fill-opacity: 0.16; }
.hx-edge { stroke: var(--muted); stroke-opacity: 0.55; stroke-width: 2; stroke-linecap: round; transition: stroke 0.15s, stroke-width 0.15s; }
/* The two half labels are links to the Math and Quant pages, placed where the labels sit in the drawing. */
.hx-link { position: absolute; top: 29%; transform: translate(-50%, -50%); z-index: 1; padding: 10px 14px; border-radius: 10px;
  font: 700 clamp(0.95rem, 1.7vw, 1.2rem)/1 var(--font-ui); letter-spacing: 0.16em; text-transform: uppercase;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.hx-link.math { left: 41.6%; color: var(--math); }
.hx-link.quant { left: 58.4%; color: var(--quant); }
.hx-link.math:hover { background: color-mix(in srgb, var(--math) 12%, transparent); }
.hx-link.quant:hover { background: color-mix(in srgb, var(--quant) 12%, transparent); }
.hx-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The name sits exactly at the centre of the hexagon; the tagline hangs below it. */
.hexa-name { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); margin: 0; text-align: center;
  font: 600 clamp(2rem, 4.4vw, 2.75rem)/1 var(--font-display); letter-spacing: -0.01em; pointer-events: none; }
.hexa-tag { position: absolute; left: 0; right: 0; top: calc(50% + 1.6em); margin: 0 auto; max-width: 17em; text-align: center;
  font: 400 var(--step--1)/1.45 var(--font-ui); color: var(--ink-2); text-wrap: balance; pointer-events: none; }
.hexa-links { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; pointer-events: none; }
.hexa-links a { pointer-events: auto; }
/* Each corner: a small raised hexagon tile on the vertex, with the group name outside it. */
.vx { position: absolute; transform: translateY(-50%); }
.vx.at-tl, .vx.at-bl { right: calc(60% - 32px); }
.vx.at-l { right: calc(70% - 32px); }
.vx.at-tr, .vx.at-br { left: calc(60% - 32px); }
.vx.at-r { left: calc(70% - 32px); }
.vx.at-tl, .vx.at-tr { top: 10.6%; }
.vx.at-l, .vx.at-r { top: 50%; }
.vx.at-bl, .vx.at-br { top: 89.4%; }
.vx a { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); border-radius: 12px; }
.vx.math a { flex-direction: row-reverse; text-align: right; }
.vx-tile { position: relative; flex: none; width: 64px; height: 56px; display: grid; place-items: center; }
.vx-hex { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.vx-hex polygon { stroke-width: 1; transition: fill 0.15s; }
.vx.math .vx-hex polygon { fill: color-mix(in srgb, var(--math) 14%, var(--paper)); stroke: var(--math); }
.vx.quant .vx-hex polygon { fill: color-mix(in srgb, var(--quant-fill) 22%, var(--paper)); stroke: var(--quant); }
.vx-hex { filter: drop-shadow(0 2px 0 color-mix(in srgb, var(--ink) 22%, transparent)); }
.vx-icon { position: relative; width: 28px; height: 28px; }
.vx.math .vx-icon { color: var(--math); }
.vx.quant .vx-icon { color: var(--quant); }
.vx-name { font: 600 1rem/1.25 var(--font-ui); max-width: 13em; }
.vx a:hover .vx-name { text-decoration: underline; text-underline-offset: 3px; }
.vx.math a:hover .vx-hex polygon { fill: color-mix(in srgb, var(--math) 26%, var(--paper)); }
.vx.quant a:hover .vx-hex polygon { fill: color-mix(in srgb, var(--quant-fill) 40%, var(--paper)); }
.vx a:active .vx-tile { transform: translateY(2px); }
.vx a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
/* Pointing at a group darkens the two edges that meet at its corner. */
.hexa:has(.vx-1 a:is(:hover, :focus-visible)) .hx-edge.v1,
.hexa:has(.vx-2 a:is(:hover, :focus-visible)) .hx-edge.v2,
.hexa:has(.vx-3 a:is(:hover, :focus-visible)) .hx-edge.v3,
.hexa:has(.vx-4 a:is(:hover, :focus-visible)) .hx-edge.v4,
.hexa:has(.vx-5 a:is(:hover, :focus-visible)) .hx-edge.v5,
.hexa:has(.vx-6 a:is(:hover, :focus-visible)) .hx-edge.v6 { stroke: var(--ink); stroke-opacity: 1; stroke-width: 3.5; }
.home-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 30px 0 12px; }
.home-actions .btn { font: 600 1rem/1.2 var(--font-ui); padding: 12px 20px; border-radius: 10px; }
.home-note { text-align: center; font: 400 var(--step--1)/1.5 var(--font-ui); color: var(--muted); margin: 0 0 56px; }

/* Why the site exists: plain text in two columns, no cards. */
.purpose { border-top: 1px solid var(--rule); padding-top: 36px; margin-bottom: 48px; }
.purpose h2 { font: 600 var(--step-2)/1.2 var(--font-display); margin: 0 0 22px; }
.purpose-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 48px; }
.purpose-item h3 { font: 600 1.05rem/1.3 var(--font-ui); margin: 0 0 6px; }
.purpose-item p { margin: 0; color: var(--ink-2); line-height: 1.65; }
@media (max-width: 760px) { .purpose-grid { grid-template-columns: 1fr; } }

/* Phones and narrow windows: the hexagon alone, then the six groups as a Math column and a Quant column. */
@media (max-width: 61.2em) {
  .hexa-wide { display: none !important; }
  .hexa-narrow { display: block !important; max-width: 460px; margin: 0 auto; }
  .hexa-fig { max-width: 460px; margin-inline: auto; }
  .hx-link { top: 29.5%; font-size: 0.95rem; padding: 14px 10px; }
  .hx-link.math { left: 36.2%; }
  .hx-link.quant { left: 63.8%; }
  .hexa-name { font-size: clamp(1.7rem, 7vw, 2.3rem); }
  .hexa-tag { max-width: 12.5em; font-size: 0.86rem; top: calc(50% + 1.5em); }
  .hexa-links { position: static; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, auto); grid-auto-flow: column; gap: 12px 14px; margin: 18px auto 0; max-width: 560px; }
  .vx { position: static; transform: none; }
  .vx a, .vx.math a { flex-direction: row; text-align: left; }
  .vx-tile { width: 48px; height: 42px; }
  .vx-icon { width: 22px; height: 22px; }
  .vx-name { font-size: 0.95rem; }
  .home-actions { flex-direction: column; align-items: stretch; max-width: 560px; margin-inline: auto; }
  .home-actions .btn { text-align: center; }
}
@media (max-width: 22em) {
  .hexa-links { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
  .hexa-name { font-size: 1.5rem; }
  .hexa-tag { max-width: 10.5em; font-size: 0.8rem; }
}

/* ---------- Math / Quant sections and subject pages ---------- */
/* Parts of a section: an index of the parts at the top, then one band per part, split into labelled shelves. */
.group-index ol { list-style: none; margin: 22px 0 6px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 20px; }
.gi { display: flex; align-items: flex-start; gap: 12px; text-decoration: none; color: var(--ink); border-radius: 12px; }
.gi .vx-hex polygon { stroke-width: 1; transition: fill 0.15s; }
.gi.math .vx-hex polygon, .gh-tile .vx-hex polygon { fill: color-mix(in srgb, var(--math) 14%, var(--paper)); stroke: var(--math); }
.gi.quant .vx-hex polygon, .quant .gh-tile .vx-hex polygon { fill: color-mix(in srgb, var(--quant-fill) 22%, var(--paper)); stroke: var(--quant); }
.gi.math .vx-icon, .math .gh-tile .vx-icon { color: var(--math); }
.gi.quant .vx-icon, .quant .gh-tile .vx-icon { color: var(--quant); }
.gi.math:hover .vx-hex polygon { fill: color-mix(in srgb, var(--math) 26%, var(--paper)); }
.gi.quant:hover .vx-hex polygon { fill: color-mix(in srgb, var(--quant-fill) 40%, var(--paper)); }
.gi:active .vx-tile { transform: translateY(2px); }
.gi:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.gi-text { display: grid; gap: 3px; min-width: 0; padding-top: 2px; }
.gi-num { font: 600 0.74rem/1.2 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; }
.gi.math .gi-num, .math .gh-num { color: var(--math); }
.gi.quant .gi-num, .quant .gh-num { color: var(--quant); }
.gi-name { font: 600 1rem/1.25 var(--font-ui); }
.gi:hover .gi-name { text-decoration: underline; text-underline-offset: 3px; }
.gi-subs { font: 400 0.84rem/1.45 var(--font-ui); color: var(--muted); }
.subject-group { margin: 44px 0 0; padding-top: 30px; border-top: 1px solid var(--rule); scroll-margin-top: 12px; }
.group-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.gh-tile { position: relative; flex: none; width: 64px; height: 56px; display: grid; place-items: center; }
.gh-tile .vx-hex { filter: none; }
.gh-tile .vx-hex polygon { stroke-width: 1; }
.gh-text { min-width: 0; }
.gh-num { font: 600 0.78rem/1.2 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; margin: 2px 0 4px; }
.subject-group h2 { font-size: var(--step-2); margin: 0 0 6px; text-wrap: balance; }
.gh-blurb { color: var(--ink-2); margin: 0 0 4px; max-width: 62ch; }
.gh-count { font: 500 0.84rem/1.3 var(--font-ui); color: var(--muted); margin: 0; }
.shelf + .shelf { margin-top: 24px; }
.shelf-name { display: flex; align-items: center; gap: 12px; font: 600 0.8rem/1.2 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 10px; }
.shelf-name::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
@media (max-width: 48em) {
  .group-index ol { grid-template-columns: 1fr; gap: 14px; }
  .group-head { gap: 14px; }
  .gh-tile { width: 52px; height: 46px; }
  .gh-tile .vx-icon { width: 22px; height: 22px; }
}
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
ul.subject-grid { list-style: none; margin: 0; padding: 0; }
ul.subject-grid > li { display: grid; min-width: 0; }
.subject-card {
  display: grid; gap: 6px; align-content: start; padding: 16px 18px; border-radius: 10px; min-width: 0;
  background: var(--surface); border: 1px solid var(--rule); color: var(--ink); text-decoration: none;
}
.subject-card:hover { border-color: var(--accent); }
.subject-card { position: relative; overflow: hidden; isolation: isolate; }
.sc-bg { position: absolute; right: -6px; bottom: -4px; width: 78%; height: auto; z-index: -1; opacity: 0.55; pointer-events: none; }
.subject-card.math .sc-bg, .subject-card.math .sc-icon { color: var(--math); }
.subject-card.quant .sc-bg, .subject-card.quant .sc-icon { color: var(--quant); }
.subject-card:hover .sc-bg { opacity: 0.8; }
.sc-head { display: flex; align-items: center; gap: 10px; }
.sc-icon { flex: none; width: 26px; height: 26px; }
.course-card .path-ticks { display: grid; grid-template-columns: repeat(22, 1fr); gap: 3px; margin: 4px 0 2px; max-width: 320px; }
.course-card .tick { height: 8px; border-radius: 2px; background: var(--rule); }
.course-card .tick.on { background: var(--quant-fill); }
.sub-path { font: 400 var(--step--1)/1.5 var(--font-ui); color: var(--ink-2); margin: 6px 0 0; }
.sc-name { font: 600 var(--step-1)/1.25 var(--font-ui); }
.sc-blurb { font-size: var(--step--1); color: var(--ink-2); line-height: 1.5; }
.sc-count { font: 500 0.82rem/1.3 var(--font-ui); color: var(--muted); }
.sc-open { font: 500 0.82rem/1.4 var(--font-ui); color: var(--ok); }
.section-foot { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.btn-link { font: 600 var(--step--1)/1.2 var(--font-ui); }
.sub-count { font: 500 var(--step--1)/1.3 var(--font-ui); color: var(--muted); margin-top: -6px; }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 18px; }
.topic-card {
  display: grid; gap: 8px; align-content: start; padding: 16px 18px; border-radius: 10px; min-width: 0;
  background: var(--surface); border: 1px solid var(--rule); color: var(--ink); text-decoration: none;
}
.topic-card:hover { border-color: var(--accent); }
.tc-title { font: 600 var(--step-1)/1.3 var(--font-ui); }
.tc-q { color: var(--ink-2); font-size: var(--step--1); }
.tc-meta { font: 500 0.82rem/1.3 var(--font-ui); color: var(--muted); }
.tc-go { font: 600 var(--step--1)/1 var(--font-ui); color: var(--accent); }
.none-yet { color: var(--ink-2); }
.muted { color: var(--muted); }
ol.planned { margin: 6px 0 0; padding: 0 0 0 1.6em; display: grid; gap: 2px; }
ol.planned li { color: var(--ink-2); padding: 4px 0; border-bottom: 1px solid var(--rule); }
ol.planned li::marker { color: var(--muted); font-family: var(--font-ui); font-size: 0.85rem; }
ol.planned .lv { font: 500 0.78rem/1 var(--font-ui); color: var(--muted); margin-left: 10px; white-space: nowrap; }
.sub-links { margin-top: 30px; }
.sub-links p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.sub-links b { font-family: var(--font-ui); min-width: 6.5em; }
.chip-link { font: 500 0.88rem/1.2 var(--font-ui); text-decoration: none; padding: 5px 10px; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); }
.chip-link:hover { border-color: var(--accent); color: var(--accent); }
main > ol.steps { margin-top: 18px; }

/* ---------- map ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.map-app { margin-top: 12px; }
.map-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.seg { display: inline-flex; gap: 0; }
.seg button { border-radius: 0; box-shadow: none; }
.seg button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.seg button:last-child { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1.5px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.map-search { flex: 1 1 220px; min-width: 0; }
.map-search input { width: 100%; }
.map-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .map-body { grid-template-columns: minmax(0, 1fr); } }
.map-stage { position: relative; min-width: 0; }
.map-scroll { border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); overflow: auto; }
.map-scroll.is-topics { height: 72vh; cursor: grab; overscroll-behavior: contain; }
.map-scroll.panning { cursor: grabbing; user-select: none; }
.map-scroll svg { display: block; }
.map-zoom { position: absolute; top: 10px; right: 10px; display: flex; gap: 4px; }
.map-zoom button { padding: 6px 10px; min-width: 36px; }
.map-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 8px 0 0; font: 500 0.82rem/1.3 var(--font-ui); color: var(--muted); }
.map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.lg-math { background: var(--math); }
.lg-quant { background: var(--quant-fill); }
.lg-open { background: transparent; border: 2px solid var(--ok); }
.lg-before { width: 18px; height: 3px; border-radius: 2px; background: var(--before); }
.lg-after { width: 18px; height: 3px; border-radius: 2px; background: var(--after); }
.lg-link { width: 18px; height: 0; border-radius: 0; border-top: 2px dashed var(--muted); }
.map-note { font-size: var(--step--1); color: var(--muted); margin-top: 14px; }

/* subjects overview */
#map-svg .zone-label { font: 700 20px var(--font-display); }
#map-svg .zone-label.math { fill: var(--math); }
#map-svg .zone-label.quant { fill: var(--quant); }
#map-svg .zone-rule { stroke: var(--rule); stroke-width: 1.5; stroke-dasharray: 4 5; }
#map-svg .group-label { font: 600 12.5px var(--font-ui); fill: var(--muted); letter-spacing: 0.02em; }
#map-svg .sedge { fill: none; stroke: var(--muted); opacity: 0.22; }
#map-svg.has-sel .sedge { opacity: 0.05; }
#map-svg .sedge.before { stroke: var(--before); opacity: 0.9; }
#map-svg .sedge.after { stroke: var(--after); opacity: 0.9; }
#map-svg .snode { cursor: pointer; outline: none; }
#map-svg .snode rect { fill: var(--surface); stroke-width: 1.5; }
#map-svg .snode.math rect { stroke: var(--math); }
#map-svg .snode.quant rect { stroke: var(--quant); }
#map-svg .snode.has-open rect { stroke-width: 2.5; }
#map-svg .snode:hover rect, #map-svg .snode:focus-visible rect { fill: var(--live-bg); stroke-width: 3; }
#map-svg .snode .sname { font: 600 14.5px var(--font-ui); fill: var(--ink); }
#map-svg .snode .scount { font: 500 11.5px var(--font-ui); fill: var(--muted); }
#map-svg.has-sel .snode { opacity: 0.32; }
#map-svg.has-sel .snode.sel, #map-svg.has-sel .snode.before, #map-svg.has-sel .snode.after { opacity: 1; }
#map-svg .snode.sel rect { stroke-width: 3.5; fill: var(--live-bg); }
#map-svg .snode.before rect { stroke: var(--before); stroke-width: 2.5; }
#map-svg .snode.after rect { stroke: var(--after); stroke-width: 2.5; }

/* topic graph */
#map-svg .lane.math { fill: var(--math); opacity: 0.035; }
#map-svg .lane.quant { fill: var(--quant-fill); opacity: 0.045; }
#map-svg .lane.odd { opacity: 0.075; }
#map-svg .lane.flash { opacity: 0.2; }
#map-svg .lane-label { font: 600 12px var(--font-ui); fill: var(--ink-2); }
#map-svg .axis-note { font: 500 11px var(--font-ui); fill: var(--muted); }
#map-svg .tedge { fill: none; stroke: var(--muted); stroke-width: 1; opacity: 0.16; }
#map-svg .tedge.link { stroke-dasharray: 5 4; opacity: 0.4; stroke-width: 1.4; }
#map-svg.has-sel .tedge { opacity: 0.04; }
#map-svg.has-sel .tedge.before { stroke: var(--before); opacity: 0.75; stroke-width: 1.6; }
#map-svg.has-sel .tedge.after { stroke: var(--after); opacity: 0.6; stroke-width: 1.4; }
#map-svg.has-sel .tedge.route { opacity: 1; stroke-width: 3; }
#map-svg .tnode { cursor: pointer; }
#map-svg .tnode .hit { fill: transparent; }
#map-svg .tnode.math .dot { fill: var(--math); }
#map-svg .tnode.quant .dot { fill: var(--quant-fill); }
#map-svg .tnode .ring { fill: none; stroke: var(--ok); stroke-width: 2.5; }
#map-svg .tnode:hover .dot { stroke: var(--ink); stroke-width: 2; }
#map-svg.has-sel .tnode { opacity: 0.18; }
#map-svg.has-sel .tnode.sel, #map-svg.has-sel .tnode.before, #map-svg.has-sel .tnode.after { opacity: 1; }
#map-svg .tnode.before .dot { fill: var(--before); }
#map-svg .tnode.after .dot { fill: var(--after); }
#map-svg .tnode.sel .dot { fill: var(--ink); r: 8; }
#map-svg .tlabel { font: 600 13px var(--font-ui); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
#map-svg .tlabel.before { fill: var(--before); }
#map-svg .tlabel.after { fill: var(--after); }
#map-svg .tlabel.sel { font-size: 15px; }
#map-svg .tlabel.dim { opacity: 0.35; }

/* side panel */
.map-panel { border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); padding: 16px 18px; min-width: 0; font-size: var(--step--1); }
@media (min-width: 901px) { .map-panel { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; } }
.map-panel h2 { font-size: var(--step-1); margin: 4px 0 6px; }
.map-panel h3 { font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.map-panel p { margin: 0 0 8px; }
.p-kicker { font: 600 0.75rem/1.3 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.p-kicker a { color: var(--muted); }
.p-lead { color: var(--ink-2); }
.p-count { font-family: var(--font-ui); color: var(--muted); }
.planned-tag { font: 500 0.85rem/1.3 var(--font-ui); color: var(--muted); border: 1px dashed var(--rule); border-radius: var(--radius); padding: 6px 10px; }
.p-open { margin: 0; padding-left: 1.1em; }
.p-list { display: flex; flex-wrap: wrap; gap: 6px; }
.plink { font-weight: 500; font-size: 0.85rem; padding: 6px 10px; text-align: left; color: var(--ink); }
.plink.open { border-color: var(--ok); }
.p-list.before .plink::before, .p-edges.before .plink::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--before); margin-right: 8px; vertical-align: 1px; }
.p-list.after .plink::before, .p-edges.after .plink::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--after); margin-right: 8px; vertical-align: 1px; }
.p-edges, .route { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.p-edges li, .route li { display: grid; gap: 4px; }
.why { font-size: 0.85rem; color: var(--ink-2); line-height: 1.5; }
.route { counter-reset: r; }
.route li { position: relative; padding-left: 26px; }
.route li::before { counter-increment: r; content: counter(r); position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font: 600 0.7rem/1 var(--font-ui); background: var(--after); color: var(--surface); }
.route .here { font-weight: 600; }
.p-note { font-size: 0.8rem; margin-top: 8px; }
.map-panel .btn-row { margin-top: 12px; }
.map-panel .example, .map-bar .example { font-size: 0.85rem; }

/* A part of the page that is not shown: kept at full width so figures inside measure correctly, but invisible and inert. */
main { position: relative; }
.stage-off { position: absolute !important; left: 0; right: 0; top: 0; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; padding: 0 !important; margin: 0 !important; }
/* Answered questions: options that can no longer be chosen lose the raised blue look. */
.options label:has(input:disabled) { cursor: default; box-shadow: none; background: transparent; border-color: var(--rule); }
.options label:has(input:disabled):hover { border-color: var(--rule); }
.options label.is-correct:has(input:disabled) { border-color: var(--ok); background: var(--ok-soft); }
.options label.is-wrong:has(input:disabled) { border-color: var(--bad); background: var(--bad-soft); }
/* Figure nodes that can be tapped (binomial trees). */
.figure svg [role="button"], .figure svg g[tabindex="0"] { cursor: pointer; }
.figure svg [role="button"]:focus { outline: none; }
.figure svg [role="button"]:hover rect, .figure svg [role="button"]:focus-visible rect,
.figure svg g[tabindex="0"]:hover rect, .figure svg g[tabindex="0"]:focus-visible rect { stroke: var(--accent); stroke-width: 2.5px; }
.chip-note { font-size: 0.75rem; color: var(--muted); }
#map-svg .sedge.link { stroke-dasharray: 5 4; }

/* ---------- brand mark in the header (owner's choice, 2026-11-06): Σ on the Math half, rising arrow on the Quant half ---------- */
:root { --mark-on-gold: #01337e; --mark-on-blue: #ffffff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --mark-on-gold: #061029; --mark-on-blue: #061029; } }
:root[data-theme="dark"] { --mark-on-gold: #061029; --mark-on-blue: #061029; }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { width: 1.6em; height: 1.6em; flex: none; }
.brand-mark .bm-l { fill: var(--math-fill); }
.brand-mark .bm-r { fill: var(--quant-fill); }
.brand-mark .bm-sig { fill: none; stroke: var(--mark-on-blue); stroke-width: 6; stroke-linejoin: round; }
.brand-mark .bm-arr { fill: none; stroke: var(--mark-on-gold); stroke-width: 6.4; stroke-linejoin: round; }
.brand-mark .bm-head { fill: var(--mark-on-gold); }
@media (max-width: 26.25em) {
  .site-head { column-gap: 12px; }
  .site-nav { column-gap: 12px; }
  .brand { gap: 5px; font-size: 1.05rem; }
  .brand-mark { width: 1.35em; height: 1.35em; }
}

/* ---------- light/dark switch in the header (theme.js) ---------- */
.site-nav { align-items: center; }
.theme-toggle {
  width: 30px; height: 30px; padding: 5px; margin: 0; border-radius: 50%;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: none;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; }
.theme-toggle svg path[d^="M20.5"] { stroke: none; }
@media (max-width: 26.25em) { .theme-toggle { width: 26px; height: 26px; padding: 4px; } .theme-toggle svg { width: 16px; height: 16px; } }
/* On phones the logo is the link home, so the Home item makes room for the switch. */
@media (max-width: 26.25em) { .site-nav a[href="/"] { display: none; } }
