/* ==========================================================================
   Reset, document defaults, shared typography classes and layout primitives.
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

/* Many components below set `display`, which would otherwise beat the UA's
   `[hidden] { display: none }`. This keeps the `hidden` attribute reliable. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--sp-5));
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  /* dvh tracks mobile Safari's collapsing toolbar; vh does not, and counts it
     as visible space that is not there. The vh line stays as the fallback. */
  min-height: 100vh;
  min-height: 100dvh;
  /* `clip` (not `hidden`) so position:sticky keeps working on descendants. */
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg,
video,
iframe {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

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

ul,
ol {
  list-style: none;
  padding: 0;
}

strong,
b {
  font-weight: 650;
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

::selection {
  background: var(--accent);
  color: var(--text-on-accent);
}

/* ------------------------------- scrollbars ------------------------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--r-pill);
  border: 3px solid var(--bg);
}

/* ----------------------------- Lenis (CDN) -------------------------------- */

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

/* ------------------------------- typography ------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-snug);
  text-wrap: balance;
}

.t-hero {
  font-size: var(--fs-hero);
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.t-section {
  font-size: var(--fs-section);
  line-height: 1.1;
  font-weight: 650;
}

.t-lead {
  font-size: var(--fs-lg);
  color: var(--text-2);
  line-height: 1.6;
  max-width: 56ch;
}

.t-body {
  font-size: var(--fs-base);
  color: var(--text-2);
}

.t-muted {
  color: var(--text-muted);
}

.t-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

.t-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.t-accent {
  color: var(--accent);
}

/* --------------------------------- layout --------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container--wide {
  max-width: 1360px;
}

.stack > * + * {
  margin-top: var(--sp-4);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.row--wrap {
  flex-wrap: wrap;
}

.hr {
  height: 1px;
  background: var(--hairline);
  border: 0;
}

/* ------------------------------ accessibility ----------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: var(--sp-2);
  left: 50%;
  translate: -50% -200%;
  z-index: calc(var(--z-nav) + 1);
  padding: var(--sp-2) var(--sp-4);
  background: var(--accent);
  color: var(--text-on-accent);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: translate var(--t-fast) var(--ease-out);
}

.skip-link:focus-visible {
  translate: -50% 0;
}

/* ------------------------------ scroll reveal -----------------------------
   Gated on `html.js`, which /js/head.js adds before the first paint. Hiding
   these elements unconditionally meant the page painted them visible, the
   deferred module then hid them, and only afterwards faded them back in - a
   flash of half-transparent text on every load.

   `html.reveal-off` is the watchdog escape hatch from head.js: if the app never
   boots, content is shown rather than left invisible forever.
   -------------------------------------------------------------------------- */

html.js [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity var(--t-slow) var(--ease-out),
    transform var(--t-slow) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}

html.js [data-reveal].is-in,
html.reveal-off [data-reveal] {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  html.js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
