@font-face { font-family: "Gelasio"; src: url("assets/cats/Gelasio.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #f6f8fb;
  --paper: #ffffff;
  --ink: #1b2733;
  --muted: #5d6a78;
  --line: #d9e3ec;
  --accent: #2f8fcf;          /* links, buttons, CaTS label */
  --accent-soft: #7ccbf5;     /* bars, highlights (matches the paper figures) */
  --accent-wash: #eaf5fd;
  --base: #bcc7d2;            /* baselines */
  --amber: #e9a53a;
  --purple: #9b7be0;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --serif: "Gelasio", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--serif); font-size: 18px; line-height: 1.7; font-variant-numeric: lining-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }

/* ---------- hero ---------- */
.hero { position: relative; height: 100vh; min-height: 420px; overflow: hidden; background: #0a0b0d; }
.hero video { width: 100%; height: 100%; object-fit: contain; background: #0a0b0d; }
.hero-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,0.08); }
.hero-progress i { display: block; height: 100%; width: 0; background: var(--accent-soft); }
.hero .hint { position: absolute; right: 28px; bottom: 22px; z-index: 1; color: rgba(255,255,255,0.75); font-size: 14px; letter-spacing: 0.2em; text-transform: uppercase; padding: 6px 12px; border: 1px solid rgba(255,255,255,0.25); border-radius: 999px; }
.hero .hint:hover { color: #fff; border-color: var(--accent-soft); text-decoration: none; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 220px minmax(0, 820px); gap: 56px; justify-content: center; padding: 64px 24px 96px; }
.toc { position: sticky; top: 32px; align-self: start; font-size: 15px; line-height: 1.4; border-left: 1px solid var(--line); padding-left: 16px; }
.toc a { position: relative; display: block; color: var(--muted); padding: 6px 0; }
.toc a.sub { padding-left: 12px; font-size: 13.5px; }
.toc a.active { color: var(--ink); font-weight: 700; }
.toc a.active::before { content: ""; position: absolute; left: -17px; width: 2px; height: 22px; margin-top: -2px; background: var(--accent); }
main { min-width: 0; }

h1 { font-size: 46px; line-height: 1.15; margin: 0 0 6px; font-weight: 700; letter-spacing: -0.01em; }
h1 .short { color: var(--accent); }
.subtitle { font-size: 24px; line-height: 1.35; color: var(--muted); margin: 0 0 22px; }
h2 { font-size: 34px; line-height: 1.2; margin: 72px 0 14px; font-weight: 700; }
h3 { font-size: 23px; margin: 40px 0 8px; font-weight: 700; }
p { margin: 0 0 16px; }
.lead { font-size: 19px; }
.muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 34px 0 0; }

.title-row { display: flex; align-items: center; gap: 22px; }
.title-row img { width: 86px; height: auto; flex: none; }
.authors { font-size: 18px; margin: 4px 0 2px; }
.affils { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--muted); font-size: 16px; margin: 0 0 20px; }
.affils a { color: var(--muted); }
.authors a { color: var(--ink); border-bottom: 1px solid var(--line); }
.authors a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
sup { font-size: 0.65em; color: var(--accent); }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font-size: 16px; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn[aria-disabled="true"] { color: var(--muted); cursor: default; }
.btn[aria-disabled="true"]:hover { border-color: var(--line); }
.btn .soon { font-size: 12px; color: var(--accent); }

figure { margin: 26px 0; }
figure.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
figure img, figure video { border-radius: 8px; width: 100%; height: auto; }
figcaption { font-size: 15px; line-height: 1.55; color: var(--muted); margin-top: 10px; }
figcaption b { color: var(--ink); }
.video-wrap video { border-radius: 12px; background: #0a0b0d; }

ul.contrib { padding-left: 0; list-style: none; }
ul.contrib li { position: relative; padding-left: 26px; margin-bottom: 12px; }
ul.contrib li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-soft); }

.callout { border-left: 3px solid var(--accent-soft); background: var(--accent-wash); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 18px 0; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 26px 0; }
.stat { background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--accent-soft); border-radius: 10px; padding: 14px 16px; }
.stat b { display: block; font-size: 34px; line-height: 1.1; color: var(--accent); }
.stat span { font-size: 14px; color: var(--muted); }

