/* ============================================================
   How Teams Build — a data report reinterpretation
   Design system: Newsreader (display) / Inter (UI) / JetBrains Mono (numerals)
   All fonts self-hosted in ../fonts/ (SIL Open Font License)
   ============================================================ */

/* ---------- Fonts ---------- */
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/Newsreader-normal.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/Newsreader-italic.woff2") format("woff2");
  font-weight: 300 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --font-display: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #0c0e12;
  --bg-raised: #14171d;
  --bg-sunken: #07090c;
  --ink: #eceef2;
  --ink-soft: #a7b0bd;
  --ink-faint: #8a93a1;
  --line: rgba(236, 238, 242, 0.1);
  --line-strong: rgba(236, 238, 242, 0.22);

  --brand: #9b8bf9;
  --brand-strong: #b4a9fb;
  --ai: #9b8bf9;          /* agents / AI series */
  --human: #e5ae4f;       /* people / integrations series */
  --pos: #4cc3a4;
  --hover-bg: rgba(155, 139, 249, 0.12);

  --ai-on-ink: #0c0e12;
  --focus: #b4a9fb;

  --shadow-fig: 0 24px 60px -28px rgba(0, 0, 0, 0.65);
  --radius: 14px;
  --measure: 42rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #faf9f6;
  --bg-raised: #ffffff;
  --bg-sunken: #f1efe9;
  --ink: #171a1f;
  --ink-soft: #4d5663;
  --ink-faint: #5c6472;
  --line: rgba(23, 26, 31, 0.12);
  --line-strong: rgba(23, 26, 31, 0.28);

  --brand: #5f46d8;
  --brand-strong: #4b37bd;
  --ai: #5f46d8;
  --human: #a8761a;
  --pos: #0e8267;
  --hover-bg: rgba(95, 70, 216, 0.09);
  --focus: #5f46d8;

  --shadow-fig: 0 24px 60px -34px rgba(23, 26, 31, 0.35);
  color-scheme: light;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0313rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.08; margin: 0; }
p { margin: 0 0 1em; }
a { color: var(--brand-strong); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; }

::selection { background: var(--brand); color: var(--ai-on-ink); }

/* Focus */
:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Utilities */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mono { font-family: var(--font-mono); }
.num { font-family: var(--font-mono); font-weight: 500; font-feature-settings: "zero"; }

.skip-link {
  position: fixed; left: 1rem; top: 0.75rem; z-index: 200;
  transform: translateY(-250%);
  background: var(--brand); color: var(--ai-on-ink);
  padding: 0.7rem 1.1rem; border-radius: 8px; font-weight: 600;
  transition: transform 0.18s ease;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

/* Grain overlay */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem var(--gutter);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header::after {
  content: "";
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--ai), var(--human));
  transition: width 0.15s linear;
  inline-size: calc(var(--scroll-progress, 0) * 100%);
}
.brand {
  display: flex; align-items: center; gap: 0.6rem;
  text-decoration: none; color: var(--ink);
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em;
  text-transform: uppercase; white-space: nowrap;
  padding: 0.45rem 0.25rem;
}
.brand strong { color: var(--brand-strong); font-weight: 700; }

/* Touch targets: every interactive link keeps a >=44px hit area.
   Padding is offset by negative margins so prose lines do not rewrap. */
.brand { min-height: 44px; }
.cap a, .stat-strip a, .site-footer a, .acc-body a {
  display: inline-block;
  padding: 0.8rem 0.3rem;
  margin: -0.8rem -0.3rem;
}
.header-spacer { flex: 1; }
.header-tools { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-width: 44px; min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line-strong);
  background: var(--bg-raised); border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.04em;
  color: var(--ink-soft);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { border-color: var(--brand); color: var(--ink); }
.icon-btn[aria-expanded="true"] { border-color: var(--brand); color: var(--brand-strong); }
@media (max-width: 600px) {
  .icon-btn .btn-label { display: none; }
  .brand { font-size: 0.72rem; letter-spacing: 0.03em; gap: 0.4rem; }
}

