:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #5b6370;
  --border: #e3e6eb;
  --accent: #1f4e8c;
  --react: #D55E00;
  --vlm: #0072B2;
  --tru: #CC79A7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; overflow-x: clip; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .88em; }
code { overflow-wrap: anywhere; }
img { max-width: 100%; display: block; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 820px; }
.center { text-align: center; }

/* ---------- nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topnav-inner {
  max-width: 1080px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-weight: 600; color: var(--text); font-size: 15px; white-space: nowrap; }
.nav-links { display: flex; gap: 20px; font-size: 14px; }
.nav-links a { color: var(--muted); }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }

/* ---------- icon + label rail (right edge, 860px and up) ---------- */
.dotnav { display: none; }
@media (min-width: 860px) {
  .topnav { display: none; }
  html { scroll-padding-top: 16px; }
  .dotnav {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; right: 8px; top: 50%; transform: translateY(-50%); z-index: 10;
    width: 72px;
  }
  .dotnav a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 3px 0; color: var(--muted);
  }
  .dotnav a:hover { text-decoration: none; color: var(--text); }
  .nav-icon {
    order: -1; box-sizing: content-box; width: 16px; height: 16px; padding: 6px; border-radius: 50%;
    fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
    transition: background .2s, color .2s;
  }
  .dotnav a:hover .nav-icon { background: var(--bg-alt); }
  .dot-label { font-size: 10.5px; line-height: 1.2; font-weight: 500; white-space: nowrap; }
  .dotnav a.active { color: var(--accent); }
  .dotnav a.active .nav-icon { background: color-mix(in srgb, var(--accent) 12%, transparent); }
  .dotnav a.active .dot-label { font-weight: 700; }
}
/* keep content clear of the rail until the side margin is wide enough */
@media (min-width: 860px) and (max-width: 1279px) {
  .container { padding-left: 48px; padding-right: 92px; }
}

/* ---------- hero ---------- */
.hero { padding: 72px 0 40px; }
a.venue:hover { text-decoration: none; border-color: var(--accent); }
.venue {
  display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 14px;
}
.hero h1 {
  font-size: clamp(30px, 5vw, 46px); line-height: 1.15; font-weight: 700;
  margin: 20px 0 18px; letter-spacing: -.02em; text-wrap: balance;
}
.authors { font-size: 19px; margin: 0 0 4px; }
.authors a { color: var(--text); border-bottom: 1px dotted var(--muted); }
.authors a:hover { text-decoration: none; color: var(--accent); }
.affil { color: var(--muted); margin: 0 0 28px; font-size: 15px; }

.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--text); color: var(--bg);
  padding: 9px 18px; border-radius: 999px; font-weight: 500; font-size: 15px;
}
.btn:hover { text-decoration: none; opacity: .85; }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.placeholder-btn { background: transparent; color: var(--muted); border: 1px dashed var(--muted); }

/* ---------- sections ---------- */
.section { padding: 64px 0; }
.section.alt { background: var(--bg-alt); }
h2 { font-size: 30px; margin: 0 0 18px; letter-spacing: -.01em; }
h3 { font-size: 21px; margin: 44px 0 14px; }
h4 { margin: 0 0 6px; font-size: 17px; }
.lede { color: var(--muted); font-size: 18px; max-width: 820px; }

/* ---------- placeholders ---------- */
.placeholder {
  border: 2px dashed var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--muted); background: var(--bg-alt); padding: 16px;
}
.media-16x9 { aspect-ratio: 16 / 9; }

.teaser { padding-top: 8px; }
.teaser-caption { max-width: 820px; margin: 20px auto 0; text-align: center; color: var(--muted); }
.teaser-caption strong { color: var(--text); font-weight: 600; }

/* ---------- abstract ---------- */
.abstract { text-align: justify; hyphens: auto; }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 32px 0 8px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 10px; text-align: center; display: flex; flex-direction: column;
}
.stat .num { font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1.2; }
.stat .lbl { font-size: 13px; color: var(--muted); }
.contrib { padding-left: 20px; }
.contrib li { margin-bottom: 6px; }

