/* ==========================================================================
   Project page — light theme (white), orange accent #FF6A3D
   Fonts: Space Grotesk (display) · Inter (body) · JetBrains Mono (code)
   ========================================================================== */

:root {
  --bg: #FFFFFF;
  --bg-elev: #F7F8FA;
  --bg-card: #F7F8FA;
  --border: #E4E7EC;
  --text: #1A1D23;
  --text-dim: #5B6472;
  --accent: #FF6A3D;
  --accent-soft: rgba(255, 106, 61, 0.10);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 14px;
  --container: 1180px;
  --narrow: 820px;
  --wide: 1680px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; display: block; }

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

sup { font-size: 0.65em; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}
.container.narrow, .narrow { max-width: var(--narrow); margin-left: auto; margin-right: auto; }
.container.container-wide { max-width: var(--wide); }

/* ============ Hero ============ */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255, 106, 61, 0.07), transparent),
    var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 96px 24px 72px;
  text-align: center;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.5vw, 3.2rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 28px;
}

.authors {
  font-size: 1.05rem;
  margin-bottom: 8px;
}
.authors a { color: var(--text); }
.authors a:hover { color: var(--accent); text-decoration: none; }
.authors .sep { color: var(--text-dim); margin: 0 10px; }

.affiliations {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 34px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 22px;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.btn:hover {
  text-decoration: none;
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.btn-ic { font-size: 1rem; }

/* animated trajectory background */
.hero-trajectory {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  pointer-events: none;
}

.traj {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 6 10;
  opacity: 0.35;
  animation: traj-flow 26s linear infinite;
}
.traj-2 { opacity: 0.22; animation-duration: 34s; animation-direction: reverse; }
.traj-3 { opacity: 0.15; animation-duration: 42s; }

@keyframes traj-flow {
  to { stroke-dashoffset: -640; }
}

.traj-dot {
  fill: var(--accent);
  opacity: 0.75;
  filter: drop-shadow(0 0 4px rgba(255, 106, 61, 0.45));
}
.traj-dot-1 { animation: dot-1 13s ease-in-out infinite alternate; }
.traj-dot-2 { animation: dot-2 17s ease-in-out infinite alternate; }
.traj-dot-3 { animation: dot-3 21s ease-in-out infinite alternate; }

@keyframes dot-1 {
  from { transform: translate(120px, 440px); }
  50%  { transform: translate(560px, 300px); }
  to   { transform: translate(1040px, 250px); }
}
@keyframes dot-2 {
  from { transform: translate(1060px, 240px); }
  50%  { transform: translate(600px, 250px); }
  to   { transform: translate(140px, 360px); }
}
@keyframes dot-3 {
  from { transform: translate(200px, 520px); }
  50%  { transform: translate(700px, 430px); }
  to   { transform: translate(1100px, 390px); }
}

@media (prefers-reduced-motion: reduce) {
  .traj, .traj-dot { animation: none; }
}

/* ============ Sections ============ */

.section { padding: 64px 0; }
.section + .section { border-top: 1px solid var(--border); }

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.8rem;
  letter-spacing: -0.01em;
  margin-bottom: 28px;
  text-align: center;
}
.section-title::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin: 12px auto 0;
}

.abstract-text, .body-text {
  color: var(--text-dim);
  font-size: 1.05rem;
}
.body-text { margin: 24px auto 0; }

/* ============ Media ============ */

.video-embed,
.figure img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
}

.teaser-video video { width: 100%; background: var(--bg-elev); }
.video-phase-wrap { border: 1px solid var(--border); }

figcaption {
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: center;
  margin-top: 12px;
}

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.figure { margin-top: 8px; }
.figure img { width: 100%; }

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 32px;
  /* wider than the text column so three tiles stay comfortably large */
  width: min(var(--wide), calc(100vw - 48px));
  margin-left: calc(50% - min(var(--wide) / 2, 50vw - 24px));
}
.video-card-wide { grid-column: 1 / -1; }
.video-card-wide video { max-width: 640px; margin: 0 auto; }

