/* ==========================================================================
   PathRIR — IWAENC 2026 demo page
   Accent is sampled from the PathRIR trace in the paper figures (#D95319)
   so the interface and the plots read as one system.
   ========================================================================== */

:root {
  --bg:        #faf9f6;
  --surface:   #ffffff;
  --surface-2: #f4f2ec;
  --ink:       #17140f;
  --ink-2:     #453f37;
  --muted:     #6d6660;
  --line:      #e3ded4;
  --line-2:    #d3ccbe;

  --accent:      #d95319;   /* PathRIR   */
  --accent-ink:  #a83c0c;
  --accent-wash: #fdf1e9;
  --ref:         #3f3a34;   /* Pyroom    */
  --abl:         #0072bd;   /* w/o Comp-MLP */
  --audio:       #12736c;   /* listening card */
  --audio-wash:  #eaf5f3;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1320px;
  --r: 10px;
  --shadow: 0 1px 2px rgba(23,20,15,.05), 0 6px 20px -10px rgba(23,20,15,.16);

  /* lets the native <audio> transport and scrollbars follow the page theme */
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #14120f;
    --surface:   #1c1a16;
    --surface-2: #232019;
    --ink:       #f3efe8;
    --ink-2:     #d6d0c6;
    --muted:     #a09991;
    --line:      #302b24;
    --line-2:    #3d3730;
    --accent:      #f4763d;
    --accent-ink:  #ffa274;
    --accent-wash: #2a1c13;
    --ref:         #bdb6ac;
    --abl:         #5aa9e6;
    --audio:       #58c6b8;
    --audio-wash:  #10201f;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.7);
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.prose { max-width: 74ch; }

a { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; }
a:hover { color: var(--accent); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.012em; line-height: 1.22; margin: 0; }

/* ------------------------------------------------------------------ hero */
.hero { padding: 48px 0 34px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-2), var(--bg) 78%); }

/* Venue label, deliberately quiet: it sits directly above the orange "PathRIR"
   in the title, so a coloured pill here reads as a status badge and competes
   with it. Plain small caps state the venue and then get out of the way. */
.venue {
  display: block;
  font: 600 11.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}

.hero h1 { font-size: clamp(28px, 3.5vw, 48px); max-width: 100%; line-height: 1.16; }
.hero h1 .name { color: var(--accent); }
.hero h1 .nb { white-space: nowrap; }

