/* DexDirect project page — showroom layout: full-bleed media, quiet type, spec rows. */

:root {
  color-scheme: light;
  --ink: #171a20;
  --ink-2: #393c41;
  --muted: #5c5e62;
  --line: #e2e3e4;
  --bg: #ffffff;
  --bg-alt: #f4f4f4;
  --bg-dark: #171a20;
  --on-dark: #ffffff;
  --on-dark-2: #b9bbbe;
  --accent: #d97706;        /* DexDirect data marks (matches the paper's figures) */
  --accent-soft: #fdf3e3;
  --neutral-mark: #8e9097;
  --btn-dark: rgba(23, 26, 32, .82);
  --btn-dark-hover: rgba(23, 26, 32, .96);
  --btn-light: rgba(244, 244, 244, .74);
  --btn-light-hover: rgba(244, 244, 244, .96);
  --radius: 4px;
  --radius-media: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --container: 1200px;
  --gutter: 24px;
  --nav-h: 56px;
  --pad-l: max(var(--gutter), env(safe-area-inset-left, 0px));
  --pad-r: max(var(--gutter), env(safe-area-inset-right, 0px));
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
sup { font-size: .68em; line-height: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
.section-dark :focus-visible, .section-black :focus-visible, .hero :focus-visible { outline-color: #fff; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--radius); text-decoration: none;
}
.skip-link:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: var(--pad-l);
  padding-right: var(--pad-r);
}
.narrow { max-width: calc(820px + 2 * var(--gutter)); }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 24px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 264px; height: 40px; padding: 0 24px;
  border-radius: var(--radius); border: 0;
  font: 500 .875rem/1 var(--font); letter-spacing: .01em; text-decoration: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background-color .3s ease;
}
.btn-dark { background: var(--btn-dark); color: #fff; }
.btn-dark:hover { background: var(--btn-dark-hover); }
.btn-light { background: var(--btn-light); color: var(--ink-2); }
.btn-light:hover { background: var(--btn-light-hover); }
.btn.is-soon { color: var(--muted); cursor: default; }
.btn.is-soon:hover { background: var(--btn-light); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--pad-r) 0 var(--pad-l);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  color: #fff;
  transition: background-color .35s ease, color .35s ease, box-shadow .35s ease;
}
.nav.is-solid {
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(23, 26, 32, .06);
}
.nav-brand { justify-self: start; font-size: 1.05rem; font-weight: 600; letter-spacing: .01em; text-decoration: none; }
.nav-center, .nav-right { display: flex; align-items: center; gap: 2px; }
.nav-right { justify-self: end; }
.nav-center a, .nav-right a, .nav-menu {
  padding: 6px 14px; border-radius: var(--radius);
  font: 500 .875rem/1.4 var(--font); color: inherit; text-decoration: none;
  background: transparent; border: 0; cursor: pointer;
  transition: background-color .25s ease;
}
.nav-center a:hover, .nav-right a:hover, .nav-menu:hover, .nav-center a.is-active { background: rgba(255, 255, 255, .16); }
.nav.is-solid .nav-center a:hover, .nav.is-solid .nav-right a:hover, .nav.is-solid .nav-menu:hover,
.nav.is-solid .nav-center a.is-active { background: rgba(23, 26, 32, .06); }
.nav-menu { display: none; }