/* ---------- code ---------- */
pre.code { background: #0f1720; color: #dbe7f3; border-radius: 10px; padding: 16px 20px; font: 15px/1.6 var(--mono); overflow-x: auto; margin: 18px 0; }
pre.code .fn { color: #f2b33d; } pre.code .sv { color: #7ccbf5; } pre.code .kw { color: #c792ff; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 16px; margin: 16px 0; background: var(--paper); border-radius: 10px; overflow: hidden; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 14px; color: var(--muted); font-weight: 700; background: #f1f5f9; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums lining-nums; }
tr.ours td { font-weight: 700; background: var(--accent-wash); }

/* ---------- task tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 12px; }
.tab { font: inherit; font-size: 15px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.task-player video { border-radius: 12px; background: #0a0b0d; aspect-ratio: 16 / 9; width: 100%; }
.task-note { margin-top: 10px; font-size: 16px; }
.task-note .rate { float: right; color: var(--accent); font-weight: 700; }

/* ---------- bar charts ---------- */
.bars { margin: 18px 0; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 64px; align-items: center; gap: 12px; margin: 7px 0; font-size: 16px; }
.bar-row .name { text-align: right; color: var(--muted); }
.bar-row.ours .name, .bar-row.ours .val { color: var(--ink); font-weight: 700; }
.bar-track { height: 18px; background: #e8eef4; border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; background: var(--base); border-radius: 4px; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.bar-row.ours .bar-fill { background: var(--accent-soft); }
.bar-row .val { font-variant-numeric: tabular-nums lining-nums; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.chart-title { font-weight: 700; font-size: 17px; margin: 20px 0 4px; }

/* ---------- simulation grid ---------- */
.sim-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.sim-card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; opacity: 0; transform: translateY(10px) rotateX(-60deg); transform-origin: top; transition: opacity .45s, transform .55s cubic-bezier(.2,.9,.3,1.2); }
.sim-grid.in .sim-card { opacity: 1; transform: none; }
.sim-card .bench { font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sim-card .bench.neo { color: var(--purple); } .sim-card .bench.uni { color: #2aa59a; }
.sim-card .task { font-weight: 700; font-size: 16px; line-height: 1.3; min-height: 2.6em; }
.sim-card .pct { font-size: 26px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.sim-card .mini { height: 6px; background: #e8eef4; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.sim-card .mini i { display: block; height: 100%; background: var(--base); width: 0; transition: width 1s .2s; }
.sim-card.hl { border-color: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-wash); }
.sim-card.hl .pct { color: var(--accent); }
.sim-card.hl .mini i { background: var(--accent-soft); }
.legend { font-size: 14px; color: var(--muted); display: flex; gap: 18px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- citation ---------- */
.bib { position: relative; }
.bib pre { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 16px; font: 14px/1.55 var(--mono); white-space: pre-wrap; }
.bib button { position: absolute; top: 10px; right: 10px; font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--bg); border-radius: 6px; padding: 3px 10px; cursor: pointer; }
footer { text-align: center; color: var(--muted); font-size: 14px; padding: 30px 20px 50px; border-top: 1px solid var(--line); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s, transform .6s; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 820px); }
  .toc { display: none; }
}
@media (max-width: 720px) {
  body { font-size: 17px; }
  h1 { font-size: 32px; } .subtitle { font-size: 19px; } h2 { font-size: 27px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .sim-grid { grid-template-columns: repeat(2, 1fr); }
  .bar-row { grid-template-columns: 96px 1fr 52px; font-size: 14px; }
  .title-row img { width: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .sim-card, .bar-fill, .sim-card .mini i { transition: none; opacity: 1; transform: none; }
}

/* ---------- interactive results ---------- */
.card-box { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 18px 0; }
.race-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-weight: 700; margin-bottom: 10px; }
.ghost { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.ghost:hover { color: var(--accent); border-color: var(--accent); }
.race-row { display: grid; grid-template-columns: 140px 1fr 70px; align-items: center; gap: 12px; margin: 8px 0; font-size: 16px; transition: opacity .3s; }
.race-row .name { text-align: right; color: var(--muted); }
.race-row .bar-track { height: 26px; border-radius: 6px; }
.race-row .bar-fill { border-radius: 6px; transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.race-row.ours .bar-fill { background: linear-gradient(90deg, #a9dcfa, var(--accent-soft)); }
.race-row.ours .name, .race-row.ours .val { color: var(--ink); font-weight: 700; }
.race-row .val { font-variant-numeric: tabular-nums lining-nums; font-size: 18px; }
.race-row.ours .val { color: var(--accent); font-size: 22px; }
.delta { min-height: 34px; margin-top: 6px; }
.delta span { display: inline-block; background: var(--accent-soft); color: #08263a; font-weight: 700; font-size: 15px; padding: 4px 12px; border-radius: 999px; opacity: 0; transform: translateY(6px) scale(.96); transition: opacity .4s, transform .4s; }
.delta span.on { opacity: 1; transform: none; }
.race-note { font-size: 14px; color: var(--muted); margin: 6px 0 0; min-height: 1.4em; }
.seg { display: inline-flex; background: #eef3f8; border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 14.5px; border: 0; background: transparent; color: var(--muted); padding: 5px 14px; border-radius: 999px; cursor: pointer; transition: background .2s, color .2s; }
.seg button[aria-selected="true"] { background: var(--paper); color: var(--accent); font-weight: 700; box-shadow: 0 1px 3px rgba(20,40,60,.15); }
.hint-text { font-size: 15px; color: var(--muted); margin: 6px 0; }

.task-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 10px 0 18px; }
.task-card { position: relative; text-align: left; font: inherit; color: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 0; overflow: hidden; cursor: pointer; transition: transform .25s, box-shadow .25s, border-color .25s; opacity: 0; transform: translateY(14px); }
.task-cards.in .task-card { opacity: 1; transform: none; transition: opacity .5s var(--d), transform .5s var(--d), box-shadow .25s, border-color .25s; }
.task-card:hover { transform: translateY(-4px) !important; box-shadow: 0 10px 24px rgba(20,60,90,.14); border-color: var(--accent-soft); }
.task-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: 30% 50%; filter: saturate(.9); transition: transform .4s; }
.task-card:hover img { transform: scale(1.05); }
.task-card .tc-body { padding: 10px 12px 12px; }
.task-card .tc-id { font-size: 13px; color: var(--accent); font-weight: 700; letter-spacing: .05em; }
.task-card .tc-name { font-weight: 700; font-size: 16px; line-height: 1.3; min-height: 2.6em; }
.task-card .tc-pct { font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.task-card .tc-base { font-size: 12.5px; color: var(--muted); }
.task-card .play { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; background: rgba(10,11,13,.6); display: grid; place-items: center; opacity: 0; transition: opacity .25s; }
.task-card:hover .play { opacity: 1; }
.task-card .play::after { content: ""; border-left: 11px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-left: 3px; }

.grid-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0 4px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: #cfd9e3; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--accent-soft); }
.switch input:checked::after { transform: translateX(16px); }
.sim-card { cursor: default; will-change: transform; }
.sim-card.gone { display: none; }
.sim-card .why { font-size: 13px; color: var(--muted); max-height: 0; overflow: hidden; transition: max-height .3s, margin .3s; }
.sim-card:hover .why, .sim-card:focus .why { max-height: 80px; margin-top: 6px; }
.sim-card:hover { box-shadow: 0 8px 20px rgba(20,60,90,.12); }
.sim-card .rank { float: right; font-size: 12.5px; color: var(--muted); }

.kv { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0 4px; font-size: 16px; }
.kv b { font-size: 26px; color: var(--accent); font-variant-numeric: tabular-nums lining-nums; }
.bar-track.lg { height: 16px; border-radius: 8px; display: block; }
.bar-track.lg .bar-fill { background: var(--accent-soft); border-radius: 8px; }
.toggle-box.off .kv b { color: var(--muted); }
.toggle-box.off .bar-fill { background: var(--base); }
.small { font-size: 14px; margin-top: 12px; }
.sensor-vals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 4px; }
.sensor-vals div { background: var(--accent-wash); border-radius: 10px; padding: 10px 12px; }
.sensor-vals b { display: block; font-size: 24px; color: var(--ink); font-variant-numeric: tabular-nums lining-nums; transition: color .3s; }
.sensor-vals b.flash { color: var(--accent); }
.sensor-vals span { font-size: 13px; color: var(--muted); }
@media (max-width: 720px) {
  .task-cards { grid-template-columns: repeat(2, 1fr); }
  .race-row { grid-template-columns: 92px 1fr 58px; font-size: 14px; }
}

/* ---------- simulation reel: three rows that drift sideways and can be swiped ---------- */
.sim-reel { margin: 18px 0 6px; display: grid; gap: 10px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.reel-row { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; cursor: grab; touch-action: pan-x pan-y; overscroll-behavior-x: contain; }
.reel-row::-webkit-scrollbar { display: none; }
.reel-row.dragging { cursor: grabbing; }
.reel-track { display: flex; gap: 10px; width: max-content; }
.reel-tile { position: relative; flex: 0 0 auto; width: 248px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #0a0b0d; box-shadow: 0 1px 2px rgba(20,40,60,.12); user-select: none; }
.reel-tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.reel-tile::after { content: ""; position: absolute; inset: auto 0 0 0; height: 46%; background: linear-gradient(transparent, rgba(10,11,13,.78)); pointer-events: none; }
.reel-tile span { position: absolute; left: 10px; bottom: 7px; z-index: 1; color: #fff; font-size: 14.5px; line-height: 1.2; display: flex; align-items: center; gap: 6px; }
.reel-tile span i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.reel-tile.u { outline: 2px solid rgba(60,200,180,.55); outline-offset: -2px; } .reel-tile.u span i, .dot-u { background: #3cc8b4; }
.reel-tile.n { outline: 2px solid rgba(180,140,245,.6); outline-offset: -2px; } .reel-tile.n span i, .dot-n { background: #b48cf5; }
.dot-u, .dot-n { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: 1px; }
.reel-note { margin-top: 4px; }
@media (max-width: 720px) { .reel-tile { width: 200px; } }

/* ---------- framework explorers: zoom + spotlight over the paper figures ---------- */
.fx { margin: 12px 0 22px; padding: 14px; }
.fx-steps { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 8px; margin-bottom: 12px; }
.fx-step { text-align: left; font: inherit; color: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .2s; }
.fx-step:hover { transform: translateY(-2px); }
.fx-step .k { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 7px; background: var(--accent-wash); color: var(--accent); font-weight: 700; font-size: 13.5px; margin-right: 6px; }
.fx-step b { font-size: 15px; line-height: 1.3; }
.fx-step small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.35; margin-top: 3px; }
.fx-step[aria-pressed="true"] { border-color: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-wash); }
.fx-step[aria-pressed="true"] .k { background: var(--accent); color: #fff; }
.fx-step.c-b .k { background: #e3f6f1; color: #148a76; } .fx-step.c-b[aria-pressed="true"] .k { background: #1aa58d; color: #fff; }
.fx-stage { position: relative; overflow: hidden; border-radius: 10px; background: #fff; border: 1px solid var(--line); cursor: zoom-in; }
.fx-stage.zoomed { cursor: zoom-out; }
.fx-view { position: relative; transform-origin: 0 0; transition: transform .75s cubic-bezier(.2,.8,.2,1); will-change: transform; }
.fx-view img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.fx-hole { position: absolute; left: 0; top: 0; width: 100%; height: 100%; border-radius: 8px; pointer-events: none; opacity: 0;
  box-shadow: 0 0 0 4000px rgba(16,28,40,.5); border: calc(3px / var(--s, 1)) solid var(--accent-soft);
  transition: left .75s cubic-bezier(.2,.8,.2,1), top .75s cubic-bezier(.2,.8,.2,1), width .75s cubic-bezier(.2,.8,.2,1), height .75s cubic-bezier(.2,.8,.2,1), opacity .4s; }
.fx.on .fx-hole { opacity: 1; }
.fx-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.fx-bar i { display: block; height: 100%; width: 0; background: var(--accent-soft); }
.fx-controls { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.fx-subs { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-height: 30px; }
.fx-sub { font: inherit; font-size: 13.5px; padding: 3px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; animation: fxIn .35s ease-out backwards; }
.fx-sub:hover { border-color: var(--accent-soft); }
.fx-sub[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.fx-btns { display: flex; gap: 6px; margin-left: auto; }
.fx-detail { margin-top: 10px; min-height: 92px; }
.fx-detail > div { animation: fxIn .35s ease-out; }
.fx-detail h4 { margin: 0 0 4px; font-size: 17px; }
.fx-detail p { margin: 0 0 6px; font-size: 16px; line-height: 1.6; }
@keyframes fxIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (max-width: 720px) {
  .fx { padding: 10px; }
  .fx-steps { grid-template-columns: repeat(2, 1fr); }
  .fx-step small { display: none; }
}
.fx-step { line-height: 1.25; }
.fx-step .k { vertical-align: 1px; height: 22px; min-width: 22px; }