.authors { margin: 24px 0 0; font-size: 20px; line-height: 1.7; max-width: none; }
.authors b { font-weight: 600; }
.authors .au { white-space: nowrap; }
.authors sup { font-size: .62em; color: inherit; font-weight: 600; padding-left: 1px; }
.authors a {
  color: var(--ink); text-decoration: none;
  transition: color .13s ease;
}
.authors a:hover {
  color: var(--accent);
  text-decoration: underline;          /* appears only on hover */
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.affil { margin: 9px 0 0; font-size: 14.5px; color: var(--muted); line-height: 1.7; max-width: none; }
.affil span { display: inline; white-space: nowrap; }
.affil span + span::before { content: "\00b7"; margin: 0 11px; color: var(--line-2); }

/* ---------------------------------------------------------------- buttons */
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 19px; border-radius: var(--r);
  font: 600 14.5px/1 var(--sans); text-decoration: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
  transition: transform .13s ease, border-color .13s ease, background .13s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); color: var(--ink); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn--primary:hover { background: var(--accent-ink); color: #fff; }

/* ------------------------------------------------------------------- nav */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.nav ul::-webkit-scrollbar { display: none; }
.nav a {
  display: block; padding: 13px 13px; white-space: nowrap;
  font: 500 14px/1.4 var(--sans); color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a.is-active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- section */
section { padding: 60px 0; border-bottom: 1px solid var(--line); }
section:last-of-type { border-bottom: 0; }

.eyebrow {
  font: 600 11.5px/1 var(--sans); letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 12px;
}
section > .wrap > h2 { font-size: clamp(24px, 2.7vw, 31px); margin-bottom: 18px; }

/* ------------------------------------------------------- demo showcase */
#showcase { padding: 30px 0 34px; border-bottom: 1px solid var(--line); }

.pitch {
  margin: 0 0 22px; max-width: none;
  font: 400 clamp(17px, 1.45vw, 21px)/1.5 var(--serif);
  color: var(--ink-2); letter-spacing: -.004em;
}

.show-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px; align-items: stretch;
}
.show-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
}
.show-head { padding: 10px 13px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.show-head h4 { margin: 0; font: 700 21px/1.25 var(--sans); letter-spacing: -.012em; color: var(--ink); }

/* the showcase player is stripped back: title + transport, no description line */
/* showcase players run tighter than the per-scenario ones */
.show-card .players { gap: 5px; padding: 4px 6px; }
.show-card .player { padding: 2px 10px 1px; }
.show-card .player h5 { margin: 0 0 1px; }
.show-card .player p { margin: 0 0 2px; }

.show-fig { position: relative; margin: 0; }
.show-fig picture {
  flex: 1 1 auto; min-height: 0; background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.show-fig img {
  display: block; width: auto; height: auto;
  max-width: 100%; max-height: 100%; object-fit: contain; margin: auto;
  background: #fff; cursor: zoom-in;
}

.stat-stack { flex: 1 1 auto; display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); }
.stat-stack .stat {
  background: transparent; border: 0; border-radius: 0; box-shadow: none;
  padding: 10px 16px; display: flex; flex-direction: column; justify-content: center;
}
.stat-stack .stat + .stat { border-top: 1px solid var(--line); }
.stat-stack .stat b { font-size: clamp(30px, 3.1vw, 42px); letter-spacing: -.03em; line-height: 1.02; }
.stat-stack .stat b sup { font-size: .45em; font-weight: 600; vertical-align: super; }
.stat-stack .stat span { margin-top: 7px; font-size: 14px; line-height: 1.4; color: var(--ink-2); }

/* superscript marker on a showcase card title; line-height 0 keeps the head height */
.fnref { font-size: .5em; font-weight: 600; vertical-align: super; line-height: 0; margin-left: 2px; }
.fnref a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.fnref a:hover { color: var(--accent); }

/* the matching provenance notes, one per card, in the same order */
.provenance {
  margin: 16px 0 0; padding: 0; list-style: none; counter-reset: prov;
  font-size: 13.5px; line-height: 1.6; color: var(--muted);
}
.provenance li { counter-increment: prov; padding-left: 17px; text-indent: -17px; }
.provenance li + li { margin-top: 2px; }
.provenance li::before {
  content: counter(prov); margin-right: 6px;
  color: var(--accent); font-weight: 700; font-size: 12px; vertical-align: super; line-height: 0;
}
.provenance li:target { color: var(--ink); }

/* ------------------------------------------------------------------ stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 32px 0 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px 20px 17px; box-shadow: var(--shadow);
}
.stat b {
  display: block; font: 600 clamp(24px, 3vw, 32px)/1 var(--mono);
  letter-spacing: -.02em; color: var(--accent); font-variant-numeric: tabular-nums;
}
.stat span { display: block; margin-top: 9px; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.note { font-size: 13.5px; color: var(--muted); margin: 14px 0 0; max-width: 78ch; }

/* --------------------------------------------------------------- scenario */
.scenario { padding-top: 62px; }
.scenario + .scenario { border-top: 1px dashed var(--line-2); margin-top: 22px; }
.sc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; }
.sc-head h3 { font-size: clamp(24px, 2.7vw, 31px); }
.sc-num {
  /* same family, size and line position as before - only the chip is new */
  font: 600 clamp(24px, 2.7vw, 31px)/1.22 var(--mono); letter-spacing: .01em;
  display: inline-block; padding: 3px 13px 4px; border-radius: 9px;
  border: 1px solid transparent;
}
/* outlined = inside the paper's settings, filled = pushed outside them */
.sc-num--base { color: var(--ink);   background: var(--surface);  border-color: var(--ink-2); }
.sc-num--oor  { color: var(--bg);    background: var(--ink-2);     border-color: var(--ink-2); }

.tag {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font: 600 11.5px/1.5 var(--sans); letter-spacing: .03em;
  border: 1px solid var(--line-2); color: var(--ink-2); background: var(--surface-2);
}
.tag--pair   { color: var(--abl); border-color: color-mix(in srgb, var(--abl) 35%, transparent); background: color-mix(in srgb, var(--abl) 9%, transparent); }
.tag--beyond { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-wash); }

.scenario > .note { max-width: none; }

