/* ==========================================================================
   Kyouma45 — AI Research · Design System
   Light-first editorial design; the theme follows the system by default and is
   overridable from the header toggle (js/theme.js sets data-theme on <html>).
   Chart colors follow the validated reference palette:
     SSM/Mamba  = blue   (slot 1)
     Transformer = orange (slot 2)
     Phase 1 = blue · Phase 2 = orange · Phase 3 = aqua
   ========================================================================== */

:root {
  color-scheme: light;

  /* Surfaces & ink */
  --page:            #f9f9f7;
  --surface:         #fcfcfb;
  --surface-raised:  #ffffff;
  --ink:             #0b0b0b;
  --ink-secondary:   #52514e;
  --ink-muted:       #898781;
  --hairline:        #e1e0d9;
  --baseline:        #c3c2b7;
  --ring:            rgba(11, 11, 11, 0.10);

  /* Brand accent (slot-1 blue) */
  --accent:          #2a78d6;
  --accent-strong:   #1c5cab;
  --accent-wash:     rgba(42, 120, 214, 0.08);

  /* Chart series — color follows the entity, everywhere on the site */
  --c-ssm:           #2a78d6;  /* blue  — SSM / Mamba / linear-state models */
  --c-transformer:   #eb6834;  /* orange — Transformer / attention */

  /* Phase identities (first three categorical slots; all-pairs safe) */
  --phase-1:         #2a78d6;  /* blue  — Linear Sequence Revolution   */
  --phase-2:         #eb6834;  /* orange — Latent Reasoning Loops      */
  --phase-3:         #1baf7a;  /* aqua  — Beyond Causal Autoregression */
  --phase-1-wash:    rgba(42, 120, 214, 0.10);
  --phase-2-wash:    rgba(235, 104, 52, 0.10);
  --phase-3-wash:    rgba(27, 175, 122, 0.10);

  /* Chart chrome */
  --gridline:        #e1e0d9;
  --axis:            #c3c2b7;

  /* Type */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;

  /* Prose measure widens with the viewport: 46rem floor on laptops,
     up to 60rem on wide monitors. */
  --w-prose: clamp(46rem, 52vw, 60rem);
  --w-reading: 50rem;
  --w-wide: 72rem;
  --gutter: 1.5rem;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(11,11,11,.05), 0 8px 28px rgba(11,11,11,.06);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page:           #0d0d0d;
  --surface:        #1a1a19;
  --surface-raised: #222220;
  --ink:            #ffffff;
  --ink-secondary:  #c3c2b7;
  --ink-muted:      #898781;
  --hairline:       #2c2c2a;
  --baseline:       #383835;
  --ring:           rgba(255, 255, 255, 0.10);

  --accent:         #3987e5;
  --accent-strong:  #6da7ec;
  --accent-wash:    rgba(57, 135, 229, 0.14);

  --c-ssm:          #3987e5;
  --c-transformer:  #d95926;

  --phase-1:        #3987e5;
  --phase-2:        #d95926;
  --phase-3:        #199e70;
  --phase-1-wash:   rgba(57, 135, 229, 0.16);
  --phase-2-wash:   rgba(217, 89, 38, 0.16);
  --phase-3-wash:   rgba(25, 158, 112, 0.16);

  --gridline:       #2c2c2a;
  --axis:           #383835;

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; }

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--accent-wash); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: 0; }
h4, h5 { font-family: var(--sans); font-weight: 600; }

code, pre, kbd { font-family: var(--mono); }

.container { max-width: var(--w-wide); margin: 0 auto; padding: 0 var(--gutter); }
.prose-width { max-width: var(--w-prose); margin-left: auto; margin-right: auto; }

.kicker {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.75rem;
}

.section { padding: 4.5rem 0; }
.section + .section { border-top: 1px solid var(--hairline); }
/* The sticky header already separates the first block from the top of the page. */
main > .section:first-child { padding-top: 3rem; }

