/* TokenEconomizer project page.
 *
 * One stylesheet, no framework. Colours are tokens on :root; dark mode redefines them
 * (following the system unless the reader picks a theme, which sets data-theme on <html>).
 * The accent blue and the three meta-strategy hues are the paper's figure colours.
 */

:root {
  --bg: #f5f7fa;
  --bg-hero: #edf2f8;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --ink: #132031;
  --ink-2: #384556;
  --muted: #5d6978;
  --rule: #d9e0e8;
  --rule-strong: #c3ccd6;
  --accent: #285e9f;
  --accent-ink: #1f4f8a;
  --accent-soft: #e5edf7;
  --good: #2b7149;
  --good-soft: #e3f1e8;
  --costlier: #f6eee8;
  --s1: #3e73a8;
  --s1-soft: #e6eef7;
  --s2: #a86c0c;
  --s2-soft: #f8eedb;
  --s3: #b84843;
  --s3-soft: #f8e5e3;
  --figure-bg: #ffffff;
  --code-bg: #f3f5f8;
  --out: #6b7684;
  --shadow: 0 1px 2px rgba(19, 32, 49, .05), 0 6px 24px rgba(19, 32, 49, .06);
  --dot: rgba(40, 94, 159, .13);

  /* chart marks: validated with the dataviz palette checker (light, on #ffffff) */
  --m-te: #285e9f;
  --m-te-rtk: #0d9298;
  --m-te-repomap: #72b875;
  --m-effort: #d8714c;
  --m-rtk: #6e767e;
  --m-serena: #959ca3;
  --m-repomap: #b8bec4;
  --hi-col: rgba(40, 94, 159, .13);
  --chart-grid: #e6eaef;
  --chart-axis: #a9b2bd;
  --r-django: #df9843;
  --r-matplotlib: #3366a8;
  --r-sklearn: #b03e7a;
  --r-sphinx: #7b4a2e;
  --r-sympy: #8a5fa3;
  --r-xarray: #3e8f56;

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 10px;
  --wrap: 1120px;
  --prose: 720px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e141b;
    --bg-hero: #111a24;
    --surface: #151e29;
    --surface-2: #1b2532;
    --ink: #e6ebf1;
    --ink-2: #c3ccd6;
    --muted: #94a0ad;
    --rule: #263241;
    --rule-strong: #364456;
    --accent: #7aaae6;
    --accent-ink: #8db7ec;
    --accent-soft: #1a2a3e;
    --good: #6cc592;
    --good-soft: #17301f;
    --costlier: #221d1b;
    --s1: #78a4dc;
    --s1-soft: #1a2a3e;
    --s2: #dca553;
    --s2-soft: #33270f;
    --s3: #e7837d;
    --s3-soft: #3a1e1c;
    --figure-bg: #f4f6f9;
    --code-bg: #111923;
    --out: #8995a3;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .28);
    --dot: rgba(122, 170, 230, .10);
    --m-te: #5c8ae1;
    --m-te-rtk: #14938d;
    --m-te-repomap: #769c03;
    --m-effort: #b44d34;
    --m-rtk: #aab2ba;
    --m-serena: #7f8892;
    --m-repomap: #5c6670;
    --hi-col: rgba(122, 170, 230, .17);
    --chart-grid: #222d3a;
    --chart-axis: #4a5869;
    --r-django: #f2b262;
    --r-matplotlib: #6f9de3;
    --r-sklearn: #db6fa6;
    --r-sphinx: #a8775f;
    --r-sympy: #b094d6;
    --r-xarray: #5fbb7d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e141b;
  --bg-hero: #111a24;
  --surface: #151e29;
  --surface-2: #1b2532;
  --ink: #e6ebf1;
  --ink-2: #c3ccd6;
  --muted: #94a0ad;
  --rule: #263241;
  --rule-strong: #364456;
  --accent: #7aaae6;
  --accent-ink: #8db7ec;
  --accent-soft: #1a2a3e;
  --good: #6cc592;
  --good-soft: #17301f;
  --costlier: #221d1b;
  --s1: #78a4dc;
  --s1-soft: #1a2a3e;
  --s2: #dca553;
  --s2-soft: #33270f;
  --s3: #e7837d;
  --s3-soft: #3a1e1c;
  --figure-bg: #f4f6f9;
  --code-bg: #111923;
  --out: #8995a3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .28);
  --dot: rgba(122, 170, 230, .10);
  --m-te: #5c8ae1;
  --m-te-rtk: #14938d;
  --m-te-repomap: #769c03;
  --m-effort: #b44d34;
  --m-rtk: #aab2ba;
  --m-serena: #7f8892;
  --m-repomap: #5c6670;
  --hi-col: rgba(122, 170, 230, .17);
  --chart-grid: #222d3a;
  --chart-axis: #4a5869;
  --r-django: #f2b262;
  --r-matplotlib: #6f9de3;
  --r-sklearn: #db6fa6;
  --r-sphinx: #a8775f;
  --r-sympy: #b094d6;
  --r-xarray: #5fbb7d;
  color-scheme: dark;
}

/* ---- base ------------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 24px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.65 var(--font-sans);
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
p { margin: 0 0 1em; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -.015em; }
code, kbd, .mono { font-family: var(--font-mono); font-size: .88em; }
.num { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -80px; z-index: 50; padding: 8px 14px;
  background: var(--surface); color: var(--ink); border-radius: 6px;
}
.skip:focus { top: 12px; box-shadow: var(--shadow); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.prose { max-width: var(--prose); }
.prose p { color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }

/* reading progress, a hairline at the very top */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 40; pointer-events: none;
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
}