.lede {
  margin: 16px 0 0; padding-left: 21px; max-width: none;
  list-style: disc; color: var(--line-2);          /* marker colour */
}
.lede li {
  margin-bottom: 7px; padding-left: 4px;
  font-size: 14.5px; line-height: 1.6; color: var(--ink-2);
}
.lede li:last-child { margin-bottom: 0; }
.lede li b { font-weight: 600; color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0 0; padding: 0; list-style: none; }
.chips li {
  font: 500 12.5px/1.5 var(--sans); color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 7px;
}
.chips li b { margin-left: 7px; font: 600 12.5px/1.5 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- figures */
.blocks {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px; margin-top: 22px; align-items: stretch;
}
figure.fig {
  margin: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
figure.fig { position: relative; }
figure.fig a.pdf, .show-fig a.pdf {
  position: absolute; right: 4px; bottom: 4px; z-index: 2;
  /* card radius 10px, 1px border, 4px inset -> 5px keeps the corners concentric */
  border-radius: 5px; padding: 3px 6px;
  font: 500 10.5px/1 var(--sans); letter-spacing: .015em;
  color: var(--muted); text-decoration: none;
  background: transparent; opacity: .45;    /* invisible until wanted */
  transition: opacity .13s ease, color .13s ease, background .13s ease;
}
figure.fig a.pdf:hover, .show-fig a.pdf:hover {                    /* only now does it announce itself */
  opacity: 1; color: var(--accent-ink); background: var(--surface-2);
}

figure.fig picture {
  flex: 1 1 auto; min-height: 0; background: #fff;
  display: flex; align-items: center; justify-content: center;
}
figure.fig img {
  /* fit inside the cell without ever distorting: leftover space becomes white margin.
     width is 100% rather than auto so the width/height attributes give the box an
     aspect ratio before the file arrives; these plots are always wider than their
     column, so the rendered size is unchanged, but the page no longer reflows as
     the lazy-loaded figures come in (which used to break anchor jumps). */
  display: block; width: 100%; height: auto;
  max-width: 100%; max-height: 100%; object-fit: contain; margin: auto;
  background: #fff;           /* plots are exported on white — keep them on white in both themes */
  cursor: zoom-in;
}
figcaption { padding: 12px 15px 14px; font-size: 13px; line-height: 1.55; color: var(--muted); border-top: 1px solid var(--line); }
figcaption b { color: var(--ink-2); font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 2px; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 15px; height: 0; border-top-width: 2.5px; border-top-style: solid; display: inline-block; }
.legend .k-ref  { border-color: var(--ref);    border-top-style: dashed; }
.legend .k-path { border-color: var(--accent); }
.legend .k-abl  { border-color: var(--abl);    border-top-style: dashed; }

/* ------------------------------------------------------------------ table */

.tbl-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
}
.tbl-scroll { flex: 1 1 auto; }
.tbl-scroll table.metrics { height: 100%; }
.tbl-head { padding: 6px 13px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tbl-head h4 { margin: 0; font: 600 13.5px/1.35 var(--sans); }
.tbl-head .meta { display: block; margin-top: 3px; font-size: 11px; line-height: 1.4; color: var(--muted); }
.tbl-scroll { overflow-x: auto; }
table.metrics { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 0; table-layout: auto; }
table.metrics th, table.metrics td { padding: 4px 13px; text-align: right; border-bottom: 1px solid var(--line); }
table.metrics th:first-child, table.metrics td:first-child { text-align: left; }
table.metrics thead th { font: 600 11px/1.35 var(--sans); letter-spacing: .02em; text-transform: uppercase; color: var(--muted); background: var(--surface); }
table.metrics tbody td { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-2); }
table.metrics tbody th { font: 500 14px/1.4 var(--sans); color: var(--ink); }
table.metrics tbody th small { display: block; font-size: 11.5px; line-height: 1.2; color: var(--muted); font-weight: 400; }
table.metrics tbody th .dir { color: var(--muted); font-weight: 400; font-size: 12px; }
table.metrics tbody tr.perf th, table.metrics tbody tr.perf td { background: var(--surface-2); }
table.metrics tbody tr.perf-first th, table.metrics tbody tr.perf-first td { border-top: 1px solid var(--line-2); }
table.metrics tbody tr.perf-speed td.win { font-size: 28px; line-height: 1.05; font-weight: 700; letter-spacing: -.03em; }
table.metrics tbody tr.perf-speed th, table.metrics tbody tr.perf-speed td { background: var(--accent-wash); }
table.metrics tbody tr:last-child th, table.metrics tbody tr:last-child td { border-bottom: 0; }
table.metrics td.win { color: var(--accent); font-weight: 600; }

/* ------------------------------------------------------------------ audio */
.audio-block {
  background: var(--surface); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
  border: 1.5px solid color-mix(in srgb, var(--audio) 42%, transparent);
}
.audio-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 13px;
  border-bottom: 1.5px solid color-mix(in srgb, var(--audio) 42%, transparent); background: var(--audio-wash); }
