/* ═══════════════════════════════════════════════════════════════
   BASE — reset, elements, layout primitives, utilities.
   Mobile first: every rule here is the phone rule.
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  /* The page colour lives on the root so body::before (z-index:-1) can
     paint the atmosphere above it without being swallowed by canvas
     background propagation. */
  background-color: var(--bg);
  /* The off-canvas drawer is parked outside the right edge; clipping here
     stops it creating a horizontal scrollbar. `clip` rather than `hidden`
     so the root stays the scroll container and sticky keeps working. */
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-400);
  line-height: var(--lh-normal);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* `clip`, not `hidden`: `hidden` would make <body> a scroll container
     and stop the sticky header from pinning to the viewport. */
  overflow-x: hidden;
  overflow-x: clip;
}

/* A single, quiet atmosphere behind every section. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(90rem 50rem at 50% -14%, rgba(125, 22, 8, 0.34), transparent 62%),
    radial-gradient(56rem 42rem at 4% 22%, rgba(111, 61, 255, 0.15), transparent 60%),
    radial-gradient(50rem 40rem at 96% 72%, rgba(31, 191, 201, 0.11), transparent 62%);
  background:
    radial-gradient(90rem 50rem at 50% -14%, color-mix(in oklab, var(--ember-700) 34%, transparent), transparent 62%),
    radial-gradient(56rem 42rem at 4% 22%, color-mix(in oklab, var(--arcane-500) 15%, transparent), transparent 60%),
    radial-gradient(50rem 40rem at 96% 72%, color-mix(in oklab, var(--mana-500) 11%, transparent), transparent 62%);
}

img, svg, video { display: block; max-width: 100%; }
svg { fill: none; }
template { display: none; }

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }

a { color: inherit; text-decoration: none; }

/* The UA rule for [hidden] loses to any component that sets `display`,
   so state it here where it can win. */
[hidden] { display: none !important; }

/* :where() keeps the reset at zero specificity so a component can set its
   own padding without having to out-specify the reset. */
:where(ul[class], ol[class]) { list-style: none; padding: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-snug);
  letter-spacing: -0.005em;
  text-wrap: balance;
  color: var(--text-hi);
}

p { text-wrap: pretty; }

::selection { background: color-mix(in oklab, var(--ember-500) 60%, transparent); color: #fff; }

:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-1);
}

/* Thin, in-world scrollbars where the browser allows it. */
* { scrollbar-width: thin; scrollbar-color: var(--steel-400) transparent; }
*::-webkit-scrollbar { height: 6px; width: 10px; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--steel-400) 80%, transparent);
  border-radius: var(--r-pill);
}
*::-webkit-scrollbar-track { background: transparent; }

/* ── Layout primitives ─────────────────────────────────────── */

.l-container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.l-container--narrow { max-width: var(--maxw-narrow); }

.l-grid {
  display: grid;
  gap: var(--sp-4);
}

/* Section rhythm */
.s-section { padding-block: var(--section-y); position: relative; }

/* ── Utilities ─────────────────────────────────────────────── */

.u-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.u-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.u-grad {
  background: var(--grad-title);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Doubled class so utilities outrank the component rules that load after
   this file (.c-btn would otherwise win on source order). */
.u-lg-up.u-lg-up { display: none; }
@media (min-width: 64rem) { .u-lg-up.u-lg-up { display: inline-flex; } }

/* ── Reveal on scroll (only when JS is running) ────────────── */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-4) var(--ease-out), transform var(--dur-4) var(--ease-out);
  will-change: opacity, transform;
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
