/* Landing shell (master prompt §8.2, §9.1, §11). Prefix lp- only; never restyles a library class except through the hook variables the
   library documents. Tokens only: every colour, radius, shadow, size step, duration and easing is var(--sm-*) or an --lp-* built from them.
   Two layouts:
     default (no class)  reduced / no-JS layout: the eight scenes stack in normal flow, every scene in its rest state (§9.6)
     html.lp-full        pinned layout: each scene is a tall track with a sticky one-screen frame; neighbouring frames overlap by --lp-t
   Nothing here animates: scroll-driven motion lives in js/ (GSAP), CSS transitions use motion tokens and the --sm-motion-move switch. */

:root {
  --lp-u: var(--sm-space-8);                                                     /* 8 px step for illustration geometry */
  --lp-nav-h: calc(var(--sm-density-target) + 2 * var(--sm-space-8));            /* floating nav pill: 60 */
  --lp-safe-top: var(--sm-space-96);                                             /* below the nav (16 + 60 + 20) */
  --lp-safe-bottom: var(--sm-space-48);
  --lp-gap: clamp(var(--sm-space-16), 3vh, var(--sm-space-48));                  /* vertical rhythm inside a frame */
  --lp-gap-sm: clamp(var(--sm-space-8), 1.6vh, var(--sm-space-24));
  --lp-shot-scale: 0.8;                                                          /* set by JS: clamp(0.8, min(vw/1440, vh/900), 1.2) */
  --lp-persp: calc(var(--sm-space-128) * 12 + var(--sm-space-64));              /* 1600 px */
  /* set type (O-A6): the hero headline scales with the viewport (§11.1 --lp-type-hero), figures one step above display */
  --lp-type-hero: clamp(var(--sm-type-size-display), 5.8vw, calc(var(--sm-type-size-display) * 1.6));
  --lp-type-figure: calc(var(--sm-type-size-display) * 1.15);                    /* 64 */
  --lp-type-figure-lg: calc(var(--sm-type-size-display) * 1.6);                  /* 90 */
  --lp-type-figure-sm: var(--sm-type-size-title-1);                              /* 40 */
  --lp-gap-lg: clamp(var(--sm-space-24), 5vh, var(--sm-space-64));
  /* text on the night canvas, second and third level: colour alpha, never opacity (check-fit reads opacity as "fading") */
  --lp-on-canvas-2: color-mix(in srgb, var(--sm-color-text-inverse) 86%, transparent);
  --lp-on-canvas-3: color-mix(in srgb, var(--sm-color-text-inverse) 72%, transparent);
  --lp-hair: color-mix(in srgb, var(--sm-color-text-inverse) 24%, transparent);
  /* night backdrop (O-A5), built from the ink token: the poster until the WebGL world fades in, and the reduced layout's canvas */
  --lp-night-deep: oklch(from var(--sm-color-ink) calc(l * 0.5) c h);
  /* the top of the world's sky (js/world/sky.js: the zenith is the ink token × 0.07 in linear light, about oklch 0.10 0.039 258,
     i.e. 41 % of the ink's OKLCH lightness at 43 % of its chroma): the page behind the world on phones and tablets, so the bands
     a phone's browser paints above and below the page (iOS Safari: status band, bottom toolbar) match the scene (O-A20) */
  --lp-night-zenith: oklch(from var(--sm-color-ink) calc(l * 0.41) calc(c * 0.43) h);
  --lp-night:
    radial-gradient(70% 55% at 78% 100%, color-mix(in srgb, var(--sm-color-support) 16%, transparent), transparent),
    radial-gradient(60% 50% at 10% 0%, color-mix(in srgb, var(--sm-color-ink) 70%, transparent), transparent),
    linear-gradient(180deg, var(--lp-night-deep), var(--sm-color-ink));
}
@media (max-height: 800px) {
  :root {
    --lp-gap: clamp(var(--sm-space-12), 2.2vh, var(--sm-space-24));
    --lp-gap-sm: clamp(var(--sm-space-4), 1.2vh, var(--sm-space-12));
    --lp-gap-lg: clamp(var(--sm-space-16), 3.4vh, var(--sm-space-32));
  }
}

html { background: var(--lp-night-deep); color-scheme: light; }
.lp-canvas { background: var(--lp-night) fixed; min-block-size: 100vh; }
body { overflow-x: clip; }
.lp-full body { overflow-x: hidden; }