.section-title { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: 0 0 0.5rem; }
.section-lede { color: var(--ink-secondary); font-size: 1.06rem; max-width: 46rem; margin: 0 0 2rem; }

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.nav {
  max-width: var(--w-wide); margin: 0 auto; padding: 0.8rem 1.5rem;
  display: flex; align-items: center; gap: 1.25rem;
}
.brand {
  font-family: var(--sans); font-weight: 700; font-size: 0.95rem;
  color: var(--ink); letter-spacing: 0;
  display: flex; align-items: center; gap: 0.55rem;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background: linear-gradient(135deg, var(--c-ssm), var(--phase-3));
}
.brand small { font-weight: 500; color: var(--ink-muted); }
.nav-links { margin-left: auto; display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav-links a {
  font-size: 0.88rem; font-weight: 500; color: var(--ink-secondary);
  padding: 0.35rem 0.7rem; border-radius: 999px;
}
.nav-links a:hover { color: var(--ink); background: var(--accent-wash); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-wash); }
.theme-toggle {
  flex: none; margin-left: 0.4rem; padding: 0;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hairline); border-radius: 999px;
  background: transparent; color: var(--ink-secondary); cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.theme-toggle:hover { color: var(--ink); background: var(--accent-wash); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 2.5rem 0 3rem;
  color: var(--ink-muted); font-size: 0.88rem;
}
.site-footer .container { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--ink-secondary); margin-left: 1rem; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--sans); font-weight: 600; font-size: 0.92rem;
  padding: 0.62rem 1.15rem; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-ghost { border-color: var(--hairline); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--baseline); background: var(--surface); }

/* --------------------------------------------------------------------------
   Chips & badges
   -------------------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 0.22rem 0.65rem; border-radius: 999px;
  border: 1px solid var(--hairline); color: var(--ink-secondary);
  white-space: nowrap;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chip-phase-1 { background: var(--phase-1-wash); border-color: transparent; }
.chip-phase-1 .dot { background: var(--phase-1); }
.chip-phase-2 { background: var(--phase-2-wash); border-color: transparent; }
.chip-phase-2 .dot { background: var(--phase-2); }
.chip-phase-3 { background: var(--phase-3-wash); border-color: transparent; }
.chip-phase-3 .dot { background: var(--phase-3); }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 1.5rem;
}
.card-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.article-card { display: flex; flex-direction: column; gap: 0.6rem; transition: border-color .15s, box-shadow .15s; }
.article-card:hover { border-color: var(--baseline); box-shadow: var(--shadow); }
.article-card h3 { font-size: 1.15rem; margin: 0; }
.article-card h3 a { color: var(--ink); }
.article-card p { margin: 0; color: var(--ink-secondary); font-size: 0.93rem; }
.article-card .meta { margin-top: auto; padding-top: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; font-size: 0.8rem; color: var(--ink-muted); }

/* --------------------------------------------------------------------------
   Stat tiles
   -------------------------------------------------------------------------- */
.stat-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat-tile {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 1.15rem 1.25rem;
}
.stat-tile .value {
  font-family: var(--sans); font-size: 1.9rem; font-weight: 700; letter-spacing: 0;
  color: var(--ink); line-height: 1.15;
}
.stat-tile .value em { font-style: normal; color: var(--accent-strong); }
.stat-tile .label { font-size: 0.85rem; color: var(--ink-secondary); margin-top: 0.3rem; }

/* --------------------------------------------------------------------------
   Chart components
   -------------------------------------------------------------------------- */
.viz {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 1.25rem 1.25rem 1rem;
}
.viz-title { font-family: var(--sans); font-weight: 600; font-size: 0.95rem; margin: 0 0 0.15rem; color: var(--ink); }
.viz-sub { font-size: 0.82rem; color: var(--ink-muted); margin: 0 0 0.9rem; }
.viz svg text { font-family: var(--sans); }
.viz .axis-label { fill: var(--ink-muted); font-size: 11px; }
.viz .grid line { stroke: var(--gridline); stroke-width: 1; }
.viz .axis line, .viz .axis path { stroke: var(--axis); }

.legend { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--ink-secondary); margin-top: 0.6rem; }
.legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 0.4rem; vertical-align: baseline; }

