/* Layout: the page's first design. Colours: the author's portfolio (~/wyrd) light "steampunk" scheme
   (tailwind.config.mjs / THEME_GUIDE.md): parchment background, dark-brown ink, copper accent. Light only. */
:root {
  --bg: #e8dcc8;            /* aged paper */
  --surface: #efe6d7;       /* cards, tables, controls: a lifted sheet of the same paper */
  --surface-2: #d4c4a8;     /* darker parchment */
  --line: #c3b39b;          /* oxidized bronze #9d8b73 at ~55% on paper: hairlines */
  --line-strong: #9d8b73;   /* oxidized bronze */
  --ink: #2a1810; --ink-2: #5a4a38; --muted: #6a5c4b;   /* pencil grey #8a7a68 darkened to 4.8:1 on paper */
  --accent: #7f5226;        /* copper (dim #8b5a2b) darkened to 4.9:1 on paper, for text and links */
  --accent-fill: #b87333;   /* copper/brass for marks, rules and highlights */
  --accent-soft: rgba(184, 115, 51, .14);
  --ours: #b5541f; --base: #00876f; --gt: #5a4a38; --others: #b3a286;   /* trajectories: burnt copper (ours) vs verdigris (baseline), ink-dashed GT; validated on #efe6d7 */
  --ok: rgba(96, 128, 60, .22); --no: rgba(160, 82, 45, .18); --ok-ink: #3d5220; --no-ink: #7a3a1f;
  --shadow: 0 1px 2px rgba(42, 24, 16, .06), 0 4px 16px rgba(42, 24, 16, .07);
  --radius: 10px; --w: 1080px; --narrow: 820px;
  color-scheme: light;
}
::selection { background: rgba(184, 115, 51, .25); color: #8b5a2b; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; display: block; }
.muted { color: var(--muted); }
sup { font-size: .68em; line-height: 0; }

/* nav */
.topnav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topnav-inner { max-width: var(--w); margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 700; color: var(--ink); }
.navlinks { display: flex; gap: 18px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.navlinks a { color: var(--ink-2); font-size: 14px; white-space: nowrap; }

/* hero */
.hero { max-width: var(--w); margin: 0 auto; padding: 56px 16px 24px; text-align: center; }
h1 { font-size: clamp(28px, 4.6vw, 46px); line-height: 1.15; margin: 0 0 18px; letter-spacing: -0.02em; font-weight: 700; }
h1 .hl { color: var(--accent-fill); }
.authors { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 22px; font-size: 18px; margin: 0 0 8px; }
.affils { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 22px; color: var(--ink-2); font-size: 15px; margin: 0 0 4px; }
.equal { font-size: 13px; margin: 0 0 22px; }
.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 15px; }
.btn:hover { text-decoration: none; opacity: .88; }
.btn svg { width: 18px; height: 18px; }
.btn.disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; border: 1px solid var(--line); }
.btn .soon { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 6px; background: var(--line); color: var(--ink-2); }

