/* ==========================================================================
   Fonts, reset, and element defaults.
   ========================================================================== */

/* Bricolage is variable on BOTH weight and width. The font-stretch range must
   be declared here or the browser clamps the width axis to 100% and
   `.display-tight` silently does nothing. */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('../fonts/bricolage-grotesque-variable.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibm-plex-sans-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibm-plex-sans-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../fonts/ibm-plex-sans-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('../fonts/ibm-plex-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* --- Reset ---------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  border: 0 solid rgb(var(--ink-3));
}

* {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* `clip`, not `hidden`. Both stop the page scrolling sideways, but `hidden`
     turns the viewport into a scroll container — which breaks position: sticky
     and forces GSAP's ScrollTrigger to fall back from fixed pinning to
     transform pinning. `clip` just clips. The overflow itself comes from
     .scrim::before, which is *meant* to bleed past its parent; this is the
     backstop, and the bleed is clamped on small screens below. */
  overflow-x: clip;
}

body {
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.6;
  color: rgb(var(--text-1));
  background-color: rgb(var(--ink));
  /* The dusk gradient from the Nova render: lifted centre, deeper edges. */
  background-image: radial-gradient(
    120% 90% at 50% 12%,
    rgb(17 24 46) 0%,
    rgb(var(--ink)) 48%,
    rgb(var(--ink-deep)) 100%
  );
  background-attachment: fixed;
  /* dvh, not vh — the mobile URL bar must not clip the hero. */
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

button {
  cursor: pointer;
}

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

/* Removes the legacy ~300ms tap delay on touch without disabling pinch-zoom
   (which `touch-action: none` would, and which we never do). */
:where(a, button, [role='button'], input, select, textarea, summary, label) {
  touch-action: manipulation;
}

ul,
ol {
  list-style: none;
}

/* --- Focus: one visible ring on everything. Never removed. ---------------- */
:where(a, button, [role='button'], input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid rgb(var(--focus-ring));
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: rgb(var(--nova) / 0.3);
  color: rgb(var(--vinyl));
}

/* --- Typographic defaults ------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* Bricolage's width axis: compress display text so long headlines pack into
   a block instead of shrinking to a size nobody reads. */
.display-tight {
  font-stretch: 82%;
}

.display-xl { font-size: var(--size-display-xl); line-height: 0.94; letter-spacing: -0.035em; }
.display-lg { font-size: var(--size-display-lg); line-height: 0.98; }
.display-md { font-size: var(--size-display-md); line-height: 1.02; }
.display-sm { font-size: var(--size-display-sm); line-height: 1.12; letter-spacing: -0.02em; }

.lede {
  font-size: var(--size-lede);
  line-height: 1.6;
  color: rgb(var(--text-2));
}

/* Tabular figures for percentages, metrics and prices — no width jitter. */
.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

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

/* --- Reduced motion: non-negotiable --------------------------------------
   The canvas never initialises (see js/capability.js); this kills every
   DOM-side timeline so the site reads as a plain, fully legible document. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