/* Mobile nav drawer */
.nav-drawer {
  position: fixed; inset: 0 0 auto 0; z-index: 150;
  transform: translateY(-100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line-strong);
  padding: 1rem var(--gutter) 1.25rem;
  max-height: 78vh; overflow-y: auto;
}
.nav-drawer.open {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.25s ease, visibility 0s;
}
.nav-drawer h2 { font-size: 1rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); margin-bottom: 0.75rem; }
.nav-drawer ol { list-style: none; margin: 0; padding: 0; columns: 1; }
@media (min-width: 700px) { .nav-drawer ol { columns: 2; column-gap: 2rem; } }
.nav-drawer li a {
  display: flex; gap: 0.6rem; align-items: baseline;
  padding: 0.65rem 0.25rem; min-height: 44px;
  color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line);
}
.nav-drawer li a .k { font-family: var(--font-mono); color: var(--brand-strong); font-size: 0.75rem; min-width: 2.2em; }
.nav-scrim {
  position: fixed; inset: 0; z-index: 140; background: rgba(0,0,0,0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.nav-scrim.open { opacity: 1; pointer-events: auto; }

/* ---------- Side rail navigator ---------- */
.rail {
  position: fixed; top: 50%; left: clamp(0.4rem, 1.6vw, 1.6rem);
  transform: translateY(-50%);
  z-index: 90; display: none;
  padding: 0.6rem 0.4rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}
@media (min-width: 1240px) { .rail { display: block; } }
.rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.rail a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0.6rem; min-height: 44px;
  border-radius: 8px; text-decoration: none;
  color: var(--ink-faint); font-size: 0.78rem; font-family: var(--font-mono);
  letter-spacing: 0.02em;
  position: relative;
}
.rail a .dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--line-strong); flex: none;
  transition: background 0.2s ease, transform 0.2s ease;
}
.rail a .lbl { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail a.act { color: var(--ink-soft); font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; font-size: 0.68rem; }
.rail a:not(.act) { padding-left: 1.55rem; }
.rail a[aria-current="true"] { color: var(--ink); background: var(--hover-bg); }
.rail a[aria-current="true"] .dot { background: var(--brand); transform: scale(1.5); }

/* ---------- Layout ---------- */
main { position: relative; z-index: 2; }
.column { max-width: var(--measure); margin-inline: auto; padding-inline: var(--gutter); }
.wide { max-width: 76rem; margin-inline: auto; padding-inline: var(--gutter); }
/* At rail widths, center content in the space right of the fixed rail so
   full-width figure cards can never slide beneath it. */
@media (min-width: 1240px) {
  main, .site-footer { padding-left: 14rem; }
}

section { scroll-margin-top: 4.5rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(3.5rem, 10vh, 7rem) 0 clamp(2.5rem, 7vh, 4.5rem);
  overflow: clip;
}
.hero-glow {
  position: absolute; inset: -20% 0 auto; height: 130%;
  pointer-events: none;
  background:
    radial-gradient(46rem 30rem at 12% 0%, color-mix(in srgb, var(--ai) 17%, transparent), transparent 65%),
    radial-gradient(40rem 26rem at 88% 12%, color-mix(in srgb, var(--human) 12%, transparent), transparent 70%);
}
[data-theme="light"] .hero-glow { opacity: 0.75; }
.hero__kicker {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--brand-strong);
  margin-bottom: 1.4rem; display: flex; align-items: center; gap: 0.8rem;
}
.hero__kicker::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.hero h1 {
  font-size: clamp(3rem, 9vw, 5.6rem);
  font-weight: 560; letter-spacing: -0.02em;
  font-variation-settings: "opsz" 72;
  margin-bottom: 1.2rem;
}
.hero h1 em { font-style: italic; color: var(--brand-strong); }
.hero__stand {
  font-family: var(--font-display); font-size: clamp(1.25rem, 2.7vw, 1.6rem);
  font-weight: 400; line-height: 1.42; color: var(--ink-soft);
  max-width: 34em; margin-bottom: 1.6rem;
}
.hero__meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem;
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-faint);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.hero__meta span { display: inline-flex; align-items: center; gap: 0.45rem; }

/* Stat strip */
.stat-strip {
  list-style: none; margin: clamp(2rem, 5vh, 3.5rem) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
@media (min-width: 860px) { .stat-strip { grid-template-columns: repeat(4, 1fr); } }
.stat-strip li {
  background: var(--bg-raised); padding: 1.1rem 1.15rem 1.2rem;
}
.stat-strip .big {
  display: block; font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem); line-height: 1; letter-spacing: -0.01em;
  color: var(--ink);
  font-feature-settings: "tnum";
}
.stat-strip .big .unit { font-size: 0.5em; color: var(--ink-soft); font-family: var(--font-body); font-weight: 600; }
.stat-strip .cap { display: block; margin-top: 0.55rem; font-size: 0.83rem; color: var(--ink-soft); line-height: 1.45; }
.stat-strip .cap a { color: inherit; text-decoration-color: var(--line-strong); }

