/* ─── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --fg:      #111827;
  --muted:   #374151;
  --faint:   #4b5563;
  --line:    #e5e7eb;
  --bg:      #ffffff;
  --surface: #f9fafb;
  --accent:  #f97316;
  --accent-light: #fff7ed;
  --good:    #15803d;
  --good-bg: #f0fdf4;
  --bad:     #b91c1c;
  --bad-bg:  #fef2f2;
  --shadow:  0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.05);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.12), 0 8px 32px rgba(0,0,0,0.07);
  --radius:  12px;
  --maxw:    1080px;
}

/* ─── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { display: block; max-width: 100%; height: auto; }

/* ─── Full-width section stripe alternation ─────────────────────────────────── */
.section-stripe { background: var(--surface); }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0 auto;
  max-width: var(--maxw);
}

/* ─── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, #f0f4ff 0%, #ffffff 60%);
  border-bottom: 1px solid var(--line);
  padding: 64px 24px 32px;
  text-align: center;
}
.hero-inner { max-width: var(--maxw); margin: 0 auto; }

.title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin: 0 0 20px;
  color: var(--fg);
}
.venue {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.8px;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.authors  { font-size: 17px; margin: 0 0 4px; }
.author   { font-weight: 600; }
.affil    { color: var(--muted); margin: 0 0 24px; font-size: 15px; }

/* ─── Anchor strip ──────────────────────────────────────────────────────────── */
.anchorbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  padding-top: 24px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}
.anchorbar a {
  color: #111827;
  background: #fff;
  border: 1px solid #4b5563;
  padding: 7px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.anchorbar a:hover {
  color: #111827;
  background: #f3f4f6;
  border-color: #9ca3af;
  text-decoration: none;
  box-shadow: var(--shadow-hover);
}

/* ─── Sections ──────────────────────────────────────────────────────────────── */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 52px 28px;
}
.section h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0 0 6px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}
.section h3.sub {
  font-size: 20px;
  font-weight: 600;
  margin: 40px 0 8px;
  color: var(--fg);
}
.section h4.evalh {
  font-size: 13px;
  font-weight: 700;
  margin: 20px 0 10px;
  color: var(--fg);
  letter-spacing: 1px;
}
.section h4.evalh.ours { color: var(--good); }
.ours-label { color: var(--good); font-weight: 700; }
.section p { margin: 8px 0 14px; }
.caption { color: var(--muted); font-size: 15px; line-height: 1.6; }

/* ─── Task prompt ───────────────────────────────────────────────────────────── */
.task-prompt {
  font-size: 16px;
  margin: 4px 0 12px;
  color: var(--fg);
}
.prompt-label { font-weight: 700; color: var(--accent); }

/* ─── Scene note callout ────────────────────────────────────────────────────── */
.scene-note {
  background: #fffbea;
  border-left: 4px solid #f59e0b;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 15px;
  line-height: 1.6;
  color: #422006;
  margin: 8px 0 16px;
}

/* ─── Figures ───────────────────────────────────────────────────────────────── */
.fig { margin: 20px 0 28px; text-align: center; }
.fig img {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.fig figcaption {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.fig figcaption.big-cap {
  font-size: 15.5px;
  line-height: 1.6;
  max-width: 100%;
  text-align: justify;
}

/* ─── Demo videos ───────────────────────────────────────────────────────────── */
.demo-stack {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 900px;
  margin: 16px auto 0;
}
.demo-item video {
  width: 100%;
  border-radius: 10px;
  background: #000;
  box-shadow: var(--shadow);
}
.demo-label {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--fg);
  letter-spacing: 0.6px;
}
#demo { text-align: center; }
.demo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 16px auto 0;
  max-width: 860px;
}
.demo-grid video {
  width: 100%;
  border-radius: 10px;
  background: #000;
  box-shadow: var(--shadow);
}
@media (max-width: 700px) { .demo-grid { grid-template-columns: 1fr; } }
.presentation-video {
  display: block;
  width: 100%;
  max-width: 860px;
  margin: 8px auto 22px;
  border-radius: 10px;
  background: #000;
  box-shadow: var(--shadow);
}


/* ─── Sliding marquee (Anchor-Align in Action) ──────────────────────────────── */
.marquee-wrap { position: relative; }
.marquee {
  overflow: hidden;
  margin-top: 18px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.marquee-track {
  display: flex;
  gap: 14px;
  width: max-content;
  will-change: transform;
}
.marquee-track .vid {
  width: 280px;
  flex: 0 0 auto;
  aspect-ratio: 16 / 9;
}
.marquee-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--fg);
  font-size: 17px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  z-index: 3;
  transition: background 0.15s, color 0.15s;
}
.marquee-btn:hover { background: var(--accent-light); color: var(--accent); }
.marquee-btn.prev { left: 4px; }
.marquee-btn.next { right: 4px; }
.marquee-note { text-align: center; color: var(--muted); margin-top: 14px; }

/* ─── Numbered generalization regimes ───────────────────────────────────────── */
.regimes { margin: 6px 0 16px; padding-left: 26px; }
.regimes li { margin: 9px 0; line-height: 1.55; color: var(--fg); }
.regimes li::marker { font-weight: 800; color: var(--accent); }