.audio-head h4 { margin: 0; font: 700 21px/1.25 var(--sans); letter-spacing: -.012em; color: var(--audio); }

.tabs { display: flex; gap: 6px; }
.tabs input, .audio-block > input[type="radio"] {
  position: absolute; width: 1px; height: 1px; opacity: 0;
  margin: 0; overflow: hidden; clip-path: inset(50%);   /* hidden but still focusable */
}
.tabs label {
  cursor: pointer; padding: 5px 12px; border-radius: 7px;
  font: 600 12.5px/1.4 var(--sans); color: var(--muted);
  border: 1px solid var(--line-2); background: var(--surface);
  transition: color .13s ease, border-color .13s ease, background .13s ease;
}
.tabs label:hover { color: var(--ink); }
#hero-speech:focus-visible ~ .audio-head label[for="hero-speech"], #hero-music:focus-visible ~ .audio-head label[for="hero-music"],
#s1-speech:focus-visible ~ .audio-head label[for="s1-speech"], #s1-music:focus-visible ~ .audio-head label[for="s1-music"],
#s2-speech:focus-visible ~ .audio-head label[for="s2-speech"], #s2-music:focus-visible ~ .audio-head label[for="s2-music"],
#s3-speech:focus-visible ~ .audio-head label[for="s3-speech"], #s3-music:focus-visible ~ .audio-head label[for="s3-music"],
#s4-speech:focus-visible ~ .audio-head label[for="s4-speech"], #s4-music:focus-visible ~ .audio-head label[for="s4-music"] {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.players.pane { flex: 1 1 auto; grid-template-rows: repeat(3, minmax(0, 1fr)); }
.players { display: grid; grid-template-columns: 1fr; gap: 5px; padding: 5px 6px; }
.player { border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px 2px; background: var(--surface);
  display: flex; flex-direction: column; justify-content: center; }
.player--path { border-color: color-mix(in srgb, var(--accent) 42%, transparent); background: var(--accent-wash); }
.player h5 { margin: 0 0 1px; font: 600 14.5px/1.2 var(--sans); color: var(--ink); display: flex; align-items: center; gap: 7px; }
.player h5::before { content: ""; width: 10px; height: 10px; border-radius: 2px; flex: none; background: var(--muted); }
.player--clean h5::before { background: var(--line-2); }
.player--ref   h5::before { background: var(--ref); }
.player--path  h5::before { background: var(--accent); }
.player p { margin: 0 0 2px; font-size: 12.5px; color: var(--muted); line-height: 1.25; }
.player audio { width: 100%; display: block; }

/* CSS-only tab panels — the players work with JavaScript disabled */
.pane { display: none; }
#hero-speech:checked ~ .players.pane-speech, #hero-music:checked ~ .players.pane-music,
#s1-speech:checked ~ .players.pane-speech, #s1-music:checked ~ .players.pane-music,
#s2-speech:checked ~ .players.pane-speech, #s2-music:checked ~ .players.pane-music,
#s3-speech:checked ~ .players.pane-speech, #s3-music:checked ~ .players.pane-music,
#s4-speech:checked ~ .players.pane-speech, #s4-music:checked ~ .players.pane-music { display: grid; }
#hero-speech:checked ~ .audio-head label[for="hero-speech"], #hero-music:checked ~ .audio-head label[for="hero-music"],
#s1-speech:checked ~ .audio-head label[for="s1-speech"], #s1-music:checked ~ .audio-head label[for="s1-music"],
#s2-speech:checked ~ .audio-head label[for="s2-speech"], #s2-music:checked ~ .audio-head label[for="s2-music"],
#s3-speech:checked ~ .audio-head label[for="s3-speech"], #s3-music:checked ~ .audio-head label[for="s3-music"],
#s4-speech:checked ~ .audio-head label[for="s4-speech"], #s4-music:checked ~ .audio-head label[for="s4-music"] {
  color: #fff; background: var(--audio); border-color: transparent;
}

