@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500&family=Inter:wght@400;500;700;800&family=STIX+Two+Text:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* ---------- Base ---------- */

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background-color: #fdfaf4;
  color: #1b1b1b;
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 18px;
  line-height: 1.65;
  padding: 60px 30px;
}

a {
  color: #1b1b1b;
  text-decoration: underline;
  text-decoration-color: #c6bba0;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: #1b1b1b;
}

hr {
  border: 0;
  height: 1px;
  background-color: #d9d2bd;
  margin: 36px 0;
}

/* ---------- Layout ---------- */

.main {
  max-width: 880px;
  margin: 0 auto;
}

/* ---------- Hero (centered) ---------- */

header {
  text-align: center;
  margin-bottom: 8px;
}

.hero-title {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  font-size: 56px;
  line-height: 1.08;
  letter-spacing: -1.5px;
  margin: 0 0 14px 0;
}

.hero-subtitle {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  font-size: 24px;
  line-height: 1.3;
  color: #444;
  margin: 0 0 20px 0;
}

.authors {
  font-size: 18px;
  line-height: 1.5;
}

.affiliation {
  display: block;
  color: #666;
  font-size: 16px;
  margin-top: 4px;
}

.review-note {
  display: block;
  color: #888;
  font-size: 15px;
  font-style: italic;
  margin-top: 6px;
}

/* ---------- Quick links ---------- */

.quick-links {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 17px;
  margin: 24px 0 8px 0;
}

.quick-links a {
  margin: 0 11px;
  text-decoration: none;
  color: #1b1b1b;
  border-bottom: 1.5px solid #c6bba0;
  padding-bottom: 2px;
}

.quick-links a:hover {
  border-bottom-color: #1b1b1b;
}

/* ---------- Author name links + equal-contribution note ---------- */

.authors a {
  color: #1b1b1b;
  text-decoration: none;
}

.authors a:hover {
  color: #6b6453;
}

.authors sup {
  font-size: 0.68em;
  color: #888;
  font-weight: 600;
}

.author-note {
  display: block;
  color: #888;
  font-size: 14px;
  margin-top: 8px;
}

.author-note sup {
  color: #888;
}

/* ---------- Resource buttons (paper / arXiv / code) ---------- */

.hero-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 24px 0 6px 0;
}

.hero-link {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #1b1b1b;
  text-decoration: none;
  background: #f3eee2;
  border: 1px solid #d8ccae;
  border-radius: 999px;
  padding: 9px 22px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.hero-link:hover {
  background: #1b1b1b;
  color: #fff;
  border-color: #1b1b1b;
}

/* ---------- BibTeX block ---------- */

.bibtex {
  font-family: 'Roboto Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  color: #333;
  background: #f3eee2;
  border: 1px solid #e4dcc8;
  border-radius: 10px;
  padding: 18px 20px;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

/* ---------- Section headers (no underline bar) ---------- */

.tagline {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -1px;
  margin: 56px 0 16px 0;
}

#abstract .tagline {
  text-align: center;
}

.subheader {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.4px;
  margin: 34px 0 10px 0;
}

.stat-line {
  font-size: 18px;
  margin: 6px 0 14px 0;
}

/* ---------- Body text ---------- */

.section p {
  margin: 14px 0;
  text-align: justify;
  hyphens: auto;
}

.section ul {
  margin: 14px 0;
  padding-left: 22px;
}

.section li {
  margin: 8px 0;
}

.section em {
  font-style: italic;
}

.section strong {
  font-weight: 700;
}

/* ---------- Figures ---------- */

.figure {
  margin: 28px 0 12px 0;
}

.figure img {
  width: 100%;
  display: block;
  border-radius: 10px;
}

.figure-caption {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #555;
  margin: 10px 0 0 0;
  text-align: left;
}

.teaser-caption {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: #444;
  text-align: left;
  margin: 16px 0 0 0;
}

/* ---------- Math ---------- */

/* Single-letter variables are italic; multi-letter subscripts
   (base, ref, task, PPS) and operators stay upright, matching
   standard math typesetting.
   STIX Two Text is the web-friendly serif companion of STIX Two Math —
   visually the closest free webfont to LaTeX's Computer Modern /
   Latin Modern Math, with proper italic Greek letters and serif Latin
   italics. Falls back to LaTeX-installed Latin Modern → Cambria Math →
   Georgia → Times. */
.math {
  font-family: 'STIX Two Text', 'Latin Modern Math', 'Cambria Math', Georgia, 'Times New Roman', serif;
}

.math .var,
.equation .var {
  font-style: italic;
}

.math sub,
.equation sub {
  font-style: normal;
}

.equation {
  font-family: 'STIX Two Text', 'Latin Modern Math', 'Cambria Math', Georgia, 'Times New Roman', serif;
  font-size: 20px;
  text-align: center;
  margin: 18px 0;
  padding: 16px 10px;
  background-color: #f4eed8;
  border-left: 3px solid #c6bba0;
  overflow-x: auto;
}

/* ---------- Analysis figure grid (2 × 2, equal height) ---------- */

.figure-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 32px;
  align-items: start;
  margin: 22px 0 12px 0;
}
@media (max-width: 640px) { .figure-row { grid-template-columns: 1fr; } }

