/* ---------- Design tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --text: #1c1e21;
  --muted: #5f6570;
  --border: #e3e5e8;
  --accent: #d55e00;        /* vermillion: full model (paper-wide rule) */
  --accent-2: #e69f00;      /* amber: ablation */
  --placeholder-bg: #f0f2f5;
  --placeholder-fg: #8a919c;
  --max-w: 1000px;
  --radius: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; height: auto; display: block; }
.media object { width: 100%; display: block; aspect-ratio: 972 / 483; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 780px; margin-left: auto; margin-right: auto; }

/* ---------- Header ---------- */
header.hero { padding: 64px 0 28px; text-align: center; }
header.hero h1 {
  font-size: 2.6rem; line-height: 1.15; margin: 0 0 6px; letter-spacing: -0.02em; font-weight: 700;
}
header.hero h1 .short { color: var(--accent); }
header.hero .subtitle { font-size: 1.25rem; color: var(--muted); margin: 0 0 22px; }
.authors { font-size: 1.05rem; margin: 0 0 4px; }
.authors sup { font-size: 0.7em; color: var(--muted); }
.affils { color: var(--muted); font-size: 0.98rem; margin: 0 0 6px; }
.venue { font-weight: 600; margin: 8px 0 22px; }

.links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px;
  background: var(--text); color: #fff; font-weight: 600; font-size: 0.95rem;
  border: 1.5px solid var(--text);
}
.btn:hover { text-decoration: none; background: #000; }
.btn.secondary { background: transparent; color: var(--text); }
.btn.secondary:hover { background: var(--bg-alt); }
.btn svg { width: 16px; height: 16px; fill: currentColor; }

/* ---------- Sections ---------- */
section { padding: 40px 0; }
section.alt { background: var(--bg-alt); }
section h2 {
  font-size: 1.9rem; text-align: center; margin: 0 0 20px; letter-spacing: -0.01em;
}
section h3 { font-size: 1.25rem; margin: 30px 0 10px; }
section p { margin: 0 0 14px; }
.lead { font-size: 1.08rem; }
.caption { color: var(--muted); font-size: 0.93rem; text-align: center; margin: 10px auto 0; max-width: 820px; }
.caption b { color: var(--text); }

/* ---------- Media ---------- */
.media {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  background: #000;
}
.media video { width: 100%; }
figure { margin: 0; }

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid figcaption { margin-top: 8px; font-size: 0.93rem; color: var(--muted); text-align: center; }
.grid figcaption b { color: var(--text); }

/* Placeholder blocks — swap out for real figures/videos */
.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: var(--placeholder-bg); color: var(--placeholder-fg);
  border: 2px dashed #c9ced6; border-radius: var(--radius);
  padding: 20px; font-size: 0.95rem;
}
.placeholder .label { font-weight: 600; color: #6b7280; margin-bottom: 4px; }
.placeholder code { font-family: var(--mono); font-size: 0.85em; }
.ph-16x9 { aspect-ratio: 16 / 9; }
.ph-4x3 { aspect-ratio: 4 / 3; }
.ph-wide { aspect-ratio: 3 / 1; }

/* Comparison rows: label on left, tiles on right */
.compare { display: grid; grid-template-columns: 140px 1fr; gap: 14px; align-items: center; margin-bottom: 14px; }
.compare .row-label { font-weight: 600; }
.compare .row-label.ours { color: var(--accent); }
.compare .tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* Results table */
table.results { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin: 10px 0; }
table.results th, table.results td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: center; }
table.results th:first-child, table.results td:first-child { text-align: left; }
table.results thead th { border-bottom: 2px solid var(--text); }
table.results tr.ours td { font-weight: 600; color: var(--accent); }

/* Bibtex */
pre.bibtex {
  background: #1c1e21; color: #e6e6e6; padding: 18px 20px; border-radius: var(--radius);
  font-family: var(--mono); font-size: 0.86rem; line-height: 1.5; overflow-x: auto; white-space: pre;
}