/* ---------- Drawer (mobile menu) ---------- */
.drawer {
  margin: 0 0 0 auto; height: 100%; max-height: 100%;
  width: min(340px, 100%); max-width: 100%;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) 20px;
  border: 0; background: #fff; color: var(--ink);
}
.drawer[open] { animation: drawer-in .3s cubic-bezier(.2, .7, .2, 1); }
.drawer::backdrop { background: rgba(0, 0, 0, .3); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@keyframes drawer-in { from { transform: translateX(100%); } }
.drawer-head { display: flex; justify-content: flex-end; }
.drawer-close {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; background: transparent; border-radius: var(--radius); cursor: pointer; color: var(--ink);
}
.drawer-close:hover { background: var(--bg-alt); }
.drawer-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.drawer-links { display: grid; gap: 2px; margin-top: 8px; }
.drawer-links a {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 1rem; font-weight: 500; text-decoration: none; color: var(--ink);
}
.drawer-links a:hover, .drawer-links a.is-active { background: var(--bg-alt); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  height: 100vh; height: 100svh; min-height: 560px;
  display: grid; grid-template-rows: 1fr auto;
  --hero-pos: 50% 50%;
  /* poster: shows until the first video frame is decoded; positioned exactly like the video */
  background: #0d0e10 url("../images/posters/hero_wide.jpg") no-repeat;
  background-size: cover; background-position: var(--hero-pos);
  color: #fff;
}
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: var(--hero-pos); }
.hero-shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, .4) 26%, rgba(0, 0, 0, .08) 46%, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, .5) 100%);
}
.hero-head {
  position: relative; align-self: start; text-align: center;
  text-shadow: 0 1px 14px rgba(0, 0, 0, .35);
  padding: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 8vh) var(--pad-r) 0 var(--pad-l);
}
.hero-venue { font-size: .875rem; font-weight: 500; letter-spacing: .02em; opacity: .92; }
.hero-title {
  margin: 10px 0 12px;
  font-size: clamp(2.75rem, 1.6rem + 4.4vw, 4.75rem); font-weight: 500; letter-spacing: -.015em; line-height: 1.02;
}
.hero-sub { max-width: 620px; margin: 0 auto; font-size: clamp(.95rem, .88rem + .3vw, 1.125rem); line-height: 1.5; opacity: .92; text-wrap: balance; }
.hero-foot {
  position: relative; display: grid; justify-items: center; gap: 18px;
  padding: 0 var(--pad-r) calc(24px + env(safe-area-inset-bottom, 0px)) var(--pad-l);
}
.hero-scroll { display: grid; place-items: center; width: 40px; height: 32px; color: #fff; opacity: .85; animation: nudge 2.2s ease-in-out infinite; }
.hero-scroll svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------- Key numbers ---------- */
.specbar { padding-block: 64px 8px; }
.specbar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; text-align: center; }
.spec-num { font-size: clamp(2rem, 1.4rem + 2vw, 2.85rem); font-weight: 500; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.spec-num span { font-size: .62em; margin-left: 1px; }
.spec-label { max-width: 220px; margin: 6px auto 0; font-size: .875rem; line-height: 1.45; color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding-block: 104px; }
.section-alt { background: var(--bg-alt); }
.section-dark { background: var(--bg-dark); color: var(--on-dark); }
.section-black { background: #000; color: var(--on-dark); }
section[id], header[id] { scroll-margin-top: var(--nav-h); }

.head { margin-bottom: 52px; }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.title { font-size: clamp(1.75rem, 1.2rem + 1.9vw, 2.6rem); font-weight: 500; letter-spacing: -.012em; line-height: 1.15; text-wrap: balance; }
.subtitle { max-width: 720px; margin-top: 12px; font-size: 1.0625rem; line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.head.center .subtitle { margin-inline: auto; }
.section-dark .subtitle, .section-black .subtitle { color: var(--on-dark-2); }
.note { margin-top: 14px; font-size: .875rem; line-height: 1.55; color: var(--muted); }

/* ---------- Overview ---------- */
.authors {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px;
  font-size: 1.0625rem; font-weight: 500;
}
.authors a { text-decoration: none; border-bottom: 1px solid var(--line); }
.authors a:hover { border-color: var(--ink); }
.affils { margin-top: 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 18px; font-size: .875rem; color: var(--muted); }
.affils-uni { margin-top: 4px; font-size: .875rem; font-weight: 500; color: var(--ink-2); }
.affils-uni span { font-weight: 400; color: var(--muted); }
.actions-tight { margin-top: 32px; gap: 12px; }
.actions-tight .btn { min-width: 150px; }
.eyebrow-title { margin-top: 80px; font-size: 1.25rem; font-weight: 500; }
.abstract { margin-top: 14px; font-size: 1.0625rem; line-height: 1.8; color: var(--ink-2); hyphens: auto; }

/* ---------- Media & figures ---------- */
.media { width: 100%; border-radius: var(--radius-media); background: #0d0e10; }
.media-wide { aspect-ratio: 16 / 9; }
.section:not(.section-dark):not(.section-black) .media-wide { box-shadow: 0 0 0 1px var(--line); }
.figure { margin: 0; }
.figure img { width: 100%; }
.figure-panel img { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-media); padding: clamp(8px, 1.6vw, 20px); }
.section-alt .figure-panel img { border-color: transparent; }
.figure figcaption { margin-top: 12px; font-size: .8125rem; color: var(--muted); text-align: center; }

/* ---------- Method: wide clip pinned on top, diagram pinned under it, steps scrolling beside the diagram ---------- */
.scrolly {
  --diag-w: clamp(240px, calc((100vh - 560px) * .82), 300px);   /* diagram card width (its height is 1.25x) */
  --row-gap: 20px;
  display: grid; grid-template-columns: var(--diag-w) minmax(0, 1fr); gap: var(--row-gap) 56px;
  grid-template-areas: "video video" "diagram steps";
}
.scrolly-video { grid-area: video; padding-block: 12px 8px; }
.scrolly-diagram { grid-area: diagram; align-self: start; }
.scrolly-steps { grid-area: steps; }
/* main.js adds .is-live and measures the band (--band-h); only then do the clip and the diagram pin. */
.scrolly.is-live .scrolly-video { position: sticky; top: var(--nav-h); z-index: 3; background: var(--bg); }
.scrolly.is-live .scrolly-video::after {          /* soft edge where the steps slide under the band */
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: var(--row-gap);
  background: linear-gradient(var(--bg), rgba(255, 255, 255, 0)); pointer-events: none;
}
.scrolly.is-live .scrolly-diagram {
  position: sticky; z-index: 2;
  top: calc(var(--nav-h) + var(--band-h, 0px) + var(--row-gap));
}
/* 3:1 clip, as wide as the container unless the screen is too short to fit it above the diagram. */
.stage-video {
  position: relative; overflow: hidden; margin-inline: auto; aspect-ratio: 3 / 1;
  width: min(100%, calc((100vh - var(--nav-h) - var(--diag-w) * 1.25 - 104px) * 3));
  border-radius: var(--radius-media); background: #0d0e10;
}
.stage-video video { width: 100%; height: 100%; object-fit: cover; }
/* The side that is not being described is dimmed. Percentages are of the clip width: the operator's right hand,
   the webcam and the hand-tracking view sit left of ~55%, the arm, the left hand and the robot hand right of it. */
.video-dim { position: absolute; top: 0; bottom: 0; opacity: 0; pointer-events: none; transition: opacity .6s ease; }
.video-dim-l { left: 0; width: 56%; background: linear-gradient(90deg, rgba(8, 10, 14, .64) 92%, rgba(8, 10, 14, 0)); }
.video-dim-r { left: 56%; right: 0; background: linear-gradient(90deg, rgba(8, 10, 14, 0), rgba(8, 10, 14, .64) 9%); }
.video-tag {
  position: absolute; top: 7%; padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .92); color: var(--ink); font: 500 .75rem/1.4 var(--font);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2); pointer-events: none;
  opacity: 0; transform: translateY(-4px); transition: opacity .5s ease, transform .5s ease;
}
.video-tag-l { left: 68%; }   /* over the operator's left hand */
.video-tag-r { left: 47%; }   /* over the operator's right hand */
.scrolly.is-live[data-active="left"] .video-dim-l,
.scrolly.is-live[data-active="right"] .video-dim-r { opacity: 1; }
.scrolly.is-live[data-active="left"] .video-tag-l,
.scrolly.is-live[data-active="right"] .video-tag-r { opacity: 1; transform: none; }
.stage-diagram {
  aspect-ratio: 4 / 5; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-media);
}
.stage-diagram-inner { position: relative; width: 90%; }
.stage-diagram-inner img { width: 100%; }
/* One box glides between the regions; its huge spread shadow washes out the rest of the diagram.
   Positions are percentages of method_diagram.webp (see tools/build_figures.py). */
