/* =============================================================
   FLOW — How money moves through a local economy
   Bespoke design system.  Semantic colour encodes meaning:
     GREEN  (--flow)  = money circulating / staying local  (good)
     GOLD   (--value) = stored value / currency / wealth
     CORAL  (--leak)  = money leaking out / extraction      (loss)
   ============================================================= */

/* ---------- Tokens ---------- */
:root {
  /* surfaces */
  --void:       #05070A;
  --void-2:     #080B10;
  --surface:    #0D121A;
  --surface-2:  #131A24;
  --surface-3:  #1A2330;
  --surface-4:  #232E3D;

  /* foreground */
  --ink:        #EAF1F2;
  --ink-2:      #C4CED6;
  --ink-dim:    #94A2AD;
  --ink-faint:  #5F6E7A;
  --ink-ghost:  #3A454F;

  /* hairlines */
  --line:        rgba(234, 241, 242, 0.08);
  --line-2:      rgba(234, 241, 242, 0.14);
  --line-3:      rgba(234, 241, 242, 0.22);

  /* semantic economics palette */
  --flow:       #24E5A0;   /* money in motion / local */
  --flow-2:     #5CF0BE;
  --flow-deep:  #0FA774;
  --flow-glow:  rgba(36, 229, 160, 0.55);
  --flow-dim:   rgba(36, 229, 160, 0.12);

  --value:      #F5B54A;   /* stored value / currency */
  --value-2:    #FFCB77;
  --value-deep: #C98A28;
  --value-dim:  rgba(245, 181, 74, 0.12);

  --leak:       #FF5C6E;   /* extraction / drain */
  --leak-2:     #FF8494;
  --leak-dim:   rgba(255, 92, 110, 0.12);

  --info:       #4EA8FF;   /* neutral data / UI accent */
  --info-dim:   rgba(78, 168, 255, 0.12);

  /* type */
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-sans:    "Inter", system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-deva:    "Noto Sans Devanagari", var(--font-sans);

  /* fluid type scale */
  --t--2: clamp(0.68rem, 0.64rem + 0.15vw, 0.76rem);
  --t--1: clamp(0.8rem, 0.76rem + 0.2vw, 0.9rem);
  --t-0:  clamp(0.98rem, 0.94rem + 0.2vw, 1.08rem);
  --t-1:  clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
  --t-2:  clamp(1.45rem, 1.25rem + 1vw, 2rem);
  --t-3:  clamp(1.9rem, 1.5rem + 2vw, 3rem);
  --t-4:  clamp(2.6rem, 1.9rem + 3.6vw, 4.6rem);
  --t-5:  clamp(3.4rem, 2.3rem + 6vw, 7.5rem);
  --t-6:  clamp(4.4rem, 2.6rem + 9vw, 12rem);

  /* spacing */
  --s-1: 0.5rem;
  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2.5rem;
  --s-5: 4rem;
  --s-6: 6rem;
  --s-7: 9rem;
  --s-8: 13rem;

  /* layout */
  --container: 1280px;
  --measure: 68ch;
  --gutter: clamp(1.15rem, 4vw, 3rem);
  --radius: 4px;
  --radius-lg: 14px;

  /* motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --nav-h: 68px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--surface-3) var(--void);
}
body {
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--t-0);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; }
:focus-visible {
  outline: 2px solid var(--flow);
  outline-offset: 3px;
  border-radius: 2px;
}
::selection { background: var(--flow); color: var(--void); }

/* thin custom scrollbar (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid var(--void); }
::-webkit-scrollbar-thumb:hover { background: var(--surface-4); }

/* ---------- Ambient texture ---------- */
body::before {   /* fine grid */
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  opacity: 0.5;
  background-image:
    linear-gradient(to right,  rgba(234,241,242,1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(234,241,242,1) 1px, transparent 1px);
  background-size: 78px 78px;
  -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000 0%, transparent 75%);
          mask-image: radial-gradient(120% 80% at 50% 0%, #000 0%, transparent 75%);
  opacity: 0.028;
}
body::after {    /* top ambient glow */
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 500px at 78% -8%, rgba(36,229,160,0.10), transparent 60%),
    radial-gradient(1000px 600px at 12% -12%, rgba(78,168,255,0.06), transparent 60%);
}
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, .site-nav, .site-footer, .progress-rail { position: relative; z-index: 1; }

/* ---------- Reading progress ---------- */
.progress-rail {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: transparent; z-index: 90;
}
.progress-bar {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--flow-deep), var(--flow) 60%, var(--flow-2));
  box-shadow: 0 0 12px var(--flow-glow);
  transform-origin: left;
  transform: scaleX(0);
  will-change: transform;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: clamp(4rem, 9vw, 9rem); }
