/*
 * Retiform Labs — base layer.
 *
 * Reset + element defaults, all expressed through the tokens. No component
 * styling lives here; this sheet answers only "what does an h1 / a link / a
 * paragraph look like before anyone gives it a class?"
 *
 * The two identity rules surface even at this level:
 *   - focus is a hairline outline, never a glow or a shadow
 *   - every transition is disabled under prefers-reduced-motion
 */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  position: relative;            /* scopes the ambient field; see .lattice-field */
  min-height: 100dvh;
  background: var(--surface-0);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: var(--fs-0);
  line-height: var(--lh-body);
  font-synthesis: weight;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* ── the ambient lattice field ──────────────────────────────────────────────
 * The site-wide background. It is an ABSOLUTE canvas sized to the DOCUMENT
 * (never position:fixed — a fixed layer cannot cover a long page and re-seeds
 * when the mobile URL bar collapses). z-index -2 keeps it behind the hero's
 * aurora and its SVG lattice, both of which sit at -1.
 *
 * It is pure decoration: aria-hidden in markup, pointer-events none, and it
 * never occludes text. Motion collapses to one static frame under
 * prefers-reduced-motion (handled in main.js) — a still field, not a blank. */
.lattice-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
  opacity: 0.55;                 /* a texture, present but never loud */
}

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

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

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

h1 { font-size: var(--fs-6); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-4); }
h3 { font-size: var(--fs-2); }
h4 { font-size: var(--fs-1); }

p, li { text-wrap: pretty; }

/* ── links ──────────────────────────────────────────────────────────────── */
a {
  color: var(--signal);
  text-decoration: none;
  text-underline-offset: 0.2em;
  transition: color var(--dur) var(--ease);
}

a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

/* ── focus ──────────────────────────────────────────────────────────────── */
/* A hairline outline, in the accent. Never a shadow, never a glow — focus has
   to be visible and has to match the geometry of everything else. */
:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* ── selection ──────────────────────────────────────────────────────────── */
::selection { background: var(--signal); color: var(--ink); }

/* ── motion courtesy ────────────────────────────────────────────────────── */
/* One rule, applied globally: if the reader has asked for less motion, every
   transition and animation stops. Components do not each have to remember. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── skip link ──────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: var(--space-s);
  top: var(--space-s);
  z-index: 100;
  padding: var(--space-2xs) var(--space-s);
  background: var(--signal);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--fs--1);
  transform: translateY(-200%);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translateY(0); }
