/* motion.css — the swiss motion: the sticky header, the hero (the giant headline + the spin
   figure, the props as a throttle) and the teardown (the pinned scrub track, the part labels,
   the caption). Colours and fonts are tokens.css's: var(--name) only. The product sits on the
   dark stage (a black plate on the white page); the stage's ink is light. */

/* ---------- the sticky header: the brand mark, flush left on white ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 max(20px, env(safe-area-inset-left), env(safe-area-inset-right));
  background: var(--ground);
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.brand-mark-square { width: 9px; height: 9px; background: var(--accent); }

.site-header-index {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

@media (max-width: 480px) { .site-header-index { display: none; } }

/* ---------- the hero: the giant headline fills the first screen; the product enters under it ---------- */

.hero { position: relative; z-index: 1; padding: clamp(72px, 11vh, 130px) 0 clamp(48px, 8vw, 80px); }

.hero-headline {
  font-size: clamp(3.5rem, 14vw, 11rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
  margin: 0 0 28px;
  color: var(--ink);
}

.hero-sub {
  font-size: clamp(1rem, 1rem + 0.6vw, 1.3rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 0 36px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: clamp(40px, 6vw, 64px); }

.hero-figure { margin: 0; }

/* ---------- the spin figure: the props as a throttle (spin.js drives it; we only place it) ---------- */

.spin {
  position: relative;
  margin: 0;
  aspect-ratio: 16 / 9;
  background: var(--stage);   /* the frames' ground is the stage: the plate sits flat, no blend */
  border: 1px solid var(--line);
  overflow: hidden;
}

/* a screen taller than wide: the portrait frames are 3/4 */
@media (orientation: portrait) { .spin { aspect-ratio: 3 / 4; } }

.spin-poster,
.spin-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.spin-canvas { z-index: 2; }

/* the rpm readout: a small instrument on the dark plate, the value in the swiss red */
.spin [data-spin-rpm] {
  position: absolute;
  z-index: 5;
  left: 14px;
  bottom: 14px;
  min-width: 104px;
  padding: 6px 10px 7px;
  background: var(--stage);
  border: 1px solid var(--stage-line);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--stage-ink);
  text-align: right;
}

.spin [data-spin-rpm]::before {
  content: 'PROPS · RPM';
  display: block;
  margin-bottom: 2px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--stage-ink-soft);
  text-align: left;
}

/* ---------- the teardown: the pinned track (scrub.js drives it; we only style it) ---------- */

.teardown { position: relative; z-index: 1; background: var(--stage); }

.scrub-pinned-track {
  position: relative;
  height: 300vh;
  height: 300svh;
}

.scrub-sticky-viewport {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--stage);   /* the frames' ground is the stage: flat, no blend mode */
}

.scrub-poster,
.scrub-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* the frame counter: a plain readout, top left, on a solid plate (the frame moves behind it).
   top: 70px keeps it clear of the sticky header (52px), which would otherwise cover it when pinned */
.scrub-telemetry-hud {
  position: absolute;
  z-index: 25;
  top: 70px;
  left: 18px;
  padding: 6px 10px;
  background: var(--stage);
  border: 1px solid var(--stage-line);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.hud-readout {
  color: var(--stage-ink);
  font-variant-numeric: tabular-nums;
}

/* the honest note: the inside is an illustration */
.scrub-caption {
  position: absolute;
  z-index: 25;
  right: 18px;
  bottom: 16px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--stage-ink-soft);
}

/* ---------- the part labels (hud-leader-lines): live DOM text, built by motion.js ---------- */

.scrub-hud {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;   /* the overlay never intercepts the scene's pointer events */
}

.scrub-hud-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scrub-hud-lines path {
  fill: none;
  stroke: var(--stage-ink-soft);
  stroke-width: 1;
  opacity: 0.6;
}

.hud-label {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 140ms linear;
}

.hud-label.is-on { opacity: 1; }

/* the anchor dot: a 6px square, moved by transform only (compositor) */
.hud-dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  background: var(--accent);
}

/* the label card: a solid panel on the dark plate (no backdrop-blur over the moving scene) */
.hud-card {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: max-content;
  max-width: 172px;
  padding: 6px 9px;
  background: var(--stage-lift);
  border: 1px solid var(--stage-line);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.hud-card-index { font-size: 9px; color: var(--stage-ink-soft); }
.hud-card-name { color: var(--stage-ink); }

@media (min-width: 1024px) {
  .hud-card {
    width: max-content;
    max-width: 190px;
    padding: 7px 10px;
    font-size: 11px;
  }
  .hud-card-index { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .hud-label { transition: none; }
}