.viz-tooltip {
  position: absolute; pointer-events: none; z-index: 30;
  background: var(--surface-raised); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 0.5rem 0.7rem; font-size: 0.8rem; color: var(--ink);
  opacity: 0; transition: opacity .1s;
}
.viz-tooltip.visible { opacity: 1; }
.viz-tooltip .tip-row { display: flex; align-items: center; gap: 0.45rem; white-space: nowrap; }
.viz-tooltip .tip-val { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: auto; padding-left: 0.8rem; }

/* Range slider */
.ctl-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0.75rem 0 1rem; }
.ctl-row label { font-size: 0.85rem; font-weight: 600; color: var(--ink-secondary); }
.ctl-row output {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.95rem;
  color: var(--accent-strong); min-width: 5.5ch;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  flex: 1 1 200px; height: 4px; border-radius: 2px;
  background: var(--gridline); outline-offset: 4px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface-raised);
  box-shadow: 0 0 0 1px var(--ring); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface-raised);
  box-shadow: 0 0 0 1px var(--ring); cursor: pointer;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--surface); }
table.data {
  border-collapse: collapse; width: 100%; font-size: 0.88rem;
}
table.data th, table.data td { padding: 0.65rem 0.9rem; text-align: left; vertical-align: top; }
table.data thead th {
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-muted); border-bottom: 1px solid var(--baseline);
  white-space: nowrap; position: sticky; top: 0; background: var(--surface);
}
table.data tbody tr + tr td { border-top: 1px solid var(--hairline); }
table.data td.num { font-variant-numeric: tabular-nums; }
table.data th[data-sort] { cursor: pointer; user-select: none; }
table.data th[data-sort]:hover { color: var(--ink); }
table.data th[data-sort]::after { content: "↕"; margin-left: 0.35rem; opacity: 0.45; font-size: 0.85em; }
table.data th[data-sort="asc"]::after { content: "↑"; opacity: 1; }
table.data th[data-sort="desc"]::after { content: "↓"; opacity: 1; }

/* --------------------------------------------------------------------------
   Article pages
   -------------------------------------------------------------------------- */
.article-header.container { max-width: var(--w-reading); }
.article-header { padding-top: clamp(2rem, 4vw, 3rem); padding-bottom: 1.75rem; }
.article-header::after {
  content: ""; display: block; height: 1px;
  margin-top: 2rem; background: var(--hairline);
}
.article-header h1 {
  font-size: 3.35rem;
  margin: 0.5rem 0 1rem; max-width: none; text-wrap: balance;
}
.article-header .dek {
  font-family: var(--serif); font-size: 1.28rem;
  color: var(--ink-secondary); max-width: 42rem; margin: 0 0 1.4rem; line-height: 1.55;
}
.article-header .byline { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; font-size: 0.85rem; color: var(--ink-muted); }
.article-header .byline .sep { opacity: 0.5; }

.article-body {
  font-family: var(--serif);
  font-size: 1.18rem; line-height: 1.78;
  max-width: var(--w-reading); margin: 0 auto; padding-top: 0.75rem; padding-bottom: 3.5rem;
}
.article-body > * + * { margin-top: 1.1em; }
.article-body p { text-wrap: pretty; }
.article-body h2 {
  font-size: 1.7rem; margin-top: 2.5em; padding-top: 0.8em;
  border-top: 1px solid var(--hairline); scroll-margin-top: 6rem;
}
.article-body h3 { font-size: 1.3rem; margin-top: 1.8em; }
.article-body strong { font-weight: 600; }
.article-body a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
.article-body a:hover { text-decoration-color: currentColor; }
.article-body blockquote {
  margin: 1.5em 0; padding: 0.2em 0 0.2em 1.25em;
  border-left: 3px solid var(--accent); color: var(--ink-secondary);
  font-style: italic;
}
.article-body code {
  font-size: 0.82em; background: var(--accent-wash);
  padding: 0.12em 0.4em; border-radius: 4px;
}
.article-body pre {
  font-size: 0.82rem; line-height: 1.55; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); padding: 1rem 1.2rem;
}
.article-body pre code { background: none; padding: 0; font-size: inherit; }
.article-body figure { margin: 2em 0; }
.article-body figure .fig-frame {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 1.25rem; overflow-x: auto;
}
.article-body figcaption {
  font-family: var(--sans); font-size: 0.82rem; color: var(--ink-muted);
  margin-top: 0.6rem; text-align: center;
}
.article-body .katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.35em 0; }
.article-body ul, .article-body ol { padding-left: 1.4em; }
.article-body li + li { margin-top: 0.4em; }
.article-body hr { border: 0; border-top: 1px solid var(--hairline); margin: 2.5em auto; width: 40%; }