.figure-row > figure {
  min-width: 0;
  margin: 0;
}

.figure-row .analysis-fig {
  display: block;
  width: 100%;
  height: 300px;
  object-fit: contain;
}

.figure-row .figure-caption {
  text-align: left;
}

/* ---------- Results video grid (N x 2) ---------- */

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 22px 0 12px 0;
}

.result-item {
  margin: 0;
  display: block;
}

.result-video {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #1b1b1b;
  display: block;
  border-radius: 10px;
}

.result-caption {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  text-align: left;
  color: #555;
  margin: 8px 0 0 0;
}

@media (max-width: 700px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Hero video custom controls (no native panel) ---------- */

.hero-video {
  position: relative;
  display: block;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
}

.hero-video > video {
  width: 100%;
  display: block;
}

.hero-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 12px 14px;
  /* No background panel — buttons + bar carry their own contrast. */
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
  z-index: 3;
}

.hero-video:hover .hero-controls,
.hero-video:focus-within .hero-controls,
.hero-controls.is-active {
  opacity: 1;
  pointer-events: auto;
}

.hero-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(27, 27, 27, 0.78);
  color: #fdfaf4;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
}

.hero-btn:hover {
  background: rgba(27, 27, 27, 0.95);
}

.hero-btn:active {
  transform: scale(0.94);
}

.hero-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 0;
}

/* Play/pause icon swap — driven by .is-playing on the parent control bar. */
.hero-play .icon-pause { display: none; }
.hero-play .icon-play  { display: block; }
.hero-controls.is-playing .hero-play .icon-pause { display: block; }
.hero-controls.is-playing .hero-play .icon-play  { display: none; }

/* Mute icon mirrors the cross-modality speaker toggle — slash when muted,
   sound-waves when on. */
.hero-mute .speaker-waves { display: none; }
.hero-mute .speaker-slash { display: block; }
.hero-mute.is-on .speaker-waves { display: block; }
.hero-mute.is-on .speaker-slash { display: none; }

.hero-progress {
  flex: 1 1 auto;
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: rgba(27, 27, 27, 0.78);  /* same dark pill as the buttons */
  cursor: pointer;
  overflow: hidden;
}

.hero-progress:focus-visible {
  outline: 2px solid #fdfaf4;
  outline-offset: 2px;
}

.hero-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: #fdfaf4;
  border-radius: 999px;
  pointer-events: none;
}

.hero-time {
  flex: 0 0 auto;
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: #fdfaf4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .hero-controls {
    padding: 0 10px 10px 10px;
    gap: 9px;
  }
  .hero-btn {
    width: 32px;
    height: 32px;
  }
  .hero-time {
    font-size: 11px;
  }
}

/* ---------- Recovery behaviors 2x2 video grid ---------- */

.recovery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  margin: 28px 0 12px 0;
  align-items: start;
}

.recovery-col-header {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  font-size: 21px;
  text-align: center;
  letter-spacing: -0.3px;
  margin-bottom: 2px;
}

/* Top-left tag overlaid on each Robust Execution clip — mirrors the
   .ppsc-tag style from the baseline-comparison carousel. */