/* sections */
.section { max-width: var(--w); margin: 0 auto; padding: 40px 16px; }
.narrow { max-width: var(--narrow); }
.section.narrow { max-width: calc(var(--narrow) + 32px); }
h2 { font-size: 28px; margin: 0 0 18px; letter-spacing: -0.01em; text-align: center; }
h3.sub { font-size: 20px; margin: 44px 0 6px; }
.lead { margin: 0 auto 24px; color: var(--ink-2); text-align: center; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
#abstract p { text-align: justify; hyphens: auto; }

.video-frame { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #000; }
.video-frame video { width: 100%; aspect-ratio: 16 / 9; }

.figure { margin: 0 0 24px; }
.figure img { width: 100%; border-radius: var(--radius); background: #fff; border: 1px solid var(--line-strong); }
.figure figcaption { text-align: center; color: var(--ink-2); font-size: 14px; margin-top: 8px; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 6px; font-size: 16px; color: var(--accent); }
.card { border-top: 3px solid var(--accent-fill); }
.card p { margin: 0; font-size: 14.5px; color: var(--ink-2); }

/* tables */
.table-wrap { overflow-x: auto; margin: 8px 0 4px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
caption { caption-side: bottom; text-align: left; color: var(--muted); font-size: 13px; padding-top: 8px; }
th, td { padding: 7px 10px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { font-weight: 600; color: var(--ink-2); border-bottom: 2px solid var(--line-strong); }
tbody th { text-align: left; font-weight: 500; }
.dstable td.ok { background: var(--ok); color: var(--ok-ink); }
.dstable td.no { background: var(--no); color: var(--no-ink); }
.dstable .us { font-weight: 700; }
.rtable tbody tr:hover { background: var(--surface-2); }
.rtable tr.ours { background: var(--accent-soft); }
.rtable tr.ours th { font-weight: 700; color: var(--accent); }
.rtable td.na { color: var(--muted); }
.rtable th.grp { border-left: 2px solid var(--line); }
.rtable td.grp { border-left: 2px solid var(--line); }
.rtable u { text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.rtable.small td.x { color: var(--muted); }
.ablations { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }

/* segmented control + pills */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 10px; }
.seg button { border: 0; background: transparent; color: var(--ink-2); padding: 6px 14px; border-radius: 7px; font: 500 14px Inter, sans-serif; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); padding: 5px 12px; border-radius: 999px; font: 500 13px Inter, sans-serif; cursor: pointer; }
.pills button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
select { font: 500 14px Inter, sans-serif; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; margin-left: 6px; }
label { font-size: 14px; color: var(--ink-2); }

/* comparison slider */
.cmp-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.cmp-controls .seg { margin-bottom: 0; }
.cmp-pick { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 12px 0; }
.slider { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #000; user-select: none; touch-action: pan-y; }
.slider canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.slider .clip { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0); }
.slider .clip canvas { position: absolute; inset: 0; }
.divider { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 2px; margin-left: -1px; background: #f6efe3; box-shadow: 0 0 0 1px rgba(0,0,0,.25); pointer-events: none; }
.divider span { position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.35); }
.divider span::before, .divider span::after { content: ""; position: absolute; top: 50%; border: 6px solid transparent; margin-top: -6px; }
.divider span::before { left: 3px; border-right-color: #333; }
.divider span::after { right: 3px; border-left-color: #333; }
.slider input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.slider input[type=range]:focus-visible + * { outline: none; }
.slider:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.tag { position: absolute; top: 10px; padding: 3px 9px; border-radius: 6px; background: rgba(15,17,20,.78); color: #fff; font-size: 13px; font-weight: 500; pointer-events: none; }
.tag.tl { left: 10px; } .tag.tr { right: 10px; }
.tag b { font-weight: 700; }
.player { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.player .play { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.player .play:hover { border-color: var(--accent-fill); color: var(--accent); }
.player .play svg { width: 16px; height: 16px; }
.player .play .i-play, .player .play.paused .i-pause { display: none; }
.player .play.paused .i-play { display: block; }
.player input[type=range] { flex: 1; accent-color: var(--accent-fill); }
.player .fc { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }
.cmp-note { color: var(--muted); font-size: 13px; margin: 8px 0 0; min-height: 1em; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--surface); cursor: pointer; padding: 0; text-align: left; color: var(--ink); font: inherit; }
.thumb canvas { display: block; width: 100%; height: auto; }
.thumb span { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; padding: 4px 7px; }
.thumb span em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.thumb.is-left { border-color: var(--base); }
.thumb.is-right { border-color: var(--ours); }

/* trajectories */
.traj-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.traj { height: 460px; position: relative; }   /* no card: the plot sits on the page, like the tables */
.traj .loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }

/* bibtex */
.bib { position: relative; }
.bib pre { margin: 0; padding: 18px 20px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; font: 13.5px/1.55 "JetBrains Mono", ui-monospace, monospace; color: var(--ink); }
.copy { position: absolute; top: 10px; right: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 7px; padding: 4px 10px; font: 500 13px Inter, sans-serif; cursor: pointer; }

.footer { border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; }

@media (max-width: 820px) {
  .cards, .ablations { grid-template-columns: 1fr; }
  .navlinks { display: none; }
  .authors { font-size: 16px; }
  .traj { height: 420px; }
  .hero { padding-top: 36px; }
}
/* the tiled source video is decoded but never shown: kept in the render tree (1 px, transparent) so browsers keep advancing frames */
.cmp { position: relative; }
.src-video { position: absolute; left: 0; top: 0; width: 1px !important; height: 1px; opacity: 0; pointer-events: none; }
.thumb span { white-space: nowrap; font-size: 11.5px; }