/* ---------- Prologue / TOC ---------- */
.prose > * { max-width: var(--measure); }
.prose h2 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); margin: 1.2em 0 0.5em; }
.prose p { color: var(--ink-soft); }
.prose strong { color: var(--ink); font-weight: 600; }

.toc {
  list-style: none; margin: 2rem 0 0; padding: 0;
  display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
@media (min-width: 700px) { .toc { grid-template-columns: 1fr 1fr; } }
.toc li { background: var(--bg-raised); }
.toc li.toc-act {
  background: var(--bg-sunken); font-family: var(--font-mono);
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint); padding: 0.55rem 1.1rem 0.35rem;
  grid-column: 1 / -1;
}
.toc a {
  display: flex; align-items: baseline; gap: 0.85rem;
  padding: 0.8rem 1.1rem; min-height: 44px;
  color: var(--ink); text-decoration: none;
  transition: background 0.15s ease;
}
.toc a:hover { background: var(--hover-bg); }
.toc a .k { font-family: var(--font-mono); font-size: 0.75rem; color: var(--brand-strong); min-width: 1.9em; }
.toc a .t { flex: 1; font-size: 0.95rem; }
.toc a .tag { font-size: 0.7rem; font-family: var(--font-mono); color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- Act divider ---------- */
.act-divider {
  position: relative;
  margin-top: clamp(4rem, 12vh, 8rem);
  padding: clamp(3.5rem, 9vh, 6rem) 0 clamp(2.5rem, 6vh, 4rem);
  border-top: 1px solid var(--line);
  overflow: clip;
}
.act-no {
  position: absolute; right: -0.08em; top: 50%; transform: translateY(-52%);
  font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(9rem, 26vw, 19rem); line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--line-strong);
  pointer-events: none; user-select: none;
}
.act-divider .eyebrow {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--brand-strong); margin-bottom: 1rem;
}
.act-divider h2 { font-size: clamp(2.6rem, 6vw, 4rem); font-weight: 560; letter-spacing: -0.015em; max-width: 12em; }
.act-divider p.lede { max-width: 33em; margin-top: 1rem; font-size: 1.08rem; color: var(--ink-soft); }
.act-toc { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.6rem; }
.act-toc a {
  font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.03em;
  padding: 0.55rem 0.9rem; min-height: 44px; display: inline-flex; align-items: center;
  border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--ink-soft); text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.act-toc a:hover { border-color: var(--brand); color: var(--ink); }

/* ---------- Story sections ---------- */
.story { padding: clamp(2.5rem, 7vh, 4.5rem) 0 0; }
.story__head { max-width: var(--measure); }
.story__no {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-faint);
  display: inline-flex; align-items: center; gap: 0.65rem; margin-bottom: 0.9rem;
}
.story__no::before { content: ""; width: 2rem; height: 1px; background: var(--line-strong); display: inline-block; }
.story h3 { font-size: clamp(1.55rem, 3.4vw, 2.15rem); font-weight: 560; letter-spacing: -0.01em; margin-bottom: 0.55rem; }
.story__lede { color: var(--ink-soft); font-size: 1.05rem; max-width: 38em; margin-bottom: 0; }

.anno-card {
  margin: 1.6rem 0 0; padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--brand); background: var(--hover-bg);
  border-radius: 0 10px 10px 0;
  font-size: 0.9rem; color: var(--ink-soft); max-width: var(--measure);
}
.anno-card strong { color: var(--ink); }

/* ---------- Figures ---------- */
.figure {
  margin: clamp(1.8rem, 4vh, 2.6rem) auto 0;
  max-width: 76rem;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-fig);
  overflow: hidden;
}
.figure__toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem;
  padding: 0.9rem 1.15rem 0.6rem;
  border-bottom: 1px solid var(--line);
}
.figure__title { font-weight: 600; font-size: 0.95rem; margin-right: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.legend button, .legend .key {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 44px; padding: 0.3rem 0.75rem;
  border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--ink-soft);
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.02em;
}
.legend button { cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease; }
.legend button:hover, .legend button:focus-visible { border-color: var(--brand); color: var(--ink); }
.legend button[aria-pressed="false"] { opacity: 0.45; }
.legend .swatch { width: 18px; height: 3px; border-radius: 2px; background: currentColor; }
.legend .swatch.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }
.legend .swatch.hatch { background: repeating-linear-gradient(45deg, currentColor 0 2.5px, transparent 2.5px 5px); height: 8px; border-radius: 2px; opacity: 0.85; width: 14px; }
.legend .swatch.dot { width: 9px; height: 9px; border-radius: 999px; }

