/* FoMoVLA (AAAI 2027) Academic Project Page Stylesheet
 * Grounded in Embodied AI / Robotics open-source conventions (Nerfies / OpenVLA / Spatial Forcing)
 */

:root {
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --surface: #ffffff;
  --ink: #1f2937;
  --ink-strong: #111827;
  --ink-muted: #6b7280;
  --border: #e5e7eb;

  --brand: #1d4ed8;
  --brand-soft: #eff6ff;
  --brand-border: #bfdbfe;
  --teal: #0d9488;
  --amber: #d97706;
  --gain: #047857;
  --gain-soft: #ecfdf5;
  --dark-pill: #27272a;
  --dark-pill-hover: #111827;

  --font-heading: "Google Sans", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Sticky Top Academic Navigation Bar */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.top-nav-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink-strong);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-brand:hover {
  text-decoration: none;
}

.nav-venue {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-border);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-links a {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-muted);
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--brand);
}

/* Layout Containers */
.container {
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 840px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Publication Hero */
.hero {
  padding: 56px 0 40px;
  text-align: center;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.publication-title {
  font-family: var(--font-heading);
  font-size: clamp(1.85rem, 3.4vw, 2.65rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.018em;
  color: var(--ink-strong);
  max-width: 920px;
  margin: 0 auto 14px;
}

.publication-venue {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 20px;
}

.publication-authors {
  font-family: var(--font-heading);
  font-size: 1.06rem;
  line-height: 1.9;
  color: var(--ink-strong);
  max-width: 820px;
  margin: 0 auto;
}

.publication-authors a {
  color: #2563eb;
}

.publication-affiliations {
  margin-top: 10px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--ink-muted);
  line-height: 1.65;
}

.publication-notes {
  margin-top: 4px;
  font-size: 0.84rem;
  color: var(--ink-muted);
}

/* Rounded Dark Pill Buttons (Nerfies / OpenVLA style) */
.publication-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: 999px;
  background: var(--dark-pill);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.16s ease, transform 0.16s ease;
}

.pill-btn:hover {
  background: var(--dark-pill-hover);
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-1px);
}

.pill-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Teaser & Key Highlights */
.teaser-section {
  padding: 8px 0 44px;
}

.teaser-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px 16px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.teaser-box img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.tldr-banner {
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--bg-alt);
  border-left: 4px solid var(--brand);
  border-radius: 0 8px 8px 0;
  font-size: 0.96rem;
  color: var(--ink);
  line-height: 1.68;
}

.highlights-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.highlight-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 16px 14px;
}

.hl-metric {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.2;
}

.hl-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--gain-soft);
  color: var(--gain);
  vertical-align: middle;
}

.hl-title {
  margin-top: 6px;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-strong);
}

.hl-desc {
  margin-top: 3px;
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.48;
}

/* Standard Sections */
.section {
  padding: 52px 0;
  scroll-margin-top: 64px;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink-strong);
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: -0.012em;
}

.section-subtitle {
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.96rem;
  max-width: 720px;
  margin: -4px auto 28px;
}

.subsection-title {
  font-family: var(--font-heading);
  font-size: 1.22rem;
  font-weight: 600;
  color: var(--ink-strong);
  margin: 34px 0 12px;
}

.subsection-title:first-of-type {
  margin-top: 8px;
}

.prose p {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.78;
}

.prose p + p {
  margin-top: 14px;
}

/* Method Pillars & Figures */
.figure-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin: 18px 0 22px;
}

.figure-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.figcaption {
  margin-top: 12px;
  font-size: 0.87rem;
  color: var(--ink-muted);
  line-height: 1.62;
}

.figcaption strong {
  color: var(--ink-strong);
}

.method-pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.pillar-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 18px;
}

.pillar-card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-strong);
  margin-bottom: 8px;
}

.pillar-card p {
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.65;
}

.method-subfigures {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  margin-top: 18px;
}

/* Rollout Video Showcase */
.filter-pills {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.filter-pill {
  padding: 7px 16px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  transition: all 0.15s ease;
}

.filter-pill:hover {
  border-color: var(--ink-muted);
  color: var(--ink-strong);
}

.filter-pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.video-pairs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.pair-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pair-task-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-strong);
  min-height: 2.6em;
  line-height: 1.35;
}

.vid-wrap {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.vid-wrap video {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.robocasa-video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.robocasa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.robocasa-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #000;
}

.vid-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(17, 24, 39, 0.78);
  color: #ffffff;
}

.vid-badge.ood {
  background: rgba(29, 78, 216, 0.88);
}

.robocasa-caption {
  padding: 10px 12px;
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink-strong);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* Experiment Chart Cards & Collapsible Tables */
.exp-block + .exp-block {
  margin-top: 38px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px 14px;
}

.chart-legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--ink-muted);
}

.legend-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.swatch-sq {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.chart-shell {
  width: 100%;
  overflow-x: auto;
}

.chart-shell svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font-heading);
  font-variant-numeric: tabular-nums;
}

details.paper-table {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

details.paper-table summary {
  padding: 10px 16px;
  font-family: var(--font-heading);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-strong);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details.paper-table summary::-webkit-details-marker {
  display: none;
}

details.paper-table[open] summary {
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  border-radius: 8px 8px 0 0;
}

.table-wrap {
  overflow-x: auto;
}

.academic-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  font-variant-numeric: tabular-nums;
}

.academic-table th,
.academic-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

.academic-table th:first-child,
.academic-table td:first-child,
.academic-table th:nth-child(2),
.academic-table td:nth-child(2) {
  text-align: left;
}

.academic-table thead th {
  background: var(--bg-alt);
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--ink-strong);
  border-bottom: 2px solid #cbd5e1;
}

.academic-table tr.ours-row {
  background: var(--brand-soft);
  font-weight: 600;
}

.academic-table td.best-val {
  font-weight: 700;
  color: var(--brand);
}

/* Efficiency Summary Strip inside Experiment 3 */
.efficiency-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.eff-item {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.84rem;
}

.eff-item strong {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.94rem;
  color: var(--ink-strong);
  margin-bottom: 2px;
}

/* Tooltip */
.svg-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 100;
  background: #111827;
  color: #f9fafb;
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.5;
  max-width: 280px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.1s ease;
}

.svg-tooltip.visible {
  opacity: 1;
}

.svg-tooltip .tt-title {
  font-family: var(--font-heading);
  font-weight: 600;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.svg-tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

/* BibTeX & Footer */
.bibtex-card {
  position: relative;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  background: var(--dark-pill);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 0.76rem;
  font-weight: 500;
}

.copy-btn:hover {
  background: var(--dark-pill-hover);
}

.bibtex-pre {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--ink-strong);
  overflow-x: auto;
  padding-right: 72px;
}

.ack-text {
  margin-top: 22px;
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.68;
}

.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.84rem;
  color: var(--ink-muted);
  background: var(--bg-alt);
}

@media (max-width: 860px) {
  .highlights-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .method-pillars,
  .method-subfigures,
  .video-pairs-grid,
  .robocasa-video-grid,
  .efficiency-strip {
    grid-template-columns: 1fr;
  }

  .pair-task-label {
    min-height: 0;
  }
}

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

  .hero {
    padding: 38px 0 28px;
  }

  .section {
    padding: 38px 0;
  }

  .container,
  .container-narrow {
    padding: 0 16px;
  }

  .chart-card {
    padding: 14px 12px;
  }
}
