/* ==========================================================================
   Base — reset, typography, layout primitives, accessibility helpers
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.7;
  color: var(--text-dark);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.is-locked { overflow: hidden; }

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

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.5em;
  color: var(--navy);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.025em; }
h3 { font-size: var(--fs-h3); line-height: 1.3; letter-spacing: -0.01em; }
h4 { font-size: 1.0625rem; line-height: 1.35; letter-spacing: -0.005em; }

p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; }

a { color: var(--primary-blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--royal-blue); }

button { font: inherit; }

:focus-visible {
  outline: 3px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--light-blue); color: var(--navy); }

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

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(3rem, 2.5rem + 2vw, 4.5rem); }
.section--tint { background: var(--ice-blue); }
.section--line { border-top: 1px solid var(--border); }
.section--navy { background: var(--navy); color: var(--text-on-dark); }
.section--navy h2, .section--navy h3 { color: var(--white); }

.stack > * + * { margin-top: var(--space-4); }
.muted { color: var(--text-muted); }
.lead { font-size: var(--fs-lead); color: var(--text-muted); line-height: 1.65; }

/* ---- Accessibility helpers ---- */
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 1000;
  padding: 0.75rem 1.25rem; background: var(--navy); color: #fff;
  border-radius: var(--radius-sm); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 1rem; color: #fff; }

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

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

/* Decorative offsets (pattern blocks, rings) must never create sideways scroll.
   `clip` (unlike `hidden`) does not create a scroll container, so sticky asides keep working. */
main { overflow-x: clip; }
