/* ==========================================================================
   Scroll Site Studio — base styles
   One set of decisions, reused everywhere (coherence is cheaper than talent):
   a type scale, a spacing scale, a small color set from tokens.css.
   The page must read perfectly with no JavaScript: every animated start state
   is scoped to .motion, which only the inline <head> script adds.
   ========================================================================== */

/* ---------- Scales ---------- */
:root {
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.94rem);
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.15rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.55rem);
  --step-2: clamp(1.6rem, 1.4rem + 1vw, 2.2rem);
  --step-3: clamp(2.1rem, 1.7rem + 2vw, 3.4rem);
  --step-4: clamp(2.8rem, 2rem + 4vw, 5.6rem);
  --step-5: clamp(3.4rem, 2.2rem + 6.5vw, 8.5rem);

  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: clamp(5rem, 4rem + 6vw, 10rem);

  --gutter: clamp(1rem, 0.5rem + 3vw, 3rem);
  --header-h: 4rem;   /* fixed header height: pinned scenes pad by this so it never covers them */
  --max: 1320px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, figure, blockquote, ul, ol { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent] { overscroll-behavior: contain; }

body {
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-body);
  font-weight: var(--weight-body);
  font-size: var(--step-0);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

[id] { scroll-margin-top: var(--header-h); }

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); line-height: 1.15; }
p { max-width: var(--measure); text-wrap: pretty; }
strong { font-weight: var(--weight-strong); }
a { color: inherit; }