/* ---------- benchmark ---------- */
.tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 24px; }
.task, .card, .metric {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.task { padding-top: 12px; }
.task-media {
  position: relative; aspect-ratio: 16 / 9; margin: 0 0 12px;
  border-radius: 6px; overflow: hidden; background: var(--bg-alt);
  border: 1px dashed var(--border);
}
.task-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s; }
.task-media.has-video { border-style: solid; }
.task-media.playing video { opacity: 1; }
.task-media-ph[hidden] { display: none; }
.task-media-ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted);
}
.task-media-hint {
  position: absolute; right: 6px; bottom: 6px; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; opacity: 0; transition: opacity .2s;
}
.task-media.has-video .task-media-hint { opacity: 1; }
.task-media.playing .task-media-hint { opacity: 0; }
.task.has-video:hover { border-color: var(--accent); }
.task p, .metric p { margin: 0; font-size: 15px; color: var(--muted); }
.tid {
  display: inline-block; font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 500;
  color: var(--accent); margin-bottom: 4px;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two-col.align-center { align-items: center; }

.tag {
  display: inline-block; font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 500;
  padding: 1px 8px; border-radius: 6px; background: var(--bg-alt); border: 1px solid var(--border);
}
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
/* variant grid: memory (rows) x environment (columns) */
.variant-task {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  margin: 20px 0 14px; font-size: 15px;
}
.variant-task .tid { margin: 0; }
.variant-target { color: var(--muted); font-size: 14px; }
.variant-scroll {
  overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); background: var(--surface);
}
.variant-grid { table-layout: fixed; font-size: 14.5px; }
.variant-grid th, .variant-grid td {
  border: 1px solid var(--border); padding: 12px 10px; vertical-align: middle; text-align: center;
  text-transform: none; letter-spacing: 0;
}
.variant-grid tr > :first-child { border-left: 0; }
.variant-grid tr > :last-child { border-right: 0; }
.variant-grid thead tr:first-child > * { border-top: 0; }
.variant-grid tbody tr:last-child > * { border-bottom: 0; }
.variant-grid thead th { background: var(--bg-alt); color: var(--text); }
.variant-grid small { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-top: 6px; line-height: 1.3; }

.variant-grid .corner { width: 120px; font-size: 12px; font-weight: 500; color: var(--muted); }
.variant-grid .axis-col { display: block; text-align: right; }
.variant-grid .axis-row { display: block; text-align: left; margin-top: 10px; }