/* ─── Pair cards ────────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 20px; margin-top: 12px; }
.grid-pairs { grid-template-columns: 1fr; }

/* Clutter: three target objects side by side */
.clutter-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 8px 0 4px;
  align-items: start;
}
.clutter-col { min-width: 0; }
.clutter-col .evalh { margin-top: 0; }
.clutter-col video {
  width: 100%;
  border-radius: 8px;
  background: #000;
  box-shadow: var(--shadow);
}
@media (max-width: 700px) { .clutter-row { grid-template-columns: 1fr; } }

.pair {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.pair:hover { box-shadow: var(--shadow-hover); }

.pair-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--fg);
}
.pair-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
/* Train/Test setup images + BC/Anchor-Align videos, all side by side at equal size */
.pair-grid.setup-quad {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  position: relative;
}
/* Vertical divider between Train setup and Test setup (after column 1 of 4) */
.pair-grid.setup-quad::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: calc(25% - 3px);
  width: 2px;
  background: #9ca3af;
  transform: translateX(-50%);
}
.pair-grid.setup-quad figure { margin: 0; display: flex; flex-direction: column; min-width: 0; }
.pair-grid.setup-quad figcaption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pair-grid.setup-quad img,
.pair-grid.setup-quad video {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
}
/* Real-world 4-up (Train | Test setup images + Standard BC | Anchor-Align videos).
   The screenshots AND the rollout videos are all natively 4:3 (640x480), so pin every
   tile to one identical 4:3 box. !important overrides .vid (16:9), the carousel reset,
   and the LIBERO 1:1, so nothing is cropped and all four tiles are the exact same size. */
