/* Shared primitives for the static surfaces.
 *
 * Reads tokens.css and defines nothing of its own: no colour literal appears
 * below, which design/build.mjs --check enforces. Every static page loads
 * tokens.css then this, so type, spacing, controls and states are identical
 * across the landing, signup, legal pages and error states.
 */

@font-face {
  font-family: "Libre Bodoni";
  src: url("/fonts/bodoni-var.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("/fonts/publicsans-var.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

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

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--c-ground);
  color: var(--c-ink);
  font-family: var(--font-text);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  /* Never let a wide child scroll the document sideways; wide things get their
     own scroll container instead. */
  overflow-x: hidden;
}

/* ---- Typography ---- */

.display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: var(--leading-tight); text-wrap: balance; }

/* Running text stays near 65 characters, which is where reading speed peaks. */
.prose { max-width: 65ch; }
.prose p + p,
.prose ul,
.prose ol { margin-top: var(--space-4); }
.prose li + li { margin-top: var(--space-2); }
.prose h2 { margin-top: var(--space-7); margin-bottom: var(--space-3); font-size: var(--text-2xl); }
.prose h3 { margin-top: var(--space-5); margin-bottom: var(--space-2); font-size: var(--text-lg); }
.prose a { color: var(--c-accent); text-underline-offset: 0.2em; }

.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--c-accent);
}

.muted { color: var(--c-ink-soft); }
.fine { font-size: var(--text-sm); color: var(--c-ink-soft); }

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

/* Visible focus is not optional. Removing it is the single most common way a
   keyboard user is locked out of a page. */
:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ---- Layout ---- */

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  /* viewport-fit=cover means the safe area must be honoured or content sits
     under the notch in landscape. */
  padding-inline: max(var(--space-5), env(safe-area-inset-left));
}

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
/* Spacing belongs to the container, so siblings cannot collapse or double it. */
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }

.section { padding-block: clamp(var(--space-7), 7vw, var(--space-9)); }

/* ---- Controls ---- */

/* 44px is the minimum tap target Apple states outright, and it is a floor for
   anything interactive rather than a button-only rule. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height-lg);
  min-width: var(--control-tap-min);
  padding-inline: var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--c-accent);
  color: var(--c-accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--motion-fast) var(--motion-ease),
              border-color var(--motion-fast) var(--motion-ease);
}
.btn:hover { background: var(--c-accent-hover); }

.btn-quiet {
  background: transparent;
  color: var(--c-ink);
  border-color: var(--c-line-strong);
}
.btn-quiet:hover { background: var(--c-surface-sunk); border-color: var(--c-ink-faint); }

.btn-sm { min-height: var(--control-height-sm); padding-inline: var(--space-4); font-size: var(--text-sm); }

.btn svg, .icon { width: 1.25em; height: 1.25em; flex: 0 0 auto; }

.field {
  width: 100%;
  min-height: var(--control-height-md);
  padding: var(--space-2) var(--space-3);
  background: var(--c-surface);
  color: var(--c-ink);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-md);
  font: inherit;
}
.field::placeholder { color: var(--c-ink-faint); }

.label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* ---- Surfaces ---- */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.rule { height: 1px; background: var(--c-line); border: 0; }

/* ---- States ----
 *
 * These render through the same tokens as everything else. The not-found page
 * that shipped was drawn before any theme was applied, so every custom
 * property was unset and it fell back to black-on-white browser serif with no
 * branding and no way out.
 */

.state {
  min-height: 70svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: var(--space-6);
}
.state .inner { max-width: 44ch; display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.state .mark { color: var(--c-accent); }
.state h1 { font-size: var(--text-3xl); }
.state p { color: var(--c-ink-soft); }

/* ---- Utilities ---- */

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

/* Wide content scrolls inside itself rather than moving the page. */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

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

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