/* MOSIS — base layer. Reset, type scale, layout primitives.
 * Rules from docs/plans/10-project-website.md §4.4: 8px grid, generous
 * whitespace, hairlines over boxes. No drop shadows, no gradient blobs,
 * no glassmorphism, no rounded-2xl card soup. */

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

:where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote, pre) {
  margin: 0;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* The page ground is a lane floor: one hairline every 8th row, barely there. */
  background-image: repeating-linear-gradient(
    to bottom,
    color-mix(in srgb, var(--rail) 26%, transparent) 0 1px,
    transparent 1px 128px
  );
}

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

/* ── Type (§4.2) ─────────────────────────────────────────────────────── */

h1,
h2,
h3,
.display {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 88%;
  letter-spacing: var(--track-display);
  line-height: 0.95;
  text-wrap: balance;
}

h1 {
  font-size: var(--t-display);
}

h2 {
  font-size: var(--t-h2);
}

h3 {
  font-size: var(--t-h3);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

p,
li {
  max-width: var(--measure);
  text-wrap: pretty;
}

/* Flow spacing. Zero-specificity so any component can override it without an
 * arms race. A headline states the claim; the block under it needs air. */
:where(h1, h2, h3) + * {
  margin-block-start: var(--s-4);
}

:where(p, ul, ol, dl, pre, figure, blockquote) + :where(p, ul, ol, dl, pre, figure, blockquote) {
  margin-block-start: var(--s-3);
}

.lede {
  font-size: clamp(1.1rem, 1rem + 0.55vw, 1.35rem);
  line-height: 1.5;
  color: var(--muted);
  max-width: 56ch;
}

small,
.small {
  font-size: var(--t-small);
}

/* Mono is native here — evidence tags, lane labels, ports, device ids,
 * pairing codes. Ornament, not just code. */
code,
kbd,
samp,
pre,
.mono {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: var(--track-mono);
  font-variant-ligatures: none;
}

.label {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Mono inside a display headline has to scale with it, or `dev` in a 3rem
 * headline reads as a typo. */
:where(h1, h2, h3) code {
  font-size: 0.68em;
  letter-spacing: 0.01em;
}

a {
  color: var(--sig);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, var(--sig) 45%, transparent);
  transition: color var(--dur-ui) var(--ease),
    text-decoration-color var(--dur-ui) var(--ease);
}

a:hover {
  color: var(--sig-dim);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--sig);
  outline-offset: 3px;
  border-radius: 1px;
}

hr {
  border: 0;
}

/* ── Layout ──────────────────────────────────────────────────────────── */

.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.stack > * + * {
  margin-block-start: var(--s-4);
}

.stack-tight > * + * {
  margin-block-start: var(--s-2);
}

section {
  padding-block: clamp(var(--s-6), 7vw, var(--s-8));
}

.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: absolute;
  inset-block-start: var(--s-2);
  inset-inline-start: var(--s-2);
  z-index: 20;
  padding: var(--s-2) var(--s-3);
  background: var(--ink-2);
  border: var(--hair) solid var(--sig);
  color: var(--sig);
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  text-transform: uppercase;
  letter-spacing: var(--track-mono);
  text-decoration: none;
  transform: translateY(calc(-100% - var(--s-4)));
}

.skip-link:focus {
  transform: none;
}
