/* ============================================================
   Base — reset, typography, layout primitives, a11y utilities
   ============================================================ */

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

/* The UA rule for [hidden] is only `display: none` at the lowest
   specificity, so any component that sets its own display (.btn uses
   inline-flex) silently defeats it. Everything that toggles visibility
   in this build does so through [hidden], so it is enforced once here. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-base);
  background: var(--c-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  color: var(--text-strong);
  line-height: var(--lh-head);
  letter-spacing: var(--ls-tight);
  margin: 0 0 var(--s-4);
  font-weight: 800;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: 700; }
h4 { font-size: var(--fs-h4); font-weight: 700; }

p { margin: 0 0 var(--s-4); max-width: 68ch; text-wrap: pretty; }
p:last-child, ul:last-child, ol:last-child { margin-bottom: 0; }

a { color: var(--c-navy-800); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--c-orange-700); }

ul, ol { margin: 0 0 var(--s-4); padding-left: var(--s-5); }
li + li { margin-top: var(--s-2); }

strong, b { font-weight: 700; color: var(--text-strong); }
hr { border: 0; border-top: 1px solid var(--c-line); margin: var(--s-8) 0; }

/* ---------- Focus: always visible, never removed ---------- */
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.on-dark :focus-visible,
.footer :focus-visible { outline-color: var(--c-lime-500); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: var(--s-4); top: var(--s-2);
  z-index: 200;
  transform: translateY(-160%);
  background: var(--surface-dark); color: #fff;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  font-weight: 600; text-decoration: none;
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translateY(0); color: #fff; }

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

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

.section { padding-block: var(--section-y); }
.section--sunk { background: var(--c-surface-sunk); }
.section--navy { background: var(--surface-dark); color: var(--text-on-dark); }
.section--navy h2, .section--navy h3, .section--navy h4 { color: #fff; }
.section--navy p { color: var(--text-on-dark-subtle); }

.stack > * + * { margin-top: var(--s-4); }
.grid { display: grid; gap: var(--s-6); }

@media (min-width: 640px)  { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .grid--3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 640px)  { .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Section headers ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-head);
  font-size: var(--fs-xs); font-weight: 800;
  letter-spacing: var(--ls-eyebrow); text-transform: uppercase;
  color: var(--c-orange-700);
  margin: 0 0 var(--s-3);
}
.eyebrow::before {
  content: ""; width: 22px; height: 3px; border-radius: 2px;
  background: var(--c-orange-500); flex: none;
}
.on-dark .eyebrow, .section--navy .eyebrow { color: var(--c-lime-500); }
.on-dark .eyebrow::before, .section--navy .eyebrow::before { background: var(--c-lime-500); }

.section-head { max-width: 62ch; margin-bottom: var(--s-10); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .eyebrow { justify-content: center; }
.lead { font-size: var(--fs-lead); color: var(--text-base); }
.section--navy .lead { color: var(--text-on-dark-subtle); }

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

/* ---------- Forced colors (Windows High Contrast) ---------- */
@media (forced-colors: active) {
  .btn { border: 1px solid ButtonText; }
  :focus-visible { outline: 3px solid Highlight; }
}
