/* ═══════════════════════════════════════════════
   ROBOTIST — MOTION LIBRARY
   System fonts only. No CDN, no external requests.
   ═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-0: #030810;
  --bg-1: #060D18;
  --bg-2: #0C1828;
  --bg-3: #142035;
  --bg-4: #1E3550;
  --accent: #4AA8C8;
  --accent-dim: #2E8FB5;
  --accent-light: #A8DCEF;
  --accent-glow: rgba(74, 168, 200, 0.12);
  --white: #F0F4F8;
  --grey-1: #8A9BB0;
  --grey-2: #4A5A6A;
  --grey-3: #1E2D3D;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --nav-h: 72px;
  --gutter: clamp(20px, 5vw, 72px);
  --max: 1440px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg-0);
  color: var(--white);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

/* ── NAV ─────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  height: var(--nav-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter); transition: background .3s, backdrop-filter .3s;
}
.nav.scrolled {
  background: rgba(3, 8, 16, 0.88);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(74, 168, 200, 0.10);
}
.nav-logo { display: flex; align-items: center; text-decoration: none; }
.nav-logo img { height: clamp(24px, 3.5vw, 36px); width: auto; display: block; }
.nav-links { display: flex; align-items: center; gap: clamp(20px, 3vw, 40px); list-style: none; }
.nav-links a {
  color: var(--grey-1); text-decoration: none; font-size: 14px; letter-spacing: .02em;
  transition: color .2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--white); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-cta {
  display: inline-flex; align-items: center; height: 40px; padding: 0 18px;
  border-radius: 999px; font-size: 13px; text-decoration: none;
  background: var(--accent); color: #04121a; font-weight: 600;
}
.nav-cta--ghost { background: transparent; color: var(--accent-light); border: 1px solid rgba(74,168,200,.35); }
.nav-hamburger { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-hamburger span {
  display: block; width: 22px; height: 2px; margin: 4px 0; background: var(--white);
  transition: transform .25s, opacity .25s;
}

/* ── LAYOUT ──────────────────────────────────── */
.page { padding-top: var(--nav-h); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.hero {
  /* Headline left, the sentence that explains it right. One narrow column left half the
     desktop empty. */
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(20px, 3vw, 56px); align-items: end;
  padding-block: clamp(34px, 4.6vw, 68px) clamp(24px, 3.4vw, 44px);
}
.hero .eyebrow { grid-column: 1 / -1; margin-bottom: 0; }
.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(34px, 5.2vw, 62px); line-height: 1.04; letter-spacing: -.03em;
  font-weight: 600; max-width: 20ch;
}
.hero h1 em { font-style: normal; color: var(--accent-light); }
.hero p {
  margin-top: 0; max-width: 46ch; color: var(--grey-1);
  font-size: clamp(15px, 1.4vw, 17px); line-height: 1.6;
  padding-bottom: 4px;
}

/* ── STAGE ───────────────────────────────────── */
.stage {
  display: grid; gap: clamp(16px, 2vw, 24px);
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  align-items: start; padding-bottom: clamp(40px, 6vw, 80px);
}

.panel {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid rgba(74, 168, 200, 0.12);
  border-radius: 18px; overflow: hidden;
}

.viewer { position: relative; }
.viewer canvas { display: block; width: 100%; aspect-ratio: 16 / 8.8; max-height: 58vh; }
.viewer-head {
  position: absolute; inset: 14px 16px auto 16px; display: flex; align-items: baseline;
  justify-content: space-between; gap: 12px; pointer-events: none;
}
.viewer-title { font-size: clamp(15px, 1.6vw, 19px); font-weight: 600; letter-spacing: -.01em; }
.viewer-meta { font-family: var(--mono); font-size: 11px; color: var(--grey-1); letter-spacing: .06em; }

.transport {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border-top: 1px solid rgba(74, 168, 200, 0.10);
}
.play {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--accent); color: #04121a; display: grid; place-items: center;
}
.play:focus-visible, .chip:focus-visible, .row:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.scrub { -webkit-appearance: none; appearance: none; flex: 1 1 auto; height: 3px; background: var(--grey-3); border-radius: 3px; }
.scrub::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 999px;
  background: var(--accent-light); border: 0; cursor: pointer;
}
.scrub::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 999px; background: var(--accent-light); }
.time { font-family: var(--mono); font-size: 12px; color: var(--grey-1); min-width: 92px; text-align: right; }
.ghost {
  border: 1px solid rgba(74, 168, 200, 0.28); background: transparent; color: var(--accent-light);
  height: 34px; padding: 0 12px; border-radius: 999px; font-size: 12px; cursor: pointer;
  font-family: var(--mono); letter-spacing: .04em;
}
.ghost[aria-pressed="true"] { background: var(--accent-glow); color: var(--white); }

/* ── RAIL ────────────────────────────────────── */
.rail { display: flex; flex-direction: column; max-height: min(66vh, 660px); position: relative; }
.rail::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 34px; pointer-events: none;
  background: linear-gradient(rgba(6, 13, 24, 0), rgba(6, 13, 24, .92));
}
.rail-head { padding: 14px 14px 10px; border-bottom: 1px solid rgba(74,168,200,.10); }
.rail-title { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--grey-1); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  border: 1px solid rgba(74, 168, 200, 0.20); background: transparent; color: var(--grey-1);
  border-radius: 999px; height: 27px; padding: 0 11px; font-size: 11.5px; cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--white); background: var(--accent-glow); }