.section--tight { padding-block: clamp(3rem, 6vw, 5rem); }
.divider { height: 1px; background: var(--line); border: 0; }

/* ---------- Nav ---------- */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h);
  display: flex; align-items: center;
  z-index: 80;
  transition: background 0.4s var(--ease-out), border-color 0.4s var(--ease-out), backdrop-filter 0.4s;
  border-bottom: 1px solid transparent;
}
.site-nav.is-stuck {
  background: rgba(5, 7, 10, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line);
}
.nav-inner {
  width: 100%; max-width: var(--container); margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; font-size: 1.05rem; }
.brand-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--flow);
  box-shadow: 0 0 0 0 var(--flow-glow);
  animation: pulse-dot 2.8s var(--ease-in-out) infinite;
  flex: none;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(36,229,160,0.5); }
  50%      { box-shadow: 0 0 0 7px rgba(36,229,160,0); }
}
.brand small { font-family: var(--font-deva); color: var(--ink-faint); font-weight: 400; font-size: 0.7rem; letter-spacing: 0; }
.nav-links { display: flex; align-items: center; gap: 1.6rem; }
.nav-link {
  font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-dim); transition: color 0.25s var(--ease-out); position: relative; padding-block: 4px;
}
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--ink); }
.nav-link[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--flow);
  box-shadow: 0 0 8px var(--flow-glow);
}
.nav-cta { display: inline-flex; }
.nav-menu-btn { display: none; }

/* chapter index dropdown */
.nav-index-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-dim); padding: 0.5rem 0.85rem; border: 1px solid var(--line-2); border-radius: var(--radius);
  transition: border-color 0.25s, color 0.25s;
}
.nav-index-btn:hover { color: var(--ink); border-color: var(--line-3); }
.nav-index-btn svg { width: 13px; height: 13px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1.4rem; border-radius: var(--radius);
  font-family: var(--font-sans); font-size: var(--t--1); font-weight: 500; letter-spacing: 0.01em;
  transition: transform 0.35s var(--ease-out), background 0.3s var(--ease-out), color 0.3s var(--ease-out), box-shadow 0.35s var(--ease-out), border-color 0.3s;
  border: 1px solid transparent; white-space: nowrap; line-height: 1;
}
.btn svg { width: 16px; height: 16px; transition: transform 0.35s var(--ease-out); }
.btn:hover svg { transform: translateX(3px); }
.btn--primary { background: var(--flow); color: #04140D; font-weight: 600; }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -12px var(--flow-glow); background: var(--flow-2); }
.btn--ghost { border-color: var(--line-3); color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--void); border-color: var(--ink); }
.btn--ghost:hover svg { color: var(--void); }
.btn--sm { padding: 0.6rem 1rem; font-size: var(--t--2); }
.btn--lg { padding: 1.05rem 1.7rem; font-size: var(--t-0); }
.btn--link { padding: 0; color: var(--flow); font-family: var(--font-mono); font-size: var(--t--1); letter-spacing: 0.04em; }
.btn--link:hover { color: var(--flow-2); }