.figure__stage { position: relative; padding: 0.4rem 0.4rem 0; }
.figure__stage svg { width: 100%; height: auto; }

.figure__loading {
  padding: 2.5rem 1.15rem; color: var(--ink-faint); font-size: 0.9rem;
}
.empty-state {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center; text-align: center;
  padding: 2rem; color: var(--ink-faint); font-size: 0.9rem;
  background: color-mix(in srgb, var(--bg-raised) 88%, transparent);
}
.empty-state.show { display: flex; }

.figure__foot {
  padding: 0.75rem 1.15rem 0.95rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.1rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem; color: var(--ink-faint);
}
.figure__foot .n { font-family: var(--font-mono); }
.figure__foot .credit { margin-left: auto; }

/* Tooltip */
#tooltip {
  position: fixed; z-index: 300; pointer-events: none;
  background: var(--bg-sunken);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 0.6rem 0.8rem;
  font-size: 0.8rem; line-height: 1.5;
  box-shadow: 0 12px 32px -10px rgba(0,0,0,0.5);
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  max-width: 16rem;
}
[data-theme="light"] #tooltip { background: #fff; box-shadow: 0 14px 34px -14px rgba(23,26,31,0.4); }
#tooltip.show { opacity: 1; transform: translateY(0); }
#tooltip .tt-title { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 0.15rem; }
#tooltip .tt-row { display: flex; justify-content: space-between; gap: 1rem; }
#tooltip .tt-row .v { font-family: var(--font-mono); font-weight: 600; }

/* Data details */
.data-details { margin-top: 0; border-top: 1px solid var(--line); }
.data-details summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1.15rem; min-height: 44px;
  font-size: 0.85rem; color: var(--ink-soft);
  user-select: none;
}
.data-details summary::-webkit-details-marker { display: none; }
.data-details summary::before {
  content: ""; width: 8px; height: 8px; flex: none;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.15s ease;
}
.data-details summary:hover { color: var(--ink); }
.data-details[open] summary::before { transform: rotate(225deg) translateY(-1px); }
.data-details summary .count { margin-left: auto; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); }
.data-table-wrap { overflow-x: auto; max-height: 22rem; overflow-y: auto; }
table.data-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-mono); font-size: 0.78rem;
}
.data-table caption { text-align: left; padding: 0.6rem 1.15rem; color: var(--ink-faint); font-family: var(--font-body); font-size: 0.8rem; }
.data-table th, .data-table td { padding: 0.5rem 1.15rem; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { position: sticky; top: 0; background: var(--bg-raised); color: var(--ink-soft); font-weight: 600; z-index: 1; }

/* Section takeaway chip after figure */
.take {
  display: flex; gap: 0.85rem; align-items: flex-start;
  max-width: var(--measure); margin: 1.5rem auto 0;
  padding: 1rem 1.15rem;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.take .mark {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--hover-bg); color: var(--brand-strong);
  font-family: var(--font-mono); font-weight: 700; font-size: 0.8rem;
}
.take p { margin: 0; font-size: 0.95rem; color: var(--ink-soft); }
.take strong { color: var(--ink); }
.take b.num { color: var(--brand-strong); font-weight: 700; }

/* ---------- Closing ---------- */
.closing {
  margin-top: clamp(4rem, 12vh, 8rem);
  padding: clamp(3.5rem, 9vh, 6rem) 0;
  border-top: 1px solid var(--line);
  position: relative; overflow: clip;
}
.closing .eyebrow { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--brand-strong); margin-bottom: 1rem; }
.closing h2 { font-size: clamp(2.1rem, 5vw, 3.1rem); font-weight: 560; letter-spacing: -0.015em; max-width: 16em; }
.closing-grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 2.2rem; }
@media (min-width: 860px) { .closing-grid { grid-template-columns: 1fr 1fr; } }
.closing-grid article { background: var(--bg-raised); padding: 1.6rem 1.5rem; }
.closing-grid h3 { font-size: 1.35rem; margin-bottom: 0.5rem; font-weight: 560; }
.closing-grid p { color: var(--ink-soft); font-size: 0.95rem; margin: 0; }
.byline { margin-top: 2.4rem; font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.byline strong { color: var(--ink-soft); }

/* ---------- Appendix ---------- */
.appendix { padding: clamp(2rem, 6vh, 4rem) 0 clamp(3rem, 8vh, 6rem); border-top: 1px solid var(--line); }
.appendix h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 1.6rem; }
.acc { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-raised); margin-bottom: 0.75rem; }
.acc summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.9rem;
  padding: 1.05rem 1.25rem; min-height: 44px; font-weight: 600; font-size: 1.02rem;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::before {
  content: ""; width: 9px; height: 9px; flex: none;
  border-right: 1.8px solid var(--brand-strong); border-bottom: 1.8px solid var(--brand-strong);
  transform: rotate(45deg) translateY(-2px); transition: transform 0.18s ease;
}
.acc[open] summary::before { transform: rotate(225deg) translateY(-1px); }
.acc summary .hint { margin-left: auto; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); font-weight: 400; }
.acc .acc-body { padding: 0.25rem 1.25rem 1.3rem; color: var(--ink-soft); font-size: 0.97rem; }
.acc .acc-body dl { display: grid; grid-template-columns: 1fr; gap: 0.15rem 1.5rem; margin: 0.6rem 0 0; }
@media (min-width: 700px) { .acc .acc-body dl { grid-template-columns: minmax(9rem, 13rem) 1fr; } }
.acc .acc-body dt { font-weight: 600; color: var(--ink); padding: 0.55rem 0; border-top: 1px solid var(--line); }
.acc .acc-body dd { margin: 0; padding: 0.55rem 0; border-top: 1px solid var(--line); }
.acc ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.acc li { margin: 0.3rem 0; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.2rem var(--gutter) 3rem;
  font-size: 0.84rem; color: var(--ink-faint);
}
.site-footer .row { max-width: 76rem; margin-inline: auto; display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: baseline; }
.site-footer .row:last-child { margin-top: 0.8rem; }
.site-footer a { color: var(--ink-soft); }

