/* ==========================================================================
   Base: fonts, reset, document typography, links, focus, media.
   Loaded after Bootstrap so it owns the element defaults.
   Replaces the copy of the Bootstrap reboot that used to live in style.css.
   ========================================================================== */

/* ---- Fonts -------------------------------------------------------------
   Self-hosted variable woff2, subset to latin and latin-ext. Latin is
   preloaded in include/links.php; latin-ext only downloads if the page
   actually uses a character from that range. font-display: swap means text
   is readable on the first paint, so no font swap can block rendering. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-var.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("../fonts/source-serif-4-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("../fonts/source-serif-4-latin-ext-var.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* ---- Reset -------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  /* Anchored headings must clear the sticky navbar. */
  scroll-padding-top: calc(var(--nav-h) + var(--space-4));
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-relaxed);
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
}

/* ---- Headings -----------------------------------------------------------
   Serif headings carry the authority; the body sans carries the reading.
   Sizes come from the fluid scale, so no page needs its own h1 rule. The
   old global `h1 { text-align: center; font-size: 2rem }` is gone. */

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-tight);
  color: var(--color-heading);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-4xl);
  line-height: var(--lh-snug);
  font-weight: var(--fw-bold);
}

h2 {
  font-size: var(--fs-3xl);
  margin-top: var(--space-10);
}

h3 {
  font-size: var(--fs-2xl);
  margin-top: var(--space-8);
}

h4 {
  font-size: var(--fs-xl);
  margin-top: var(--space-6);
}

h5 {
  font-size: var(--fs-lg);
}

h6 {
  font-size: var(--fs-md);
}

/* A heading that opens a section or a card should not inherit the top
   margin meant for headings that break up running prose. */
:is(h1, h2, h3, h4, h5, h6):first-child,
section > :is(h2, h3),
header > :is(h2, h3),
.card > :is(h2, h3),
.u-flush-top {
  margin-top: 0;
}

/* ---- Text --------------------------------------------------------------- */

p,
ul,
ol,
dl,
blockquote,
figure,
table,
pre {
  margin: 0 0 var(--space-4);
}

ul,
ol {
  padding-left: var(--space-6);
}

li + li {
  margin-top: var(--space-2);
}

li::marker {
  color: var(--color-accent-solid);
}

strong,
b {
  font-weight: var(--fw-semibold);
  color: var(--color-heading);
}

small {
  font-size: var(--fs-sm);
}

address {
  font-style: normal;
  margin-bottom: var(--space-4);
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

hr {
  height: 0;
  margin: var(--space-8) 0;
  border: 0;
  border-top: 1px solid var(--color-border);
}

blockquote {
  padding: var(--space-4) var(--space-6);
  border-left: 3px solid var(--color-accent);
  background: var(--green-50);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--color-heading);
  font-size: var(--fs-md);
}

blockquote > :last-child {
  margin-bottom: 0;
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Dates, lab values and phone numbers line up. */
time,
.u-tabular {
  font-variant-numeric: tabular-nums;
}

/* ---- Links -------------------------------------------------------------
   In running prose links are underlined, which is both the accessible
   default and what AI crawlers read as a citation. Components opt out. */

a {
  color: var(--color-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--t-fast) var(--ease);
}

a:hover {
  color: var(--color-link-hover);
}

/* ---- Focus -------------------------------------------------------------
   One visible focus treatment for every interactive element. The old
   stylesheet removed outlines globally with `outline: 0 !important`. */

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: var(--blue-200);
  color: var(--neutral-900);
}

/* ---- Media -------------------------------------------------------------- */

img,
svg,
video,
iframe {
  max-width: 100%;
  vertical-align: middle;
}

img,
video {
  height: auto;
}

/* Images carrying width/height attributes keep their aspect ratio when CSS
   constrains the width, which is what stops layout shift. */
img[width][height] {
  height: auto;
}

iframe {
  border: 0;
  display: block;
}

figure figcaption {
  margin-top: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

/* ---- Icons -------------------------------------------------------------
   Sprite symbols inherit the surrounding text colour and sit on the text
   baseline. Size with width/height or the --icon-size variable. */

.icon-sprite {
  display: none;
}

.icon {
  width: var(--icon-size, 1.15em);
  height: var(--icon-size, 1.15em);
  flex: none;
  vertical-align: -0.2em;
}

/* ---- Forms -------------------------------------------------------------- */

label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-heading);
}

input,
select,
textarea,
button {
  font: inherit;
  color: inherit;
}

textarea {
  resize: vertical;
}

/* ---- Tables -----------------------------------------------------------
   Comparison tables are one of the formats AI answer engines quote most
   readily, so they get a real default rather than Bootstrap's bare one. */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

caption {
  caption-side: bottom;
  padding-top: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  text-align: left;
}

th,
td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

thead th {
  background: var(--blue-600);
  color: var(--color-text-on-dark);
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  border-bottom: 0;
}

thead th:first-child {
  border-top-left-radius: var(--radius-md);
}

thead th:last-child {
  border-top-right-radius: var(--radius-md);
}

tbody tr:nth-child(even) {
  background: var(--neutral-50);
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* ---- Utilities ---------------------------------------------------------- */

.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.u-measure {
  max-width: var(--measure);
}

.u-muted {
  color: var(--color-text-muted);
}

.u-center {
  text-align: center;
}

.u-balance {
  text-wrap: balance;
}

.u-no-marker {
  list-style: none;
  padding-left: 0;
}

.u-no-marker > li + li {
  margin-top: var(--space-2);
}

/* Skip link: first focusable element on every page. */
.skip-link {
  position: absolute;
  top: 0;
  left: var(--space-4);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-5);
  background: var(--color-primary);
  color: var(--color-text-on-dark);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transform: translateY(-100%);
  transition: transform var(--t-base) var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--color-text-on-dark);
}