/* ---------- Eyebrow / titles ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-mono); font-size: var(--t--2); font-weight: 500;
  letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-dim);
  margin-bottom: var(--s-3);
}
.eyebrow-num {
  color: var(--flow); padding: 0.15rem 0.5rem; border: 1px solid var(--line-2);
  border-radius: 3px; background: var(--flow-dim); font-weight: 600;
}
.eyebrow-tick { width: 26px; height: 1px; background: var(--line-3); }
.title-xl { font-family: var(--font-display); font-weight: 500; font-size: var(--t-5); line-height: 0.98; letter-spacing: -0.03em; }
.title-lg { font-family: var(--font-display); font-weight: 500; font-size: var(--t-4); line-height: 1; letter-spacing: -0.03em; }
.title-md { font-family: var(--font-display); font-weight: 500; font-size: var(--t-3); line-height: 1.04; letter-spacing: -0.02em; }
.title-sm { font-family: var(--font-display); font-weight: 500; font-size: var(--t-2); line-height: 1.1; letter-spacing: -0.015em; }
.title em, .lead em, .prose em { font-style: italic; color: var(--value); }
.lead { font-size: var(--t-1); line-height: 1.55; color: var(--ink-2); font-weight: 300; max-width: 40ch; }
.text-flow { color: var(--flow); }
.text-value { color: var(--value); }
.text-leak { color: var(--leak); }
.text-dim { color: var(--ink-dim); }
.mono { font-family: var(--font-mono); }
.deva { font-family: var(--font-deva); }

/* ---------- Reveal ---------- */
[data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out); }
[data-reveal].is-visible { opacity: 1; transform: none; }
[data-reveal-stagger] > * { opacity: 0; transform: translateY(22px); transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out); }
[data-reveal-stagger].is-visible > * { opacity: 1; transform: none; }

/* ---------- Legend (semantic colour key) ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; align-items: center; }
.legend-item { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.06em; color: var(--ink-dim); }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; box-shadow: 0 0 10px -1px currentColor; }
.legend-item.is-flow .legend-swatch  { background: var(--flow);  color: var(--flow-glow); }
.legend-item.is-value .legend-swatch { background: var(--value); color: rgba(245,181,74,0.5); }
.legend-item.is-leak .legend-swatch  { background: var(--leak);  color: rgba(255,92,110,0.5); }

/* ---------- Chapter cards ---------- */
.chapter-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.chapter-card {
  grid-column: span 4; background: var(--surface); padding: 2rem 1.8rem 1.7rem; min-height: 260px;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
  transition: background 0.4s var(--ease-out);
}
.chapter-card::before {
  content: ""; position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(120% 90% at 50% 120%, var(--flow-dim), transparent 70%);
  transition: opacity 0.5s var(--ease-out); pointer-events: none;
}
.chapter-card:hover { background: var(--surface-2); }
.chapter-card:hover::before { opacity: 1; }
.chapter-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: auto; }
.chapter-card__num { font-family: var(--font-mono); font-size: var(--t--1); color: var(--flow); letter-spacing: 0.1em; }
.chapter-card__glyph { width: 30px; height: 30px; color: var(--ink-faint); transition: color 0.4s, transform 0.5s var(--ease-out); }
.chapter-card:hover .chapter-card__glyph { color: var(--flow); transform: translateX(2px) translateY(-2px); }
.chapter-card__title { font-family: var(--font-display); font-weight: 500; font-size: var(--t-2); line-height: 1.05; letter-spacing: -0.02em; margin: 1.4rem 0 0.6rem; }
.chapter-card__desc { color: var(--ink-dim); font-size: var(--t--1); line-height: 1.5; }
.chapter-card__cta { margin-top: 1.3rem; display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); transition: color 0.3s; }
.chapter-card:hover .chapter-card__cta { color: var(--flow); }
.chapter-card__cta svg { width: 14px; height: 14px; transition: transform 0.35s var(--ease-out); }
.chapter-card:hover .chapter-card__cta svg { transform: translateX(3px); }
.chapter-card.is-wide { grid-column: span 6; }