footer { padding: 30px 0 50px; text-align: center; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 720px) {
  body { font-size: 16px; }
  header.hero { padding-top: 40px; }
  header.hero h1 { font-size: 1.9rem; }
  section h2 { font-size: 1.5rem; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .compare { grid-template-columns: 1fr; }
  .compare .tiles { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Additions for manuscript content ---------- */
.side { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: center; }
.side.flip { grid-template-columns: 300px 1fr; }
.side .media { background: #fff; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 26px; }
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
section.alt .card { background: #fff; }
.card h3 { margin: 0 0 8px; font-size: 1.08rem; }
.card p { margin: 0; font-size: 0.97rem; color: #33373d; }
.card .num { display: inline-block; width: 26px; height: 26px; line-height: 26px; text-align: center; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 0.85rem; margin-right: 8px; }
.callout { border-left: 4px solid var(--accent); background: var(--bg-alt); padding: 14px 18px; border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic; margin: 18px 0; }
section.alt .callout { background: #fff; }
.eyebrow { text-align: center; color: var(--accent); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.8rem; margin: 0 0 6px; }
.subsec { margin-top: 48px; }
.subsec:first-of-type { margin-top: 0; }
.media.light { background: #fff; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.stat { background: var(--bg-alt); border-radius: var(--radius); padding: 12px 14px; text-align: center; }
section.alt .stat { background: #fff; border: 1px solid var(--border); }
.stat .v { font-size: 1.5rem; font-weight: 700; }
.stat.ours .v { color: var(--accent); }
.stat .l { font-size: 0.85rem; color: var(--muted); }
table.results td.sub { padding-left: 24px; }
@media (max-width: 720px) {
  .side, .side.flip { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Research question pull-quote ---------- */
.question {
  position: relative;
  max-width: 860px;
  margin: 40px auto 36px;
  padding: 26px 48px;
  text-align: center;
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
}
.question p {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.question p em { font-style: normal; color: var(--accent); }
.question::before, .question::after {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 4.5rem; line-height: 1; color: var(--accent); opacity: 0.35;
}
.question::before { content: "\201C"; left: 8px; }
.question::after  { content: "\201D"; right: 8px; }
@media (max-width: 720px) {
  .question { padding: 20px 28px; margin: 28px auto; }
  .question p { font-size: 1.2rem; }
  .question::before, .question::after { font-size: 3rem; top: 8px; transform: none; }
  .question::after { top: auto; bottom: 8px; }
}

/* Wider media column for the Results intro video */
.side.wide { grid-template-columns: 1fr 440px; }
@media (max-width: 900px) { .side.wide { grid-template-columns: 1fr 360px; } }
@media (max-width: 720px) { .side.wide { grid-template-columns: 1fr; } }

/* Let a block extend beyond the 1000px text column, centered, up to 1320px */
.breakout {
  width: min(1400px, calc(100vw - 40px));
  margin-left: 50%;
  transform: translateX(-50%);
}

/* ---------- Dataset headings inside Results ---------- */
.subsec { margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--border); }
.subsec:first-of-type { margin-top: 40px; }
.ds-title { text-align: center; margin: 0 auto 22px; max-width: 820px; }
.ds-title .eyebrow { margin-bottom: 8px; }
.ds-title h3 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.ds-title::after {
  content: "";
  display: block;
  width: 56px; height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 16px auto 0;
}
@media (max-width: 720px) {
  .subsec { margin-top: 40px; padding-top: 28px; }
  .ds-title h3 { font-size: 1.35rem; }
}

/* Evaluation-trajectory row: identical boxes regardless of each clip's aspect ratio.
   The clips share a #181818 background, so letterboxing inside the same color is invisible. */
/* Widths are proportional to each clip's aspect ratio, so all three render at the same height
   with no letterboxing. Default column = 536x338 (1.586); .ar-232 = 1026x442 (2.321). */
.eval-row { display: flex; gap: 18px; align-items: flex-start; }
.eval-row figure { flex: 1.955 1 0; min-width: 0; }  /* SoundSpaces / AI2-THOR clips are 524x268 */
.eval-row figure.ar-232 { flex: 2.726 1 0; }  /* LoopNav clip is 1014x372 */
.eval-row .media { background: #181818; }
.eval-row .media video { width: 100%; display: block; }
.eval-row figcaption { text-align: center; }
@media (max-width: 720px) { .eval-row { flex-direction: column; } .eval-row figure { flex: none; width: 100%; } }

/* ---------- Collapsed full-rollout grids ---------- */
details.rollouts { margin-top: 32px; }
details.rollouts > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 18px; border: 1.5px solid var(--text); border-radius: 999px;
  font-weight: 600; font-size: 0.95rem; color: var(--text); background: transparent;
}
details.rollouts > summary::-webkit-details-marker { display: none; }
details.rollouts > summary::before { content: "\25B8"; font-size: 1.1em; transition: transform .2s ease; }
details.rollouts[open] > summary::before { transform: rotate(90deg); }
details.rollouts > summary:hover { background: var(--bg-alt); }
section.alt details.rollouts > summary:hover { background: #fff; }
details.rollouts > .inner { margin-top: 18px; }

/* Emphasis for the red error overlay mentioned in captions */
/* Specific enough to beat ".caption b" and ".band .caption b" (which set the bold text color). */
.red, .caption b.red, figcaption b.red, .band .caption b.red, .band figcaption b.red { color: #d62828 !important; font-weight: 700; }

/* ---------- Hero title width ---------- */
/* Wider than the text column so the title line does not wrap on a desktop screen. */
header.hero .container { max-width: 1400px; }
header.hero h1 { text-wrap: balance; }
header.hero .subtitle { max-width: 860px; margin-left: auto; margin-right: auto; }
@media (max-width: 1100px) { header.hero h1 { font-size: 2.2rem; } }

/* ---------- Sticky in-page navigation ---------- */
nav.pagenav {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,0.92);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
nav.pagenav .container {
  display: flex; gap: 6px; justify-content: center;
  overflow-x: auto; white-space: nowrap; padding-top: 0; padding-bottom: 0;
}
nav.pagenav a {
  display: inline-block; padding: 11px 14px;
  font-size: 0.92rem; font-weight: 600; color: var(--text);
}
nav.pagenav a:hover { color: var(--accent); text-decoration: none; }
[id] { scroll-margin-top: 64px; }
@media (max-width: 720px) {
  nav.pagenav .container { justify-content: flex-start; }
  .stats .v { font-size: 1.25rem; }
}

/* ---------- Stat-tile row titles and units ---------- */
.stats-title { text-align: center; font-weight: 700; font-size: 1.05rem; margin: 20px 0 10px; }
.stats-title span { display: block; color: var(--muted); font-weight: 400; font-size: 0.88rem; margin-top: 2px; }
.stat .v .u { font-size: 0.8rem; color: var(--muted); font-weight: 600; margin-left: 3px; }

/* ---------- Two-row stat table (label column + method columns) ---------- */
.stats-table { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 10px 12px; align-items: stretch; }
.stats-table .cell.head { font-size: 0.88rem; font-weight: 600; color: var(--muted); text-align: center; align-self: end; }
.stats-table .cell.head.ours-h { color: var(--accent); }
.stats-table .cell.rowlab { display: flex; align-items: center; justify-content: flex-end; text-align: right; font-size: 0.92rem; font-weight: 600; }
.stats-table .cell.stat { background: var(--bg-alt); border-radius: var(--radius); padding: 12px 10px; text-align: center; }
section.alt .stats-table .cell.stat { background: #fff; border: 1px solid var(--border); }
.stats-table .cell.stat .v { font-size: 1.4rem; font-weight: 700; }
.stats-table .cell.stat.ours .v { color: var(--accent); }
@media (max-width: 720px) {
  .stats-table { grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
  .stats-table .cell.rowlab { font-size: 0.8rem; }
  .stats-table .cell.stat .v { font-size: 1.1rem; }
}

/* "coming soon" tag inside the Code button */
.btn .soon {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--accent); color: #fff;
  padding: 2px 8px; border-radius: 999px; margin-left: 2px;
}

/* Emoji icon inside a button (Hugging Face) */
.btn .emoji { font-size: 1.1em; line-height: 1; }