.eyebrow {
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.lede { font-size: var(--step-1); color: var(--color-muted); }

/* ---------- Accessibility ---------- */
.skip-link {
  position: absolute; left: var(--space-s); top: -100px; z-index: 2000;
  background: var(--color-accent); color: var(--color-on-accent);
  padding: var(--space-2xs) var(--space-s); border-radius: var(--radius);
}
.skip-link:focus { top: var(--space-s); }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.section { padding-block: var(--space-2xl); }
.full { min-height: 100dvh; display: grid; align-content: center; }
.flow > * + * { margin-top: var(--space-m); }   /* vertical rhythm utility (not the stack scene) */

.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  min-height: var(--header-h); padding: var(--space-xs) var(--gutter);
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.site-header a { text-decoration: none; font-weight: var(--weight-strong); }
.site-header nav { display: flex; gap: var(--space-m); align-items: center; }
.btn-small { padding: 0.6em 1.1em; font-size: var(--step--1); }  /* the primary action, always on screen */

/* ---------- Buttons & links (hover in 0.25s, out 0.15s: exits faster) ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2xs);
  padding: 0.95em 1.6em; border-radius: 999px;
  background: var(--color-accent); color: var(--color-on-accent);
  font-weight: var(--weight-strong); text-decoration: none;
  transition: background-color 0.15s ease-out, color 0.15s ease-out;
}
.btn:hover { background: var(--color-fg); color: var(--color-bg); transition-duration: 0.25s; }
.btn:focus-visible { outline: 2px solid var(--color-fg); outline-offset: 4px; }

.link-underline { position: relative; text-decoration: none; }
.link-underline::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -0.15em; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform 0.15s ease-out;
}
.link-underline:hover::after, .link-underline:focus-visible::after { transform: scaleX(1); transition-duration: 0.25s; }

/* ---------- Hero ---------- */
.hero { min-height: 100dvh; display: grid; align-content: end; padding-bottom: var(--space-xl); }
.hero h1 { max-width: 14ch; }
.hero .lede { margin-top: var(--space-m); }

/* ---------- Claim ---------- */
.claim .statement { font-family: var(--font-display); font-size: var(--step-3); line-height: 1.15; max-width: 22ch; }

/* ---------- Steps (pinned story) ---------- */
.steps-layout { display: grid; gap: var(--space-l); }
.steps { display: grid; gap: var(--space-l); }
[data-step] h3 { margin-bottom: var(--space-xs); }
@media (min-width: 900px) {
  .steps-layout { grid-template-columns: 1fr 1fr; align-items: center; }
}
.is-pinned-steps { padding-block: 0; }
.is-pinned-steps .steps-layout { height: 100dvh; padding-top: var(--header-h); }
.is-pinned-steps [data-step] { grid-area: 1 / 1; }

/* ---------- Horizontal ---------- */
.h-head { margin-bottom: var(--space-l); }
.h-track { display: grid; gap: var(--space-m); padding-inline: var(--gutter); }
@media (min-width: 768px) { .h-track { grid-template-columns: 1fr 1fr; } }
.panel {
  background: var(--color-surface); border-radius: var(--radius);
  padding: var(--space-l); display: grid; align-content: end; gap: var(--space-xs);
  min-height: 18rem;
}
.panel .num { font-family: var(--font-display); font-size: var(--step-4); color: var(--color-accent); line-height: 1; }
/* flex column, not grid: a max-content track would widen a grid column and push the heading off-screen */
.is-horizontal { height: 100dvh; padding-block: var(--header-h) 0; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.is-horizontal .h-head { margin-bottom: var(--space-m); }
.is-horizontal .h-track {
  display: flex; width: max-content; gap: var(--space-m);
  padding-inline: var(--gutter);
}
.is-horizontal .panel { flex: 0 0 80vw; max-width: 1100px; height: 68dvh; min-height: 0; }

/* ---------- Parallax bands ---------- */
.band { position: relative; overflow: hidden; min-height: 70dvh; display: grid; align-content: end; padding: var(--space-l) var(--gutter); }
.band + .band { margin-top: 2px; }
.band-bg { position: absolute; inset: -10% 0; z-index: -1; }  /* 20% taller: no gaps */
.band-bg img { width: 100%; height: 100%; object-fit: cover; }
.band-label { position: relative; color: #fff; text-shadow: 0 1px 24px rgba(0,0,0,0.35); }
.band { isolation: isolate; }

/* Parallax anywhere (e.g. a full-bleed hero image): put class="has-depth" on the
   holder and data-depth on the layer. The layer is 20% taller so no gap ever shows. */
.has-depth { position: relative; overflow: hidden; isolation: isolate; }
.has-depth > [data-depth] { position: absolute; inset: -10% 0; z-index: -1; }
.has-depth > [data-depth] img { width: 100%; height: 100%; object-fit: cover; }

/* Alternate surface (e.g. light sections on a dark site): add class="theme-alt" to a section.
   Its colors come from brand.json "alt" (generated into tokens.css). */
.theme-alt { background: var(--color-bg); color: var(--color-fg); }  /* tokens.css redefines the colors inside .theme-alt */

/* ---------- Sequence (product spin) ---------- */
.seq { display: grid; gap: var(--space-l); align-items: center; }
@media (min-width: 900px) { .seq { grid-template-columns: 1fr 1.2fr; } }
.seq-live { padding-block: 0; }
.seq-live .seq { height: 100dvh; padding-top: var(--header-h); }
.seq-media { position: relative; aspect-ratio: 1; width: 100%; max-height: 82dvh; margin-inline: auto; }
.seq-media > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.seq-canvas { display: none; }
.seq-live .seq-canvas { display: block; }
.seq-live .seq-still { display: none; }

/* ---------- Scrubbed video ---------- */
.scrub-video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); background: var(--color-surface); }
.video-live { padding-block: 0; height: 100dvh; display: grid; align-content: center; }
.caption { margin-top: var(--space-s); color: var(--color-muted); font-size: var(--step--1); }

/* ---------- 3D model ---------- */
.model-stage { position: relative; aspect-ratio: 1; width: min(100%, 80dvh); margin-inline: auto; }
.model-stage > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.model-canvas { display: none; }
.model-live .model-canvas { display: block; }
.model-live .model-still { display: none; }
[data-scene~="model"].model-live { padding-block: 0; min-height: 100dvh; display: grid; align-content: center; }

/* ---------- Detail (shader) ---------- */
.detail-grid { display: grid; gap: var(--space-m); }
@media (min-width: 768px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
.detail-grid img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); }
.detail-grid figcaption { margin-top: var(--space-xs); color: var(--color-muted); font-size: var(--step--1); }
.distort-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.distort-live img[data-distort] { opacity: 0; } /* still receives the pointer */