.callout {
  font-family: var(--sans); font-size: 0.95rem;
  background: var(--accent-wash); border-radius: var(--radius);
  padding: 1rem 1.25rem; border: 1px solid transparent;
}
.callout.note { background: var(--phase-1-wash); }

.canonical-note {
  font-family: var(--sans); font-size: 0.85rem; color: var(--ink-muted);
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
  padding-top: 1rem; padding-bottom: 1rem; margin: 2.5rem auto 0; max-width: var(--w-reading);
}

.article-nav {
  max-width: var(--w-reading); margin: 0 auto; padding-top: 2rem; padding-bottom: 4rem;
  display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9rem;
}
.article-nav a {
  display: flex; flex-direction: column; gap: 0.15rem; max-width: 45%;
  color: var(--ink-secondary);
}
.article-nav .dir { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); }

.reading-progress {
  position: fixed; z-index: 100; inset: 0 0 auto; height: 3px;
  background: transparent; pointer-events: none;
}
.reading-progress span {
  display: block; width: 100%; height: 100%; background: var(--accent);
  transform: scaleX(0); transform-origin: left center; will-change: transform;
}
.reader-toc {
  max-width: var(--w-reading); margin: 0 auto 1.75rem;
  padding: 1rem var(--gutter);
  border-bottom: 1px solid var(--hairline);
}
.reader-toc > p {
  margin: 0 0 0.55rem; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted);
}
.reader-toc ol {
  display: flex; gap: 1rem; list-style: none; margin: 0; padding: 0 0 0.2rem;
  overflow-x: auto; scrollbar-width: none;
}
.reader-toc ol::-webkit-scrollbar { display: none; }
.reader-toc li { flex: none; }
.reader-toc a {
  display: block; max-width: 16rem; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--ink-secondary); font-size: 0.82rem;
}
.reader-toc a[aria-current="location"] { color: var(--accent-strong); font-weight: 600; }

/* Once the gutters are no longer doing the spacing work, pull these rules in
   to the text column so every divider on the page shares one width. */
@media (min-width: 860px) {
  .reader-toc,
  .canonical-note {
    max-width: calc(var(--w-reading) - 2 * var(--gutter));
    padding-left: 0; padding-right: 0;
  }
}

@media (min-width: 1280px) {
  .reader-toc {
    position: fixed; z-index: 20; top: 6.75rem;
    left: calc(50% + 26.5rem); width: min(14rem, calc(50vw - 28rem));
    max-height: calc(100vh - 8.5rem); margin: 0; padding: 0 0 0 1rem;
    border: 0; border-left: 1px solid var(--hairline); overflow-y: auto;
  }
  .reader-toc ol { display: block; overflow: visible; }
  .reader-toc li + li { margin-top: 0.5rem; }
  .reader-toc a { white-space: normal; line-height: 1.35; }
}

/* --------------------------------------------------------------------------
   Survey paper — every block shares the container's left edge; the section
   index moves into the right margin only when there is room for it.
   -------------------------------------------------------------------------- */