/* ---- hero ------------------------------------------------------------------------------ */
.hero {
  position: relative;
  background: var(--bg-hero);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}
.hero::before {
  /* a faint ledger grid of dots, fading out towards the bottom right */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(160deg, #000 20%, transparent 75%);
  mask-image: linear-gradient(160deg, #000 20%, transparent 75%);
}
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 40px;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 64px;
}
.topline {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: relative; padding-top: 22px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.brand svg { width: 22px; height: 22px; }
.topline-right { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--surface);
  color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--rule-strong); }
.icon-btn svg { width: 18px; height: 18px; }

.kicker {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px;
  color: var(--accent-ink); font-size: 14px; font-weight: 500;
}
.kicker .pill {
  padding: 2px 9px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent-ink); font-size: 13px; font-weight: 600;
}
.hero h1 { font-size: clamp(40px, 6.4vw, 64px); line-height: 1.02; letter-spacing: -.03em; font-weight: 700; }
.hero h1 .w2 { color: var(--accent); }
.hero .subtitle {
  margin: 14px 0 0; max-width: 34ch; color: var(--ink-2);
  font-size: clamp(19px, 2.3vw, 23px); line-height: 1.35; font-weight: 400; letter-spacing: -.01em;
}

/* Authors in two fixed rows (5 + 6 names) wherever they fit; on narrow screens the rows flow
   together and balance, so no name is left alone on a line. */
