/* The mascot and the motion system.
 *
 * One orchestrated moment carries the page: the lid opens, the screen wakes,
 * the headline sets. Everything after that is small and reactive. Nothing here
 * runs under prefers-reduced-motion except a single static render.
 */

:root {
  --screen-off: #0b1c3d;
  --wash: #e8efff;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ── the mascot ─────────────────────────────────────────────────────────── */
.lm { display: block; width: 100%; perspective: 1400px; }
.lm-svg { display: block; width: 100%; height: auto; overflow: visible; }

/* The lid hinges at the base, so the open reads as a real machine opening. */
.lm .lm-lid {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: rotateX(-82deg);
  opacity: 0;
  transition: transform 620ms var(--ease-out), opacity 240ms linear;
}
.lm.is-open .lm-lid { transform: rotateX(0deg); opacity: 1; }

.lm .lm-screen { transition: fill 420ms var(--ease-out); }
.lm.is-awake .lm-screen { fill: var(--accent); }
.lm .lm-sheen { opacity: 0; transition: opacity 420ms linear 160ms; }
.lm.is-awake .lm-sheen { opacity: 1; }
.lm.is-awake.is-down .lm-screen { fill: #c8102e; }

.lm .lm-face { opacity: 0; transition: opacity 300ms linear 120ms; }
.lm.is-awake .lm-face { opacity: 1; }

.lm .lm-label, .lm .lm-sub {
  font-family: var(--display); font-weight: 700; font-size: 19px; fill: #fff;
  opacity: 0; transition: opacity 220ms linear;
  font-variant-numeric: lining-nums tabular-nums;
}
.lm.is-focused .lm-label, .lm.is-focused .lm-sub { opacity: .92; }

/* A launch landing: the whole machine nudges once, the screen flares. */
@keyframes lm-spike {
  0% { transform: translateY(0) rotate(0); }
  22% { transform: translateY(-9px) rotate(-1deg); }
  55% { transform: translateY(2px) rotate(.6deg); }
  100% { transform: translateY(0) rotate(0); }
}
.lm.is-spiking .lm-svg { animation: lm-spike 780ms var(--ease-out) 1; }
.lm.is-spiking .lm-screen { fill: #2f7bff; }

/* ── the load sequence ──────────────────────────────────────────────────── */
/* Lines of the headline set one after another from behind a mask. Nothing
   moves more than a few pixels: the reveal does the work, not the travel. */
.rise { display: block; overflow: hidden; }
.rise > * {
  display: block;
  transform: translateY(102%);
  transition: transform 760ms var(--ease-out);
}
.is-set .rise > * { transform: translateY(0); }
.is-set .rise:nth-of-type(2) > * { transition-delay: 90ms; }
.is-set .rise:nth-of-type(3) > * { transition-delay: 180ms; }

.fade-in { opacity: 0; transition: opacity 600ms linear 340ms; }
.is-set .fade-in { opacity: 1; }

/* ── scroll reveals ─────────────────────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 520ms linear, transform 620ms var(--ease-out); }
.reveal.seen { opacity: 1; transform: none; }

/* ── board cards ────────────────────────────────────────────────────────── */
/* A card lifts a little and its edge picks up the accent, so pointing at one
   feels connected to the mascot reacting above it. */
.board .win { transition: transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out), border-color 200ms linear; }
.board .win:hover, .board .win:focus-within {
  transform: translateY(-3px);
  border-color: rgba(0, 82, 255, .35);
  box-shadow: 0 2px 8px rgba(18, 21, 26, .06), 0 22px 48px rgba(0, 82, 255, .10);
}

/* ── a quiet ground for the hero, so the machine sits on something ─────── */
.hero-ground {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 78% 18%, var(--wash) 0%, transparent 62%),
    linear-gradient(180deg, transparent 60%, rgba(18, 21, 26, .03) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .lm .lm-lid { transform: none; opacity: 1; transition: none; }
  .lm .lm-face { opacity: 1; transition: none; }
  .lm .lm-screen { fill: var(--accent); }
  .rise > *, .fade-in, .reveal { transform: none !important; opacity: 1 !important; transition: none !important; }
  .board .win:hover { transform: none; }
  .lm.is-spiking .lm-svg { animation: none; }
}

/* ── hero layout with the machine in it ─────────────────────────────────── */
.hero { position: relative; padding: 46px 0 30px; }
.hero-in {
  display: grid; gap: 30px 44px; align-items: center;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  grid-template-areas: "copy machine" "steps machine";
}
.hero-copy { grid-area: copy; }
.hero-machine { grid-area: machine; align-self: center; }
.hero-win { grid-area: steps; }
.mascot-slot { max-width: 520px; margin-left: auto; }
.mascot-cap {
  margin: 14px 0 0; text-align: right; font-size: 12.5px; color: var(--ink-3);
  max-width: 520px; margin-left: auto; transition: color 200ms linear;
}
.mascot-cap.on { color: var(--accent); }

@media (max-width: 900px) {
  .hero-in { grid-template-columns: 1fr; grid-template-areas: "copy" "machine" "steps"; }
  .mascot-slot, .mascot-cap { margin: 0 auto; max-width: 420px; text-align: center; }
  .hero { padding: 26px 0 20px; }
}

/* The 404 keeps the machine small and centred, above the message. */
.mascot-404 { max-width: 260px; margin: 8px auto 22px; }