.paper-hero {
  padding: clamp(2.25rem, 4vw, 3rem) 0 2.25rem;
  border-bottom: 1px solid var(--hairline);
}
.paper-hero h1 {
  max-width: var(--w-reading); margin: 0 0 1.1rem;
  font-size: 3.5rem; text-wrap: balance;
}
.paper-hero .section-lede {
  max-width: var(--w-reading); margin-bottom: 1.6rem; font-size: 1.1rem;
}
.paper-metrics {
  display: flex; align-items: baseline; gap: 0.55rem 2rem; flex-wrap: wrap;
  max-width: var(--w-reading); padding-top: 1.1rem;
  border-top: 1px solid var(--hairline);
  color: var(--ink-secondary); font-size: 0.84rem;
}
.paper-metrics strong { color: var(--ink); font-size: 1rem; }
.paper-metrics a { margin-left: auto; font-weight: 600; }

.paper-reading { padding-top: 2.75rem; padding-bottom: 3.25rem; }
.paper-layout {
  display: grid; grid-template-columns: minmax(0, var(--w-reading));
  justify-content: start; align-items: start; row-gap: 2rem;
}
.paper-index {
  min-width: 0; padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--hairline);
}
.paper-index > p,
.paper-section-label {
  margin: 0 0 0.55rem; color: var(--ink-muted);
  font-family: var(--sans); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.paper-index nav {
  display: flex; gap: 1.5rem; padding-bottom: 0.15rem;
  overflow-x: auto; scrollbar-width: none;
}
.paper-index nav::-webkit-scrollbar { display: none; }
.paper-index a {
  flex: none; white-space: nowrap;
  color: var(--ink-secondary); font-size: 0.85rem;
}

.paper-manuscript { min-width: 0; }
.paper-manuscript,
.paper-status { font-family: var(--serif); font-size: 1.1rem; line-height: 1.75; }
.paper-status > * { max-width: var(--w-reading); }
.paper-section { scroll-margin-top: 6rem; }
.paper-section + .paper-section {
  margin-top: 2.25rem; padding-top: 2.25rem; border-top: 1px solid var(--hairline);
}
.paper-section h2,
.paper-status h2 { margin: 0 0 1.05rem; font-size: 1.65rem; }
.paper-section p,
.paper-status li { text-wrap: pretty; }
.paper-equation {
  margin: 1.6rem 0; padding: 0.9rem 1.2rem;
  border-left: 3px solid var(--accent); background: var(--accent-wash);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  overflow-x: auto; color: var(--ink);
}
.paper-equation .katex-display { margin: 0.4em 0; }
.paper-status li + li { margin-top: 0.5rem; }

@media (min-width: 1200px) {
  .paper-layout {
    grid-template-columns: minmax(0, var(--w-reading)) minmax(10rem, 1fr);
    column-gap: clamp(2.5rem, 4vw, 4.5rem);
  }
  .paper-manuscript { grid-column: 1; grid-row: 1; }
  .paper-index {
    grid-column: 2; grid-row: 1; align-self: stretch;
    position: sticky; top: 6.5rem;
    padding: 0 0 0 1.15rem;
    border-bottom: 0; border-left: 1px solid var(--hairline);
  }
  .paper-index nav { display: grid; gap: 0.6rem; overflow: visible; }
  .paper-index a { white-space: normal; font-size: 0.82rem; line-height: 1.35; }
}

@media (max-width: 1200px) {
  .article-header h1 { font-size: 2.95rem; }
  .paper-hero h1 { font-size: 3rem; }
}

@media (max-width: 960px) {
  .article-header h1 { font-size: 2.6rem; }
  .paper-hero h1 { font-size: 2.6rem; }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero { padding: 3rem 0 3.5rem; }
.hero-grid { display: grid; gap: 3rem; grid-template-columns: 1.15fr 1fr; align-items: start; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.4rem); margin: 0 0 1rem; }
.hero .lede { font-size: 1.15rem; color: var(--ink-secondary); max-width: 34rem; margin: 0 0 1.75rem; }
.hero .cta-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Atlas timeline
   -------------------------------------------------------------------------- */
.timeline-scroll { overflow-x: auto; padding-bottom: 0.5rem; }
.phase-filter { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.phase-filter button {
  font-family: var(--sans); font-size: 0.82rem; font-weight: 600;
  padding: 0.35rem 0.85rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--hairline); background: transparent; color: var(--ink-secondary);
}
.phase-filter button[aria-pressed="true"] { border-color: transparent; color: var(--ink); }
.phase-filter button[data-phase="1"][aria-pressed="true"] { background: var(--phase-1-wash); }
.phase-filter button[data-phase="2"][aria-pressed="true"] { background: var(--phase-2-wash); }
.phase-filter button[data-phase="3"][aria-pressed="true"] { background: var(--phase-3-wash); }
.phase-filter button[data-phase="all"][aria-pressed="true"] { background: var(--accent-wash); }

.arch-node { cursor: pointer; }
.arch-node circle { transition: r .12s; }
.arch-node:hover circle, .arch-node.active circle { stroke-width: 3; }
.arch-node text { font-size: 11.5px; fill: var(--ink-secondary); }
.arch-node.active text { fill: var(--ink); font-weight: 600; }

.dossier {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 1.75rem; margin-top: 1.5rem;
}
.dossier h3 { margin: 0.35rem 0 0.5rem; font-size: 1.45rem; }
.dossier .facts { display: grid; gap: 0.75rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 1.25rem 0; }
.dossier .facts div { font-size: 0.88rem; }
.dossier .facts dt { color: var(--ink-muted); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.15rem; }
.dossier .facts dd { margin: 0; font-weight: 600; }
.dossier .eq {
  background: var(--page); border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem; margin: 1rem 0; overflow-x: auto; font-size: 1.02rem;
}
.dossier .links { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: 0.88rem; margin-top: 1rem; }

/* --------------------------------------------------------------------------
   Research timeline (24-month plan)
   -------------------------------------------------------------------------- */
.plan { display: grid; gap: 1rem; }
.plan-phase {
  display: grid; grid-template-columns: 130px 1fr; gap: 1.25rem;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 1.4rem; align-items: start;
}
@media (max-width: 640px) { .plan-phase { grid-template-columns: 1fr; } }
.plan-phase .months { font-family: var(--sans); font-weight: 700; font-size: 0.9rem; }
.plan-phase .months small { display: block; font-weight: 500; color: var(--ink-muted); margin-top: 0.2rem; }
.plan-phase h3 { margin: 0 0 0.5rem; font-size: 1.2rem; font-family: var(--sans); font-weight: 650; }
.plan-phase p { margin: 0; color: var(--ink-secondary); font-size: 0.95rem; }
.plan-bar { height: 6px; border-radius: 3px; margin-top: 0.6rem; background: var(--gridline); position: relative; overflow: hidden; }
.plan-bar span { position: absolute; top: 0; bottom: 0; border-radius: 3px; }

/* --------------------------------------------------------------------------
   "vs" panel — two papers, two conclusions
   -------------------------------------------------------------------------- */
.vs-wrap {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 1.25rem; align-items: stretch;
}
@media (max-width: 780px) { .vs-wrap { grid-template-columns: 1fr; } }
.vs-card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 1.5rem;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.vs-card h3 { font-size: 1.2rem; margin: 0.35rem 0 0; }
.vs-card p { margin: 0; color: var(--ink-secondary); font-size: 0.95rem; }
.vs-card a { margin-top: auto; padding-top: 0.5rem; font-size: 0.9rem; font-weight: 600; }
.vs-badge {
  align-self: center; justify-self: center;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-weight: 700; font-size: 0.85rem;
  letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--surface-raised); border: 1px solid var(--baseline);
  color: var(--ink-secondary); box-shadow: var(--shadow);
}
@media (max-width: 780px) { .vs-badge { margin: -0.5rem auto; } }
.vs-moral {
  margin-top: 1.25rem; padding: 1.1rem 1.4rem;
  border-left: 3px solid var(--accent); background: var(--accent-wash);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.vs-moral p { margin: 0; font-size: 0.98rem; color: var(--ink-secondary); max-width: 62rem; }
.vs-moral strong { color: var(--ink); }

/* --------------------------------------------------------------------------
   Survey coverage — one deep-dive per architecture
   -------------------------------------------------------------------------- */
.cov-mini { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0 0 1.5rem; }
.cov-mini-bar { display: flex; gap: 3px; }
.cov-mini-bar .seg {
  width: 16px; height: 8px; border-radius: 2px;
  background: transparent; border: 1px solid var(--baseline);
}
.cov-mini-bar .seg.on.p1 { background: var(--phase-1); border-color: var(--phase-1); }
.cov-mini-bar .seg.on.p2 { background: var(--phase-2); border-color: var(--phase-2); }
.cov-mini-bar .seg.on.p3 { background: var(--phase-3); border-color: var(--phase-3); }
.cov-mini-label { font-size: 0.88rem; color: var(--ink-secondary); }

.cov-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cov-phase {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 1.25rem 1.25rem 1rem;
  border-top-width: 3px;
}
.cov-phase[data-phase="1"] { border-top-color: var(--phase-1); }
.cov-phase[data-phase="2"] { border-top-color: var(--phase-2); }
.cov-phase[data-phase="3"] { border-top-color: var(--phase-3); }
.cov-phase > h3 { font-family: var(--sans); font-size: 0.95rem; margin: 0 0 1rem; }
.cov-phase ul { list-style: none; margin: 0; padding: 0; }
.cov-item { padding: 0.7rem 0; display: flex; gap: 0.7rem; align-items: flex-start; }
.cov-item + .cov-item { border-top: 1px solid var(--hairline); }
.cov-dot {
  flex: none; width: 12px; height: 12px; border-radius: 50%;
  margin-top: 0.3rem; border: 2px solid var(--baseline); background: transparent;
}
.cov-item.done .cov-dot { border-color: transparent; }
.cov-phase[data-phase="1"] .cov-item.done .cov-dot { background: var(--phase-1); }
.cov-phase[data-phase="2"] .cov-item.done .cov-dot { background: var(--phase-2); }
.cov-phase[data-phase="3"] .cov-item.done .cov-dot { background: var(--phase-3); }
.cov-item .cov-name { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.cov-item .cov-name small { font-weight: 500; color: var(--ink-muted); margin-left: 0.35rem; }
.cov-item .cov-links { font-size: 0.85rem; margin-top: 0.1rem; }
.cov-item .cov-links a { display: block; }
.cov-item .cov-planned {
  display: inline-block; font-size: 0.75rem; font-weight: 600;
  color: var(--ink-muted); border: 1px dashed var(--baseline);
  border-radius: 999px; padding: 0.08rem 0.6rem; margin-top: 0.15rem;
}

/* --------------------------------------------------------------------------
   Utility
   -------------------------------------------------------------------------- */
.muted { color: var(--ink-muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

@media (max-width: 700px) {
  :root { --gutter: 1rem; }

  html { scroll-padding-top: 7rem; -webkit-text-size-adjust: 100%; }

  .section { padding: 3rem 0; }
  main > .section:first-child { padding-top: 2rem; }
  .section-title { font-size: 1.75rem; }
  .section-lede { margin-bottom: 1.5rem; font-size: 1rem; }

  .nav {
    padding: 0.65rem 1rem 0.5rem; gap: 0.5rem;
    flex-wrap: wrap;
  }
  .brand { width: 100%; font-size: 0.9rem; }
  .nav-links {
    width: 100%; margin-left: 0; gap: 0;
    flex-wrap: nowrap; justify-content: space-between;
  }
  .nav-links a { padding: 0.35rem 0.25rem; font-size: 0.76rem; }
  .theme-toggle { width: 26px; height: 26px; margin-left: 0.2rem; }

  .hero { padding: 2rem 0 2.5rem; }
  .hero-grid { gap: 2rem; }
  .hero h1 { font-size: 2.45rem; }
  .hero .lede { font-size: 1.05rem; }

  .card-grid,
  .cov-grid { grid-template-columns: minmax(0, 1fr); }
  .card,
  .viz,
  .dossier,
  .vs-card { padding: 1rem; }
  .chip {
    max-width: 100%; white-space: normal; line-height: 1.3;
    align-items: flex-start;
  }
  .chip .dot { margin-top: 0.18rem; }
  .stat-tile { padding: 1rem; }
  .stat-tile .value { font-size: 1.65rem; }
  .legend { gap: 0.65rem; }
  .ctl-row { gap: 0.65rem; }
  .ctl-row input[type="range"] { flex-basis: 100%; }
  .phase-filter button { flex: 1 1 auto; }
  .dossier .facts { grid-template-columns: minmax(0, 1fr); }

  .article-header { padding-top: 1.75rem; padding-bottom: 1.25rem; }
  .article-header::after { margin-top: 1.5rem; }
  .article-header h1 {
    font-size: 2.15rem; text-wrap: pretty; overflow-wrap: anywhere;
  }
  .article-header .dek { font-size: 1.08rem; }
  .article-header .byline { gap: 0.35rem 0.65rem; }
  .article-header .byline .sep { display: none; }
  .article-body {
    padding-top: 0; padding-bottom: 2.5rem;
    font-size: 1.05rem; line-height: 1.72; overflow-wrap: break-word;
  }
  .article-body h2 {
    margin-top: 2.1em; padding-top: 0.7em;
    font-size: 1.5rem; scroll-margin-top: 8rem;
  }
  .article-body h3 { font-size: 1.24rem; }
  .article-body figure { margin: 1.5em 0; }
  .article-body figure .fig-frame { padding: 0.65rem; }
  .article-body figcaption { text-align: left; }
  .article-body pre { padding: 0.8rem; font-size: 0.74rem; }
  .article-body ul,
  .article-body ol { padding-left: 1.2em; }
  .reader-toc { margin-bottom: 1.25rem; padding: 0.9rem 1rem; }
  .reader-toc ol { margin-right: -1rem; padding-right: 1rem; }
  .canonical-note { margin-top: 1.5rem; }
  .article-nav { flex-direction: column; gap: 1.5rem; padding-top: 1.5rem; padding-bottom: 3rem; }
  .article-nav a {
    max-width: 100%; margin-left: 0 !important; text-align: left !important;
  }

  .paper-hero { padding: 2rem 0 1.75rem; }
  .paper-hero h1 { font-size: 2.2rem; text-wrap: pretty; overflow-wrap: anywhere; }
  .paper-hero .section-lede { font-size: 1.02rem; }
  .paper-metrics { align-items: flex-start; gap: 0.65rem 1rem; }
  .paper-metrics span { flex: 1 1 8rem; }
  .paper-metrics a { width: 100%; margin-left: 0; }
  .paper-reading { padding-top: 2.25rem; }
  .paper-layout { row-gap: 1.75rem; }
  .paper-index nav { margin-right: -1rem; padding-right: 1rem; }
  .paper-manuscript,
  .paper-status { font-size: 1.05rem; line-height: 1.72; }
  .paper-section { scroll-margin-top: 8rem; }
  .paper-section + .paper-section { margin-top: 1.9rem; padding-top: 1.9rem; }
  .paper-section h2,
  .paper-status h2 { font-size: 1.5rem; }
  .paper-equation { margin: 1.4rem 0; padding: 0.75rem; font-size: 0.9rem; }

  .cov-mini { align-items: flex-start; gap: 0.65rem; }
  .cov-mini-bar { max-width: 100%; overflow-x: auto; padding-bottom: 0.2rem; }
  .cov-phase > h3 { line-height: 1.35; }
  .cov-item > div { min-width: 0; }
  .cov-item .cov-links,
  .cov-item .cov-name { overflow-wrap: anywhere; }

  .site-footer { padding: 2rem 0 2.5rem; }
  .site-footer .container { align-items: flex-start; flex-direction: column; }
  .site-footer a:first-child { margin-left: 0; }
}

@media (max-width: 360px) {
  .brand small { display: none; }
  .nav-links a { font-size: 0.72rem; }
  .hero h1 { font-size: 2.15rem; }
  .stat-row { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
