/* base.css: reset, layout primitives, WebGL hosts, 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); background: var(--ink); }
@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; border-radius: 0; }
a { color: inherit; text-underline-offset: 0.25em; }
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: 0; }
::selection { background: var(--crimson); color: var(--ivory); }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: var(--z-overlay); padding: .6rem 1rem; background: var(--ivory); color: var(--ink); }
.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; }

.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.section { padding-block: var(--section-y); position: relative; }

/* WebGL hosts */
[data-shader], [data-three] { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.shader-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1.2s var(--ease-out); }
.is-live > .shader-canvas { opacity: 1; }

/* 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; }

/* Motion gating: hidden only when JS runs; 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; }
}