.authors { margin: 30px 0 0; font-size: 15.5px; line-height: 1.75; color: var(--ink); text-wrap: balance; }
.authors .au { display: inline-block; margin-right: 10px; white-space: nowrap; }
.authors .au:last-child { margin-right: 0; }
@media (min-width: 720px) { .authors .au-row { display: block; white-space: nowrap; } }
.authors sup { color: var(--muted); font-size: 11px; margin-left: 1px; }
.affils { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--muted); font-size: 14.5px; }
.affils sup { font-size: 10px; margin-right: 2px; }
.note { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
.note a { color: inherit; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px;
  border-radius: 9px; border: 1px solid var(--rule-strong); background: var(--surface);
  color: var(--ink); font: 500 15px/1 var(--font-sans); text-decoration: none; cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { border-color: var(--ink-2); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary:hover { border-color: var(--ink); }
.btn[aria-disabled="true"] { cursor: default; color: var(--ink-2); background: transparent; border-color: var(--rule-strong); border-style: dashed; box-shadow: none; transform: none; }

.logos { display: flex; align-items: center; gap: 26px; margin-top: 30px; }
.logos img { height: 26px; width: auto; }
.logos .ms { height: 22px; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

/* ---- at a glance: the hero's one-picture summary ----------------------------------- */
.glance { padding: 22px 22px 20px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--rule); }
.gl-title { margin: 0 0 6px; font: 600 12px/1 var(--font-mono); letter-spacing: .08em; color: var(--ink); }
.gl-loop { width: 100%; height: auto; margin: 2px 0 10px; font-family: var(--font-sans); }
.gl-box { fill: var(--surface-2); stroke: var(--rule-strong); stroke-width: 1.2; }
.gl-box-te { fill: var(--accent-soft); stroke: var(--accent); }
.gl-name { font-size: 13px; font-weight: 600; fill: var(--ink); }
.gl-name-te { fill: var(--accent-ink); font-size: 12px; }
.gl-sub { font-size: 10.5px; fill: var(--muted); }
.gl-lab { font-size: 10.5px; fill: var(--muted); }
.gl-lab-te { fill: var(--accent-ink); }
.gl-path { fill: none; stroke: var(--rule-strong); stroke-width: 1.6; stroke-dasharray: 4 4; }
.gl-path-te { stroke: var(--accent); }
.gl-arrowhead { fill: var(--muted); }
.gl-levers { list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px dashed var(--rule-strong); display: grid; gap: 10px; }
.gl-levers li { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.gl-levers .ix { width: 22px; height: 22px; font-size: 12px; margin-top: 1px; }
.gl-levers b { color: var(--ink); font-weight: 600; }
.gl-foot { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--rule-strong); font-size: 13px; line-height: 1.5; color: var(--muted); }

/* ---- side rail: the contents, shown when there is room ------------------------------- */
.rail {
  position: fixed; top: 50%; left: max(16px, calc((100vw - var(--wrap)) / 2 - 190px));
  transform: translateY(-50%); z-index: 20; width: 160px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.rail.on { opacity: 1; pointer-events: auto; }
.rail ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.rail a {
  display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent;
  color: var(--muted); font-size: 13.5px; text-decoration: none; line-height: 1.35;
}
.rail a:hover { color: var(--ink); }
.rail a.active { color: var(--ink); border-left-color: var(--accent); font-weight: 500; }
@media (max-width: 1499px) { .rail { display: none; } }

/* ---- sections ---------------------------------------------------------------------- */
section { padding: 88px 0 0; }
section:last-of-type { padding-bottom: 96px; }
.eyebrow {
  display: flex; align-items: center; gap: 10px; margin: 0 0 12px;
  color: var(--accent-ink); font-size: 14.5px; font-weight: 600;
}
.eyebrow .n {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px;
  border-radius: 6px; background: var(--accent-soft); font-size: 12.5px; font-variant-numeric: tabular-nums;
}
h2 { font-size: clamp(27px, 3.4vw, 36px); max-width: 28ch; margin-bottom: 18px; }
h3 { font-size: 21px; margin-bottom: 10px; }
h4 { font-size: 16px; margin-bottom: 6px; }
.lede { font-size: 19px; line-height: 1.6; color: var(--ink-2); }

/* key numbers */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 8px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.stat { padding: 22px 22px 20px; border-left: 1px solid var(--rule); }
.stat:first-child { border-left: 0; }
.stat .v { display: block; font-size: 34px; font-weight: 600; letter-spacing: -.03em; line-height: 1.05; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 20px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat .k { display: block; margin-top: 8px; font-size: 14.5px; line-height: 1.5; color: var(--muted); }
.stat.lead .v { color: var(--accent); }

.abstract {
  margin-top: 40px; padding: 26px 30px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--rule);
}
.abstract h3 { font-size: 15px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.abstract p { margin: 0; color: var(--ink-2); font-size: 16.5px; line-height: 1.7; }
.abstract p + p { margin-top: 12px; }

/* figures */
figure { margin: 0; }
.fig {
  margin: 36px 0 0; padding: 22px; border-radius: var(--radius);
  background: var(--figure-bg); border: 1px solid var(--rule);
}
.fig img { margin: 0 auto; }
.fig.zoomable img { cursor: zoom-in; }
figcaption, .caption { margin-top: 14px; color: var(--muted); font-size: 14.5px; line-height: 1.55; max-width: 80ch; }
figcaption b, .caption b { color: var(--ink); font-weight: 600; }
.fig figcaption { color: #5d6978; }
.fig figcaption b { color: #132031; }
.panel {
  margin: 36px 0 0; padding: 26px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--rule);
}
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 15px; max-width: 62ch; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.two-col.wide-left { grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); }

/* ---- charts ------------------------------------------------------------------------ */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; font-family: var(--font-sans); font-size: 12px; }
.chart .grid line { stroke: var(--chart-grid); }
.chart .zero { stroke: var(--chart-axis); stroke-width: 1.2; }
.chart .wash { fill: var(--costlier); }
.chart .hit { fill: transparent; cursor: default; }
.chart .dim { opacity: .18; transition: opacity .2s; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 13.5px; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend svg { width: 14px; height: 14px; }
.legend button { all: unset; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; border-radius: 4px; }
.legend button[aria-pressed="false"] { opacity: .4; }
.focus-legend button[aria-pressed="false"] { opacity: 1; }
.focus-legend.has-focus button[aria-pressed="false"] { opacity: .4; }
.legend button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); cursor: pointer;
  font: 500 13px/1 var(--font-sans); padding: 8px 11px; border-radius: 999px;
}
.chip:hover { border-color: var(--rule-strong); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip small { color: inherit; opacity: .7; font-weight: 400; }

.tooltip {
  position: fixed; z-index: 60; pointer-events: none; max-width: 280px;
  padding: 9px 11px; border-radius: 8px; background: var(--ink); color: var(--bg);
  font-size: 13px; line-height: 1.45; box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.tooltip.on { opacity: 1; transform: none; }
.tooltip b { font-weight: 600; }
.tooltip .tt-sw { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.tooltip .tt-v { font-variant-numeric: tabular-nums; font-weight: 600; }

details.data { margin-top: 14px; font-size: 14px; color: var(--muted); }
details.data summary { cursor: pointer; width: max-content; }
details.data summary:hover { color: var(--ink); }
details.data .table-scroll { margin-top: 10px; }

/* ---- tables ------------------------------------------------------------------------ */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.t th, table.t td { padding: 9px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); }
table.t th:first-child, table.t td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.t thead th { color: var(--muted); font-weight: 500; font-size: 13px; vertical-align: bottom; }
table.t thead tr.grp th { color: var(--ink); font-weight: 600; font-size: 13.5px; text-align: center; border-bottom: 0; padding-bottom: 2px; }
table.t thead tr.grp th span { display: block; border-bottom: 1.5px solid var(--rule-strong); padding-bottom: 6px; }
table.t tbody tr:hover td { background: var(--surface-2); }
table.t tbody tr.te td { background: var(--accent-soft); }
table.t tbody tr.te td:first-child { font-weight: 600; color: var(--ink); }
table.t tbody tr.sep td { border-top: 1.5px solid var(--rule-strong); }
table.t td.muted { color: var(--muted); }
table.t .lbl-short { display: none; }
table.t td .sd { color: var(--muted); font-size: 11.5px; margin-left: 2px; }
table.t td.best { font-weight: 700; color: var(--ink); }
table.t td.greyed { color: var(--muted); opacity: .75; }
/* a highlighted setting: its two columns are tinted and outlined, the others fade back */
table.t th[data-col], table.t td[data-col] { transition: opacity .2s, background-color .2s; }
table.t.has-hi td[data-col]:not(.col-hi), table.t.has-hi th[data-col]:not(.col-hi) { opacity: .35; }
table.t td.col-hi, table.t th.col-hi { background: var(--hi-col) !important; opacity: 1; }
table.t thead th.col-hi { color: var(--accent-ink); }
table.t thead tr.grp th.col-hi span { border-bottom-color: var(--accent); }
.cell-bar { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.cell-bar .b { position: relative; width: 46px; height: 6px; border-radius: 3px; background: var(--surface-2); }
.cell-bar .b i { position: absolute; top: 0; bottom: 0; right: 50%; border-radius: 3px; background: var(--m-te); }
.cell-bar .b i.up { right: auto; left: 50%; background: var(--m-effort); }
.cell-bar .b::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--chart-axis); }

/* ---- motivation: three kinds of recurring waste ----------------------------------- */
.waste-title { margin: 52px 0 6px; font-size: 22px; }
.waste-lede { margin: 0; max-width: var(--prose); color: var(--ink-2); }
.waste { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.w { display: flex; flex-direction: column; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); }
.w h4 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 17px; }
.w p { margin: 0 0 16px; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.w p b { color: var(--ink); font-weight: 600; }
.w .fix { margin: auto 0 0; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 14.5px; }
.w.s1 .fix b { color: var(--s1); }
.w.s2 .fix b { color: var(--s2); }
.w.s3 .fix b { color: var(--s3); }
.why-adapt {
  margin: 18px 0 0; padding: 16px 20px; border-radius: var(--radius); background: var(--accent-soft);
  color: var(--ink-2); font-size: 15.5px; line-height: 1.6;
}
.why-adapt b { color: var(--ink); font-weight: 600; }

/* ---- motivation: the fixed strategies, one panel each beside the pilot chart -------- */
.fixed {
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 32px; align-items: start;
  margin-top: 22px; padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule);
}
.fx-list { border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
details.fx + details.fx { border-top: 1px solid var(--rule); }
details.fx > summary {
  list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  padding: 13px 16px; font-size: 14px; color: var(--muted);
}
details.fx > summary::-webkit-details-marker { display: none; }
details.fx > summary::before {
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 2px 2px 0;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); transition: transform .2s;
}
details.fx[open] > summary::before { transform: rotate(45deg); }
details.fx > summary:hover, details.fx[open] > summary { background: var(--surface-2); }
.fx-mk svg { width: 14px; height: 14px; }
.fx-name { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.fx-body { padding: 12px 16px 16px 37px; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.fx-body p { margin: 0 0 10px; }
.fx-res b { color: var(--ink); font-weight: 600; }
.fx-res .up { color: var(--s3); }
.fx-res .down { color: var(--good); }
.fx-body a { font-size: 13.5px; }
.fixed .why-adapt { font-size: 15px; }
.fixed .legend { margin-bottom: 6px; }

/* numbered discs in the strategy colours */
.ix {
  flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  color: #fff; font-weight: 600; font-size: 14px; line-height: 1; background: var(--accent);
}
.s1 .ix { background: var(--s1); }
.s2 .ix { background: var(--s2); }
.s3 .ix { background: var(--s3); }

/* ---- method overview: the controller, what it sets in the agent, and the learning loop ---- */
.ov { margin: 36px 0 0; padding: 26px 26px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); }
.ov-grid { display: grid; grid-template-columns: minmax(0, .8fr) 52px minmax(0, 1.2fr); gap: 14px 0; align-items: center; }
.ov-head { display: flex; flex-direction: column; gap: 2px; padding-bottom: 4px; align-self: start; }
.ov-kicker { font: 600 11.5px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ov-head b { font-size: 17px; color: var(--ink); }
.ov-head small { font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.ov-card { padding: 14px 16px; border-radius: 10px; border: 1.5px solid var(--rule-strong); background: var(--surface); height: 100%; }
.ov-card h4 { display: flex; align-items: center; gap: 9px; margin: 0 0 6px; font-size: 15.5px; }
.ov-card .ix { width: 24px; height: 24px; font-size: 12.5px; }
.ov-card p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.ov-card.s1 { border-color: var(--s1); }
.ov-card.s2 { border-color: var(--s2); }
.ov-card.s3 { border-color: var(--s3); }
.ov-arrow { --c: var(--rule-strong); position: relative; height: 2px; margin: 0 8px; background: var(--c); }
.ov-arrow::after { content: ""; position: absolute; right: -2px; top: -5px; border: 6px solid transparent; border-left: 9px solid var(--c); border-right: 0; }
.ov-arrow.s1 { --c: var(--s1); }
.ov-arrow.s2 { --c: var(--s2); }
.ov-arrow.s3 { --c: var(--s3); }
.ov-row { padding: 12px 16px 14px; border-radius: 10px; background: var(--surface-2); height: 100%; }
.ov-row-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 10px; font-size: 14px; color: var(--ink-2); }
.ov-row-head b { color: var(--ink); letter-spacing: .02em; }
.ov-when { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.ov-row.s1 .ov-when { color: var(--s1); background: var(--s1-soft); }
.ov-row.s2 .ov-when { color: var(--s2); background: var(--s2-soft); }
.ov-row.s3 .ov-when { color: var(--s3); background: var(--s3-soft); }
.ov-prefix { display: grid; grid-template-columns: 1.15fr 1fr .75fr; border: 1px solid var(--rule-strong); border-radius: 6px; overflow: hidden; font-size: 12.5px; }
.ov-prefix > span { padding: 7px 8px; text-align: center; color: var(--muted); background: var(--surface); }
.ov-prefix > span + span { border-left: 1px solid var(--rule-strong); }
.ov-prefix .hl { color: var(--s1); font-weight: 600; background: var(--s1-soft); box-shadow: inset 0 0 0 1.5px var(--s1); }
.ov-note { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.ov-chips, .ov-roll { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; }
.ov .t { display: inline-block; padding: 4px 8px; border-radius: 5px; font: 500 12px/1.2 var(--font-mono); border: 1px solid var(--rule-strong); color: var(--ink); background: var(--surface); }
.ov .t.core { background: var(--s2-soft); border-color: var(--s2); }
.ov .t.off { color: var(--muted); border-style: dashed; text-decoration: line-through; opacity: .75; background: transparent; }
.ov-off { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-left: 6px; border-left: 1px dashed var(--rule-strong); }
.ov-off em, .ov-grp em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.ov-grp { display: inline-grid; grid-auto-flow: column; gap: 4px; justify-items: center; }
.ov-grp em { grid-row: 2; grid-column: 1 / span 2; }
.ov .t.fail { border-color: var(--s3); background: var(--s3-soft); }
.ov .t.act { background: var(--s3); border-color: var(--s3); color: #fff; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.ov .t.act.outline { background: transparent; color: var(--s3); border-width: 1.5px; }
.ov-dots { padding: 4px 0; color: var(--muted); font-size: 13px; }
.ov-loop { grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-start; margin-top: 4px; padding: 12px 16px; border-radius: 10px; border: 1px dashed var(--rule-strong); font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.ov-loop svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--accent); }
.ov-loop b { color: var(--ink); }
.ov figcaption { margin-top: 14px; }

/* ---- method: the three meta-strategies ---------------------------------------------- */
.eq {
  margin: 22px 0; padding: 16px 20px; border-radius: 8px; background: var(--surface);
  border: 1px solid var(--rule); overflow-x: auto; color: var(--ink);
}
.eq .katex { font-size: 1.12em; }
.eq-note { margin: -10px 0 0; font-size: 14.5px; color: var(--muted); }

.strategies3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 36px; }
.sc { padding: 22px 22px 6px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); border-top: 3px solid var(--rule-strong); min-width: 0; }
.sc.s1 { border-top-color: var(--s1); }
.sc.s2 { border-top-color: var(--s2); }
.sc.s3 { border-top-color: var(--s3); }
.sc header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.sc header h3 { margin: 0; font-size: 18px; }
.sc header small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.sc .sp-eq { font-size: 14px; }
/* a parameter and the value used in the experiments */
.pv {
  display: inline-block; margin-left: 2px; padding: 0 7px; border-radius: 5px; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink); font-size: 13.5px; line-height: 1.6;
}
.s1 .pv { background: var(--s1-soft); border-color: transparent; }
.s2 .pv { background: var(--s2-soft); border-color: transparent; }
.s3 .pv { background: var(--s3-soft); border-color: transparent; }
.params-note { margin: 16px 0 0; max-width: 92ch; font-size: 14.5px; line-height: 1.6; color: var(--muted); }
.sc .katex { white-space: nowrap; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { position: relative; padding: 0 0 18px 30px; }
.steps li::before {
  content: ""; position: absolute; left: 7px; top: 22px; bottom: 0; width: 2px; background: var(--rule);
}
.steps li:last-child::before { display: none; }
.steps li::after {
  content: ""; position: absolute; left: 2px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--accent); background: var(--surface);
}
.s1 .steps li::after { border-color: var(--s1); }
.s2 .steps li::after { border-color: var(--s2); }
.s3 .steps li::after { border-color: var(--s3); }
.steps h4 { margin: 0 0 3px; font-size: 15.5px; }
.steps p { margin: 0; font-size: 15px; color: var(--ink-2); line-height: 1.6; }
.sp-eq { margin: 4px 0 0; padding: 10px 14px; border-radius: 7px; background: var(--surface-2); overflow-x: auto; font-size: 15px; }
.sp-eq .katex, .eq .katex { white-space: nowrap; }
.sp-eq .katex-display { margin: 0; text-align: left; }
.sp-eq .katex-display > .katex { text-align: left; }

/* example from the appendix: default against TokenEconomizer */
.example-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 14px; margin-bottom: 12px; }
.example-head h4 { margin: 0; font-size: 15px; }
.example-head .meta { color: var(--muted); font-size: 13px; font-family: var(--font-mono); }
.skillbox {
  margin: 0 0 14px; padding: 11px 14px; border-radius: 7px; border-left: 3px solid var(--s1);
  background: var(--s1-soft); font: 12.5px/1.6 var(--font-mono); color: var(--ink);
}
.skillbox .tag { display: block; font: 600 11.5px/1 var(--font-sans); color: var(--s1); margin-bottom: 6px; letter-spacing: .02em; }
.traces { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.trace { border-radius: 8px; border: 1px solid var(--rule); background: var(--code-bg); overflow: hidden; }
.trace header {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--rule); font-size: 13px; color: var(--ink-2); background: var(--surface);
}
.trace header b { font-weight: 600; color: var(--ink); }
.trace header .turns { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.trace.te header { border-bottom-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.trace.te header .turns { color: var(--accent-ink); font-weight: 600; }
.trace pre {
  margin: 0; padding: 10px 12px 12px; font: 12px/1.65 var(--font-mono); color: var(--ink);
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
}
.trace .ln { display: block; padding-left: 1.4em; text-indent: -1.4em; }
.trace .ln.out { color: var(--out); padding-left: 2.4em; }
.trace .ln.note { color: var(--out); font-style: italic; }
.trace .ln.redirect { color: var(--s3); font-weight: 600; }
.trace .ln.stop { color: var(--s3); font-weight: 600; }
.trace .ln.ok { color: var(--good); }
.trace .ln.bad { color: var(--s3); }
.trace.playing .ln { opacity: 0; transform: translateY(3px); }
.trace .ln.shown { opacity: 1; transform: none; transition: opacity .3s, transform .3s; }
.replay { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--accent-ink); }
.replay svg { flex: none; width: 14px; height: 14px; }
.replay:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* tool pruning example */
.toolgrid { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.tool {
  font: 500 11.5px/1 var(--font-mono); padding: 6px 8px; border-radius: 5px;
  border: 1px solid var(--s2); color: var(--ink); background: var(--s2-soft);
  transition: opacity .35s, background .35s, color .35s, border-color .35s;
}
.tool.core { border-width: 1.5px; }
.tool.masked { opacity: .55; background: transparent; color: var(--muted); border-color: var(--rule-strong); border-style: dashed; text-decoration: line-through; text-decoration-color: var(--muted); }
.taskbar { display: grid; grid-template-columns: 88px minmax(0, 1fr) 128px; gap: 10px; align-items: center; margin: 8px 0; font-size: 13px; }
.taskbar .tn { color: var(--ink-2); }
.taskbar .tn small { display: block; color: var(--muted); font: 11px/1.3 var(--font-mono); }
.taskbar .bars { position: relative; height: 22px; }
.taskbar .bars i { position: absolute; left: 0; height: 9px; border-radius: 3px; transition: width .6s cubic-bezier(.2, .7, .2, 1); }
.taskbar .bars .def { top: 0; background: var(--m-rtk); opacity: .45; }
.taskbar .bars .te { top: 12px; background: var(--s2); }
.taskbar .tv { text-align: right; font: 12px/1.35 var(--font-mono); color: var(--ink); }
.taskbar .tv small { display: block; color: var(--muted); }
.taskbar.current .tn { color: var(--ink); font-weight: 600; }
.mini-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.mini-legend i { display: inline-block; width: 14px; height: 7px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }

/* failure loop example: turn strips */
.turnstrip { margin: 6px 0 16px; }
.turnstrip .lab { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.turnstrip .lab b { color: var(--ink); font-weight: 600; }
.turnstrip .cells { display: grid; gap: 2px; }
.turnstrip .cells i { height: 16px; border-radius: 2px; background: var(--rule-strong); opacity: .7; }
.turnstrip .cells i.loop { background: var(--s3); opacity: .45; }
.turnstrip .cells i.after { background: var(--good); opacity: .55; }
.turnstrip .cells i.mark { background: var(--s3); opacity: 1; }
.turnstrip .cells i.budget { box-shadow: inset 0 -3px 0 var(--ink-2); }
.turnstrip .cells i.ghost { background: transparent; border: 1px dashed var(--rule-strong); opacity: 1; }
.turnstrip.has-budget { margin-top: 26px; }
.turnstrip .cells-wrap { position: relative; }
.turnstrip .budget { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.turnstrip .budget-label { position: absolute; top: -19px; font: 11.5px/1 var(--font-mono); color: var(--ink-2); white-space: nowrap; }
.turnstrip .caption { margin: 6px 0 0; font-size: 13px; }
.mini-legend { flex-wrap: wrap; }
.mini-legend .lg-loop { background: var(--s3); opacity: .45; }
.mini-legend .lg-after { background: var(--good); opacity: .55; }
.mini-legend .lg-mark { background: var(--s3); }
.mini-legend .lg-ghost { background: transparent; border: 1px dashed var(--rule-strong); }
.mini-legend .lg-def { background: var(--m-rtk); opacity: .45; }
.mini-legend .lg-te { background: var(--s2); }

/* ---- examples from the paper ------------------------------------------------------- */
.lc { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; margin-top: 30px; }
.lc-list { display: flex; flex-direction: column; gap: 8px; }
.lc-group { margin: 14px 0 0; font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.lc-group:first-child { margin-top: 0; }
.lc-group.s1 { color: var(--s1); }
.lc-group.s2 { color: var(--s2); }
.lc-group.s3 { color: var(--s3); }
.lc-item {
  all: unset; box-sizing: border-box; cursor: pointer; display: block; padding: 13px 15px;
  border-radius: 9px; border: 1px solid var(--rule); background: var(--surface);
}
.lc-item:hover { border-color: var(--rule-strong); }
.lc-item[aria-selected="true"] { border-color: var(--accent); box-shadow: var(--shadow); }
.lc-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lc-item .t { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.lc-item .t span:last-child { font: 400 12px/1.6 var(--font-mono); color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.on { color: var(--good); background: var(--good-soft); }
.badge.off { color: var(--s3); background: var(--s3-soft); }
.badge.held { color: var(--s2); background: var(--s2-soft); }
.badge.cand { color: var(--muted); background: var(--surface-2); }
.lc-detail { padding: 24px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); min-width: 0; }
.lc-detail .detectors { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 4px 12px; margin: 0 0 16px; font: 12px/1.6 var(--font-mono); }
.lc-detail .detectors dt { color: var(--muted); }
.lc-detail .detectors dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0 0 4px; padding: 0; font-size: 14px; }
.timeline li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-top: 1px solid var(--rule); }
.timeline li span:first-child { font: 500 12px/1.9 var(--font-mono); color: var(--muted); }
.timeline li span:last-child { color: var(--ink-2); line-height: 1.55; }
.badge.s2 { color: var(--s2); background: var(--s2-soft); }
.badge.s3 { color: var(--s3); background: var(--s3-soft); }
.ex-h { margin: 20px 0 8px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.ex-h-note { margin-left: 8px; font-size: 12.5px; font-weight: 400; }
.ex-h-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ex-intro { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.ex-result { margin: 10px 0 0; padding: 10px 14px; border-radius: 8px; background: var(--good-soft); color: var(--ink); font-size: 14.5px; line-height: 1.55; }
details.ex-more { margin-top: 16px; font-size: 14px; }
details.ex-more summary { cursor: pointer; color: var(--muted); width: max-content; max-width: 100%; }
details.ex-more summary:hover { color: var(--ink); }
details.ex-more p { margin: 10px 0 10px; color: var(--ink-2); line-height: 1.6; }
.lc-detail .why { margin: 16px 0 0; padding: 12px 14px; border-radius: 8px; background: var(--surface-2); font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }

/* ---- results ---------------------------------------------------------------------- */
.results-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.results-grid .panel { margin: 0; }
.ablation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 44px; }
.abl h4 { font-size: 14px; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.abl-row { display: grid; grid-template-columns: 132px minmax(0, 1fr) 56px 52px; gap: 10px; align-items: center; font-size: 13.5px; margin: 7px 0; }
.abl-row.abl-head { margin: 0 0 2px; font-size: 12px; color: var(--muted); }
.abl-row.abl-head .v { color: var(--muted); }
.abl-row .bar { height: 10px; border-radius: 3px; background: var(--surface-2); position: relative; overflow: hidden; }
.abl-row .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.abl-row .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.abl-row.total { font-weight: 600; }

.explore-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; padding-bottom: 18px; margin-bottom: 4px; border-bottom: 1px solid var(--rule); }
.explore-head h3 { margin: 0 0 4px; font-size: 18px; }
.explore-head p { margin: 0; max-width: 56ch; font-size: 14.5px; color: var(--muted); }
.explore .results-grid { margin-top: 0; gap: 0; grid-template-rows: auto auto auto auto; }
.explore .sub { display: grid; grid-row: span 4; grid-template-rows: subgrid; align-content: start; padding: 22px 0 0; min-width: 0; }
.explore .sub > h3 { margin-bottom: 10px; }
.sub-foot { margin-top: 12px; }
.sub-foot .legend { margin-bottom: 10px; }
.sub-foot .story-bar { margin: 0; }
.explore .sub + .sub { padding-left: 28px; border-left: 1px solid var(--rule); margin-left: 28px; }
.explore .chip[aria-pressed="true"], .table-tools .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.table-tools .chip { padding: 6px 10px; font-size: 12.5px; }

/* ---- generalization ------------------------------------------------------------------ */
.gen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 36px; }
.gcard { padding: 22px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); }
.gcard h3 { font-size: 18px; margin-bottom: 4px; }
.gcard .sub { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; line-height: 1.5; }
.grow { display: grid; grid-template-columns: 90px minmax(0, 1fr) 52px; gap: 8px; align-items: center; font-size: 13.5px; margin: 10px 0 2px; }
.grow .bar { height: 10px; border-radius: 3px; background: var(--surface-2); position: relative; overflow: hidden; }
.grow .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--m-te); border-radius: 3px; }
.grow .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.grow-q { margin: 0 0 8px 98px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.grow-q b { font-weight: 500; color: var(--ink-2); }
.gcard .gfoot { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }

/* ---- expandable panels for the details ---------------------------------------------- */
details.xp { margin-top: 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
details.xp > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
  padding: 15px 20px; font-size: 15.5px; font-weight: 600; color: var(--ink); border-radius: var(--radius);
}
details.xp > summary::-webkit-details-marker { display: none; }
details.xp > summary::before {
  content: ""; flex: none; width: 8px; height: 8px; margin: 0 2px 2px 2px;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); transition: transform .2s;
}
details.xp[open] > summary::before { transform: rotate(45deg); }
details.xp > summary:hover { background: var(--surface-2); }
details.xp[open] > summary { border-bottom: 1px solid var(--rule); border-radius: var(--radius) var(--radius) 0 0; }
.xp-hint { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--muted); }
details.xp[open] .xp-hint { visibility: hidden; }
.xp-body { padding: 20px; }
.xp-body > .prose p { color: var(--ink-2); }
.xp-body .strategies3 { margin-top: 18px; }
.js .xp .strategies3 .steps li { opacity: 1; transform: none; transition: none; }

/* ---- citation, footer ------------------------------------------------ */
.bib { position: relative; margin-top: 18px; border-radius: var(--radius); background: var(--code-bg); border: 1px solid var(--rule); }
.bib pre { margin: 0; padding: 20px 22px; overflow-x: auto; font: 13px/1.7 var(--font-mono); color: var(--ink); }
.bib .copy {
  position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 7px; border: 1px solid var(--rule); background: var(--surface);
  color: var(--ink-2); font: 500 13px/1 var(--font-sans); cursor: pointer;
}
.bib .copy:hover { color: var(--ink); border-color: var(--rule-strong); }
.bib .copy svg { width: 14px; height: 14px; }

footer.site { border-top: 1px solid var(--rule); padding: 28px 0 40px; color: var(--muted); font-size: 14px; }
footer.site .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; }
footer.site a { color: inherit; }

/* image zoom */
dialog.zoom { padding: 0; border: 0; border-radius: 12px; max-width: min(1200px, 94vw); background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
dialog.zoom::backdrop { background: rgba(10, 16, 24, .72); }
dialog.zoom img { max-height: 86vh; width: auto; margin: 0 auto; padding: 20px; }
dialog.zoom button { position: absolute; top: 8px; right: 8px; }

/* ---- motion -------------------------------------------------------------------- */
/* Figure 1(a): turns build up one at a time; what is new on each turn flashes */
.fig-plain { margin: 0; }
.fig-plain figcaption { margin-top: 12px; }
.fig-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.fig-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.fig .replay { color: #1f4f8a; }
.alegend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.alegend li { display: inline-flex; align-items: center; }
.asw { display: inline-block; width: 13px; height: 9px; border-radius: 2px; margin-right: 6px; }
.anatomy .arow { transform-box: fill-box; transform-origin: 0 50%; }
.anatomy.wait .arow { transform: scaleX(0); opacity: 0; }
.anatomy.play .arow { animation: arow-in .55s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i) * .34s); }
.anatomy.play .arow .fresh { animation: fresh-flash 1s ease-out both; animation-delay: calc(var(--i) * .34s + .3s); }
@keyframes arow-in { from { transform: scaleX(0); opacity: .2; } to { transform: none; opacity: 1; } }
@keyframes fresh-flash { 0% { filter: brightness(1.45) saturate(1.3); } 100% { filter: none; } }

/* Figure 3(b): the story reveals one family of methods at a time */
.story-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 0 0 10px; }
.story-cap { margin: 0; min-height: 2.9em; font-size: 14.5px; line-height: 1.45; color: var(--ink); font-weight: 500; }
.story-cap.in { animation: cap-in .45s ease both; }
@keyframes cap-in { from { opacity: 0; transform: translateY(4px); } }
.pt, .star0 { transform-box: fill-box; transform-origin: center; }
.story .pt { opacity: 0; transform: scale(.2); transition: opacity .4s ease, transform .6s cubic-bezier(.3, 1.6, .5, 1); }
.story.g-effort .pt[data-g="effort"], .story.g-fixed .pt[data-g="fixed"], .story.g-te .pt[data-g="te"] { opacity: .95; transform: none; }
.story:not(.g-effort) .star0 { animation: star-pulse 1.1s ease-in-out infinite; }
@keyframes star-pulse { 50% { transform: scale(1.45); } }

/* Figure 3(a): each dot slides out from zero to its value, then the means appear */
.slide-wait .sm { transform: translateX(var(--dx)); opacity: 0; }
.slide-wait .late { opacity: 0; }
.slide-go .sm { transition: transform 1s cubic-bezier(.2, .7, .2, 1) var(--d), opacity .3s ease var(--d); }
.slide-go .late { animation: fade-in .5s ease 1.4s both; }
@keyframes fade-in { from { opacity: 0; } }

/* failure-loop examples: both runs fill in turn by turn, at the same pace */
.turnstrip.fill .cells i { animation: cell-in .22s ease-out both; animation-delay: calc(var(--i) * 60ms); }
@keyframes cell-in { from { opacity: 0; transform: scaleY(.3); } }

/* method cards: the steps of each card come in one after another */
.strategies3 .sc:nth-child(1) { --c: 0s; }
.strategies3 .sc:nth-child(2) { --c: .15s; }
.strategies3 .sc:nth-child(3) { --c: .3s; }
.strategies3 .steps li:nth-child(1) { --s: .1s; }
.strategies3 .steps li:nth-child(2) { --s: .25s; }
.strategies3 .steps li:nth-child(3) { --s: .4s; }
.strategies3 .steps li:nth-child(4) { --s: .55s; }
.js .strategies3 .steps li { opacity: 0; transform: translateY(8px); transition: opacity .5s ease, transform .5s ease; transition-delay: calc(var(--c) + var(--s)); }
.js .strategies3.in .steps li { opacity: 1; transform: none; }

/* the ledger dots of the hero drift very slowly */
.hero::before { animation: drift 60s linear infinite; }
@keyframes drift { to { background-position: 44px 44px; } }

/* bars that grow in */
.abl-row .bar i, .grow .bar i { width: 0; transition: width .9s cubic-bezier(.2, .7, .2, 1); }

/* entrance */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .taskbar .bars i, .tool, .abl-row .bar i, .grow .bar i { transition: none; }
  .hero::before, .anatomy .arow, .anatomy .fresh, .story .pt, .star0, .sm, .late, .turnstrip .cells i { animation: none !important; transition: none !important; }
  .js .strategies3 .steps li { opacity: 1; transform: none; transition: none; }
}