.rows { overflow-y: auto; overscroll-behavior: contain; }
.rows::-webkit-scrollbar { width: 8px; }
.rows::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; }
.row {
  display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 7px 12px; background: none; border: 0; width: 100%; text-align: left; cursor: pointer;
  border-left: 2px solid transparent; color: inherit;
}
.row:hover { background: rgba(74, 168, 200, 0.06); }
.row[aria-selected="true"] { background: var(--accent-glow); border-left-color: var(--accent); }
.row img { width: 104px; height: 68px; object-fit: cover; border-radius: 6px; background: var(--bg-3); display: block; }
.row .name { display: block; font-size: 13px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--grey-2); margin-top: 2px; }
.row .len { font-family: var(--mono); font-size: 11px; color: var(--grey-1); }

/* ── FACTS ───────────────────────────────────── */
.facts {
  display: grid; gap: clamp(14px, 2vw, 28px);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  padding-block: clamp(24px, 4vw, 44px); border-top: 1px solid rgba(74, 168, 200, 0.10);
}
.fact b { display: block; font-size: clamp(26px, 3.4vw, 40px); letter-spacing: -.03em; font-weight: 600; }
.fact { padding-left: 20px; border-left: 1px solid rgba(74, 168, 200, 0.14); }
.fact:first-child { padding-left: 0; border-left: 0; }
.fact span { display: block; margin-top: 7px; font-size: 13.5px; color: var(--grey-1); line-height: 1.5; }

/* ── SPEC ────────────────────────────────────── */
.stage-status {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--grey-2); pointer-events: none; animation: stage-pulse 1.6s ease-in-out infinite;
}
@keyframes stage-pulse { 0%, 100% { opacity: .45; } 50% { opacity: .9; } }
.spec { padding-block: clamp(24px, 3.4vw, 40px); border-top: 1px solid rgba(74, 168, 200, 0.10); }
.spec-label { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; }
.spec-grid { display: grid; gap: 18px clamp(20px, 3vw, 48px); grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.spec-grid dt { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); opacity: .82; }
.spec-grid dd { margin: 7px 0 0; font-size: 14px; line-height: 1.6; color: var(--grey-1); }
.spec-grid a { color: var(--accent-light); text-decoration: none; border-bottom: 1px solid rgba(168, 220, 239, .35); }
.viewer-spec {
  padding: 9px 18px 12px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em;
  color: var(--grey-2); border-top: 1px solid rgba(74, 168, 200, .08);
}
.schema { margin-top: 20px; }
.schema summary {
  cursor: pointer; font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent-light);
}
.schema pre {
  margin: 12px 0 0; padding: 14px 16px; overflow-x: auto; background: rgba(12, 24, 40, .72);
  border: 1px solid rgba(74, 168, 200, .14); border-radius: 10px;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.7; color: var(--grey-1);
}
.payload { text-decoration: none; }
.payload:hover { color: var(--accent-light); }

.note-section {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(18px, 3vw, 52px); align-items: start;
  padding-block: clamp(28px, 4vw, 46px) clamp(44px, 6vw, 80px);
  border-top: 1px solid rgba(74, 168, 200, 0.10);
}
.note-section .note-label { grid-column: 1 / -1; margin-bottom: 0; }
.note-label { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.note-section p { max-width: 84ch; color: var(--grey-1); font-size: 14.5px; line-height: 1.72; }
.note-section p + p { margin-top: 12px; }
.note-section a { color: var(--accent-light); text-decoration: none; border-bottom: 1px solid rgba(168, 220, 239, .35); }

footer { border-top: 1px solid rgba(74, 168, 200, 0.10); padding: 26px var(--gutter) 40px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; color: var(--grey-2); font-size: 12px; }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 1080px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .rail { max-height: none; }
  .rows { max-height: none; }
  .rail::after { display: none; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .hero p { margin-top: 14px; max-width: 60ch; }
  .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note-section { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  /* A phone held upright still gives the figure a landscape window: the performances
     are horizontal, and a portrait box shrinks a crawling body to a splinter. */
  .viewer canvas { aspect-ratio: 16 / 11; max-height: 56vh; }
  .viewer-head { inset: 10px 12px auto 12px; }
  .hero { padding-block: 22px 18px; }
  .hero h1 { font-size: clamp(26px, 7.4vw, 33px); max-width: 24ch; }
  .hero p { font-size: 14px; margin-top: 10px; }
  .viewer-spec { padding: 8px 14px 10px; font-size: 9.5px; letter-spacing: .02em; }
  /* One scrollable chip row beats two ragged rows pushing the list down. */
  /* The fade is the affordance: without it the last chip just looks chopped off. */
  .chips {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    mask-image: linear-gradient(90deg, #000 88%, transparent 100%);
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
  /* One line of transport, never two: play, scrub, time, mode and payload share the row. */
  .transport { gap: 8px; padding: 10px 12px; flex-wrap: nowrap; }
  .time { min-width: 0; font-size: 10.5px; white-space: nowrap; }
  .transport .ghost { padding: 7px 10px; font-size: 11px; }
  /* The payload link lives in the spec block on a phone; the row keeps the control that
     changes what you see. */
  .transport .payload { display: none; }
}
@media (max-width: 820px) {
  .nav-links, .nav-actions { display: none; }
  .nav-hamburger { display: block; }
  .nav.open .nav-links {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: rgba(3, 8, 16, .97); padding: 16px var(--gutter) 22px;
    border-bottom: 1px solid rgba(74, 168, 200, .12);
  }
  .nav.open .nav-links a { font-size: 16px; padding: 8px 0; }
  .transport { flex-wrap: nowrap; }
  .time { min-width: 0; }
}
/* Laptop screens: keep the transport and the spec line above the fold. A viewer taller
   than the window hides its own controls. */
@media (min-width: 901px) and (max-height: 950px) {
  .hero { padding-block: 26px 18px; }
  .hero h1 { font-size: clamp(30px, 4vw, 48px); }
  .viewer canvas { max-height: 46vh; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