/* ---------- Stat band ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.stat { background: var(--void); padding: 2.2rem 1.6rem; }
.stat__num { font-family: var(--font-display); font-weight: 500; font-size: var(--t-3); letter-spacing: -0.03em; line-height: 1; color: var(--ink); }
.stat__num .unit { color: var(--flow); }
.stat__num.is-value { color: var(--value); }
.stat__num.is-leak { color: var(--leak); }
.stat__label { margin-top: 0.7rem; font-size: var(--t--1); color: var(--ink-dim); line-height: 1.4; }
.stat__src { margin-top: 0.5rem; font-family: var(--font-mono); font-size: var(--t--2); color: var(--ink-ghost); letter-spacing: 0.04em; }

/* ---------- Prose (deep-dive body) ---------- */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.3rem; }
.prose p { color: var(--ink-2); font-size: var(--t-0); line-height: 1.75; font-weight: 300; }
.prose p strong, .prose strong { color: var(--ink); font-weight: 600; }
.prose h3 { font-family: var(--font-display); font-weight: 500; font-size: var(--t-2); letter-spacing: -0.02em; margin-top: 2.6rem; line-height: 1.1; }
.prose h4 { font-family: var(--font-display); font-weight: 500; font-size: var(--t-1); margin-top: 2rem; }
.prose a { color: var(--flow); text-decoration: underline; text-decoration-color: var(--flow-dim); text-underline-offset: 3px; transition: text-decoration-color 0.25s; }
.prose a:hover { text-decoration-color: var(--flow); }
.prose ul.dash { display: grid; gap: 0.6rem; }
.prose ul.dash li { position: relative; padding-left: 1.5rem; color: var(--ink-2); font-weight: 300; }
.prose ul.dash li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 12px; height: 1px; background: var(--flow); }

/* key term */
.keyterm { color: var(--flow); border-bottom: 1px dashed var(--flow-dim); cursor: help; }

/* pull quote */
.pullquote { border-left: 2px solid var(--value); padding: 0.4rem 0 0.4rem 1.6rem; margin-block: 2rem; font-family: var(--font-display); font-weight: 400; font-size: var(--t-2); line-height: 1.3; letter-spacing: -0.02em; color: var(--ink); font-style: italic; }
.pullquote cite { display: block; margin-top: 0.8rem; font-family: var(--font-mono); font-size: var(--t--2); font-style: normal; letter-spacing: 0.08em; color: var(--ink-faint); }

/* callout */
.callout { border: 1px solid var(--line-2); border-left-width: 2px; border-radius: var(--radius); padding: 1.3rem 1.5rem; background: var(--surface); }
.callout--flow  { border-left-color: var(--flow); }
.callout--value { border-left-color: var(--value); }
.callout--leak  { border-left-color: var(--leak); }
.callout__label { font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 0.5rem; display: block; }
.callout p { font-size: var(--t--1); color: var(--ink-2); }

/* figure frame (interactive containers) */
.figure {
  border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface), var(--void-2));
  overflow: hidden; position: relative;
}
.figure__bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.2rem; border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.012); }
.figure__tag { font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); display: inline-flex; align-items: center; gap: 0.6rem; }
.figure__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--flow); box-shadow: 0 0 8px var(--flow-glow); }
.figure__body { padding: clamp(1.2rem, 3vw, 2.2rem); }
.figure__caption { padding: 0.9rem 1.2rem; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: var(--t--2); color: var(--ink-faint); letter-spacing: 0.03em; }

/* controls: range, toggles, chips */
.control-row { display: flex; flex-wrap: wrap; gap: 1.4rem 2rem; align-items: flex-end; }
.control { display: flex; flex-direction: column; gap: 0.6rem; min-width: 200px; flex: 1; }
.control__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.control__label { font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.control__val { font-family: var(--font-mono); font-size: var(--t-1); color: var(--flow); letter-spacing: -0.01em; }
.control__val.is-value { color: var(--value); }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 3px; border-radius: 3px;
  background: var(--surface-3); outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--flow); border: 3px solid var(--void); box-shadow: 0 0 0 1px var(--flow), 0 0 14px var(--flow-glow);
  transition: transform 0.2s var(--ease-spring);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--flow); border: 3px solid var(--void); box-shadow: 0 0 0 1px var(--flow); }