/* ---- responsive ------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-top: 44px; }
  .glance { max-width: 440px; }
}
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-top: 44px; }
  .two-col, .two-col.wide-left, .results-grid, .lc { grid-template-columns: minmax(0, 1fr); }
  .gen, .ablation, .waste, .strategies3, .fixed { grid-template-columns: minmax(0, 1fr); }
  .ov-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .ov-gap { display: none; }
  .ov-head + .ov-gap + .ov-head { margin: 8px 0 14px; }
  .ov-arrow { width: 2px; height: 22px; margin: 0 auto; }
  .ov-arrow::after { right: auto; left: -5px; top: auto; bottom: -2px; border: 6px solid transparent; border-top: 9px solid var(--c); border-bottom: 0; }
  .ov-card, .ov-row { height: auto; }
  .ov-row { margin-bottom: 18px; }
  .ov-loop { margin-top: 0; }
  .explore .sub + .sub { padding-left: 0; margin-left: 0; border-left: 0; border-top: 1px solid var(--rule); margin-top: 22px; }
  .explore-head { position: sticky; top: 3px; z-index: 5; background: var(--surface); padding-top: 12px; }
  .lc-list { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .lc-group { flex: 0 0 100%; margin: 8px 0 0; }
  .lc-item { flex: 0 0 auto; padding: 8px 12px; border-radius: 999px; }
  .lc-item .t { gap: 8px; font-size: 13.5px; }
  .lc-item .badge { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  section { padding-top: 64px; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat { border-left: 0 !important; }
  .stat + .stat { border-top: 1px solid var(--rule); }
  .panel, .sc, .lc-detail, .fixed { padding: 18px; }
  .fig { padding: 14px; }
  .abstract { padding: 20px; }
  .taskbar { grid-template-columns: 70px minmax(0, 1fr) 96px; }
  .abl-row { grid-template-columns: 108px minmax(0, 1fr) 50px 46px; gap: 8px; }
  .lc-detail .detectors, .timeline li { grid-template-columns: 76px minmax(0, 1fr); }
  table.t .lbl-full { display: none; }
  table.t .lbl-short { display: inline; }
}