/* ---------- Buy ---------- */
.buy { text-align: center; }
.buy .price { font-family: var(--font-display); font-size: var(--step-3); margin-block: var(--space-s) var(--space-l); }
.buy .actions { display: flex; gap: var(--space-l); justify-content: center; align-items: center; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.site-footer { padding: var(--space-xl) var(--gutter); color: var(--color-muted); font-size: var(--step--1); display: flex; justify-content: space-between; gap: var(--space-m); flex-wrap: wrap; }

/* ---------- Loader & page wipe ---------- */
#loader {
  position: fixed; inset: 0; z-index: 1000; display: none;
  background: var(--color-bg); color: var(--color-fg);
  place-content: center; justify-items: center; gap: var(--space-s);
}
.motion:not(.no-loader) #loader { display: grid; }
.loader-name { font-family: var(--font-display); font-size: var(--step-2); }
.loader-bar { width: 160px; height: 1px; background: color-mix(in srgb, var(--color-fg) 20%, transparent); overflow: hidden; }
.loader-fill { display: block; height: 100%; background: var(--color-accent); transform: scaleX(0); transform-origin: left; }

#wipe {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  background: var(--color-surface); transform: translateY(100%);
}
.is-arriving #wipe, .is-leaving #wipe { pointer-events: auto; }
.is-arriving #wipe { transform: none; }

/* ---------- Motion start states (only when JS + motion are on) ---------- */
.motion [data-scene~="reveal"] [data-reveal] { opacity: 0; }
.motion [data-scene~="lines"]:not(.is-split):not(.is-static) { visibility: hidden; }
.scene-off [data-reveal], .scene-off[data-reveal] { opacity: 1 !important; transform: none !important; }

/* ==========================================================================
   Scenes: full-bleed, one idea per screen. This is the default layout language
   of a scroll-driven site: no card grids, no boxed sections. Each scene owns the
   whole viewport and is played by the scroll.
   ========================================================================== */
.scene { position: relative; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; overflow: clip; }  /* minmax(0,1fr): a nowrap drift line can't widen the column */
.scene-dark { background: var(--color-fg); color: var(--color-bg); }
.scene-dark .eyebrow, .scene-dark .lede { color: color-mix(in srgb, var(--color-bg) 72%, transparent); }

/* Statement lit word by word (scrubtext) */
.statement { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); place-content: center; padding-inline: var(--gutter); text-align: center; }
.statement-text { font-family: var(--font-display); font-size: clamp(2.4rem, 1.2rem + 4.6vw, 6.2rem); line-height: 1.06; letter-spacing: -0.02em; max-width: 17ch; margin-inline: auto; text-wrap: balance; }

/* Expanding window (expand) */
.expand { position: relative; height: 100dvh; overflow: hidden; display: grid; place-items: center; }
.expand-frame { position: absolute; inset: 0; overflow: hidden; transform-origin: 50% 50%; will-change: transform; }
.expand-media { position: absolute; inset: 0; transform-origin: 50% 50%; will-change: transform; }
.expand-media img, .expand-media video { width: 100%; height: 100%; object-fit: cover; }
.expand-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgb(0 0 0 / .45), transparent 60%); }
.expand-copy { position: relative; z-index: 1; color: #fff; text-align: center; padding: var(--gutter); align-self: end; margin-bottom: 12dvh; }
.expand-copy h2 { font-size: clamp(2.8rem, 1.6rem + 5vw, 7rem); }

/* Stacking panels (stack) */
.stack-panel { position: relative; min-height: 100dvh; background: var(--color-bg); overflow: hidden; }
.stack-panel:nth-of-type(even) { background: var(--color-surface); }  /* articles only: an sr-only heading first doesn't shift it */
.stack-inner { min-height: 100dvh; display: grid; gap: var(--space-l); align-content: center; padding: calc(var(--header-h) + var(--space-l)) var(--gutter) var(--space-l); transform-origin: 50% 0; }
.stack-inner img { width: 100%; height: 100%; max-height: 70dvh; object-fit: cover; border-radius: var(--radius); }
@media (min-width: 900px) { .stack-inner { grid-template-columns: 1fr 1.1fr; align-items: center; gap: var(--space-2xl); } }
.stack-num { font-family: var(--font-display); font-size: var(--step-5); color: var(--color-accent); line-height: 1; }

/* Drifting giant type (scrub on a single line) */
.drift-band { overflow: clip; padding-block: var(--space-xl); }
.drift { font-family: var(--font-display); font-size: clamp(4rem, 1.5rem + 11vw, 15rem); line-height: 1; white-space: nowrap; letter-spacing: -0.03em; margin: 0; max-width: none; }

/* Full-height image panels for horizontal rows */
.panel-media { padding: 0; overflow: hidden; align-content: end; position: relative; color: #fff; min-height: 70dvh; }
.panel-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.panel-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgb(0 0 0 / .6), transparent 55%); }
.panel-media .panel-copy { position: relative; z-index: 1; padding: var(--space-l); display: grid; gap: var(--space-2xs); }