/* memory condition colours: accurate / incomplete / outdated */
.m-acc { --m: #2e8b57; --m-bg: #e8f5ee; }
.m-inc { --m: #b7791f; --m-bg: #fdf3e1; }
.m-out { --m: #c0392b; --m-bg: #fbeae8; }
.variant-grid tbody td { background: var(--m-bg); color: var(--text); font-weight: 500; line-height: 1.35; }
.variant-grid .mem-head {
  background: var(--surface); color: var(--m); font-size: 15px; font-weight: 700; text-align: left;
  border-left: 4px solid var(--m);
}
.variant-grid tr > .mem-head:first-child { border-left: 4px solid var(--m); }
.base-label { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--m); margin-bottom: 2px; }
.variant-grid td.highlight { box-shadow: inset 0 0 0 2px var(--m); }

.grid-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 13.5px; color: var(--muted); }
.grid-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.grid-legend .lg i { width: 12px; height: 12px; border-radius: 3px; background: var(--m-bg); border: 2px solid var(--m); }
.grid-note { font-size: 13.5px; color: var(--muted); margin-top: 6px; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ---------- planners ---------- */
.planners { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.planner {
  background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--c);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.planner h4 { color: var(--c); font-size: 19px; }
.planner .sub { font-weight: 500; margin: 0 0 8px; font-size: 15px; }
.planner p { margin: 0; font-size: 15px; color: var(--muted); }
.planner .sub { color: var(--text); }
.react { --c: var(--react); }
.vlm   { --c: var(--vlm); }
.tru   { --c: var(--tru); }
.c-react { color: var(--react); font-weight: 600; }
.c-vlm   { color: var(--vlm); font-weight: 600; }
.c-tru   { color: var(--tru); font-weight: 600; }

.diagram-legend {
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 22px;
  margin: 20px 0 12px; font-size: 13.5px; color: var(--muted);
}
.lg-item { display: inline-flex; align-items: center; gap: 8px; }
.lg-line { width: 28px; height: 4px; stroke-width: 2; stroke-linecap: round; }
.lg-line.solid { stroke: var(--text); }
.lg-line.muted { stroke: #5b6b7f; }
.planner-rows { display: flex; flex-direction: column; gap: 16px; }
.planner-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 28px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--c);
  border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow);
}
.planner-text h4 { color: var(--c); font-size: 19px; }
.planner-text .sub { font-weight: 500; margin: 0 0 8px; font-size: 15px; }
.planner-text p:not(.sub) { margin: 0; font-size: 15px; color: var(--muted); }
.planner-diagram { width: 100%; height: auto; }

/* ---------- results ---------- */
.headline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.hl {
  border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: var(--radius);
  padding: 14px 18px; display: flex; flex-direction: column; background: var(--surface);
}
.hl .num { font-size: 30px; font-weight: 700; color: var(--c); line-height: 1.2; }
.hl .lbl { font-weight: 500; }
.hl .sub { color: var(--muted); font-size: 14px; }

figure { margin: 0 0 8px; }
figure img { border-radius: 8px; border: 1px solid var(--border); width: 100%; }
figcaption { font-size: 14.5px; color: var(--muted); margin-top: 10px; }

.mem-table caption { caption-side: top; text-align: left; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.mem-table td:not(:first-child), .mem-table th:not(:first-child) { text-align: center; font-variant-numeric: tabular-nums; }
.mem-table tr td:first-child { font-weight: 600; color: var(--c); }
.mem-table td { color: var(--c); }
.mem-table td.best { font-weight: 700; background: color-mix(in srgb, var(--c) 12%, transparent); }

/* failure / inefficiency heatmap tables */
.finding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.finding-fig { margin: 0; }
.finding-scroll {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.finding-table { --heat: #3b7dd8; table-layout: fixed; font-size: 13.5px; }
.finding-table caption {
  caption-side: top; text-align: left; font-weight: 700; font-size: 14.5px; color: var(--text);
  padding: 10px 12px 6px;
}
.finding-table caption span { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.finding-table th, .finding-table td { border-bottom: 1px solid var(--border); padding: 6px 8px; vertical-align: middle; }
.finding-table tbody tr:last-child > * { border-bottom: 0; }
.finding-table thead th { width: 22%; text-align: center; color: var(--c); font-size: 11.5px; white-space: nowrap; padding-left: 4px; padding-right: 4px; text-transform: none; letter-spacing: 0; line-height: 1.25; }
.finding-table thead th:first-child { width: auto; text-align: left; color: var(--muted); }
.finding-table thead small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.finding-table tbody th { font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 13px; line-height: 1.3; cursor: help; }
.finding-table td {
  text-align: center; font-variant-numeric: tabular-nums; color: var(--text);
  background: color-mix(in srgb, var(--heat) calc(var(--h) * .55), var(--surface));
  border-left: 2px solid var(--surface);
}
.finding-table td.max { font-weight: 700; }
.finding-fig figcaption { font-size: 13.5px; }

.callout {
  margin-top: 28px; padding: 18px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}

/* ---------- rollouts ---------- */
.video-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.video-grid video { width: 100%; border-radius: var(--radius); }

/* ---------- bibtex ---------- */
.bib { position: relative; }
.bib pre {
  margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; overflow-x: auto; line-height: 1.5;
}
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  font: inherit; font-size: 13px; padding: 4px 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg-alt); color: var(--text);
}
.copy-btn:hover { border-color: var(--muted); }

/* ---------- citations ---------- */
.cite { font-size: .68em; font-weight: 400; color: var(--muted); margin-left: 2px; vertical-align: .35em; white-space: nowrap; }
.cite:hover { color: var(--accent); text-decoration: none; }
.references { padding: 40px 0; }
.references h2 { font-size: 18px; margin-bottom: 10px; }
.ref-list { font-size: 13px; line-height: 1.5; color: var(--muted); list-style: none; padding: 0; margin: 0; counter-reset: ref; }
.ref-list li { counter-increment: ref; position: relative; padding-left: 34px; margin-bottom: 5px; }
.ref-list li::before { content: "[" counter(ref) "]"; position: absolute; left: 0; }
.ref-list li:target { background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 4px; }

.footer { padding: 32px 0; font-size: 14px; color: var(--muted); border-top: 1px solid var(--border); }

/* ---------- responsive ---------- */
.tasks > *, .two-col > *, .metrics > *, .planners > *, .headline > *, .video-grid > * { min-width: 0; }
@media (max-width: 860px) {
  .planners, .headline, .metrics, .video-grid, .two-col, .planner-row { grid-template-columns: 1fr; }
  .planner-row { gap: 16px; padding: 18px; }
  .diagram-legend { justify-content: flex-start; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .nav-links { display: none; }
  .hero { padding-top: 48px; }
  .section { padding: 48px 0; }
  .variant-grid { font-size: 12px; }
  .variant-grid th, .variant-grid td { padding: 8px 4px; hyphens: auto; overflow-wrap: anywhere; }
  .variant-grid .corner { width: 74px; font-size: 10.5px; }
  .variant-grid .mem-head { font-size: 12px; padding-left: 6px; }
  .variant-grid small { font-size: 11px; }
  .variant-grid .tag { font-size: 10px; padding: 1px 4px; }
  .base-label { font-size: 9px; }
  .mem-table th, .mem-table td { padding: 8px 6px; }
  .finding-grid { grid-template-columns: 1fr; }
}