.pair-grid.setup-quad.rw { align-items: start; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pair-grid.setup-quad.rw > figure { margin: 0; min-width: 0; display: flex; flex-direction: column; }
.pair-grid.setup-quad.rw > figure > figcaption {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  min-height: 1.3em;
  margin: 0 0 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
}
.pair-grid.setup-quad.rw > figure > img,
.pair-grid.setup-quad.rw > figure > video {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 4 / 3 !important;
  object-fit: cover !important;
  border-radius: 8px;
  background: #000;
  display: block !important;
  margin: 0;
}
.setup-cap {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.4px;
}
/* For the language-rephrase axis: scene is identical, so show the differing prompt as a tile */
.prompt-tile {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
  font-style: italic;
  color: var(--fg);
}
@media (max-width: 760px) {
  .pair-grid.setup-quad { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pair-grid.setup-quad.rw { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pair-grid.setup-quad::after { display: none; }
}
.pair-grid-single {
  grid-template-columns: 1fr;
  max-width: 560px;
}
.pair-grid figure { margin: 0; display: flex; flex-direction: column; }
.pair-grid figcaption {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 7px;
}
.pair-grid .bad  { color: var(--bad);  }
.pair-grid .good { color: var(--good); }

/* ─── Videos ────────────────────────────────────────────────────────────────── */
.vid {
  width: 100%;
  border-radius: 8px;
  background: #000;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

/* ─── 2×3 grid ──────────────────────────────────────────────────────────────── */
.grid-2x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 10px;
}
.single-vid {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 12px 14px;
  box-shadow: var(--shadow);
}
.single-caption {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.single-center { max-width: 580px; margin: 10px auto 24px; }

/* One shared box wrapping a grid of bare (boxless, caption-less) videos */
.vid-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-top: 10px;
}
.vid-box .grid-2x3 { margin-top: 0; }
.bare-vid { margin: 0; }

/* ─── Carousel ──────────────────────────────────────────────────────────────── */
.carousel {
  position: relative;
  padding: 4px 56px 46px;
  margin: 10px auto 24px;
  max-width: 580px;
}
/* two-video pair sliders (LIBERO-Plus axes) need the full width */
.carousel[data-noadvance] { max-width: 1024px; }
/* auto-generated "jump to case" dropdown above each slider */
.carousel-select {
  display: block;
  margin: 8px auto 14px;
  max-width: 520px;
  width: 100%;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
/* framed container so each axis reads clearly as an interactive slider */
.carousel[data-noadvance] {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 64px 52px;
}
.carousel-track { position: relative; width: 100%; }
.carousel-slide {
  position: absolute;
  top: 0; left: 0; right: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.carousel-slide.active {
  position: relative;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.carousel-slide .vid {
  width: 100%; height: auto;
  aspect-ratio: unset; object-fit: unset;
  border-radius: 8px; background: #000;
}
.carousel-caption {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  letter-spacing: 0.5px;
}
.carousel-counter { font-weight: 400; font-size: 12px; text-transform: none; letter-spacing: 0; }
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #d1d5db;
  border: 1px solid #b6bcc4;
  border-radius: 50%;
  width: 48px; height: 48px;
  font-size: 22px;
  cursor: pointer;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
  z-index: 2;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.carousel-btn:hover { background: #b6bcc4; box-shadow: 0 5px 16px rgba(0,0,0,0.25); transform: translateY(-50%) scale(1.08); }
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }
.carousel-dots {
  position: absolute;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 9px;
}
.dot {
  width: 12px; height: 12px;
  border-radius: 50%; border: 2px solid #9ca3af;
  background: #fff; cursor: pointer; padding: 0;
  transition: background 0.2s, transform 0.2s;
}
.dot:hover { transform: scale(1.3); background: #e5e7eb; }
.dot.active { background: #6b7280; border-color: #6b7280; transform: scale(1.25); }

/* ─── BibTeX ────────────────────────────────────────────────────────────────── */
.bib {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 13.5px;
  font-family: "SF Mono", "Menlo", Consolas, monospace;
  overflow-x: auto;
  line-height: 1.6;
  box-shadow: var(--shadow);
}

/* ─── Sticky side navigation ────────────────────────────────────────────────── */
.sidenav {
  position: fixed;
  top: 16px;
  left: 16px;
  background: #f1f4fa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 50;
  box-shadow: var(--shadow);
}
.sidenav-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 14px 14px 14px;
  min-width: 195px;
}
.sidenav a, .sidenav a.sub { white-space: normal; word-break: break-word; }
.sidenav-toggle {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  border: 1px solid var(--line);
  background: #fff; color: var(--muted);
  border-radius: 6px; cursor: pointer;
  font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.sidenav-toggle:hover { background: var(--accent-light); color: var(--accent); }
.sidenav.collapsed .sidenav-body { display: none; }
.sidenav.collapsed { padding: 0; width: 38px; height: 38px; }
.sidenav.collapsed .sidenav-toggle { position: static; margin: 6px; width: 26px; height: 26px; }
.sidenav-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.sidenav-cat {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.4px;
  color: var(--accent);
  margin: 13px 0 5px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.sidenav a {
  color: var(--muted);
  padding: 5px 8px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  line-height: 1.3;
  transition: background 0.12s, color 0.12s;
}
.sidenav a:hover { color: var(--fg); text-decoration: none; background: var(--surface); }
.sidenav a.active {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-light);
}
.sidenav .sub-links {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 4px 8px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.sidenav .sub-group {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--fg);
  margin: 6px 0 2px;
}
.sidenav a.sub {
  font-size: 12px;
  padding: 3px 6px;
  color: var(--muted);
  border-left: none;
}
.sidenav a.sub:hover { color: var(--fg); background: var(--surface); }
.sidenav a.sub.active { color: var(--accent); font-weight: 600; background: var(--accent-light); }

@media (max-width: 1280px) { .sidenav { display: none; } }

/* At widths where the fixed side bar is shown, offset the centered content so the
   expanded bar never sits on top of the text. */
@media (min-width: 1281px) {
  .section, .hero-inner, hr {
    margin-left: max(calc((100% - var(--maxw)) / 2), 264px);
    margin-right: auto;
  }
  .hero-inner { transform: translateX(-24px); }
}

/* Range/gallery grids: 3-up on desktop, 2-up on mid screens (1-up phones below). */
@media (max-width: 900px) {
  .grid-2x3 { grid-template-columns: 1fr 1fr; }
}

/* ─── Pair dropdown selector ────────────────────────────────────────────────── */
.pair-select {
  display: block;
  margin: 10px 0 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow);
}
.pair-select:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.carousel-select { margin-bottom: 0; }

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 28px 64px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .title { font-size: 26px; }
  .title br { display: none; }
  .section { padding: 40px 18px; }
  .hero { padding: 48px 18px 28px; }
  .pair-grid, .grid-2x3 { grid-template-columns: 1fr; }
  .carousel,
  .carousel[data-noadvance] { padding: 12px 42px 50px; }
  .carousel-btn { width: 38px; height: 38px; font-size: 18px; }
  .carousel-btn.prev { left: 2px; }
  .carousel-btn.next { right: 2px; }
  .prompt-tile { aspect-ratio: auto; min-height: 90px; padding: 10px; font-size: 13px; }
  .pair-grid.setup-quad figcaption,
  .pair-grid.setup-quad.rw > figure > figcaption { white-space: normal; line-height: 1.3; min-height: 2.6em; }
  .fig figcaption.big-cap { text-align: left; }
  .bib { padding: 16px 14px; font-size: 12.5px; }
}

/* Method-figure video: show the full ultra-wide frame, no 16:9 crop */
.fig video.fig-vid { aspect-ratio: auto; height: auto; object-fit: contain; background: transparent; border: 1px solid var(--line); box-shadow: var(--shadow); }

/* Author names are links: keep them blue (link affordance) despite the orange theme */
.authors a { color: #1d4ed8; }
.authors a:hover { color: #1e40af; text-decoration: underline; }

/* Hero action buttons */
.hero-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 16px 0 4px; }
.hero-btns .btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; background: var(--surface); color: var(--fg); border: 1px solid var(--line); font-size: 15px; font-weight: 600; transition: background .12s, border-color .12s, color .12s, transform .12s, box-shadow .12s; }
.hero-btns a.btn:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.hero-btns .btn-disabled { opacity: .5; cursor: not-allowed; }
