/* ==========================================================================
   Base: reset, document defaults, typography, links, focus, layout, grid

   Typography rule: h1 and h2 (and the hero display line) are Cutmark. Every
   heading from h3 down, and all other text, is IBM Plex Sans.
   ========================================================================== */

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
  interpolate-size: allow-keywords;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-19);
  line-height: var(--lh-19);
  color: var(--text-default);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

::selection { background: var(--iron-100); color: var(--navy-950); }

/* Cross-document view transitions: pages fade into each other and the header
   stays put. Browsers without support just navigate normally. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 220ms; }

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

/* ---- Headings ----------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading);
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}
/* h1 and h2: Cutmark */
h1, h2 { font-family: var(--font-display); }
h1 { font-size: var(--fs-48); line-height: var(--lh-48); font-variation-settings: "wght" 800, "wdth" 88; letter-spacing: -0.01em; margin-bottom: var(--space-6); }
h2 { font-size: var(--fs-36); line-height: var(--lh-36); font-variation-settings: "wght" 760, "wdth" 90; margin-top: var(--space-9); margin-bottom: var(--space-5); }
/* h3 and below: IBM Plex Sans */
h3, h4, h5, h6 { font-family: var(--font-body); font-weight: 700; font-variation-settings: normal; }
h3 { font-size: var(--fs-24); line-height: var(--lh-24); margin-top: var(--space-7); }
h4 { font-size: var(--fs-19); line-height: var(--lh-19); margin-top: var(--space-6); }
h5, h6 { font-size: var(--fs-19); line-height: var(--lh-19); font-weight: 600; }

/* The hero display line: the biggest Cutmark on the site (GOV.UK 80px step). */
.display {
  font-family: var(--font-display);
  font-size: var(--fs-80);
  line-height: var(--lh-80);
  font-variation-settings: "wght" 860, "wdth" 86;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 var(--space-4); max-width: var(--measure); text-wrap: pretty; }
.lede { font-size: var(--fs-27); line-height: var(--lh-27); color: var(--text-muted); max-width: var(--measure); margin-bottom: var(--space-7); }
.small { font-size: var(--fs-16); line-height: var(--lh-16); }

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

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

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

strong, b { font-weight: 600; }

/* ---- Links ----------------------------------------------------------------
   Unvisited navy, visited iron, hover thickens the underline, focus is a gold
   highlight with a dark underline (the GOV.UK pattern: it never relies on
   colour alone and keeps 3:1 against any background). */
a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: max(1px, 0.0625rem);
  text-underline-offset: 0.1578em;
  transition: color var(--dur-fast) ease, text-decoration-thickness var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
a:visited { color: var(--link-visited); }
a:hover {
  color: var(--link-hover);
  text-decoration-thickness: max(3px, 0.1875rem, 0.12em);
}
a:focus-visible {
  outline: 3px solid transparent;
  color: var(--focus-text);
  background-color: var(--focus);
  box-shadow: 0 -2px var(--focus), 0 4px var(--focus-text);
  text-decoration: none;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Everything else that can take focus gets a dual ring: dark inner, gold outer.
   The shadow is !important on purpose: components that draw their own shadow
   (the selected tab, cards) must never be able to remove the dark half of the
   ring, which is what keeps it visible on white. */
:where(button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--focus-text) !important;
}
[tabindex="-1"]:focus { outline: none; box-shadow: none; }

/* ---- Skip link ---------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -6rem;
  z-index: 200;
  background: var(--focus);
  color: var(--focus-text);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  font-weight: 700;
  box-shadow: 0 0 0 3px var(--focus-text);
  text-decoration: none;
  transition: top var(--dur-fast) ease;
}
.skip-link:visited { color: var(--focus-text); }
.skip-link:focus, .skip-link:focus-visible { top: var(--space-3); }

/* ---- Layout ------------------------------------------------------------- */
/* The page container. Content is at most 960px wide (--container); the side
   margins sit outside that, so the box grows by 2 x the margin. Margins are
   16px on mobile and 30px from the tablet breakpoint (641px) up. */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--page-margin));
  margin-inline: auto;
  padding-inline: var(--page-margin);
}
/* Wider band for heroes and image strips that "break out" of the 960px column. */
.container-wide {
  width: 100%;
  max-width: calc(var(--container-wide) + 2 * var(--page-margin));
  margin-inline: auto;
  padding-inline: var(--page-margin);
}
@media (min-width: 40.0625em) {
  .container { max-width: calc(var(--container) + 2 * var(--page-margin-tablet)); padding-inline: var(--page-margin-tablet); }
  .container-wide { max-width: calc(var(--container-wide) + 2 * var(--page-margin-tablet)); padding-inline: var(--page-margin-tablet); }
}

main {
  flex: 1 0 auto;
  padding-block: var(--space-8) var(--space-9);
}
main:focus { outline: none; }

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

/* ---- Layout grid (GOV.UK / NHS pattern) ----------------------------------
   Put columns in a .grid-row inside a .container. Below the tablet breakpoint
   (641px) every column is full width and stacks in source order, so write the
   markup in the order it should be read on a phone. From 641px up the columns
   sit side by side, with a 30px gutter between them. Widths: full, one-half,
   one-third, two-thirds, one-quarter, three-quarters. A row's widths should add
   up to a whole (for example 2/3 + 1/3, 1/2 + 1/2, 1/4 x 4). Rows can nest.   */
.grid-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-inline: calc(var(--gutter) / -2);
}
[class*="grid-column-"] {
  box-sizing: border-box;
  width: 100%;
  padding-inline: calc(var(--gutter) / 2);
}
@media (min-width: 40.0625em) {
  .grid-column-one-quarter { width: 25%; }
  .grid-column-one-third { width: 33.3333%; }
  .grid-column-one-half { width: 50%; }
  .grid-column-two-thirds { width: 66.6667%; }
  .grid-column-three-quarters { width: 75%; }
}

/* ---- Scroll reveal ----------------------------------------------------------
   Pure CSS, no JavaScript: content rises into place as it scrolls into view.
   Only where the browser supports scroll-driven animations and the visitor has
   not asked for reduced motion. Elsewhere, content is simply there. */
@keyframes reveal-up { from { opacity: 0; transform: translateY(1.5rem); } to { opacity: 1; transform: none; } }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: reveal-up linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }
}