.recovery-tag {
  position: absolute;
  left: 14px;
  top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  z-index: 2;
  pointer-events: none;
}
.recovery-tag.pps  { background: #4f9d5d; }
.recovery-tag.lora { background: #4f86c6; }

.recovery-cell {
  position: relative;
  width: 100%;
  display: block;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0; /* kill descender gap under the video */
}

.recovery-video {
  width: 100%;
  display: block;
  background: #1b1b1b;
  border-radius: 10px;
}

.recovery-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: rgba(27, 27, 27, 0.7);
  padding: 6px 12px;
  border-radius: 8px;
  letter-spacing: 0;
  pointer-events: none;
}

@media (max-width: 700px) {
  .recovery-col-header {
    font-size: 18px;
  }
  .recovery-grid {
    gap: 8px 10px;
  }
}

/* ---------- Cross-modality 2x2 video grid ---------- */

.crossmod-grid {
  display: grid;
  /* Videos are 16:9; charts are ~0.82:1 (608×756). Sizing the chart column
     at 0.82/1.78 ≈ 0.46 of a video column makes the chart exactly as tall as
     the videos with no leftover space in the row. */
  grid-template-columns: 1fr 1fr 0.5fr;
  gap: 12px 14px;
  margin: 28px 0 12px 0;
  align-items: stretch;
}

/* Per-task success-rate chart (third column): scaled to the row height, which
   is set by the videos. */
.crossmod-chart { position: relative; min-width: 0; line-height: 0; }
.crossmod-chart img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center; }

/* Shared legend under the grid, centred. */
.crossmod-legend { text-align: center; margin: 6px 0 4px; line-height: 0; }
.crossmod-legend img { display: inline-block; width: min(100%, 300px); height: auto; }

/* Column header above each video column — matches the section subheaders
   (e.g. "Visualize the steering effect"): Inter 700, 21px, -0.4px. */
.crossmod-col-header {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 700;
  font-size: 21px;
  text-align: center;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}

.crossmod-video {
  width: 100%;
  display: block;
  background: #ffffff;  /* matches the white padding inside the pointcloud_mod cell */
  border-radius: 10px;
}

.crossmod-cell {
  position: relative;
  width: 100%;
  display: block;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0; /* kill descender gap under the video */
}

/* Modality label overlay (e.g. "point cloud", "audio") — top-left corner. */
.crossmod-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: rgba(27, 27, 27, 0.7);
  padding: 6px 12px;
  border-radius: 8px;
  letter-spacing: 0;
  pointer-events: none;
  z-index: 4;
}

/* Top-left role tags overlaid on cross-mod cells — mirror the
   .recovery-tag / .ppsc-tag pill style. Blue for the "Additional Modality"
   input column, green for the "Steered Policy Rollout" output column. */
.crossmod-role-tag {
  position: absolute;
  left: 14px;
  top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  z-index: 3;
  pointer-events: none;
}
.crossmod-role-tag.mod  { background: #407CB6; }
.crossmod-role-tag.roll { background: #4f9d5d; }

.crossmod-audio-toggle {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(27, 27, 27, 0.72);
  color: #fdfaf4;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
}

.crossmod-audio-toggle:hover {
  background: rgba(27, 27, 27, 0.92);
}

.crossmod-audio-toggle:active {
  transform: scale(0.94);
}

.crossmod-audio-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: currentColor;
}

/* Default state (video is muted): show slash, hide waves. */
.crossmod-audio-toggle .speaker-waves { display: none; }
.crossmod-audio-toggle .speaker-slash { display: block; }

/* Sound-on state (video is un-muted): show waves, hide slash. */
.crossmod-audio-toggle.is-on .speaker-waves { display: block; }
.crossmod-audio-toggle.is-on .speaker-slash { display: none; }

@media (max-width: 700px) {
  .crossmod-col-header {
    font-size: 18px;
  }
  .crossmod-grid {
    gap: 8px 10px;
  }
}

/* ---------- BibTeX / code block ---------- */

pre {
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  background-color: #f4eed8;
  border-left: 3px solid #c6bba0;
  padding: 16px 18px;
  margin: 14px 0;
  overflow-x: auto;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ---------- Footer ---------- */

.footer {
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid #d9d2bd;
  text-align: center;
  font-size: 14px;
  color: #777;
}

.footer a {
  color: #555;
}

/* ---------- Mobile tweaks ---------- */

@media (max-width: 700px) {
  body {
    padding: 30px 20px;
    font-size: 17px;
  }
  .hero-title {
    font-size: 40px;
  }
  .hero-subtitle {
    font-size: 21px;
  }
  .tagline {
    font-size: 25px;
  }
  .subheader {
    font-size: 19px;
  }
}