/* ---- skip link: first focusable element, shown on focus -------------------------------------------------------------------- */
.lp-skip {
  position: fixed; inset-block-start: var(--sm-space-16); inset-inline-start: var(--sm-space-16); z-index: calc(var(--sm-z-nav) + 1);
  display: inline-flex; align-items: center; min-block-size: var(--sm-density-target); padding-inline: var(--sm-space-24);
  border-radius: var(--sm-radius-pill); background: var(--sm-color-surface-raised); color: var(--sm-color-text-default);
  font-size: var(--sm-type-size-label); font-weight: var(--sm-type-weight-medium); box-shadow: var(--sm-elevation-raised);
  translate: 0 calc(-100% - var(--sm-space-32));
}
.lp-skip:focus, .lp-skip:focus-visible { translate: 0 0; color: var(--sm-color-text-default); }

/* ---- floating nav (glass layer 1: blur + refraction; never 3D-transformed) ------------------------------------------------- */
.lp-navbar { position: fixed; inset: var(--sm-space-16) 0 auto; z-index: var(--sm-z-nav); pointer-events: none; }
.lp-navbar .sm-fnav { pointer-events: auto; }
.lp-nav { gap: var(--sm-space-2); padding-inline-start: var(--sm-space-12); }
/* the brand: the library's W2 wordmark as the library draws it, straight on the glass of the nav, no plate */
.lp-nav .sm-wordmark { --sm-wordmark-size: var(--sm-type-size-title-3); padding-block: var(--sm-space-8); }
.lp-nav__brand { margin-inline-end: auto; border-radius: var(--sm-radius-pill); }
/* section = aria-current="true" (the library styles only "page"): the same pill, from the same glass tokens (library-proposals) */
.lp-nav .sm-fnav__link[aria-current="true"] {
  font-weight: var(--sm-type-weight-medium); background-color: var(--sm-glass-selected-fill);
  box-shadow: inset 0 0 0 var(--sm-border-width) var(--sm-glass-selected-edge);
}
.lp-nav__btn { margin: 0; border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.lp-nav__btn:hover { background-color: var(--sm-glass-hover-fill); }
.lp-nav__btn[aria-pressed="true"] { background-color: var(--sm-glass-selected-fill); box-shadow: inset 0 0 0 var(--sm-border-width) var(--sm-glass-selected-edge); }
.lp-nav__lbl { display: none; }
.lp-nav__cta { font-weight: var(--sm-type-weight-medium); }
/* progress through the eight stops (decorative; the links carry the state for AT) */
.lp-progress { display: inline-flex; align-items: center; gap: var(--sm-space-4); padding-inline: var(--sm-space-12) var(--sm-space-8); }
.lp-progress__dot {
  inline-size: var(--sm-space-12); block-size: var(--sm-rule-weight-accent); border-radius: var(--sm-radius-pill);
  background: color-mix(in srgb, var(--sm-color-ink) 18%, transparent);
  transition-property: background-color; transition-duration: var(--sm-motion-duration-base); transition-timing-function: var(--sm-motion-easing-standard);
}
.lp-progress__dot[data-state="done"] { background: color-mix(in srgb, var(--sm-color-ink) 55%, transparent); }
.lp-progress__dot[data-state="now"] { background: var(--sm-color-signal); }
[data-glass="off"] .lp-nav__cta { box-shadow: inset 0 0 0 var(--sm-border-width) var(--sm-color-border-strong); }

/* ---- scenes: shared frame -------------------------------------------------------------------------------------------------- */
.lp-scene { position: relative; }
.lp-frame {
  position: relative; display: grid; align-content: center; box-sizing: border-box;
  min-block-size: 100vh; padding-block: var(--lp-safe-top) var(--lp-safe-bottom);
}
.lp-layout { align-content: center; row-gap: var(--lp-gap); perspective: var(--lp-persp); perspective-origin: 50% 46%; }

/* pinned layout (html.lp-full): track + sticky frame per scene; neighbours overlap by --lp-t (geometry §9.1) */
/* the scene boxes overlap the neighbours' frames (a later scene's tall box lies over the active one), so no scene box takes the
   pointer; only the active scene's own controls do (below) */
.lp-full .lp-scene { block-size: calc(var(--lp-s) + 100vh); z-index: var(--lp-z); pointer-events: none; }
.lp-full .lp-scene + .lp-scene { margin-block-start: calc(-1 * (100vh + var(--lp-t))); }
.lp-full .lp-frame {
  position: sticky; inset-block-start: 0; block-size: 100vh; min-block-size: 0; overflow: clip;
  perspective: var(--lp-persp); perspective-origin: 50% 46%; pointer-events: none;
}
/* only the active scene takes the pointer (the frames above it are transparent boxes during and after their own transitions) */
.lp-full .lp-scene[data-active] .lp-frame :is(a, button, input, select, textarea, summary, label, [tabindex], .lp-copy, .lp-aside, .lp-review, .lp-quote, .lp-signup, .lp-faq, .lp-tier, .lp-foot, .lp-floors) { pointer-events: auto; }
/* a move across several scenes (O-A15) passes the scenes on the way without their copy */
.lp-full .lp-scene[data-skipped] .lp-frame { visibility: hidden; }
/* boot: until the timelines own the scenes, nothing but the hero may show (frames overlap while stuck) */
.lp-full.lp-boot .lp-scene:not(:first-child) .lp-layout { visibility: hidden; }
/* intro start state of the hero (only with JS and full motion; the fail-safe removes lp-js) */
.lp-js .lp-scene--hero :is(.lp-reveal, .lp-hero-title) { opacity: 0; }

/* the WebGL world: fixed behind every frame; the CSS night canvas (.lp-canvas on body) is the poster until it fades in */
.lp-world { position: fixed; inset: 0; z-index: 0; inline-size: 100vw; block-size: 100vh; pointer-events: none; opacity: 0; }
.lp-world[data-ready] { opacity: 1; transition: opacity var(--sm-motion-duration-slow) var(--sm-motion-easing-enter); }

/* ---- text on the canvas (O-A5): the world is a night scene, so text that sits straight on it is white — the library's on-ink
   pattern (--sm-color-text-inverse on --sm-color-surface-inverse). Text on a plate stays ink (.lp-ink re-colours the library's
   muted desc / label there: muted or signal text on a plate over a dark backdrop falls under 4.5:1) -------------------------- */
.lp-on-canvas { color: var(--sm-color-text-inverse); }
.lp-ink { color: var(--sm-color-text-default); }
.lp-copy__head .sm-head__desc { max-inline-size: 36em; font-size: var(--sm-type-size-body-lg); line-height: var(--sm-type-lh-body); color: var(--lp-on-canvas-2); }
.lp-copy__head .sm-head__label { color: var(--lp-on-canvas-2); }
/* the accent bar of a section head draws in with its text (the scene timeline tweens --lp-bar 0 -> 1); static layouts keep 1 */
.lp-copy__head::before { opacity: var(--lp-bar, 1); transform: scaleY(var(--lp-bar, 1)); transform-origin: top; }
.lp-copy__head { gap: var(--sm-space-12); }

/* ---- shots: live library UI as illustration (inert); scaled as a whole, never the copy ------------------------------------- */
.lp-shot { position: relative; margin: 0; scale: var(--lp-shot-scale); }
.lp-shot__ui { position: absolute; inset: 0; perspective: var(--lp-persp); perspective-origin: var(--lp-po-x, 50%) var(--lp-po-y, 46%); }
.lp-stack { position: absolute; inset: 0; transform-style: preserve-3d; }
.lp-stack > * { position: absolute; margin: 0; }
.lp-shot__ui :is(p, ul, ol, dl, dd, h3, h4) { margin: 0; }

/* ---- shared content parts -------------------------------------------------------------------------------------------------- */
.lp-review { margin: 0; gap: var(--sm-space-12); padding: var(--sm-space-16) var(--sm-space-24); }
.lp-review__quote { margin: 0; font-size: var(--sm-type-size-body); line-height: var(--sm-type-lh-body); color: var(--sm-color-text-default); }
.lp-review__quote::before { content: "“"; }
.lp-review__quote::after { content: "”"; }
.lp-review__who { display: flex; align-items: center; gap: var(--sm-space-12); }
.lp-review__id { display: grid; }
.lp-review__name { font-size: var(--sm-type-size-label); font-weight: var(--sm-type-weight-medium); color: var(--sm-color-text-default); }
.lp-review__role { font-size: var(--sm-type-size-meta); color: var(--sm-color-text-default); }
.lp-review .sm-avatar { inline-size: var(--sm-space-32); block-size: var(--sm-space-32); font-size: var(--sm-type-size-meta); }

.lp-stat { gap: var(--sm-space-2); }
.lp-stat__fig, .lp-kstats__fig, .lp-problem__fig, .lp-mod__fig, .lp-price__fig { font-family: var(--sm-type-font-figures); font-variant-numeric: tabular-nums lining-nums; }

/* bullets with a duo icon */
.lp-bullets { display: grid; gap: var(--lp-gap-sm); margin: 0; padding: 0; list-style: none; }
.lp-bullets > li { display: flex; align-items: flex-start; gap: var(--sm-space-12); color: var(--sm-color-text-inverse); }
.lp-bullets .sm-icon { margin-block-start: var(--sm-space-4); } /* .sm-icon--on-ink (library) colours it */

/* chevron of the FAQ: same token transition as the library, but switchable by --sm-motion-move */
.lp-faq__h { margin: 0; font: inherit; color: inherit; }

/* ---- loading screen: a line sketch of the real model (scripts/make-loader-sketch.mjs, L78) — the city and the HQ tower as the camera sees them
   on the first frame of the S1 intro. One boot step draws one chunk of the city and one band of the tower, bottom to top; the crown last.
   When the world has drawn its first frame the sketch is wiped away from the bottom up and the intro camera starts drifting in behind it.
   Shown from the first paint of the full layout; js/main.js removes it (the reduced layout and the fail-safe never show it). */
@property --lp-ld-r { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
.lp-loader { display: none; }
.lp-full .lp-loader {
  --lp-ld-line: color-mix(in oklch, var(--sm-color-white) 62%, var(--sm-color-signal));
  --lp-ld-city: color-mix(in oklch, var(--sm-color-white) 40%, var(--sm-color-signal));
  --lp-ld-crown: oklch(from var(--sm-color-signal) calc(l + 0.30) c h);
  position: fixed; inset: 0; z-index: calc(var(--sm-z-nav) + 2); display: grid; align-content: center; justify-items: start; row-gap: var(--sm-space-24);
  padding-inline: clamp(var(--sm-space-24), 4.5vw, var(--sm-space-64)); overflow: hidden;
  background: var(--lp-night); color: var(--sm-color-text-inverse);
}
/* the wipe: the sketch and its backdrop go from the bottom up, the world is already behind it */
.lp-full .lp-loader[data-done] {
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to top, transparent calc(var(--lp-ld-r) - 22%), var(--sm-color-ink) var(--lp-ld-r));
  mask-image: linear-gradient(to top, transparent calc(var(--lp-ld-r) - 22%), var(--sm-color-ink) var(--lp-ld-r));
  animation: lp-ld-wipe 1.5s cubic-bezier(0.45, 0, 0.25, 1) forwards;
}
@keyframes lp-ld-wipe { from { --lp-ld-r: 0%; } to { --lp-ld-r: 122%; } }
@supports not (mask-image: linear-gradient(black, transparent)) {
  .lp-full .lp-loader[data-done] { animation: none; opacity: 0; transition: opacity var(--sm-motion-duration-narrative) var(--sm-motion-easing-enter); }
}
.lp-loader > .sm-wordmark, .lp-loader > .lp-loader__msg { position: relative; z-index: 1; }
.lp-loader .sm-wordmark { --sm-wordmark-size: var(--sm-type-size-title-1); margin-inline-start: calc(var(--sm-wordmark-cap) * -1); }
.lp-loader__msg { margin: 0; font-size: var(--sm-type-size-body); line-height: var(--sm-type-lh-ui); opacity: 0.72; }

.lp-ld-sketch {
  position: absolute; inset: 0; inline-size: 100%; block-size: 100%; fill: none; stroke-linecap: round; stroke-linejoin: round;
  transform-origin: 70% 62%; animation: lp-ld-drift 16s linear infinite alternate;
}
.lp-ld-sketch--tall { display: none; }
.lp-ld-sketch path {
  stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0;
  transition: stroke-dashoffset 1.4s cubic-bezier(0.22, 0.6, 0.18, 1), opacity 0.6s ease-out;
}
/* three sub-parts per boot step cascade 70 ms apart, so the steps run into one flowing draw */
.lp-ld-sketch path[data-s="1"] { transition-delay: 0.07s; }
.lp-ld-sketch path[data-s="2"] { transition-delay: 0.14s; }
.lp-ld-city { stroke: var(--lp-ld-city); stroke-opacity: 0.55; }
.lp-ld-tw { stroke: var(--lp-ld-line); }
.lp-ld-tw[data-f="10"] { stroke: var(--lp-ld-crown); stroke-width: 1.6; }
.lp-ld-sketch path[data-on] { stroke-dashoffset: 0; opacity: 1; }
@keyframes lp-ld-drift { from { transform: scale(1); } to { transform: scale(1.035); } }

/* phones and tall screens: the portrait sketch, the words below it */
@media (max-width: 56rem), (max-aspect-ratio: 1 / 1) {
  .lp-full .lp-loader { justify-items: center; align-content: end; text-align: center; padding-block-end: 12vh; }
  .lp-loader .sm-wordmark { margin-inline-start: 0; }
  .lp-ld-sketch--wide { display: none; }
  .lp-ld-sketch--tall { display: block; transform-origin: 50% 50%; }
}
@media (prefers-reduced-motion: reduce) { .lp-ld-sketch { animation: none; } }