/* Back to top (appears after scroll) */
.to-top {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 95;
  min-width: 44px; min-height: 44px;
  display: none; place-items: center;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--bg-raised); color: var(--ink-soft);
  text-decoration: none; font-family: var(--font-mono); font-size: 0.72rem;
  box-shadow: var(--shadow-fig);
}
.to-top.show { display: grid; }

/* ---------- Chart internals (shared) ---------- */
.chart text { font-family: var(--font-mono); fill: var(--ink-faint); font-size: 11px; }
.chart .tick-label { font-size: 11px; }
.chart .axis-line { stroke: var(--line-strong); stroke-width: 1; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .series-ai { color: var(--ai); }
.chart .series-human { color: var(--human); }
.chart .series-pos { color: var(--pos); }
.chart .dim { opacity: 0.16; transition: opacity 0.2s ease; }
.chart .end-label { font-size: 12px; font-weight: 700; }
.chart .anno-text { fill: var(--ink-soft); font-family: var(--font-body); font-size: 12px; }
.chart .anno-strong { fill: var(--ink); font-weight: 600; }
.chart .crosshair { stroke: var(--line-strong); stroke-dasharray: 3 3; }
.chart .tip-dot { stroke: var(--bg-raised); stroke-width: 2; }
.chart .baseline { stroke: var(--line-strong); stroke-dasharray: 5 4; }
.chart .delta-chip { font-size: 11px; font-weight: 700; }
.chart .row-label { fill: var(--ink-soft); font-family: var(--font-body); font-size: 12.5px; }
.chart .row-label.focused { fill: var(--ink); font-weight: 600; }
.chart .value-label { font-size: 11.5px; font-weight: 600; }
.chart .bar-25 { fill: none; }
.chart .ghost-note { fill: var(--ink-faint); font-style: italic; font-family: var(--font-body); }

/* Reveal transition for figures */
.figure__stage { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.figure__stage.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .figure__stage { opacity: 1; transform: none; transition: none; }
}

/* Print: light-friendly */
@media print {
  :root, [data-theme="light"] {
    --bg: #fff; --bg-raised: #fff; --bg-sunken: #f4f4f4;
    --ink: #111; --ink-soft: #333; --ink-faint: #555;
    --line: #ddd; --line-strong: #bbb;
  }
  .site-header, .rail, .to-top, .nav-drawer, .nav-scrim { display: none !important; }
  body::after { display: none; }
  .figure { break-inside: avoid; box-shadow: none; }
}