input[type="range"].is-value::-webkit-slider-thumb { background: var(--value); box-shadow: 0 0 0 1px var(--value), 0 0 14px var(--value-dim); }
input[type="range"].is-value::-moz-range-thumb { background: var(--value); }

.chip-group { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--void-2); }
.chip { padding: 0.5rem 0.95rem; border-radius: 3px; font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.06em; color: var(--ink-dim); transition: background 0.25s, color 0.25s; }
.chip[aria-pressed="true"], .chip.is-active { background: var(--surface-3); color: var(--ink); }

.toggle { display: inline-flex; align-items: center; gap: 0.7rem; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track { width: 40px; height: 22px; border-radius: 20px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; transition: background 0.3s; flex: none; }
.toggle__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-dim); transition: transform 0.3s var(--ease-spring), background 0.3s; }
.toggle input:checked + .toggle__track { background: var(--leak-dim); border-color: var(--leak); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); background: var(--leak); }
.toggle__label { font-size: var(--t--1); color: var(--ink-2); }

/* data table */
.data-table { width: 100%; border-collapse: collapse; font-size: var(--t--1); }
.data-table th, .data-table td { text-align: left; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); }
.data-table th { font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); font-weight: 500; }
.data-table td.num { font-family: var(--font-mono); text-align: right; }
.data-table tr:hover td { background: rgba(255,255,255,0.015); }

/* dig-deeper accordion */
.dig { border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.dig + .dig { margin-top: 0.7rem; }
.dig__q { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.3rem; text-align: left; font-family: var(--font-display); font-weight: 500; font-size: var(--t-0); transition: background 0.25s; }
.dig__q:hover { background: var(--surface); }
.dig__q .plus { width: 18px; height: 18px; position: relative; flex: none; color: var(--flow); }
.dig__q .plus::before, .dig__q .plus::after { content: ""; position: absolute; inset: 50% 0 auto; height: 1.5px; background: currentColor; transition: transform 0.3s var(--ease-out); }
.dig__q .plus::after { transform: rotate(90deg); }
.dig[open] .plus::after { transform: rotate(0); }
.dig__a { padding: 0 1.3rem 1.3rem; color: var(--ink-dim); font-size: var(--t--1); line-height: 1.65; }
.dig summary { list-style: none; cursor: pointer; }
.dig summary::-webkit-details-marker { display: none; }

/* audience tabs (general / student / policy) */
.audience { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--void-2); }
.audience button { padding: 0.5rem 0.9rem; border-radius: 3px; font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.08em; color: var(--ink-dim); transition: 0.25s; }
.audience button[aria-selected="true"] { background: var(--flow); color: var(--void); font-weight: 600; }

/* ---------- Page hero (deep-dive) ---------- */
.page-hero { padding-top: calc(var(--nav-h) + clamp(3rem, 8vw, 6rem)); padding-bottom: clamp(2.5rem, 6vw, 4rem); position: relative; }
.page-hero__index { font-family: var(--font-mono); font-size: var(--t--1); letter-spacing: 0.2em; color: var(--flow); text-transform: uppercase; }
.page-hero .title-xl { margin: 1rem 0 1.4rem; max-width: 16ch; }

/* prev/next chapter nav */
.chapter-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.chapter-nav a { background: var(--void); padding: 2rem var(--gutter); display: flex; flex-direction: column; gap: 0.5rem; transition: background 0.35s; }
.chapter-nav a:hover { background: var(--surface); }
.chapter-nav a.next { text-align: right; align-items: flex-end; }
.chapter-nav .dir { font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.chapter-nav .name { font-family: var(--font-display); font-weight: 500; font-size: var(--t-1); color: var(--ink); }
.chapter-nav a:hover .name { color: var(--flow); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: clamp(3rem, 6vw, 5rem) 2.5rem; background: var(--void-2); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2.5rem; }
.footer-brand .title-md { margin-bottom: 1rem; }
.footer-col h4 { font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 1.1rem; }
.footer-col ul { display: grid; gap: 0.7rem; }
.footer-col a { color: var(--ink-dim); font-size: var(--t--1); transition: color 0.25s; }
.footer-col a:hover { color: var(--flow); }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; margin-top: 3.5rem; padding-top: 1.6rem; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: var(--t--2); color: var(--ink-faint); letter-spacing: 0.04em; }
.footer-bottom a { color: var(--ink-dim); }
.footer-bottom a:hover { color: var(--flow); }