/* Portrait side-by-side compare clips (FullVLA over GloVLA) */
.sim-grid { grid-template-columns: repeat(5, 1fr); }
.sim-grid .video-card video {
  aspect-ratio: 1 / 2;
  object-fit: contain;
  background: #14171c;
}
.tier-easy { color: #0ca30c; font-weight: 600; }
.tier-medium { color: #eda100; font-weight: 600; }
.tier-hard { color: #d03b3b; font-weight: 600; }
.video-card video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
}

/* ============ Stats ============ */

.stats-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
}

.stat {
  flex: 1 1 200px;
  max-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
}
.stat-value {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  color: var(--accent);
  line-height: 1.2;
}
.stat-label {
  display: block;
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 6px;
}

/* ============ Pipeline diagram ============ */

.pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 32px auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.pipe-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 18px;
  white-space: nowrap;
}
.pipe-planner { border-color: #B8C0CC; color: #3D4450; }
.pipe-vla {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #C24A24;
  font-weight: 500;
}
.pipe-arrow { color: var(--text-dim); }

.key-planner { color: #3D4450; font-weight: 600; }
.key-vla { color: #C24A24; font-weight: 600; }

/* ============ Phase state-machine panels ============ */

/* Break out of the text column and use the full page width. */
.phase-machine {
  margin: 8px 0 0;
  width: min(var(--wide), calc(100vw - 48px));
  margin-left: calc(50% - min(var(--wide) / 2, 50vw - 24px));
}
.phase-track {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1fr;
  align-items: start;
  gap: 4px;
}
.phase-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.phase-cap { text-align: center; }
.phase-img img {
  width: 100%;
  aspect-ratio: 19 / 14;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  display: block;
}
.phase-index {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 10px;
}
.phase-name {
  display: block;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  margin-top: 2px;
  line-height: 1.25;
}
.phase-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.35;
}
.phase-name-neutral { color: var(--text-dim); }
.phase-name-planner { color: #3D4450; }
.phase-name-vla { color: #C24A24; }

/* ============ Image lightbox (click to zoom) ============ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(10, 12, 15, 0.9);
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}
/* arrow vertically centered on the image band.
   image height = column-width * 14/19; column-width ≈ (track - arrows - gaps)/5.
   The arrow spacer box below reproduces that height so align matches exactly. */
.phase-sep {
  align-self: start;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 1.7rem;
  /* height of one image cell: (100% of the 1fr column) * 14/19.
     A zero-width helper with the image aspect can't know the 1fr width, so we
     approximate the image height from the track width. */
  height: calc((min(var(--wide), 100vw - 48px) - 4 * 1.7rem - 8 * 4px) / 5 * 14 / 19);
}

/* ============ Live phase badge on teaser video ============ */

.video-phase-wrap {
  position: relative;
  display: block;
  line-height: 0;          /* kill the inline-video descender gap */
  border-radius: var(--radius);
  overflow: hidden;        /* badge + video share one rounded box */
}
.video-phase-wrap video { display: block; }
.phase-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(13, 15, 18, 0.72);
  backdrop-filter: blur(6px);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #fff;
  transition: background 0.3s;
}
.phase-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9AA3AF;
  box-shadow: 0 0 8px currentColor;
  color: #9AA3AF;
}
.phase-badge[data-phase="transport-object"] .phase-dot,
.phase-badge[data-phase="transport-basket"] .phase-dot { background: #B8C0CC; color: #B8C0CC; }
.phase-badge[data-phase="grasp"] .phase-dot,
.phase-badge[data-phase="place"] .phase-dot { background: var(--accent); color: var(--accent); }

/* ============ Design principles grid ============ */

.principles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 40px 0;
}
.principle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.principle h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.principle p {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ============ SVG charts ============ */

.chart-figure svg {
  width: 100%;
  height: auto;
  font-family: var(--font-body);
}
.chart-grid line {
  stroke: var(--border);
  stroke-width: 1;
}
.bar-full { fill: #5B6472; }
.bar-hyb  { fill: var(--accent); }
.line-full {
  fill: none;
  stroke: #5B6472;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.line-hyb {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.marker-full circle { fill: #5B6472; stroke: var(--bg); stroke-width: 2; }
.marker-hyb circle  { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.chart-ticks text, .axis-label {
  fill: var(--text-dim);
  font-size: 15px;
}
.bar-label {
  fill: var(--text);
  font-size: 15px;
  font-weight: 600;
}
.bar-label-in { fill: #fff; }
.chart-legend text {
  fill: var(--text);
  font-size: 15px;
}
.row-overall .axis-label { font-weight: 700; fill: var(--text); }

/* ============ Data tables ============ */

.table-details {
  margin-top: 8px;
}
.table-details summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent);
  padding: 10px 0;
  user-select: none;
}
.table-details summary:hover { text-decoration: underline; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
}
.table-wrap table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table-wrap th, .table-wrap td {
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}
.table-wrap th:first-child, .table-wrap td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--bg);
}
.table-wrap thead th {
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  text-align: center;
}
.table-wrap thead th:first-child { background: var(--bg-card); }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap td { color: var(--text-dim); }
.table-wrap td.win { color: var(--text); font-weight: 600; }
.table-wrap .row-avg td {
  border-top: 2px solid var(--border);
  font-weight: 600;
  color: var(--text);
}

/* ============ BibTeX ============ */

.bibtex {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  overflow-x: auto;
}
.bibtex code {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
  white-space: pre;
}

/* ============ Footer ============ */

.footer {
  border-top: 1px solid var(--border);
  padding: 36px 0 48px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ============ Responsive ============ */

@media (max-width: 960px) {
  .principles { grid-template-columns: repeat(2, 1fr); }
  .video-grid { grid-template-columns: repeat(2, 1fr); }
  .sim-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .hero { padding: 72px 20px 56px; }
  .section { padding: 48px 0; }
  .video-grid { grid-template-columns: 1fr; }
  .authors .sep { margin: 0 6px; }
  .stats-row { gap: 14px; }
  .stat { flex-basis: 100%; max-width: none; }
  .principles { grid-template-columns: 1fr; }
  .pipeline { font-size: 0.78rem; gap: 6px; }
  .pipe-step { padding: 6px 12px; }
}
