/* Reset, typography, page shell, and themed native controls.
   Nothing here is page-specific; components live in components.css. */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; font-weight: 400; line-height: var(--leading-tight); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, video { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }

/* ── Themed browser defaults ───────────────────────────────────── */
::selection { background: var(--selection-bg); color: var(--selection-fg); }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
:where(a, button, input, select, textarea):focus:not(:focus-visible) { outline: none; }

html { -webkit-tap-highlight-color: var(--accent-soft); }

a { color: var(--link); text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); text-underline-offset: 0.2em; }
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-pill); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--fg-subtle); }

input, select, textarea, button { font: inherit; color: inherit; }
::placeholder { color: var(--fg-subtle); opacity: 1; }
caret-color: var(--accent);
input, textarea { caret-color: var(--accent); }

/* The yellow/blue autofill wash is a browser default; repaint it with tokens. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--accent);
  transition: background-color 9999s ease-in-out 0s;
}

input[type="checkbox"], input[type="radio"], input[type="range"], progress {
  accent-color: var(--accent);
}

/* Safari renders date/time pickers with a dark glyph, invisible on black. */
::-webkit-calendar-picker-indicator { filter: invert(1) opacity(0.55); cursor: pointer; }
::-webkit-calendar-picker-indicator:hover { filter: invert(1) opacity(1); }

/* ── Page shell ────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100dvh; flex-direction: column; }
.shell__main { flex: 1; }

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

.section { padding-block: var(--section-y); }
/* Stacked sections would otherwise pay the rhythm twice at the seam. */
.section + .section { padding-block-start: 0; }
.section--sunken + .section, .section + .section--sunken { padding-block-start: var(--section-y); }
.section--flush { padding-block: 0; }
.section--sunken { background: var(--bg-sunken); }

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100%;
  z-index: var(--z-toast);
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: var(--space-4); color: var(--accent-contrast); }

/* ── Type helpers ──────────────────────────────────────────────── */
/* Negative tracking would pull a joined script's letters through each other,
   and the em box is too short for its loops — hence the script leading. */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: normal;
  line-height: var(--leading-script);
}
/* A small grotesk label above a big signature title: two scripts stacked
   would read as one block and lose the hierarchy the eyebrow exists for. */
.eyebrow {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.lede { font-size: var(--text-lg); color: var(--fg-muted); max-width: var(--measure); line-height: var(--leading-snug); }
.prose { max-width: var(--measure); color: var(--fg-muted); }
.prose p + p { margin-top: var(--space-4); }
.muted { color: var(--fg-muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
