/* ==========================================================================
   02-base.css  |  ELEMENT DEFAULTS
   --------------------------------------------------------------------------
   Styles plain HTML elements (body, headings, links, images, lists).
   Also points Astra's own colour variables at our brand tokens, so anything
   Astra or its Customizer draws (buttons, links, menus) uses CDS colours
   even if the Customizer is left on defaults.

   SPECIFICITY NOTE: Astra prints its own typography rules with selectors like
   ".entry-content h1". To win without !important we repeat those selectors
   here. This file loads AFTER Astra, so equal specificity = ours wins.
   ========================================================================== */

/* ---- 1. Re-map Astra's global colour variables to the CDS palette ---- */
:root,
body {
  --ast-global-color-0: var(--cds-blue);   /* theme/primary colour */
  --ast-global-color-1: var(--cds-navy);   /* link hover */
  --ast-global-color-2: var(--cds-ink);    /* headings */
  --ast-global-color-3: var(--cds-ink);    /* body text */
  --ast-global-color-4: var(--cds-cream);  /* light background */
  --ast-global-color-5: var(--cds-white);  /* background */
  --ast-global-color-6: var(--cds-grey-100);
  --ast-global-color-7: var(--cds-navy);
  --ast-global-color-8: var(--cds-black);
}

/* ---- 2. Page basics ---- */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%; /* stop iOS inflating text in landscape */
}
body {
  font-family: var(--cds-font-body);
  font-size: var(--cds-fs-body);
  line-height: var(--cds-lh-body);
  color: var(--cds-text);
  background: var(--cds-white);
  /* "clip" (not "hidden") stops sideways scroll WITHOUT breaking sticky header */
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Astra sets html{font-size:112.5%} from its body-size setting, which made every
   rem-based size here 12% too big. Pin the root to the browser default so 1rem = 16px. */
html { font-size: 100%; }

/* ---- 3. Headings (Outfit) ---- */
h1, h2, h3, h4, h5, h6,
.entry-content h1, .entry-content h2, .entry-content h3,
.entry-content h4, .entry-content h5, .entry-content h6 {
  font-family: var(--cds-font-heading);
  line-height: var(--cds-lh-heading);
  letter-spacing: var(--cds-ls-heading);
  color: inherit;          /* inherits from section so dark sections just work */
  font-weight: 700;
  margin: 0 0 0.5em;
  text-wrap: balance;      /* nicer line breaks in headings (progressive enhancement) */
}
h1, .entry-content h1 { font-size: var(--cds-fs-h1); font-weight: 800; }
h2, .entry-content h2 { font-size: var(--cds-fs-h2); }
h3, .entry-content h3 { font-size: var(--cds-fs-h3); }
h4, .entry-content h4 { font-size: var(--cds-fs-h4); }
h5, h6, .entry-content h5, .entry-content h6 { font-size: var(--cds-fs-body); }

/* ---- 4. Text ---- */
p, .entry-content p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }
strong, b { font-weight: 700; }

/* ---- 5. Links ---- */
a { color: var(--cds-link); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; transition: color var(--cds-speed) var(--cds-ease); }
a:hover { color: var(--cds-link-hover); }

/* Visible keyboard focus everywhere (accessibility) */
:focus-visible {
  outline: 3px solid var(--cds-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- 6. Media ---- */
img, svg, video, iframe { max-width: 100%; }
img { height: auto; }

/* ---- 7. Lists inside content ---- */
.entry-content ul, .entry-content ol { margin: 0 0 1.1em 1.25em; }
.entry-content li { margin-bottom: 0.4em; }

/* ---- 8. Selection colour ---- */
::selection { background: var(--cds-blue); color: var(--cds-white); }

/* ---- 9. Respect users who ask for less 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;
  }
}
