/* ─────────────────────────────────────────────────────────────
   motion-skills — scroll-driven story (matches Remotion video)
   ───────────────────────────────────────────────────────────── */

:root {
  --bg:        rgb(248, 243, 232);
  --bg-deep:   rgb(240, 232, 217);
  --bg-ink:    rgb(20, 18, 16);
  --ink:       rgb(28, 24, 20);
  --ink-soft:  rgb(74, 65, 56);
  --ink-mute:  rgb(130, 120, 110);
  --rule:      rgb(210, 198, 180);
  --accent:    rgb(212, 86, 50);    /* vermilion  */
  --accent-2:  rgb(232, 175, 80);   /* amber      */
  --green:     rgb(86, 168, 90);
  --term-bg:   rgb(22, 18, 16);
  --term-fg:   rgb(242, 234, 220);

  --noise: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.09 0 0 0 0 0.07 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --font-sans: 'Geist', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  background-image: var(--noise);
  background-size: 240px;
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: color-mix(in oklch, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.topbar__brand { color: var(--ink); font-weight: 700; }
.topbar__pct { font-feature-settings: 'tnum' on; }
.topbar__bar {
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: rgba(28,24,20,0.06);
}
.topbar__bar > span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

/* ── Scene base ─────────────────────────────────────────────── */
.scene {
  position: relative;
  min-height: 100vh;
  padding: 80px 7vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

.scene--cmd,
.scene--checks {
  background: var(--bg-ink);
  color: var(--term-fg);
}

.scene--demo {
  align-items: center;
  text-align: center;
}

.tag {
  position: absolute;
  top: 80px;
  left: 7vw;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  z-index: 10;
}
.tag span {
  color: var(--ink);
  font-weight: 700;
  font-feature-settings: 'tnum' on;
}
.tag i {
  display: inline-block;
  width: 22px;
  height: 1px;
  background: var(--ink-mute);
}
.tag--dark { color: rgba(242,234,220,0.55); }
.tag--dark span { color: var(--term-fg); }
.tag--dark i { background: rgba(242,234,220,0.4); }

/* ── 00 · TITLE ─────────────────────────────────────────────── */
.scene--title { align-items: center; justify-content: center; }

.title { display: flex; flex-direction: column; align-items: center; gap: 28px; text-align: center; }

.title__dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 10px rgba(212,86,50,0.16);
  transform: scale(0);
  opacity: 0;
}

.title__head {
  margin: 0;
  font-weight: 800;
  font-size: clamp(48px, 7vw, 96px);
  letter-spacing: -0.035em;
  line-height: 1.04;
  color: var(--ink);
}

.title__line {
  display: block;
  white-space: nowrap;
  padding-right: 0.1em;
}

.title__line--accent {
  color: var(--accent);
  font-style: italic;
  padding-right: 0.25em;
}

.title__tag {
  font-family: var(--font-mono);
  font-size: clamp(11px, 1vw, 14px);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.title__scroll {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.title__scroll-line { display: block; width: 80px; height: 1px; background: var(--ink-mute); }

/* ── 01 · BRIEF ─────────────────────────────────────────────── */
.brief { width: 100%; display: flex; justify-content: center; }

.term {
  width: min(720px, 92vw);
  border-radius: 18px;
  overflow: hidden;
  background: var(--term-bg);
  box-shadow: 0 40px 80px -50px rgba(28,24,20,0.55);
}
.term__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  background: rgb(28,24,20);
  border-bottom: 1px solid rgba(242,234,220,0.06);
}
.term__dot {
  width: 12px; height: 12px; border-radius: 999px;
  background: rgba(242,234,220,0.3);
}
.term__dot:nth-child(1) { background: rgb(231,92,75); }
.term__dot:nth-child(2) { background: rgb(232,175,80); }
.term__dot:nth-child(3) { background: rgb(86,168,90); }
.term__title {
  margin-left: 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: rgba(242,234,220,0.55);
}
.term__body {
  margin: 0;
  padding: 28px 32px;
  font-family: var(--font-mono);
  font-size: clamp(14px, 1.3vw, 18px);
  line-height: 1.65;
  color: var(--term-fg);
  white-space: pre;
  min-height: 360px;
}
.caret {
  color: var(--accent-2);
  font-weight: 700;
  animation: blink 1.05s steps(2,end) infinite;
}
@keyframes blink { to { opacity: 0; } }

/* ── 02 · OUTPUT ────────────────────────────────────────────── */
.scene--output { align-items: center; }

.output { width: 100%; display: flex; justify-content: center; }

.card {
  width: min(420px, 86vw);
  position: relative;
  background: white;
  border: 1px solid var(--rule);
  border-radius: 24px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 460px;
  box-shadow: 0 50px 90px -60px rgba(28,24,20,0.4);
  opacity: 0;
  transform: translateY(40px);
}
.card__avatar { width: 76px; height: 76px; border-radius: 999px; background: var(--bg-deep); }
.card__h1 { width: 64%; height: 24px; border-radius: 4px; background: var(--bg-deep); }
.card__h2 { width: 42%; height: 12px; border-radius: 4px; background: var(--bg-deep); }
.card__h3 { width: 78%; height: 12px; border-radius: 4px; background: var(--bg-deep); }
.card__pills { display: flex; gap: 10px; margin-top: 8px; }
.card__pills span { width: 76px; height: 22px; border-radius: 6px; background: var(--bg-deep); }
.card__file {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
}
.card__stamp {
  position: absolute;
  top: -16px; right: -16px;
  padding: 8px 14px;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-radius: 6px;
  background: rgba(248,243,232,0.85);
  transform: rotate(-25deg) scale(0.6);
  opacity: 0;
}

/* ── 03 · CAPTION ───────────────────────────────────────────── */
.scene--caption { align-items: center; justify-content: center; }

.caption {
  text-align: center;
  font-weight: 800;
  font-size: clamp(36px, 6vw, 84px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  color: var(--ink-soft);
}
.caption__line { display: block; white-space: nowrap; }
.caption__line--strong { color: var(--ink); }
.caption__line em { color: var(--accent); font-style: italic; font-weight: 800; padding-right: 0.18em; }
.caption__rule {
  margin: 28px auto 0;
  width: 120px;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
}

/* ── 04 · CMD ───────────────────────────────────────────────── */
.scene--cmd { align-items: center; justify-content: center; }

.cmd { position: relative; max-width: 92vw; }
.cmd__text {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(20px, 2.5vw, 36px);
  font-weight: 500;
  color: var(--term-fg);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.cmd__underline {
  display: block;
  margin: 12px auto 0;
  width: 70%;
  margin-left: 30%;
  height: 4px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

/* ── 05 · CHECKS ────────────────────────────────────────────── */
.scene--checks { align-items: center; justify-content: center; gap: 28px; }

.checks { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 28px; }

.checks__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 56px;
  font-family: var(--font-mono);
  font-size: clamp(18px, 2vw, 28px);
  color: var(--term-fg);
}
.checks__list li {
  display: flex;
  align-items: center;
  gap: 16px;
  opacity: 0;
  transform: translateX(-12px);
}
.checks__list li .check {
  color: var(--green);
  font-weight: 700;
  transform: scale(0);
  display: inline-block;
}

.checks__done {
  font-family: var(--font-mono);
  font-size: clamp(14px, 1.6vw, 22px);
  color: var(--accent-2);
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
}

/* ── 06 · CUE ───────────────────────────────────────────────── */
.scene--cue { align-items: center; justify-content: center; }

.cue {
  display: flex;
  align-items: center;
  gap: 28px;
  font-family: var(--font-mono);
  font-size: clamp(16px, 2vw, 30px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
}
.cue__line {
  display: block;
  width: clamp(60px, 14vw, 160px);
  height: 2px;
  background: var(--ink);
  transform: scaleX(0);
}
.cue__line[data-cue-l] { transform-origin: right center; }
.cue__line[data-cue-r] { transform-origin: left center; }

/* ── 07 · CONTRAST ──────────────────────────────────────────── */
.scene--contrast { gap: 22px; }

.contrast { display: flex; flex-direction: column; gap: 22px; align-items: flex-start; }
.contrast__a, .contrast__b {
  margin: 0;
  font-weight: 800;
  font-size: clamp(44px, 7vw, 100px);
  line-height: 0.96;
  letter-spacing: -0.04em;
  white-space: nowrap;
  padding-right: 0.2em;
}
.contrast__a { color: var(--ink); }
.contrast__b { color: var(--accent); }
.contrast__b > span { display: block; font-style: italic; padding-right: 0.25em; }

.contrast__rule {
  width: 220px;
  height: 5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

/* ── 08–15 · DEMOS (shared) ─────────────────────────────────── */
.demo {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}
.demo__stage {
  width: min(720px, 90vw);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.demo__api {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.4vw, 20px);
  color: var(--ink-mute);
  letter-spacing: 0.06em;
}

/* core: bars */
.demo__stage--core { gap: 14px; }
.demo__stage--core .bar {
  width: 28px;
  height: 220px;
  border-radius: 14px;
  background: var(--ink);
  transform: translateY(120px);
  opacity: 0;
}
.demo__stage--core .bar:nth-child(odd) { background: var(--accent); }

/* timeline: lanes */
.demo__stage--tl { flex-direction: column; gap: 22px; }
.demo__stage--tl .lane {
  width: clamp(280px, 60vw, 480px);
  height: 22px;
  background: var(--bg-deep);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.demo__stage--tl .lane span {
  position: absolute;
  inset: 0;
  transform: scaleX(0);
  transform-origin: left center;
}
.demo__stage--tl .lane:nth-child(1) span { background: var(--accent); }
.demo__stage--tl .lane:nth-child(2) span { background: var(--accent-2); }
.demo__stage--tl .lane:nth-child(3) span { background: var(--green); }
.demo__stage--tl .lane:nth-child(4) span { background: var(--ink); }

/* scrolltrigger */
.demo__stage--st { flex-direction: column; gap: 18px; width: min(620px, 90vw); }
.st-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--ink-mute);
}
.st-row b { color: var(--ink); font-feature-settings: 'tnum' on; font-weight: 700; }
.st-row--sub { font-size: 13px; }
.st-bar {
  width: 100%;
  height: 22px;
  background: var(--bg-deep);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.st-bar__fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

/* split */
.demo__stage--split { font-size: 0; }
.split-word {
  font-weight: 800;
  font-size: clamp(72px, 12vw, 184px);
  font-style: italic;
  letter-spacing: -0.04em;
  color: var(--ink);
  display: inline-flex;
  gap: 4px;
}
.split-word .chunk {
  display: inline-block;
  will-change: transform;
}
.split-word .chunk:nth-child(3) { color: var(--accent); }

/* utils */
.demo__stage--utils { gap: 32px; align-items: baseline; }
.utils-num {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' on;
  font-size: clamp(120px, 18vw, 280px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--ink);
}
.utils-meta { display: flex; flex-direction: column; gap: 6px; }
.utils-meta > span { font-size: clamp(20px, 2vw, 30px); color: var(--ink-soft); }
.utils-meta > small {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
}

/* performance */
.demo__stage--perf {
  flex-direction: column;
  gap: 48px;
  width: min(820px, 92vw);
  align-items: stretch;
}
.perf-lane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.perf-lane__label {
  font-family: var(--font-mono);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
}
.perf-lane__track {
  position: relative;
  width: 100%;
  height: 56px;
  background: var(--bg-deep);
  border-radius: 10px;
}
.perf-lane__track > span {
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 56px;
  border-radius: 6px;
}
#perf-bad  { background: var(--ink-mute); left: 8px; }
#perf-good { background: var(--accent);   left: 8px; }

/* react */
.demo__stage--react { flex-direction: column; gap: 28px; }
.logo { width: 240px; height: 240px; }
.demo__code {
  margin: 0;
  background: var(--term-bg);
  color: var(--term-fg);
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.5vw, 20px);
  padding: 14px 22px;
  border-radius: 10px;
  letter-spacing: 0.02em;
}
.demo__code .tok-key { color: var(--accent-2); }
.demo__code .tok-fn  { color: var(--green); }
.demo__code .tok-str { color: rgb(240, 140, 96); }

/* frameworks */
.demo__stage--fw { flex-direction: column; gap: 32px; }
.fw-pair { display: flex; gap: 80px; align-items: flex-end; }
.fw-badge { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.fw-badge svg { width: 140px; height: auto; }
.fw-badge figcaption {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.demo__code--fw { font-size: clamp(13px, 1.5vw, 18px); }

/* ── 16 · STATEMENT ─────────────────────────────────────────── */
.scene--statement { gap: 14px; }

.statement { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.statement__a, .statement__b {
  margin: 0;
  font-weight: 800;
  font-size: clamp(44px, 7vw, 96px);
  line-height: 0.94;
  letter-spacing: -0.035em;
  white-space: nowrap;
  padding-right: 0.25em;
}
.statement__a { color: var(--ink); }
.statement__a span { display: inline-block; }
.statement__b { color: var(--accent); }
.statement__b span { display: inline-block; font-style: italic; padding-right: 0.25em; }

.statement__rule {
  width: 320px;
  height: 6px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

.statement__credit {
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: clamp(14px, 1.5vw, 22px);
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  opacity: 0;
  transform: translateY(12px);
}
.statement__credit strong { color: var(--ink); font-weight: 700; }
.statement__credit span:nth-child(3) { color: var(--ink-mute); }

/* ── 17 · SIGN ──────────────────────────────────────────────── */
.scene--sign { gap: 48px; }

.sign { display: flex; flex-direction: column; gap: 48px; width: 100%; }

.sign__install {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 18px 26px;
  background: var(--term-bg);
  color: var(--term-fg);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: clamp(14px, 1.6vw, 22px);
  box-shadow: 0 20px 40px -28px rgba(28,24,20,0.5);
}
.sign__dollar { color: var(--accent-2); }

.sign__footer {
  border-top: 1px solid var(--ink);
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sign__label {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
}
.sign__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
}
.sign__row strong {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: clamp(28px, 4vw, 56px);
  letter-spacing: -0.025em;
  color: var(--ink);
}
.sign__links {
  display: flex;
  gap: 22px;
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.2vw, 17px);
  color: var(--ink-soft);
}
.sign__links a { position: relative; }
.sign__links a::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -3px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s ease;
}
.sign__links a:hover::after { transform: scaleX(1); }

/* ── chars wrapped by JS at runtime ─────────────────────────── */
/* Spans stay inline so the parent's letter-spacing applies between
   chars (italic glyphs especially need it — inline-block breaks
   negative letter-spacing). Only opacity is animated per char. */
[data-chars] .char-wrap {
  opacity: 0;
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caret { animation: none; opacity: 1; }
}

/* ── No-rAF bailout (background tab fallback) ───────────────── */
body.no-anim [data-chars] .char-wrap,
body.no-anim .title__dot,
body.no-anim .card,
body.no-anim .card__stamp,
body.no-anim .caption__rule,
body.no-anim .cmd__underline,
body.no-anim .checks__list li,
body.no-anim .checks__list li .check,
body.no-anim .checks__done,
body.no-anim .cue__line,
body.no-anim .contrast__rule,
body.no-anim .statement__rule,
body.no-anim .statement__credit,
body.no-anim .demo__stage--core .bar,
body.no-anim .demo__stage--tl .lane span,
body.no-anim .st-bar__fill,
body.no-anim .fw-badge,
body.no-anim .demo__code,
body.no-anim .sign__install,
body.no-anim .sign__footer > * {
  opacity: 1 !important;
  transform: none !important;
}

body.no-anim #brief-text::after {
  content: '';
}

/* ── Responsive tweaks ──────────────────────────────────────── */
@media (max-width: 720px) {
  .checks__list { grid-template-columns: 1fr; }
  .fw-pair { gap: 40px; }
}
