/* ==========================================================================
   Base: reset, document defaults, typography, layout primitives, a11y
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.125rem;            /* 18px base, NHS/GDS-ish readable size */
  line-height: 1.6;
  color: var(--text-default);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Headings ---- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-default);
  line-height: 1.15;
  margin: 0 0 var(--space-4);
  font-weight: 700;
  font-variation-settings: "wght" 700, "wdth" 92;
}
h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.01em; font-variation-settings: "wght" 800, "wdth" 88; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin-top: var(--space-7); font-variation-settings: "wght" 760, "wdth" 90; }
h3 { font-size: 1.25rem; margin-top: var(--space-6); }
h4 { font-size: 1.05rem; }

p { margin: 0 0 var(--space-4); max-width: var(--measure); }

/* ---- Links ---- */
a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { color: var(--link-hover); }
a:visited { color: var(--link-visited); }

/* ---- Lists ---- */
ul, ol { max-width: var(--measure); padding-left: 1.25rem; margin: 0 0 var(--space-4); }
li { margin-bottom: var(--space-2); }

/* ---- Focus: visible gold ring everywhere ---- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}
/* Fallback for browsers without :focus-visible */
a:focus, button:focus, [tabindex]:focus { outline: 3px solid var(--focus); outline-offset: 2px; }
a:focus:not(:focus-visible), button:focus:not(:focus-visible) { outline: none; }

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -4rem;
  background: var(--surface-inverse);
  color: var(--text-on-inverse);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  z-index: 100;
  transition: top 0.15s ease;
}
.skip-link:focus { top: var(--space-4); color: var(--text-on-inverse); }

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

main {
  flex: 1 0 auto;
  padding-block: var(--space-7) var(--space-8);
}

.lede {
  font-size: 1.3rem;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: var(--measure);
  margin-bottom: var(--space-6);
}

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

hr.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin-block: var(--space-5);
}

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