/* ----------------------------------------------------------- architecture */
.arch { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; margin-top: 26px; }
.arch .arch-canvas { background: #fff; padding: 22px; overflow-x: auto; }
.arch img { display: block; width: 100%; min-width: 720px; height: auto; cursor: zoom-in; }
.arch figcaption { border-top: 1px solid var(--line); font-size: 14px; line-height: 1.6; color: var(--ink-2); padding: 16px 20px 18px; }
.arch figcaption b { color: var(--ink); }

/* ------------------------------------------------------------- overview */
/* The pipeline figure keeps the 40px side inset it has always had (previously
   inherited from the UA <figure> margin); --ov-inset makes that number explicit
   so the two eyebrow labels and the abstract can line up with the card edges. */
#overview { --ov-inset: 40px; }
#overview .arch { margin: 0 var(--ov-inset) 16px; }
#overview .eyebrow { margin-left: var(--ov-inset); margin-right: var(--ov-inset); }
#overview .eyebrow--abs { margin-top: 34px; }
#overview .prose {
  max-width: none;
  margin-left: var(--ov-inset); margin-right: var(--ov-inset);
  font-size: 15px; line-height: 1.72; color: var(--ink-2);
}
#overview .prose p { margin: 0 0 1em; }
#overview .prose p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------- citation */
.cite {
  position: relative; margin-top: 24px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
}
.cite pre {
  margin: 0; padding: 18px 20px; overflow-x: auto;
  font: 400 12.5px/1.7 var(--mono); color: var(--ink-2); background: var(--surface);
}
.copy {
  position: absolute; top: 12px; right: 12px; z-index: 1;
  font: 600 11.5px/1 var(--sans); cursor: pointer;
  color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2);
  padding: 7px 12px; border-radius: 6px; transition: all .13s ease;
}
.copy:hover { border-color: var(--accent); color: var(--accent-ink); }
.copy.done { background: var(--accent); border-color: transparent; color: #fff; }

/* --------------------------------------------------------------- refs */
ol.refs { margin: 20px 0 0; padding-left: 0; max-width: 82ch; list-style: none; counter-reset: ref; }
ol.refs li {
  counter-increment: ref; margin-bottom: 11px; padding-left: 30px; text-indent: -30px;
  font-size: 14.5px; line-height: 1.62; color: var(--ink-2);
}
ol.refs li::before { content: "[" counter(ref) "]"; margin-right: 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* text-indent inherits into block children, so cancel it on the note line */
ol.refs li span { display: block; text-indent: 0; font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ------------------------------------------------------------------ misc */

.lightbox {
  position: fixed; inset: 0; z-index: 90; display: none;
  align-items: center; justify-content: center; padding: 3vmin;
  background: rgba(12,10,8,.86); backdrop-filter: blur(3px); cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 94vh; background: #fff; border-radius: 6px; padding: 10px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--surface); padding: 10px 14px; border-radius: 8px; border: 1px solid var(--accent); }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .blocks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  #overview { --ov-inset: 0px; }
  .stats { grid-template-columns: 1fr; }
  .show-grid { grid-template-columns: 1fr; }
  .blocks { grid-template-columns: 1fr; }
  .hero { padding: 44px 0 32px; }
  .affil span { white-space: normal; }
  section { padding: 44px 0; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .btn { flex: 1 1 auto; justify-content: center; }
  .arch .arch-canvas { padding: 12px; }
}

/* ------------------------------------------------------ reveal on scroll */
/* Same fade-up as shaohenry.github.io (14px, .6s ease); --rd carries the
   per-batch stagger set in main.js. Scoped to html.js-reveal, which only the
   inline <head> script adds, so with JavaScript off nothing is ever hidden. */
html.js-reveal .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .6s ease var(--rd, 0ms), transform .6s ease var(--rd, 0ms);
}
html.js-reveal .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html.js-reveal .reveal { opacity: 1; transform: none; transition: none; }
}

@media print {
  .nav, .lightbox, .copy, .btn-row { display: none !important; }
  body { background: #fff; }
  .pane { display: grid !important; }
  section { border: 0; page-break-inside: avoid; }
  /* never print a page half-faded, whatever was scrolled into view */
  html.js-reveal .reveal { opacity: 1 !important; transform: none !important; }
}
