/* base.css: reset, layout primitives, forms and the CSS half of the motion patterns. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 1rem); }
@media (prefers-reduced-motion: no-preference) { html:not([data-lenis]) { scroll-behavior: smooth; } }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-underline-offset: 0.2em; }
p, li { max-width: 65ch; text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.08; text-wrap: balance; font-weight: 600; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-contrast); }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: var(--z-overlay); padding: .6rem 1rem; background: var(--text); color: var(--bg); border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.section { padding-block: var(--section-y); position: relative; }
.stack > * + * { margin-top: var(--stack-gap, 1.25rem); }
.display { font-size: var(--fs-display); letter-spacing: var(--tracking-display); line-height: var(--leading-display); padding-bottom: .08em; font-weight: 700; }
.h2 { font-size: var(--fs-h2); letter-spacing: -0.025em; }
.h3 { font-size: var(--fs-h3); letter-spacing: -0.01em; }
.lead { font-size: clamp(1.05rem, 1rem + .4vw, 1.25rem); color: var(--text-muted); max-width: 52ch; }
.muted { color: var(--text-muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Forms (label above, error below, never placeholder-as-label) ---------- */
.field { display: grid; gap: .45rem; }
.field label { font-weight: 600; font-size: .92rem; }
.field__hint { font-size: .85rem; color: var(--text-muted); }
.field input, .field textarea, .field select {
  width: 100%; min-height: 48px; padding: .75rem .9rem; border-radius: var(--radius-input);
  border: 1px solid color-mix(in oklab, var(--text) 22%, transparent); background: var(--bg-elevated);
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: color-mix(in oklab, var(--text-muted) 85%, transparent); }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); border-radius: var(--radius-input); }
.field [aria-invalid] { border-color: var(--red-deep); }
.field__error { color: var(--red-deep); font-size: .88rem; }
.form-status { min-height: 1.5em; font-weight: 600; }
form[data-state="success"] .form-status { color: #1f6b3d; }
form[data-state="error"] .form-status { color: var(--red-deep); }

/* ---------- Media ---------- */
.frame { position: relative; overflow: hidden; border-radius: var(--radius-card); background: var(--bg-muted); }
.frame > img, .frame > video { width: 100%; height: 100%; object-fit: cover; }
.frame--parallax > img { height: 115%; margin-top: -7.5%; } /* room for data-parallax on the img */

/* ---------- Scroll patterns (CSS half) ---------- */
/* Horizontal pan: native scroll-snap row by default (mobile, reduced motion); GSAP pins it on desktop. */
[data-hpan] { overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
[data-hpan]::-webkit-scrollbar { display: none; }
[data-hpan-track] { display: flex; gap: var(--gutter); width: max-content; padding-inline: var(--gutter); }
[data-hpan-track] > * { scroll-snap-align: start; flex: 0 0 auto; }
[data-hpan].is-pinned { overflow: hidden; height: 100svh; display: flex; align-items: center; }

/* Story: steps stack in normal flow; GSAP pins and crossfades on desktop. */
[data-story].is-pinned { min-height: 100svh; }
[data-story].is-pinned [data-story-stage] { display: grid; }
[data-story].is-pinned [data-story-stage] > [data-story-step] { grid-area: 1 / 1; }

/* ---------- Motion gating ----------
   html.js is set inline in <head>. Elements start hidden only when JS is on; motion.js reveals them.
   If motion.js never boots (blocked CDN), the head failsafe adds .motion-off after 2.5s. */
html.js:not(.motion-off) [data-reveal],
html.js:not(.motion-off) [data-split],
html.js:not(.motion-off) [data-hero-item] { visibility: hidden; }
html.motion-off [data-reveal], html.motion-off [data-split], html.motion-off [data-hero-item] { visibility: visible !important; opacity: 1 !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