.stage-hl {
  position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h);
  border: 2px solid var(--accent); border-radius: 10px;
  box-shadow: 0 0 0 100vmax rgba(255, 255, 255, .62);
  pointer-events: none;
  transition: left .65s cubic-bezier(.65, 0, .35, 1), top .65s cubic-bezier(.65, 0, .35, 1),
              width .65s cubic-bezier(.65, 0, .35, 1), height .65s cubic-bezier(.65, 0, .35, 1);
}
.scrolly[data-active="left"]   .stage-hl { --x: -.54%;  --y: -.09%;  --w: 39.19%;  --h: 42.06%; }
.scrolly[data-active="right"]  .stage-hl { --x: 38.77%; --y: -.09%;  --w: 61.53%;  --h: 42.06%; }
.scrolly[data-active="record"] .stage-hl { --x: -.54%;  --y: 43.28%; --w: 100.84%; --h: 57%; }
.stage-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 10px; }
.stage-tabs[hidden] { display: none; }
.stage-tabs button {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  font: 500 .75rem/1.3 var(--font); color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}
.stage-tabs button:hover { color: var(--ink); border-color: #c6c7c9; }
.stage-tabs button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.step { min-height: 60vh; padding-block: 8px 48px; }
.step .feature-text { max-width: 600px; }
.scrolly.is-live .step { opacity: .22; transition: opacity .45s ease; }
.scrolly.is-live .step.is-active { opacity: 1; }
.kicker { font-size: .875rem; font-weight: 500; color: var(--muted); }
.feature-title { margin: 6px 0 14px; font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); font-weight: 500; letter-spacing: -.01em; line-height: 1.2; }
.feature-text > p { color: var(--ink-2); line-height: 1.7; }
.feature-specs { margin: 30px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature-specs dt { font-size: 1.75rem; font-weight: 500; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.feature-specs dd { margin: 4px 0 0; font-size: .8125rem; line-height: 1.4; color: var(--muted); }
.feature-specs dd span { color: #8a8c90; }

/* ---------- Hardware ---------- */
.hardware { display: grid; grid-template-columns: 1.3fr 1fr; gap: 64px; align-items: center; }
.hardware-figure { margin: 0; }
.hardware-figure img { width: 100%; background: #fff; border-radius: var(--radius-media); padding: clamp(10px, 2vw, 24px); }
.spec-list { margin: 30px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 26px 32px; }
.spec-list dt { font-size: .8125rem; color: var(--muted); }
.spec-list dd { margin: 4px 0 0; font-size: 1rem; font-weight: 500; line-height: 1.45; color: var(--ink); }
.spec-list-3 { margin: 0; grid-template-columns: 1fr; gap: 22px; }
.spec-list-dark { margin: 0; grid-template-columns: 1fr; gap: 22px; }
.spec-list-dark dt { color: var(--on-dark-2); }
.spec-list-dark dd { color: var(--on-dark); }

/* ---------- 3D slot ---------- */
.viewer-3d {
  position: relative; width: 100%; max-width: 100%; aspect-ratio: 16 / 9;
  border-radius: var(--radius-media); overflow: hidden; background: #0b0c0e;
}
.viewer-3d.is-empty {
  border: 1px dashed rgba(255, 255, 255, .22);
  background:
    radial-gradient(circle, rgba(255, 255, 255, .08) 1px, transparent 1.5px) 0 0 / 24px 24px,
    radial-gradient(ellipse at 50% 60%, #1c1e23 0%, #0b0c0e 72%);
}
.viewer-3d > canvas, .viewer-3d > iframe { display: block; width: 100%; height: 100%; border: 0; }
.viewer-3d-placeholder {
  position: absolute; inset: 0; padding: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  font-size: .9375rem; color: rgba(255, 255, 255, .62); text-align: center;
}
.viewer-3d-placeholder svg { width: 52px; height: 52px; fill: none; stroke: rgba(255, 255, 255, .42); stroke-width: 1.4; stroke-linejoin: round; }
.viewer-3d-placeholder p { max-width: 46ch; margin: 0; line-height: 1.5; }
.viewer-3d-placeholder a { color: #fff; text-underline-offset: 3px; }
.viewer-3d-placeholder code { font-family: var(--mono); font-size: .875em; color: #fff; }
.viewer-3d:not(.is-empty) .viewer-3d-placeholder { display: none; }

/* Playground (static/js/playground.js): MuJoCo simulation, start overlay, toolbar, webcam inset */
.pg { position: absolute; inset: 0; user-select: none; -webkit-user-select: none; }
.pg-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.pg-start { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 60%, #1c1e23 0%, #0b0c0e 72%); }
.pg-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.pg-start-inner { position: relative; display: grid; justify-items: center; gap: 14px; padding: 16px; text-align: center; }
.pg-kicker { margin: 0; font-size: .8125rem; font-weight: 500; letter-spacing: .04em; color: rgba(255, 255, 255, .78); }
.pg-go {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 22px; border: 0; border-radius: var(--radius);
  background: #fff; color: var(--ink); font: 600 .9375rem var(--font); cursor: pointer; box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
.pg-go:hover { background: #ececec; }
.pg-go svg { width: 16px; height: 16px; fill: currentColor; }
.pg-note { margin: 0; font-size: .75rem; line-height: 1.45; color: rgba(255, 255, 255, .62); }
.pg-hint { position: absolute; top: 14px; left: 16px; right: 16px; margin: 0; font-size: .8125rem; line-height: 1.4; color: rgba(255, 255, 255, .7); pointer-events: none; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.pg-hint span { color: #ffb067; font-weight: 600; }
.pg-bar {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 3;
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px;
  background: rgba(13, 14, 17, .62); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.pg-bar[hidden], .pg-start[hidden], .pg-loading[hidden], .pg-grip[hidden], .pg-btn[hidden] { display: none; }
.pg-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border: 0; border-radius: var(--radius);
  background: rgba(255, 255, 255, .12); color: #fff; font: 500 .8125rem var(--font); white-space: nowrap; cursor: pointer;
}
.pg-btn:hover { background: rgba(255, 255, 255, .2); }
.pg-btn:disabled { opacity: .6; cursor: progress; }
.pg-btn.is-on { background: #fff; color: var(--ink); }
.pg-btn svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pg-reset { margin-left: auto; }
.pg-grip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; max-width: 320px; font-size: .8125rem; color: rgba(255, 255, 255, .75); }
.pg-grip input { flex: 1; min-width: 40px; accent-color: #ffb067; }
.pg-webcam { position: absolute; right: 12px; bottom: 60px; z-index: 3; width: 176px; }
.pg-webcam video { display: block; width: 100%; border-radius: 6px; background: #000; transform: scaleX(-1); }
.pg-lm { position: absolute; top: 0; left: 0; width: 100%; pointer-events: none; }
.pg-webcam .pg-note { margin-top: 6px; font-size: .6875rem; text-align: right; }
.pg-status { position: absolute; left: 16px; bottom: 60px; max-width: 60%; margin: 0; font-size: .8125rem; line-height: 1.4; color: rgba(255, 255, 255, .78); pointer-events: none; }
/* Reference pose for resetting the hand mapping (C), top-right corner. */
.pg-pose {
  position: absolute; top: 12px; right: 12px; z-index: 3; display: flex; align-items: center; gap: 14px;
  width: 260px; padding: 12px 14px; border-radius: 6px; font-size: .8125rem; line-height: 1.4; color: #fff;
  background: rgba(13, 14, 17, .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.pg-pose[hidden] { display: none; }
.pg-pose svg { flex: none; width: 46px; height: 64px; fill: #ececec; }
.pg-pose p { margin: 0; }
.pg-pose-title { font-weight: 600; }
.pg-pose ul { margin: 4px 0 8px; padding: 0; list-style: none; font-size: .75rem; color: rgba(255, 255, 255, .72); }
.pg-pose-key { font-weight: 600; color: #ffb067; }
.pg-pose kbd {
  display: inline-block; min-width: 1.6em; padding: 0 .3em; border: 1px solid rgba(255, 176, 103, .7); border-radius: 4px;
  font: inherit; line-height: 1.35; text-align: center;
}
.pg-pose-esc { margin-top: 2px !important; font-size: .6875rem; color: rgba(255, 255, 255, .5); }
.pg.is-posing .pg-hint { right: 288px; }
.pg.is-failed .pg-status { left: 50%; top: 50%; bottom: auto; max-width: 80%; transform: translate(-50%, -50%); text-align: center; }
.pg-loading { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; font-size: .875rem; color: rgba(255, 255, 255, .7); text-align: center; }
.pg-loading i { display: block; width: 180px; height: 2px; background: rgba(255, 255, 255, .15); }
.pg-loading b { display: block; width: 0; height: 100%; background: #fff; transition: width .25s ease; }
.pg.is-dragging .pg-hint span { color: #fff; }
@media (max-width: 760px) {
  .viewer-3d { aspect-ratio: 4 / 5; }
  .pg-hint { top: 10px; left: 12px; right: 12px; font-size: .75rem; }
  .pg-bar { left: 8px; right: 8px; bottom: 8px; gap: 8px; }
  .pg-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .pg-btn { width: 32px; padding: 0; justify-content: center; }
  .pg-grip span { display: none; }
  .pg-webcam { width: 112px; bottom: 54px; right: 8px; }
  .pg-status { bottom: 54px; max-width: 55%; font-size: .75rem; }
  .pg-pose { top: 8px; right: 8px; width: 208px; gap: 10px; padding: 10px; font-size: .75rem; }
  .pg-pose svg { width: 34px; height: 48px; }
  .pg-pose ul { font-size: .6875rem; }
  .pg.is-posing .pg-hint { right: 224px; }
}

/* ---------- Carousel (tasks) ---------- */
.carousel {
  --edge: max(var(--gutter), env(safe-area-inset-left, 0px), calc((100% - var(--container)) / 2));
  display: grid; grid-auto-flow: column; grid-auto-columns: min(520px, 82%);
  gap: 24px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--edge);
  padding: 4px var(--edge) 8px;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel:focus-visible { outline-offset: -2px; }
.slide { min-width: 0; scroll-snap-align: start; }
.slide .media { aspect-ratio: 4 / 3; object-fit: cover; }
.slide h3 { margin-top: 18px; font-size: 1.25rem; font-weight: 500; }
.slide p { margin-top: 6px; font-size: .9375rem; line-height: 1.6; color: var(--ink-2); }
.slide-stats { margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.slide-stats dt { font-size: 1.25rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.slide-stats dd { margin: 2px 0 0; font-size: .8125rem; color: var(--muted); }
.carousel-arrows { display: flex; gap: 12px; flex-shrink: 0; }
.arrow {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--bg-alt); color: var(--ink); cursor: pointer;
  transition: background-color .2s ease, opacity .2s ease;
}
.arrow:hover { background: #e7e7e8; }
.arrow:disabled { opacity: .35; cursor: default; }
.arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.carousel-dots { display: flex; justify-content: center; gap: 8px; margin-top: 28px; }
.carousel-dots button {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%;
  background: #d0d1d2; cursor: pointer; transition: background-color .2s ease;
}
.carousel-dots button.is-active { background: var(--ink); }

/* ---------- Compare interfaces ---------- */
.compare { margin-top: 40px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.compare-col { background: #fff; border-radius: var(--radius-media); padding: 28px 28px 30px; text-align: center; }
.compare-col.is-ours { box-shadow: inset 0 0 0 2px var(--ink); }
.compare-col h3 { display: inline-flex; align-items: center; gap: 8px; font-size: 1.375rem; font-weight: 500; }
.tag {
  font-size: .6875rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  background: var(--ink); color: #fff; padding: 2px 8px; border-radius: 3px;
}
.compare-how { margin-top: 10px; min-height: 3.1em; font-size: .9375rem; line-height: 1.55; color: var(--ink-2); }
.compare dl { margin: 24px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare dt { font-size: 2rem; font-weight: 500; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.compare dd { margin: 4px 0 0; font-size: .8125rem; color: var(--muted); }
.study { margin-top: 64px; display: grid; grid-template-columns: 1.7fr 1fr; gap: 48px; align-items: center; }
.study .media { aspect-ratio: 1280 / 488; background: #fff; }

/* ---------- Results: throughput chart ---------- */
.chart { margin: 0 0 40px; background: var(--bg-alt); border-radius: var(--radius-media); padding: 28px 32px 30px; }
.chart-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 20px; }
.chart-title { font-size: 1.0625rem; font-weight: 500; color: var(--ink); }
.chart-sub { font-size: .875rem; color: var(--muted); }
.hbar { display: grid; gap: 6px; }
.hbar-row {
  display: grid; grid-template-columns: 104px 1fr; align-items: center; gap: 14px;
  padding: 6px 0; border-radius: var(--radius); cursor: default; outline-offset: 2px;
}
.hbar-label { font-size: .9375rem; font-weight: 500; color: var(--ink); }
.hbar-track { display: flex; align-items: center; gap: 10px; min-height: 30px; border-left: 1px solid #c9cacc; }
.hbar-fill {
  flex: 0 0 calc((100% - 56px) * var(--v) / var(--max));
  height: 22px; min-width: 2px;
  background: var(--neutral-mark); border-radius: 0 4px 4px 0;
  transition: filter .15s ease;
}
.hbar-row.is-ours .hbar-fill { background: var(--accent); }
.hbar-row:hover .hbar-fill, .hbar-row:focus-visible .hbar-fill { filter: brightness(1.12); }
.hbar-value { font-size: .9375rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.chart-tip {
  position: fixed; z-index: 60; pointer-events: none;
  display: grid; gap: 2px; min-width: 160px; padding: 8px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 20px rgba(23, 26, 32, .12);
}
.chart-tip[hidden] { display: none; }
.chart-tip strong { font-size: .9375rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.chart-tip span { font-size: .8125rem; color: var(--muted); }

/* ---------- Results: table ---------- */
.table-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-media); padding: 6px 6px 4px; }
.table-title { padding: 14px 14px 10px; font-size: 1rem; font-weight: 500; color: var(--ink); }
.table-title span { font-size: .8125rem; font-weight: 400; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 14px; text-align: right; white-space: nowrap; }
th:first-child { text-align: left; }
thead th { font-size: .75rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
thead tr:last-child th { border-bottom: 1px solid #c9cacc; }
thead th.group { text-align: center; color: var(--ink-2); padding-bottom: 4px; }
thead th.col-task { vertical-align: bottom; border-bottom: 1px solid #c9cacc; }
thead th.col-ours { color: var(--ink); }
.group-start { border-left: 1px solid var(--line); }
tbody th { font-weight: 500; color: var(--ink); }
tbody td { color: var(--ink-2); }
tbody tr + tr > * { border-top: 1px solid var(--line); }
td.best { font-weight: 600; color: var(--ink); background: var(--accent-soft); }
.results-table th:first-child { position: sticky; left: 0; z-index: 1; background: #fff; }

/* ---------- Results: workload ---------- */
.workload { margin-top: 80px; display: grid; grid-template-columns: 1fr 1.25fr; gap: 56px; align-items: center; }
.workload-text > p { margin-top: 4px; line-height: 1.7; color: var(--ink-2); }

/* ---------- Policy ---------- */
.policy { display: grid; grid-template-columns: 1.6fr 1fr; gap: 48px; align-items: center; }
.policy .media { aspect-ratio: 16 / 9; }
.rollout { list-style: none; margin: 48px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.rollout li { position: relative; }
.rollout img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-media); }
.rollout span {
  position: absolute; left: 10px; bottom: 10px;
  padding: 2px 8px; border-radius: 3px; background: rgba(0, 0, 0, .62);
  font-size: .8125rem; font-weight: 500; color: #fff; font-variant-numeric: tabular-nums;
}


/* ---------- Citation ---------- */
.bibtex { position: relative; }
.bibtex pre {
  margin: 0; overflow-x: auto;
  background: #fff; border-radius: var(--radius-media);
  padding: 24px; font-family: var(--mono); font-size: .8125rem; line-height: 1.7; color: var(--ink);
}
.copy-btn {
  position: absolute; top: 12px; right: 12px;
  height: 32px; padding: 0 14px; border: 0; border-radius: var(--radius);
  background: var(--bg-alt); color: var(--ink-2); font: 500 .8125rem var(--font); cursor: pointer;
}
.copy-btn:hover { background: #e7e7e8; }

/* ---------- Footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px;
  padding: 28px var(--pad-r) calc(32px + env(safe-area-inset-bottom, 0px)) var(--pad-l);
  font-size: .8125rem; color: var(--muted);
}
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .nav { grid-template-columns: 1fr auto; }
  .nav-center, .nav-right a { display: none; }
  .nav-menu { display: inline-flex; }
  .hardware, .study, .policy, .workload { grid-template-columns: 1fr; gap: 32px; }
}
/* Narrow or short screens: the clip and, under it, a row with the diagram and the tabs pin under the nav on white
   bands, and the steps scroll up beneath them. main.js uses the same query. */
@media (max-width: 860px), (max-height: 599px) {
  .scrolly {
    --diag-w: clamp(110px, min(34vw, calc((100vh - 470px) * .8)), 220px);
    --row-gap: 0px;
    grid-template-columns: minmax(0, 1fr); grid-template-areas: "video" "diagram" "steps";
  }
  .scrolly-video, .scrolly-diagram {
    margin-inline: calc(-1 * var(--pad-l)) calc(-1 * var(--pad-r));
    padding-inline: var(--pad-l) var(--pad-r);
    background: var(--bg);
  }
  .scrolly-video { padding-block: 8px 6px; }
  .stage-video { width: min(100%, calc(32vh * 3)); }
  .scrolly-diagram { display: flex; align-items: center; justify-content: center; gap: 18px; padding-block: 6px 12px; }
  .scrolly.is-live .scrolly-video::after { content: none; }
  .scrolly.is-live .scrolly-diagram::after {
    content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 24px;
    background: linear-gradient(var(--bg), rgba(255, 255, 255, 0)); pointer-events: none;
  }
  .stage-diagram { width: var(--diag-w); flex: none; }
  .stage-tabs { flex-direction: column; flex-wrap: nowrap; margin-top: 0; }
  .stage-tabs button { padding: 6px 14px; font-size: .8125rem; }
  .step { min-height: 62vh; padding-block: 32px; }
}
/* Too short for the diagram row as well: the clip alone (its dimming and hand labels still mark the step). */
@media (max-width: 860px) and (max-height: 620px), (max-height: 599px) {
  .scrolly-diagram { display: none; }
}

/* Square-ish screens still get the 16:9 cut: keep the robot side of it in view.
   Portrait screens (<= 3:4) get the 9:16 cut, which is already framed on the action. */
@media (max-aspect-ratio: 1/1) {
  .hero { --hero-pos: 80% 50%; }
}
@media (max-aspect-ratio: 3/4) {
  .hero { --hero-pos: 50% 50%; background-image: url("../images/posters/hero_portrait.jpg"); }
}

@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .section { padding-block: 72px; }
  .hero-head { padding-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 6vh); }
  /* side by side: one short row covers less of the robot hand at the bottom of the portrait cut */
  .hero .actions { flex-wrap: nowrap; width: 100%; max-width: 420px; gap: 10px; }
  .hero .btn { flex: 1 1 0; min-width: 0; padding-inline: 8px; }
  .hero-foot { gap: 10px; }
  .specbar { padding-top: 48px; }
  .specbar-grid { grid-template-columns: 1fr 1fr; gap: 32px 16px; }
  .head { margin-bottom: 36px; }
  .head-row { align-items: flex-start; }
  .carousel-arrows { display: none; }
  .actions-tight .btn { min-width: 0; flex: 1 1 40%; }
  .feature-specs dt { font-size: 1.4rem; }
  .spec-list { grid-template-columns: 1fr; }
  .compare { grid-template-columns: 1fr; }
  .compare-how { min-height: 0; }
  .rollout { grid-template-columns: 1fr 1fr; }
  .chart { padding: 22px 16px 24px; }
  .hbar-row { grid-template-columns: 84px 1fr; gap: 10px; }
  .hbar-label { font-size: .875rem; }
  .bibtex pre { padding: 18px 16px; font-size: .75rem; }
  .copy-btn { top: 8px; right: 8px; }
}