/* ---------- Utilities ---------- */
.stack { display: flex; flex-direction: column; }
.gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); } .gap-4 { gap: var(--s-4); }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-5 { margin-top: var(--s-5); }
.mb-3 { margin-bottom: var(--s-3); } .mb-4 { margin-bottom: var(--s-4); }
.max-40 { max-width: 40ch; } .max-52 { max-width: 52ch; }
.center { text-align: center; } .mx-auto { margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.sticky-media { position: sticky; top: calc(var(--nav-h) + 2rem); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .chapter-card { grid-column: span 6; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .two-col { grid-template-columns: 1fr; }
  .sticky-media { position: static; }
}
@media (max-width: 720px) {
  :root { --nav-h: 60px; }
  .nav-links { display: none; }
  .nav-menu-btn { display: inline-flex; }
  .chapter-card { grid-column: 1 / -1; min-height: 0; }
  .chapter-nav { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .control { min-width: 100%; }
}

/* ---------- Chapter index overlay ---------- */
.index-overlay { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.index-overlay.is-open { pointer-events: auto; }
.index-overlay__scrim { position: absolute; inset: 0; background: rgba(3,5,8,0.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.5s var(--ease-out); }
.index-overlay.is-open .index-overlay__scrim { opacity: 1; }
.index-overlay__panel { position: absolute; top: 0; right: 0; height: 100%; width: min(460px, 92vw); background: var(--surface); border-left: 1px solid var(--line-2); padding: calc(var(--nav-h) - 4px) 1.4rem 2rem; overflow-y: auto; transform: translateX(100%); transition: transform 0.6s var(--ease-out); display: flex; flex-direction: column; gap: 2px; }
.index-overlay.is-open .index-overlay__panel { transform: none; }
.index-overlay__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.index-close { font-size: 1.7rem; color: var(--ink-dim); width: 40px; height: 40px; line-height: 1; transition: color 0.25s; }
.index-close:hover { color: var(--ink); }
.index-link { display: flex; align-items: center; gap: 1rem; padding: 0.95rem 0.8rem; border-radius: var(--radius); transition: background 0.25s; border: 1px solid transparent; }
.index-link:hover { background: var(--surface-2); }
.index-link.is-current { background: var(--flow-dim); border-color: rgba(36,229,160,0.25); }
.index-link__n { font-family: var(--font-mono); font-size: var(--t--1); color: var(--flow); min-width: 2ch; }
.index-link__body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.index-link__t { font-family: var(--font-display); font-weight: 500; font-size: var(--t-0); color: var(--ink); line-height: 1.15; }
.index-link__b { font-size: var(--t--2); color: var(--ink-faint); }
.index-link svg { color: var(--ink-faint); flex: none; transition: transform 0.3s var(--ease-out), color 0.25s; }
.index-link:hover svg { color: var(--flow); transform: translateX(3px); }
.index-link--muted { margin-top: auto; border-top: 1px solid var(--line); border-radius: 0; }
.index-link--muted .index-link__n { color: var(--value); }
.index-link--muted .index-link__t { color: var(--ink-dim); }

/* ---------- Mobile menu button ---------- */
.nav-menu-btn { flex-direction: column; gap: 5px; width: 42px; height: 42px; align-items: center; justify-content: center; border: 1px solid var(--line-2); border-radius: var(--radius); }
.nav-menu-btn span { display: block; width: 18px; height: 1.5px; background: var(--ink); transition: 0.3s; }

/* ---------- Reduced motion ---------- */
/* ============================================================
   ROUND 2 — learning + motion layer
   ============================================================ */

/* ---- Glossary tooltips ---- */
.keyterm, .has-tip { color: var(--flow); border-bottom: 1px dashed var(--flow-dim); cursor: help; transition: border-color 0.2s; }
.keyterm:hover, .has-tip:hover, .has-tip:focus-visible { border-bottom-color: var(--flow); }
.glossary-tip {
  position: fixed; z-index: 120; left: 0; top: 0;
  background: var(--surface-3); color: var(--ink-2);
  border: 1px solid var(--line-3); border-radius: 10px;
  padding: 0.75rem 0.9rem; font-family: var(--font-sans); font-size: var(--t--2); line-height: 1.55;
  box-shadow: 0 20px 44px -14px rgba(0,0,0,0.75); pointer-events: none;
  opacity: 0; transform: translateY(4px); transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}
.glossary-tip.is-on { opacity: 1; transform: none; }
.glossary-tip::after { content: ""; position: absolute; left: var(--arrow-x, 50%); bottom: -5px; width: 10px; height: 10px; background: var(--surface-3); border-right: 1px solid var(--line-3); border-bottom: 1px solid var(--line-3); transform: translateX(-50%) rotate(45deg); }
.glossary-tip.is-below::after { bottom: auto; top: -5px; border: none; border-left: 1px solid var(--line-3); border-top: 1px solid var(--line-3); }

/* ---- Visited chapter ✓ (index overlay) ---- */
.index-link.is-visited .index-link__n { color: var(--flow); position: relative; }
.index-link.is-visited .index-link__n::after { content: "✓"; margin-left: 0.35rem; font-size: 0.72em; color: var(--flow); }

/* ---- "In 30 seconds" TL;DR card ---- */
.tldr { border: 1px solid var(--line-2); border-radius: var(--radius-lg); background: linear-gradient(180deg, var(--surface), var(--void-2)); padding: clamp(1.5rem, 3vw, 2.2rem); position: relative; overflow: hidden; }
.tldr::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: linear-gradient(var(--flow), transparent 80%); }
.tldr__label { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--font-mono); font-size: var(--t--2); letter-spacing: 0.16em; text-transform: uppercase; color: var(--flow); margin-bottom: 1.1rem; }
.tldr__label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--flow); box-shadow: 0 0 8px var(--flow-glow); }
.tldr ul { display: grid; gap: 0.8rem; counter-reset: tldr; }
.tldr li { display: flex; gap: 0.8rem; align-items: flex-start; color: var(--ink-2); font-size: var(--t-0); line-height: 1.5; font-weight: 300; }
.tldr li b, .tldr li strong { color: var(--ink); font-weight: 600; }
.tldr li::before { content: counter(tldr); counter-increment: tldr; font-family: var(--font-mono); font-size: var(--t--2); color: var(--flow); background: var(--flow-dim); border-radius: 5px; min-width: 1.7rem; height: 1.7rem; display: inline-grid; place-items: center; flex: none; margin-top: 1px; }

/* ---- "Continue where you left off" chip (hub) ---- */
.continue-chip { display: inline-flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.7rem 0.6rem 1rem; border: 1px solid var(--line-2); border-radius: 100px; background: var(--surface); font-size: var(--t--1); color: var(--ink-2); transition: border-color 0.25s, transform 0.25s var(--ease-out); }
.continue-chip:hover { border-color: var(--flow); transform: translateY(-1px); }
.continue-chip b { color: var(--ink); font-weight: 600; }
.continue-chip .go { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--flow); color: var(--void); }
.continue-chip .go svg { width: 14px; height: 14px; }
.continue-chip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--flow); box-shadow: 0 0 8px var(--flow-glow); }

/* ---- Cross-page View Transitions (progressive; Chromium MPA) ---- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 0.32s var(--ease-out) both; }
::view-transition-new(root) { animation: vt-in 0.42s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* ---- Scroll-scrub helper (chapters can opt a moment in) ---- */
[data-scrub] > * { will-change: transform, opacity; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  [data-reveal], [data-reveal-stagger] > * { opacity: 1 !important; transform: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}
