/* Base layer — reset, typography, primitives. Shared by every page.
 * Every colour and font comes from tokens.css; no raw values here. */

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  overflow-x: clip;
  min-height: 100dvh;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-weight: var(--weight-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, picture, svg, video { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
p, li, dd { overflow-wrap: break-word; }
[hidden] { display: none !important; }

/* ── Typography ────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-style: normal;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  text-wrap: balance;
  overflow-wrap: anywhere;
  min-width: 0;
}
h1 { font-size: var(--text-display-s); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-md); letter-spacing: -0.015em; line-height: var(--leading-snug); }

p { text-wrap: pretty; max-width: var(--measure); }
strong, b { font-weight: var(--weight-strong); }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.lede {
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--color-muted);
  max-width: 58ch;
}

.label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-muted);
}

.tabular { font-variant-numeric: tabular-nums; }

/* ── Links ─────────────────────────────────────────────── */
a { color: inherit; text-decoration: none; }

.link {
  color: var(--color-accent-text);
  font-weight: var(--weight-strong);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-thickness var(--dur-fast) var(--ease-out);
}
.link:hover { text-decoration-thickness: 2px; }

.prose a {
  color: var(--color-accent-text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* ── Focus — instant, never animated ───────────────────── */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* ── Buttons ───────────────────────────────────────────── *
 * States: default · hover · focus-visible · active · disabled · loading. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  min-height: 2.75rem;
  padding: 0 var(--space-md);
  border-radius: var(--radius-pill);
  border: var(--rule-width) solid transparent;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-strong);
  line-height: 1;
  white-space: nowrap;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn[aria-disabled="true"], .btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}
.btn[data-state="loading"] { cursor: progress; opacity: 0.75; }

/* Primary: accent fill; label + hover colours come from the palette's tokens. */
.btn--primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-color: var(--color-accent-edge);
}
.btn--primary:hover {
  background: var(--color-accent-hover);
  color: var(--color-on-accent-hover);
}

/* Secondary: ink outline. */
.btn--ghost {
  border-color: var(--color-control);
  color: var(--color-ink);
}
.btn--ghost:hover { border-color: var(--color-ink); background: var(--color-paper-2); }

.btn--lg { min-height: 3.25rem; padding: 0 var(--space-lg); font-size: var(--text-base); }

.btn__arrow { transition: transform var(--dur-base) var(--ease-out); }
.btn:hover .btn__arrow { transform: translateX(3px); }

@media (pointer: coarse) {
  .btn { min-height: 3rem; }
}

/* ── Layout primitives ─────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  inset-block-start: var(--space-2xs);
  inset-inline-start: var(--space-2xs);
  z-index: var(--z-toast);
  padding: var(--space-2xs) var(--space-sm);
  background: var(--color-ink);
  color: var(--color-paper);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

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

/* ── Spark — the logo's diamond, reused as the brand device ──
 * Bullets, live-status marks, the footer mast. Always decorative (aria-hidden). */
.spark {
  display: inline-block;
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 1.5px;
  background: var(--color-spark);
  transform: rotate(45deg);
}

.scroll-sentinel {
  position: absolute;
  inset-block-start: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* ── Status chip (Live / Rolling out) ──────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: var(--space-3xs) var(--space-2xs);
  border-radius: var(--radius-pill);
  border: var(--rule-width) solid var(--color-rule);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  line-height: 1.4;
  white-space: nowrap;
  color: var(--color-muted);
}
.chip::before {
  content: "";
  width: 0.45rem; height: 0.45rem;
  border-radius: 50%;
  background: var(--color-muted);
}
.chip[data-status="live"] { color: var(--color-ink); }
.chip[data-status="live"]::before { background: var(--color-success); }
.chip[data-status="rolling-out"]::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--color-muted);
}

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
