/* ==========================================================================
   BASE RESET & GLOBAL ELEMENTS
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 120px; /* v3: taller header */
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

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

ul[role='list'],
ol[role='list'] {
  list-style: none;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
  line-height: 1.08;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

p,
li,
figcaption {
  text-wrap: pretty;
}

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

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

@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;
  }
}

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

table {
  border-collapse: collapse;
  width: 100%;
}

/* v6 (§12) CRITICAL TOUCH FIX: every interactive element opts out of the
   browser's double-tap-zoom / tap-delay heuristics. iOS WebKit keeps a
   double-tap-to-zoom gesture recognizer active inside embedded iframe
   contexts (the platform's mobile preview wrapper) even when the page has a
   proper width=device-width viewport meta — single finger taps on tappable
   elements that have NOT opted out via touch-action can be swallowed or
   deferred while WebKit waits to disambiguate a possible second tap, which
   made the menu tabs (and potentially every other button) read as dead on
   real phones while desktop mouse clicks worked. `manipulation` allows
   pan + pinch-zoom but removes the tap-disambiguation delay entirely.
   Do NOT remove this rule. */
a,
button,
[role='button'],
[role='link'],
[role='tab'],
input,
textarea,
select,
label,
summary {
  touch-action: manipulation;
}

a,
button,
[role='button'],
[role='link'],
input,
textarea,
select {
  transition:
    color var(--transition-interactive),
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}

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

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

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  background: #151516; /* v4 (§2): white-on-core-teal fails AA at small sizes */
  color: #ffffff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  z-index: 200;
  font-weight: 600;
  transition: top var(--transition-interactive);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ---- Layout helpers ---- */
.container {
  width: 100%;
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: clamp(var(--space-5), 5vw, var(--space-12));
}

.container--narrow {
  max-width: var(--content-narrow);
}

.container--default {
  max-width: var(--content-default);
}

section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-32));
}

.section-tight {
  padding-block: clamp(var(--space-10), 5vw, var(--space-16));
}

/* ---- Textures ---- */
.paper-texture {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(32, 28, 24, 0.035) 1px, transparent 0);
  background-size: 22px 22px;
}