/* Hero over a full-bleed image/canvas: light text, scrim where the words sit */
.hero.has-depth { color: #fff; }
.hero.has-depth::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgb(0 0 0 / .62), rgb(0 0 0 / .18) 70%), linear-gradient(0deg, rgb(0 0 0 / .4), transparent 50%); }
.hero.has-depth .eyebrow, .hero.has-depth .lede { color: rgb(255 255 255 / .82); }
.hero-inner { position: relative; }

/* Story beats with an image */
[data-step] img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); margin-bottom: var(--space-m); }
.is-pinned-steps [data-step] img { max-height: 46dvh; }

/* Assembling object (assemble): the stage's layout IS the assembled object; parts are placed in % */
.assemble-stage { position: relative; z-index: 1; width: min(80vw, 520px); aspect-ratio: 1; }
.assemble-stage .part { position: absolute; display: block; height: auto; max-width: none; }

/* Kinetic cut (cut): without motion the images simply stack; with motion they share one full screen */
.cut { position: relative; }
.cut-layer img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.motion [data-scene~="cut"] { height: 100dvh; overflow: hidden; display: grid; place-items: center; }
.motion [data-scene~="cut"] .cut-frame { position: absolute; inset: 0; overflow: hidden; }
.motion [data-scene~="cut"] .cut-layer { position: absolute; inset: 0; transform-origin: 50% 50%; will-change: transform; }
.motion [data-scene~="cut"] .cut-layer img { height: 100%; aspect-ratio: auto; }
.motion [data-scene~="cut"] .cut-layer + .cut-layer { visibility: hidden; }          /* start state; the scene takes over */
.cut-copy { position: relative; z-index: 1; color: #fff; text-align: center; padding: var(--gutter); }
.motion [data-scene~="cut"] .cut-frame::after { content: ""; position: absolute; inset: 0; background: rgb(0 0 0 / .28); pointer-events: none; }

/* Strategic 3D (model data-swap): stills at rest, live model only during the turn */
.model-still-end { display: none; }
.model-live.model-swap .model-still { display: block; }
.model-live.model-swap .model-still-end { opacity: 0; }

/* Fly (fly): slots in a headline hand their media down to cells. Without motion the slots collapse
   and the headline reads normally. Nothing between the slots and the cells may clip (no overflow: hidden). */
.fly-slot { display: inline-block; width: 0; height: 1em; vertical-align: -0.12em; }
.motion .is-fly-source .fly-slot { width: 1.1em; height: 1.1em; margin-inline: 0.06em; }
.fly-track { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 40%), 1fr)); gap: var(--space-m); }
.fly-cell { aspect-ratio: 1; }
.fly-cell > img, .fly-cell > video { position: relative; z-index: 2; width: 100%; height: 100%; object-fit: cover;
  border-radius: 24%; transform-origin: 0 0; will-change: transform; }
.motion [data-scene~="fly"]:not(.is-flying) .fly-cell > * { visibility: hidden; }   /* until the scene places them in the slots */

/* Tactile type (weight): hidden until split so it never flashes at the wrong weight */
.motion [data-scene~="weight"]:not(.is-split) { visibility: hidden; }

/* Reactive environment (react): accent tint over each [data-react], plus the optional invert dot */
.react { position: relative; }
.is-reactive [data-react] { position: relative; }
.is-reactive [data-react]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: var(--react-color, var(--color-accent)); mix-blend-mode: color; opacity: var(--react, 0); }
.react-dot { position: absolute; left: 0; top: 0; z-index: 5; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: #fff; mix-blend-mode: difference; pointer-events: none; opacity: 0; transition: opacity .2s; }
.react-dot.is-on { opacity: 1; }
