:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1b1f24;
  --ink-2: #4a525c;
  --ink-3: #7a838e;
  --rule: #e4e1da;
  --accent: #0b6fb8;          /* the fine-tuned blue from the paper's plots */
  --accent-ink: #ffffff;
  --accent-soft: #e6f0f8;
  --chip: #f0eee9;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .05);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --w: 940px;
  --w-wide: 1140px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418; --surface: #181c21; --ink: #e8e6e1; --ink-2: #b3b8bf; --ink-3: #858c95;
    --rule: #2a3038; --accent: #5aa9e6; --accent-ink: #0b1620; --accent-soft: #16283a; --chip: #20252c;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111418; --surface: #181c21; --ink: #e8e6e1; --ink-2: #b3b8bf; --ink-3: #858c95;
  --rule: #2a3038; --accent: #5aa9e6; --accent-ink: #0b1620; --accent-soft: #16283a; --chip: #20252c;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
img, video { display: block; max-width: 100%; }
.wrap      { max-width: var(--w);      margin-inline: auto; padding-inline: 16px; }
.wrap-wide { max-width: var(--w-wide); margin-inline: auto; padding-inline: 16px; }

/* ---------------------------------------------------------------- masthead */
.masthead { text-align: center; padding-top: 72px; padding-bottom: 8px; }
h1 {
  font: 500 clamp(30px, 4.6vw, 46px)/1.12 var(--serif); letter-spacing: -.015em;
  margin: 0 auto; max-width: 1100px; text-wrap: balance;
}
.authors { font-size: 18px; margin: 28px 0 2px; }
.authors a { color: var(--ink); text-decoration-color: var(--rule); }
.authors a:hover { text-decoration-color: var(--accent); }
.affil { color: var(--ink-2); font-size: 15px; margin: 0; }

.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 26px 0 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font: 500 15px/1 var(--sans); text-decoration: none;
  transition: transform .15s, opacity .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.btn[aria-disabled="true"] { background: var(--chip); color: var(--ink-3); pointer-events: none; }

/* ---------------------------------------------------------------- hero */
.hero { margin-top: 36px; margin-bottom: 0; }
.hero video { width: 100%; border-radius: 14px; box-shadow: var(--shadow); aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.hero .yt { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); background: #000; }
.hero .yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.hero figcaption { text-align: center; }


.toc {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px;
  margin-top: 36px; padding-block: 14px; border-block: 1px solid var(--rule);
  font-size: 14px;
}
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--accent); }

/* ---------------------------------------------------------------- sections */
section { padding-top: 64px; }
.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.sec-num { font: 500 14px/1 var(--mono); color: var(--accent); }
h2 { font: 500 34px/1.15 var(--serif); letter-spacing: -.01em; margin: 0; }
.sub-head { margin-top: 44px; }
h3 { font: 500 24px/1.25 var(--serif); margin: 0 0 8px; }
h4 { font: 600 15px/1.3 var(--sans); margin: 22px 0 6px; }
.prose p { margin: 0 0 14px; }
.prose p:last-child { margin-bottom: 0; }
.eq {
  font-size: 15px; text-align: center;
  padding: 4px 10px; background: var(--chip); border-radius: 8px; overflow-x: auto;
}

figure { margin: 28px auto; }
figure img, figure video { width: 100%; border-radius: 10px; }
figure video { background: #000; }
figure.plain img { background: #fff; padding: 12px; border: 1px solid var(--rule); }
figcaption { font-size: 14px; line-height: 1.5; color: var(--ink-2); margin-top: 10px; }
figcaption b { color: var(--ink); }


.split { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; margin-top: 12px; }
.split > * { min-width: 0; }
.split figure { margin: 0; }
.eq .katex-display { margin: .6em 0; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; gap: 20px; } }

/* ---------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; margin: 6px 0 4px; }
caption { caption-side: bottom; text-align: left; font-size: 13px; color: var(--ink-2); padding-top: 8px; line-height: 1.45; }
th, td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; font-size: 13px; color: var(--ink-2); border-bottom-color: var(--ink-3); }
td small { color: var(--ink-3); font-size: 12px; }

/* ---------------------------------------------------------------- players (tabs + chips + one video) */
.player { margin-top: 26px; }
.picker { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 12px; overflow-x: auto; }
.picker button {
  appearance: none; background: none; border: 0; cursor: pointer; white-space: nowrap;
  font: 500 15px/1 var(--sans); color: var(--ink-3);
  padding: 10px 12px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.picker button:hover { color: var(--ink); }
.picker button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chips[hidden] { display: none; }
.chips button {
  appearance: none; cursor: pointer; border: 1px solid var(--rule); background: var(--surface);
  font: 500 14px/1 var(--sans); color: var(--ink-2); padding: 8px 13px; border-radius: 999px;
  transition: background .15s, color .15s, border-color .15s;
}
.chips button:hover { border-color: var(--ink-3); color: var(--ink); }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.player figure { margin: 0; }
.player video { box-shadow: var(--shadow); }
.player figcaption { min-height: 3em; }

.compare-labels { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 6px; }
.compare-labels span { font: 600 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); text-align: center; }
.compare-labels span:last-child { color: var(--accent); }

/* ---------------------------------------------------------------- citation */
.bib { position: relative; }
.bib pre {
  margin: 0; padding: 18px 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  font: 13.5px/1.55 var(--mono); overflow-x: auto; color: var(--ink);
}
.copy {
  position: absolute; top: 10px; right: 26px; cursor: pointer;
  font: 500 12px/1 var(--sans); padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--bg); color: var(--ink-2);
}
.copy:hover { color: var(--ink); border-color: var(--ink-3); }

footer { padding-block: 56px 48px; font-size: 13px; color: var(--ink-3); text-align: center; }
footer a { color: inherit; }

/* ---------------------------------------------------------------- theme toggle */
.theme-toggle {
  position: fixed; top: 14px; right: 14px; z-index: 10; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--rule); color: var(--ink-2); box-shadow: var(--shadow);
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .masthead { padding-top: 56px; }
  h2 { font-size: 28px; }
  section { padding-top: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
