/* =================================================================
   DriveBlox project page: warm editorial light theme
   ================================================================= */

:root {
  --bg: #fbf8f2;          /* warm paper */
  --bg-2: #f3ede1;        /* beige band */
  --surface: #fffdf9;
  --surface-2: #f7f2e8;
  --ink: #1f1b16;
  --ink-2: #4a433a;
  --muted: #7b7366;
  --faint: #aaa192;
  --line: #e7dfd0;
  --line-2: #d4c8b3;

  --accent: #c2552d;      /* terracotta, echoes the vehicle blocks */
  --accent-ink: #a5421c;
  --accent-wash: rgb(194 85 45 / .09);
  --accent-mark: rgb(236 150 80 / .32);

  --code-bg: #221d18;
  --code-ink: #efe6d8;

  --font-sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 12px;
  --aspect: 3 / 2;
  --maxw: 1180px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
img { max-width: 100%; }
::selection { background: var(--accent-mark); }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: clamp(16px, 4vw, 48px);
}

code { font-family: var(--font-mono); font-size: .86em; }
:not(pre) > code {
  padding: .08em .4em;
  border-radius: 4px;
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.mark {
  background: linear-gradient(180deg, transparent 58%, var(--accent-mark) 58%);
  color: var(--ink);
  font-weight: 600;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding-block: 28px clamp(48px, 7vw, 88px);
  background:
    radial-gradient(900px 480px at 92% -10%, rgb(236 150 80 / .16), transparent 70%),
    radial-gradient(700px 420px at -10% 110%, rgb(194 85 45 / .07), transparent 70%);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(40px, 6vw, 72px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-decoration: none;
}

.hero-meta, .kicker, .card-k, .step-n, .codeblock-tag, .hero-cap {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.hero-meta { color: var(--muted); font-size: 12px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}
@media (min-width: 980px) {
  .hero-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; }
}

.hero-title {
  margin: 0;
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.hero-thesis {
  margin: 22px 0 0;
  color: var(--ink-2);
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.5;
}
.hero-thesis strong { color: var(--ink); font-weight: 600; }
.hero-thesis .arr { color: var(--accent); }
.hero-thesis .hl { color: var(--accent); font-weight: 700; }   /* "blocks-level" emphasis */
.hero-thesis .nw { white-space: nowrap; }
.sub .hl { color: var(--accent); }   /* "General Video" emphasis */


.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.btn {
  display: inline-flex;
  align-items: center;
  padding: 11px 22px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.btn-solid { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.is-disabled { opacity: .5; pointer-events: none; }

.hero-cap { margin: 10px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

/* ---------- sticky nav ---------- */

.toc {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding-inline: 16px;
  margin-top: -22px;
  margin-bottom: clamp(28px, 3.5vw, 44px);   /* room between the bar and the first section rule */
  pointer-events: none;
}
.toc .wrap {
  display: flex;
  gap: 2px;
  width: auto;
  max-width: 100%;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 253 249 / .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 24px rgb(80 60 30 / .10);
  pointer-events: auto;
}
.toc a {
  flex: none;
  padding: 6px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s, background-color .15s;
}
.toc a:hover { color: var(--ink); background: var(--surface-2); }
.toc a.is-active { color: var(--bg); background: var(--ink); }

/* ---------- sections ---------- */

.section { padding-block: clamp(64px, 8vw, 112px); border-top: 1px solid var(--line); }
.section.bg { background: var(--bg-2); }

.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.kicker .kn { color: var(--accent-ink); }
.kicker::after { content: ""; width: 34px; height: 1px; background: var(--line-2); }

.sec-head { display: grid; gap: 20px; margin-bottom: clamp(32px, 5vw, 56px); }
@media (min-width: 900px) {
  .sec-head.split { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 48px; align-items: end; }
}

.sec-title {
  margin: 0;
  font-size: clamp(32px, 4.4vw, 54px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.sec-title em { font: inherit; color: inherit; }   /* titles stay plain black (no italic accent) */
#bibtex .sec-title { margin-bottom: 24px; }

.sec-lede { margin: 0; color: var(--ink-2); font-size: clamp(16px, 1.4vw, 19px); line-height: 1.55; }
.sec-lede strong { color: var(--ink); font-weight: 600; }
.tldr { display: grid; gap: 12px; padding-left: 1.4em; }   /* 01 TL;DR: three numbered points */
#abstract .sec-head.split { align-items: start; }   /* title top-aligned with the list (the list is taller than the title) */
.tldr li { padding-left: .2em; }
.tldr li::marker { color: var(--accent); font-weight: 700; }
.tldr .hl { color: var(--accent); font-weight: 600; }   /* highlighted key terms */
.tldr-gen { color: var(--ink); font-weight: 700; }   /* "general method" line, links to #general */
.tldr-gen a { color: #1a56db; text-decoration: none; }   /* link: standard link blue + chain-link icon, no underline */
.tldr-gen a::after { content: ""; display: inline-block; width: .8em; height: .8em; margin-left: .18em; vertical-align: -.06em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E") center / contain no-repeat; }
.tldr-gen a:hover { color: #1e40af; }


.sub { margin: clamp(48px, 6vw, 72px) 0 10px; font-size: clamp(20px, 2vw, 24px); font-weight: 700; letter-spacing: -.015em; }
.desc { margin: 0 0 20px; color: var(--muted); font-size: 15px; max-width: 78ch; }

/* ---------- overview steps ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (max-width: 860px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.steps a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.steps a:hover { border-color: var(--line-2); transform: translateY(-2px); }
.steps b { font-size: 22px; letter-spacing: -.02em; }
.steps span:last-child { color: var(--ink-2); font-size: 15px; }
.step-n { color: var(--accent-ink); font-size: 11px; }

/* ---------- cards ---------- */

.cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0 0;
}
@media (max-width: 860px) { .cols { grid-template-columns: minmax(0, 1fr); } }

.card {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14.5px;
}
.card-k { margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.card h4 { margin: 0 0 10px; font-size: 18px; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--ink-2); }
/* 03 (a): the agent and its six perception tools */
.tool-ring { display: block; width: 100%; max-width: 360px; margin: 6px auto 0; overflow: visible; }
.tool-ring .ring { fill: none; stroke: var(--line-2); stroke-width: 1.5; stroke-dasharray: 3 5; }
.tool-ring .spoke { stroke: var(--line-2); stroke-width: 1; }
.tool-ring .dot { fill: var(--accent); }
.tool-ring .hub { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
.tool-ring text { fill: var(--ink-2); font-size: 13px; font-weight: 500; }
.tool-ring .hub-t { fill: var(--ink); font-size: 12.5px; font-weight: 700; }
.tool-ring.loop { margin-top: 14px; }
.tool-ring .arc { fill: none; stroke: var(--accent); stroke-width: 1.8; }
.tool-ring .arrowhead { fill: var(--accent); }
.card .mini-code { margin: 16px 0 0; padding: 14px 16px; border-radius: 10px; background: var(--code-bg); color: var(--code-ink); font: 12px/1.6 var(--font-mono); overflow-x: auto; }
.card .mini-code code { font-size: inherit; }
.card .mini-code .c { color: #9c8f7c; }
.card .mini-code .s { color: #f0b37e; }
.card ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.card li + li { margin-top: 7px; }
.card b { color: var(--ink); }

.is-ours > a, .card.is-ours {
  border-color: rgb(194 85 45 / .45);
  box-shadow: inset 3px 0 0 var(--accent);
  background: linear-gradient(135deg, var(--accent-wash), var(--surface) 60%);
}
.card.is-ours .card-k { color: var(--accent-ink); }

/* ---------- 04 results as charts (no boxes: each chart sits under a thin rule) ---------- */

.kv-charts { --dense: #2f6db5; --base: #868b91; margin: 36px 0 0; }
.kvc-row { display: grid; gap: 30px 44px; }
.kvc-row.single { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr) minmax(0, 1.15fr); }
@media (max-width: 860px) { .kvc-row.single { grid-template-columns: minmax(0, 1fr); } }   /* phone: one under another */
.kvc { margin: 0; padding-top: 12px; border-top: 1px solid var(--line-2); }
.kvc figcaption { margin: 0 0 14px; }
.kvc figcaption b { display: block; color: var(--ink); font-size: 17px; letter-spacing: -.01em; }
.kvc figcaption span { display: block; margin-top: 2px; color: var(--muted); font-size: 13.5px; }
.hbars { display: grid; gap: 2px; }
.hb { --lw: 112px; display: grid; grid-template-columns: var(--lw) minmax(0, 1fr); align-items: center; gap: 10px; min-height: 26px; outline: none; cursor: default; }
.hb-l { overflow: hidden; color: var(--ink-2); font-size: 13.5px; white-space: nowrap; text-overflow: ellipsis; }
.hb.is-ours .hb-l { color: var(--ink); font-weight: 600; }
.hb-t { display: flex; align-items: center; gap: 7px; min-width: 0; height: 14px; }
.hb-t i { flex: none; width: calc(var(--v) * (100% - var(--vw, 46px))); min-width: 3px; height: 100%; border-radius: 0 4px 4px 0; background: var(--base); transition: filter .12s; }
.hb.is-ours .hb-t i { background: var(--accent); }
.hb.dense .hb-t i { background: var(--dense); }
.hb:hover .hb-t i, .hb:focus-visible .hb-t i { filter: brightness(.88); }
.hb-v { flex: none; color: var(--ink-2); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb.is-ours .hb-v { color: var(--ink); }
.kvc-note { margin: 10px 0 0; color: var(--ink-2); font-size: 13.5px; }
.kvc-note b { color: var(--ink); }
.kvc-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: -4px 0 12px; color: var(--ink-2); font-size: 13px; }
.kvc-legend .sw { display: inline-block; width: 10px; height: 10px; margin: 0 2px 0 12px; border-radius: 2px; }
.kvc-legend .sw:first-child { margin-left: 0; }
.sw.dense { background: var(--dense); }
.sw.ours { background: var(--accent); }
.cost { --vw: 86px; }
.cost .hb { grid-template-columns: minmax(0, 1fr); min-height: 20px; }
.cg + .cg { margin-top: 12px; }
.cg-h { display: flex; justify-content: space-between; margin-bottom: 3px; color: var(--ink-2); font-size: 13.5px; }
.cg-h b { color: var(--ink); font-weight: 700; }
.cache { position: relative; min-height: 200px; }
.cache-svg { display: block; overflow: visible; font-family: var(--font-sans); }
.cache-svg .g { stroke: var(--line-2); stroke-width: 1; }
.cache-svg .g.base { stroke: var(--faint); }
.cache-svg .yt, .cache-svg .xt { fill: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cache-svg .yt { text-anchor: end; }
.cache-svg .xt { text-anchor: middle; }
.cache-svg .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cache-svg .dense { stroke: var(--dense); }
.cache-svg .ours { stroke: var(--accent); }
.cache-svg circle.dense { fill: var(--dense); }
.cache-svg circle.ours { fill: var(--accent); }
.cache-svg circle { stroke: var(--bg-2); stroke-width: 2; }
.cache-svg .en { fill: var(--ink); font-size: 12.5px; font-weight: 700; }
.cache-svg .ev { fill: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.cache-svg .ratio { fill: var(--ink); font-size: 26px; font-weight: 800; letter-spacing: -.02em; text-anchor: end; }
.cache-svg .ratio-s { fill: var(--ink-2); font-size: 13px; text-anchor: end; }
.cache-svg .xh { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 3; }
.cache-svg .hit { fill: transparent; cursor: crosshair; }
.kvc-tip { position: fixed; z-index: 60; padding: 6px 9px; border-radius: 6px; background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.35; white-space: nowrap; pointer-events: none; box-shadow: 0 6px 18px -8px rgb(0 0 0 / .45); }
.kvc-tip[hidden] { display: none; }

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0 0;
}
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stats div {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.stats b { display: block; color: var(--accent-ink); font-size: clamp(26px, 3vw, 34px); line-height: 1.15; letter-spacing: -.02em; }
.stats span { color: var(--ink-2); font-size: 13.5px; }

/* ---------- code ---------- */

.codeblock {
  position: relative;
  margin-top: 28px;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  overflow-x: auto;
}
.codeblock pre { margin: 0; padding: 44px 22px 22px; font: 13.5px/1.65 var(--font-mono); }
.codeblock-tag { position: absolute; top: 14px; left: 22px; color: #a69a88; font-size: 11px; }
.codeblock .c { color: #9a8f7e; }
.codeblock .s { color: #a8d08d; }
.codeblock .n { color: #f2b27a; }

/* ---------- placeholders ---------- */


.ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgb(120 90 50 / .045) 14px 28px),
    var(--surface-2);
}
.ph-label { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.ph code { color: var(--muted); font: 11px/1.3 var(--font-mono); word-break: break-all; background: none; padding: 0; }
.is-loaded > .ph, .is-loaded .ph { display: none; }

/* ---------- media ---------- */

.slot { margin: 0; min-width: 0; }

.slot-media, .img-slot, .wipe, .explainer {
  position: relative;
  aspect-ratio: var(--aspect);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.slot-media video, .wipe video, .img-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.explainer { aspect-ratio: 16 / 9; box-shadow: 0 18px 50px -24px rgb(80 50 20 / .35); }
.explainer video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }

.slot figcaption { margin-top: 7px; color: var(--muted); font-size: 13px; text-align: center; }
.slot.is-ours figcaption { color: var(--accent-ink); font-weight: 600; }
.slot.is-ours .slot-media { border: 2px solid var(--accent); }

.img-slot { aspect-ratio: 21 / 9; }
.img-slot img { object-fit: contain; background: #fff; }

/* ---------- teaser wipe ---------- */

.wipe {
  --pos: 50%;
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
  box-shadow: 0 24px 60px -28px rgb(80 50 20 / .4);
}
.wipe .layer { position: absolute; inset: 0; }
.wipe .layer.top { clip-path: inset(0 0 0 var(--pos)); }
.wipe .layer.bottom .ph { padding-right: 50%; }
.wipe .layer.top .ph { padding-left: 50%; background-color: var(--bg-2); }
.wipe .handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: #fff;
  pointer-events: none;
}
.wipe .handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f1b16' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l-5 6 5 6M15 6l5 6-5 6'/%3E%3C/svg%3E") center / 20px no-repeat;
  box-shadow: 0 2px 10px rgb(0 0 0 / .25);
}
.wipe .tag {
  position: absolute;
  top: 10px;
  padding: 3px 9px;
  border-radius: 4px;
  background: rgb(31 27 22 / .7);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}
.wipe .tag.left { left: 10px; }
.wipe .tag.right { right: 10px; }
.wipe .tag.loc {                                  /* gallery location tag (landmark drives): bottom-left, map pin */
  top: auto;
  bottom: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 8px;
  font-size: 13px;
}
.wipe .tag.loc[hidden] { display: none; }
.wipe .tag.loc::before {
  content: "";
  width: 12px;
  height: 14px;
  flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 28'%3E%3Cpath fill='%23fff' fill-rule='evenodd' d='M12 0C5.4 0 0 5.2 0 11.6 0 19.8 12 28 12 28s12-8.2 12-16.4C24 5.2 18.6 0 12 0zm0 16.2a4.6 4.6 0 1 1 0-9.2 4.6 4.6 0 0 1 0 9.2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- comparison blocks ---------- */

.compare {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(80 60 30 / .05);
}

/* one row of tabs: the ones that do not fit scroll sideways (no wrapping), with a fade on the clipped side */
.tabs { position: relative; display: flex; flex-wrap: nowrap; gap: 6px; margin-bottom: 12px; padding: 2px 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); }
.tabs.fade-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent); }
.tabs.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent); }
.tab {
  flex: none;
  white-space: nowrap;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.tab:hover { color: var(--ink); border-color: var(--line-2); }
.tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }

.grid-row {
  display: grid;
  grid-template-columns: var(--cols, repeat(var(--n), minmax(0, 1fr)));
  gap: 10px;
}
.grid-row + .grid-row { margin-top: 12px; }

.panel[hidden] { display: none; }

@media (max-width: 720px) {
  .grid-row { grid-template-columns: repeat(min(var(--n), 2), minmax(0, 1fr)); }
}

.sync { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.sync button {
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}
.sync .track { position: relative; flex: 1; }
.sync input[type=range] { width: 100%; margin: 0; accent-color: var(--accent); }
.sync .time { flex: none; min-width: 88px; color: var(--muted); font: 12px var(--font-mono); text-align: right; }
.sync .speed {
  flex: none;
  padding: 4px 6px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}
.marker {
  position: absolute;
  top: -18px;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- bibtex ---------- */

.bib {
  position: relative;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-ink);
  overflow-x: auto;
}
.bib pre { margin: 0; padding: 22px; font: 13.5px/1.6 var(--font-mono); }
.copy {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  border: 1px solid rgb(255 255 255 / .2);
  border-radius: 6px;
  background: rgb(255 255 255 / .06);
  color: var(--code-ink);
  font: 12px var(--font-sans);
  cursor: pointer;
}
.copy:hover { background: rgb(255 255 255 / .12); }

/* ---------- footer ---------- */

footer { padding-block: 40px 56px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer .wrap { display: flex; justify-content: center; }

/* ---------- authors ---------- */

.authors { margin-top: 24px; }
.author-list { margin: 0; font-size: 16.5px; line-height: 1.75; color: var(--ink); }
.author-list a {
  text-decoration: none;
  background: linear-gradient(var(--accent-mark), var(--accent-mark)) 0 100% / 100% 0 no-repeat;
  transition: background-size .15s;
}
.author-list a:hover { background-size: 100% 40%; }
.author-list sup, .affils sup { color: var(--accent-ink); font-weight: 600; font-size: .68em; margin-left: 1px; }
.affils { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 10px 0 0; color: var(--muted); font-size: 14px; }

/* overview summary video sits between the header and the step cards */
.explainer.summary { margin-bottom: 28px; }
/* overview teaser figure (in place of the summary video since 12-01): white card, click opens the full-size image */
.teaser-fig { margin: 0 0 28px; padding: clamp(6px, 1.2vw, 14px); background: #fff; border: 1px solid rgb(80 50 20 / .12); border-radius: var(--radius); box-shadow: 0 14px 40px -28px rgb(80 50 20 / .3); }
.teaser-fig a { display: block; cursor: zoom-in; }
.teaser-fig img { display: block; width: 100%; height: auto; }
.ov-tabs { margin-bottom: 28px; }
.ov-tabs .teaser-fig, .ov-tabs .explainer.summary { margin-bottom: 0; }
.author-list sup .fn { margin-left: 1px; }
.footnote { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.footnote sup { color: var(--accent-ink); font-weight: 600; margin-right: 2px; }

/* ---------- merged results (blue / orange outline legend, footnotes) ---------- */
.desc .c1 { color: #2f7fe0; font-weight: 600; }
.desc .c2 { color: #d9761a; font-weight: 600; }
.desc-gap { margin-top: 36px; }
.note.footnote-note { margin: 12px 0 0; max-width: 92ch; padding: 0 0 0 12px; border-left: 2px solid var(--line-2); color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.note.footnote-note b { color: var(--ink-2); font-weight: 600; }


/* review fixes (11-19) */
.stats span { display: block; line-height: 1.45; }
.sub { line-height: 1.25; }

/* paper figure (section 04 headliner) */
.figure { margin: 0; }
.figure .img-slot { aspect-ratio: 2400 / 1029; background: #fff; box-shadow: 0 18px 50px -24px rgb(80 50 20 / .25); }
.figure figcaption { margin: 12px auto 0; max-width: 92ch; color: var(--muted); font-size: 14px; text-align: center; }

/* larger teaser (user 11-19): the hero is wider than the content column and the video takes the larger share */
.hero .wrap { max-width: 1360px; }
@media (min-width: 980px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 48px; }
}

.card .card-lead { margin: 0 0 10px; color: var(--ink-2); }

/* memory token-bank animation (overview) */
.explainer.memory-bank { aspect-ratio: 2160 / 1560; max-width: 1100px; margin: 0 auto; background: #faf7f2; }
.explainer.memory-bank video { background: #faf7f2; }

/* subsection inside a section (11-20): a ruled group heading with smaller experiment headings under it */
.subsection { margin-top: clamp(56px, 7vw, 88px); padding-top: clamp(28px, 3.5vw, 40px); border-top: 1px solid var(--line, rgb(0 0 0 / .1)); }
.subsection .sub-group { margin-top: 0; font-size: clamp(22px, 2.3vw, 28px); }
.sub-minor { margin: clamp(36px, 4.5vw, 52px) 0 8px; font-size: clamp(17px, 1.6vw, 20px); font-weight: 650; letter-spacing: -.01em; line-height: 1.3; }

/* Section 3 edit-agent clip (11-20): compact, in place of the agent-session player */
.explainer.edit-agent { aspect-ratio: 16 / 9; max-width: 820px; margin: 0 auto; background: #fbf8f2; }
.explainer.edit-agent video { background: #fbf8f2; }

/* explainer frames: no black edge (the video box takes the frame colour), light shadow, a play button in place of the native bar */
.explainer.summary { background: #fbf7f1; border-color: rgb(80 50 20 / .12); box-shadow: 0 14px 40px -28px rgb(80 50 20 / .3); }
.explainer.summary video { background: #fbf7f1; object-fit: cover; }
.play-btn { position: absolute; left: 50%; top: 50%; z-index: 2; width: 76px; height: 76px; margin: -38px 0 0 -38px; border: 0; border-radius: 50%; background: var(--accent, #c2552d); box-shadow: 0 10px 28px -10px rgb(80 40 20 / .55); cursor: pointer; transition: transform .15s, background .15s; }
.play-btn::before { content: ""; position: absolute; left: 30px; top: 23px; border-style: solid; border-width: 15px 0 15px 24px; border-color: transparent transparent transparent #fff; }
.play-btn:hover { transform: scale(1.06); }
.play-btn:focus-visible { outline: 3px solid var(--accent-mark, #f0a77f); outline-offset: 3px; }
.explainer.summary .play-btn { top: 76%; }   /* between the subtitle and the step bar of the title card */
/* logo in front of the page title */
.hero-title .title-logo { display: inline-block; width: auto; height: .86em; margin: 0 .3em 0 0; vertical-align: -.06em; }

/* ---------- BEV route beside the long-horizon grid ---------- */
.bev-body { display: grid; grid-template-columns: minmax(0, 1fr) clamp(120px, 16%, 200px); gap: 12px; align-items: stretch; }
.bev { display: flex; flex-direction: column; min-width: 0; margin: 0; }
.bev-map { position: relative; flex: 1 1 auto; min-height: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #eee8dc; }
.bev-map svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bev figcaption { margin-top: 7px; color: var(--muted); font-size: 13px; text-align: center; }
.bev-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 10px; margin-top: 3px; color: var(--muted); font-size: 12px; }
.bev-key { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.bev-key::before { content: ""; width: 14px; height: 3px; border-radius: 2px; background: var(--c); }
.bev-ground { fill: #eee8dc; }
.bev-blocks polygon { fill: #e2dacb; }
.bev-road-edge polyline, .bev-road polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.bev-road-edge polyline { stroke: #cfc5b3; stroke-width: var(--edge-w, 4.4); }
.bev-road polyline { stroke: #fbfaf6; stroke-width: 3.6; }
.bev-cross polygon { fill: #fbfaf6; stroke: #ddd3c2; stroke-width: .25; }
.bev-route-faint polyline, .bev-route polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.bev-route-faint polyline { stroke-width: var(--faint-w, 1); opacity: .3; }
.bev-route polyline { stroke-width: var(--route-w, 1.4); }
.bev-ego path { fill: #1f1d1a; stroke: #fff; stroke-linejoin: round; }
.bev-scale line { stroke: #4a453d; }
.bev-label { fill: #4a453d; font-family: inherit; font-weight: 600; }
@media (max-width: 720px) {
  .bev-body { grid-template-columns: minmax(0, 1fr); }
  .bev-map { flex: none; aspect-ratio: 2.78 / 1; }
}
.footnote + .footnote { margin-top: 2px; }
.nowrap { white-space: nowrap; }

/* ---------- results gallery ---------- */

.hero-right { min-width: 0; }
.g-kicker { margin-bottom: 14px; }
.hero .g-cats { gap: 8px; }
.hero .g-cat { width: 90px; }
.hero .g-cover { border-radius: 6px; }
.hero .g-name { margin-top: 6px; font-size: 11px; line-height: 1.25; min-height: 2.5em; }   /* two lines reserved: cards stay aligned */

.g-cats, .g-items {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.g-cats {          /* the padding (and matching scroll-padding) keeps the active outline, 4px outside the cover, inside the
                      scrolled area; the negative margin keeps the covers aligned with the content edge */
  gap: 14px;
  align-items: flex-start;
  margin-inline: -8px;
  padding: 6px 8px 10px;
  scroll-padding-inline: 8px;
  scroll-snap-type: x proximity;
}
.g-cat {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: clamp(148px, 16vw, 184px);
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
}
.g-cover {
  display: block;
  aspect-ratio: 3 / 2;
  border-radius: 10px;
  overflow: hidden;
  outline: 2px solid transparent;
  outline-offset: 2px;
  background: var(--surface-2);
  box-shadow: 0 8px 22px -14px rgb(80 50 20 / .45);
  transition: outline-color .15s;
}
.g-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.g-cat:hover .g-cover img { transform: scale(1.04); }
.g-name { display: block; margin-top: 9px; font-size: 14px; font-weight: 600; line-height: 1.3; transition: color .15s; }
.g-cat:hover .g-name { color: var(--ink-2); }
.g-word { white-space: nowrap; }
.g-cat.is-active .g-cover { outline-color: var(--accent); }
.g-cat.is-active .g-name { color: var(--ink); }

.g-items { gap: 6px; margin: 12px -5px 12px; padding: 5px; scroll-padding-inline: 5px; }
.g-item {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  aspect-ratio: 3 / 2;
  padding: 0;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  outline: 2px solid transparent;
  outline-offset: 1px;
  background: var(--surface-2);
  opacity: .62;
  cursor: pointer;
  transition: opacity .15s, outline-color .15s;
}
.g-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.g-item:hover { opacity: .9; }
.g-item.is-active { opacity: 1; outline-color: var(--accent); }
.g-prog { position: absolute; left: 0; bottom: 0; width: 0; height: 2px; background: var(--accent); }

.g-stage { aspect-ratio: 3 / 2; width: min(100%, calc(80vh * 1.5)); margin-inline: auto; }
.g-stage .layer video { background: #000; }
.gallery .hero-cap { margin-top: 12px; }

/* 2x2 weather grid (categories with grid: true): one composited video, labels on top */
.g-stage.is-grid { cursor: default; }
.g-stage.is-grid .layer.top { clip-path: none; }
.g-stage.is-grid .layer.bottom, .g-stage.is-grid .handle, .g-stage.is-grid > .tag { display: none; }
.g-glabels { display: none; position: absolute; inset: 0; pointer-events: none; }
.g-stage.is-grid .g-glabels { display: block; }
.g-gl {
  position: absolute;
  padding: 3px 9px;
  border-radius: 4px;
  background: rgb(31 27 22 / .7);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.g-gl.tl { top: 10px; left: 10px; }
.g-gl.tr { top: 10px; right: 10px; }
.g-gl.bl { bottom: 10px; left: 10px; }
.g-gl.br { bottom: 10px; right: 10px; }
.g-gl.in { top: calc(62.3% + 6px); left: 50%; transform: translateX(-50%); }   /* just under the baked-in canvas inset */

@media (max-width: 720px) {
  .g-cat, .hero .g-cat { width: 84px; }
  .g-name, .hero .g-name { font-size: 10px; }
  .g-item { width: 34px; }
  .g-gl { padding: 2px 6px; font-size: 10px; }
  .g-gl.tl, .g-gl.tr { top: 6px; }
  .g-gl.bl, .g-gl.br { bottom: 6px; }
  .g-gl.tl, .g-gl.bl { left: 6px; }
  .g-gl.tr, .g-gl.br { right: 6px; }
  .g-gl.in { top: calc(62.3% + 4px); }
}

/* 03 zero-shot group (11-30): one larger heading, the two experiments close under it */
.subsection.tight .sub-group + .desc { margin-bottom: 0; }
.subsection.tight .sub-minor { margin-top: clamp(30px, 3.4vw, 40px); }
.subsection.tight .sub-group + .desc + .sub-minor { margin-top: 18px; }

/* 02 card (a) Perception (11-30): tool tiles with each model's output on one frame (replaces the tool ring);
   compact 3 x 2 grid, names only (roles in the tooltip) so card (a) is no taller than (b) and (c) */
.card .card-lead { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; }
.tool { margin: 0; }
.tool img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; border: 1px solid var(--line, rgb(0 0 0 / .08)); }
.tool figcaption { margin-top: 4px; font-size: 11.5px; line-height: 1.25; font-weight: 600; color: var(--ink); }
