/* whatislmp.com — site design system
   Direction: a calm, premium medical-educational brand. Soft tinted surfaces and gentle depth,
   a serif for headings, a plain sans for reading, one rosewood accent for actions; the calculator
   card is the product. Light theme on :root; dark theme via prefers-color-scheme or [data-theme]. */

/* ---------- 1. Tokens ---------- */
:root {
  /* Color (light) */
  --color-bg: #f5f6f8;
  --color-surface: #ffffff;
  --color-surface-muted: #eceff3;
  --color-text: #15202b;
  --color-text-muted: #4a5765;
  --color-border: #d5dbe2;
  --color-border-strong: #7d8996;  /* ≥3:1 on bg, surface and muted (WCAG 1.4.11) */
  --color-accent: #9e2f4c;          /* buttons, links */
  --color-accent-hover: #7f2139;
  --color-accent-contrast: #ffffff; /* text on accent */
  --color-accent-soft: #f7e8ed;
  --color-link: #9e2f4c;
  --color-link-visited: #7a2a52;
  --color-focus: #1f5fbf;
  --color-note-bg: #eef3f8;
  --color-note-border: #9fb6cf;
  --color-error: #b3261e;
  --color-error-bg: #fbeceb;
  --color-tint: #fbf3f6;              /* rose-tinted panels (hero, intros, results) */
  --color-tint-strong: #f4dfe6;
  --shadow-sm: 0 1px 2px rgb(21 32 43 / 0.06);
  --shadow-md: 0 2px 4px rgb(21 32 43 / 0.04), 0 8px 24px -8px rgb(21 32 43 / 0.12);
  --shadow-lg: 0 4px 8px rgb(21 32 43 / 0.04), 0 18px 48px -16px rgb(21 32 43 / 0.20);
  color-scheme: light;

  /* Type */
  /* Self-hosted (see "Fonts" below). Gelasio shares Georgia's metrics, so Georgia is its first fallback. */
  --font-display: "Gelasio", Georgia, Cambria, "Times New Roman", serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.1875rem;
  --text-h3: 1.25rem;
  --text-h2: clamp(1.5rem, 1.2rem + 1.1vw, 1.875rem);
  --text-h1: clamp(2.125rem, 1.6rem + 2.4vw, 3rem);
  --text-display: clamp(2.5rem, 1.6rem + 4vw, 4rem); /* home hero only */
  --leading-body: 1.65;
  --leading-tight: 1.2;
  --measure: 68ch;

  /* Space (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  /* Shape and layout */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --container: 72rem;
  --gutter: 1rem;
  --header-height: 4rem;
  --tap: 48px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0f151c;
    --color-surface: #151d26;
    --color-surface-muted: #1c2631;
    --color-text: #e6ebf0;
    --color-text-muted: #a7b3bf;
    --color-border: #2b3946;
    --color-border-strong: #66788a;
    --color-accent: #f0a3b7;
    --color-accent-hover: #f7c3d1;
    --color-accent-contrast: #2a0d17;
    --color-accent-soft: #33202a;
    --color-link: #f0a3b7;
    --color-link-visited: #e0b0d0;
    --color-focus: #8ab4ff;
    --color-note-bg: #172433;
    --color-note-border: #3d5a78;
    --color-error: #ffb4ab;
    --color-error-bg: #3a1b19;
    --color-tint: #1c1820;
    --color-tint-strong: #2c2029;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 2px 4px rgb(0 0 0 / 0.3), 0 8px 24px -8px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 4px 8px rgb(0 0 0 / 0.3), 0 18px 48px -16px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --color-bg: #0f151c;
  --color-surface: #151d26;
  --color-surface-muted: #1c2631;
  --color-text: #e6ebf0;
  --color-text-muted: #a7b3bf;
  --color-border: #2b3946;
  --color-border-strong: #66788a;
  --color-accent: #f0a3b7;
  --color-accent-hover: #f7c3d1;
  --color-accent-contrast: #2a0d17;
  --color-accent-soft: #33202a;
  --color-link: #f0a3b7;
  --color-link-visited: #e0b0d0;
  --color-focus: #8ab4ff;
  --color-note-bg: #172433;
  --color-note-border: #3d5a78;
  --color-error: #ffb4ab;
  --color-error-bg: #3a1b19;
  --color-tint: #1c1820;
  --color-tint-strong: #2c2029;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 2px 4px rgb(0 0 0 / 0.3), 0 8px 24px -8px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 4px 8px rgb(0 0 0 / 0.3), 0 18px 48px -16px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

@media (min-width: 768px) {
  :root { --gutter: 1.5rem; }
}

/* Fonts (BUILD-LOCK: two self-hosted families, Latin subset, font-display: swap).
   Gelasio Bold for headings and Public Sans (variable weight) for text; both SIL Open Font
   License 1.1, licence texts in /assets/fonts/. Latin subset files from Fontsource 5.3.0. */
@font-face {
  font-family: "Gelasio";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/gelasio-latin-700-normal.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: "Public Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/public-sans-latin-wght-normal.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;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  overflow-wrap: break-word;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-text);
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: var(--text-h1); letter-spacing: -0.015em; }
h2 { font-size: var(--text-h2); letter-spacing: -0.01em; }
h3 { font-size: var(--text-h3); }

p, ul, ol, dl { margin: 0; }
ul, ol { padding-left: 1.25em; }
li + li { margin-top: var(--space-2); }

strong { font-weight: 650; }

a {
  color: var(--color-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:visited { color: var(--color-link-visited); }
a:hover { text-decoration-thickness: 2px; }

hr { border: 0; border-top: 1px solid var(--color-border); margin: var(--space-7) 0; }

abbr[title] { text-decoration: underline dotted; text-underline-offset: 0.15em; }

/* Focus: one visible ring for every interactive element */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
main:focus { outline: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  color: var(--color-text);
  border: 2px solid var(--color-focus);
  border-radius: var(--radius);
  font-weight: 600;
}
.skip-link:focus { top: var(--space-3); }

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

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-4); }
.prose > h2 { margin-top: var(--space-7); }
.prose > h3 { margin-top: var(--space-6); }
.prose > h2 + *, .prose > h3 + * { margin-top: var(--space-3); }

.stack > * + * { margin-top: var(--space-4); }

.page { padding-bottom: var(--space-7); }

/* Main reading column below a page intro */
.content { max-width: 48rem; }
.content p, .content li { max-width: var(--measure); }
/* Home: full width for card grids; running text keeps the reading measure */
.content--home { max-width: none; }
.content--home > .section > :not(.link-list):not(.timeline) { max-width: 48rem; }
.content--home .link-list__item { max-width: none; }
.final-cta { margin-top: var(--space-8); }
.content--home .references, .content--home .disclaimer { max-width: 48rem; }

/* ---------- 4. Text styles ---------- */
.eyebrow {
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
/* In the home hero the eyebrow is a small pill */
.intro .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-tint-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-accent);
  font-size: 0.8125rem;
}
.intro .eyebrow::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--color-accent); }

.lead {
  font-size: var(--text-lg);
  line-height: 1.6;
  max-width: 60ch;
}

.meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.small { font-size: var(--text-sm); }

/* ---------- 5. Buttons and links ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: var(--space-3) var(--space-5);
  border: 2px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.button:active { transform: translateY(1px); }
.button--primary,
.button--primary:visited {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  box-shadow: 0 1px 2px rgb(21 32 43 / 0.12), 0 6px 16px -6px color-mix(in srgb, var(--color-accent) 70%, transparent);
}
.button--primary:hover { background: var(--color-accent-hover); transform: translateY(-1px); box-shadow: 0 2px 4px rgb(21 32 43 / 0.12), 0 10px 22px -8px color-mix(in srgb, var(--color-accent) 75%, transparent); }
.button--primary:active { transform: translateY(1px); }
.button--secondary,
.button--secondary:visited {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.button--secondary:hover { border-color: var(--color-text); background: var(--color-surface-muted); }

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--tap);
  font-weight: 600;
}
.arrow-link .icon-arrow { flex: none; transition: transform 0.15s ease; }
.arrow-link:hover .icon-arrow { transform: translateX(3px); }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}
.icon-button { border-radius: var(--radius-pill); transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease); }
.icon-button:hover { border-color: var(--color-border); background: var(--color-surface-muted); }

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
}

/* ---------- 6. Header and navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
@supports (backdrop-filter: blur(1px)) {
  .site-header {
    background: color-mix(in srgb, var(--color-surface) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
  }
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  min-height: var(--header-height);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand:visited { color: var(--color-text); }
.brand__mark { width: 30px; height: 30px; color: var(--color-text); transition: transform 0.25s var(--ease); }
.brand:hover .brand__mark { transform: rotate(-6deg); }
.brand__dot { fill: var(--color-accent); }
.lmp-mark__page { fill: var(--color-accent-soft); stroke: var(--color-accent); }
.lmp-mark__band { fill: var(--color-accent); }
.lmp-mark__ink { fill: none; stroke: var(--color-accent); }
.brand__name { font-size: 1.0625rem; }

.site-nav__group-label { display: none; }

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav__list li + li { margin-top: 0; }

.site-nav__link {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  color: var(--color-text);
  font-weight: 550;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.site-nav__link:visited { color: var(--color-text); }
.site-nav__link:hover { background: var(--color-surface-muted); }
.site-nav__link[aria-current="page"] { background: var(--color-accent-soft); color: var(--color-accent); }

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.theme-toggle .icon-theme__sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-theme__sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-theme__moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-theme__sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-theme__moon { display: none; }
}

.menu-toggle .icon-menu__close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-menu__open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-menu__close { display: block; }

/* Small screens */
@media (max-width: 899.98px) {
  /* Without JavaScript, the nav stays visible as a full-width row under the brand. */
  .site-nav { order: 3; width: 100%; padding-bottom: var(--space-2); }
  .site-header__actions { order: 2; }

  .js .site-nav { display: none; }
  .js .site-header.is-menu-open .site-nav {
    display: block;
    border-top: 1px solid var(--color-border);
    padding-block: var(--space-3) var(--space-4);
  }
  .js .site-nav__group-label {
    display: block;
    margin: 0 0 var(--space-1);
    padding-inline: var(--space-3);
    font-size: 0.8125rem;
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
  }
  .js .site-nav__list { display: block; }
  .js .site-nav__list--tools {
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
  }
  .js .site-header.is-menu-open .site-nav { animation: menu-in 0.2s var(--ease) both; }
  .js .site-nav__link { border-radius: var(--radius); }
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Large screens: one row, no menu button. The main calculator link is the header's call to action. */
@media (min-width: 900px) {
  .site-header__inner { flex-wrap: nowrap; column-gap: var(--space-4); }
  .site-nav { display: flex; align-items: center; gap: var(--space-1); margin-left: auto; }
  .site-nav__list--tools { padding-right: var(--space-2); margin-right: var(--space-1); border-right: 1px solid var(--color-border); }
  .site-nav__link { padding: 0 var(--space-3); font-size: 0.9688rem; }
  .site-nav__link--cta,
  .site-nav__link--cta:visited { background: var(--color-accent); color: var(--color-accent-contrast); box-shadow: var(--shadow-sm); }
  .site-nav__link--cta:hover { background: var(--color-accent-hover); }
  .site-nav__link--cta[aria-current="page"] { background: var(--color-accent); color: var(--color-accent-contrast); box-shadow: 0 0 0 3px var(--color-accent-soft); }
  .site-header__actions { margin-left: 0; }
  .menu-toggle { display: none; }
}
@media (min-width: 900px) and (max-width: 1079.98px) {
  .site-nav__link { padding: 0 var(--space-2); font-size: 0.9063rem; }
  .brand__name { font-size: 1rem; }
}

/* ---------- 7. Breadcrumbs ---------- */
.breadcrumbs { font-size: var(--text-sm); color: var(--color-text-muted); }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; color: var(--color-accent); }
.breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}
.breadcrumbs__list li + li { margin-top: 0; }
.breadcrumbs__list li:not(:last-child)::after {
  content: "/";
  margin-inline: var(--space-2);
  color: var(--color-border-strong);
}
.breadcrumbs a { color: var(--color-text-muted); }

/* ---------- 8. Sections and content blocks ---------- */
.section { padding-top: var(--space-8); }
.section > h2 { margin-bottom: var(--space-4); }
/* A short rosewood rule above every section heading gives each section a clear start. */
.section > h2::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  margin-bottom: var(--space-3);
  border-radius: 3px;
  background: var(--color-accent);
}
.section > .eyebrow { margin-bottom: var(--space-2); }
.section > * + * { margin-top: var(--space-4); }
.section > h2 + * { margin-top: 0; }

/* Home hero: answer first, key facts beside it on wide screens */
.intro {
  position: relative;
  display: grid;
  gap: var(--space-6);
  margin-top: var(--space-5);
  padding: var(--space-6) var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 90% at 0% 0%, var(--color-tint-strong) 0%, transparent 55%),
    linear-gradient(160deg, var(--color-tint) 0%, var(--color-surface) 60%);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.intro h1 { font-size: var(--text-display); letter-spacing: -0.025em; line-height: 1.05; }
.intro .lead { font-size: clamp(1.1875rem, 1.05rem + 0.5vw, 1.375rem); color: var(--color-text); }
.intro__main > * + * { margin-top: var(--space-4); }
.intro__main .button-row { margin-top: var(--space-6); }
.intro__main .button { min-height: 3.25rem; padding-inline: var(--space-6); font-size: 1.0625rem; }
.intro__main .meta { padding-top: var(--space-2); }
@media (min-width: 640px) { .intro { padding: var(--space-7) var(--space-6); } }
@media (min-width: 960px) {
  .intro { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; gap: var(--space-7); padding: var(--space-8) var(--space-7); }
}

/* Key facts panel (the hero's companion card) */
.facts {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-5) var(--space-4);
  box-shadow: var(--shadow-lg);
}
.facts::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-hover));
}
.facts__title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

/* Terms */
.term-list { display: grid; gap: 0; }
.term-list__row {
  display: grid;
  gap: var(--space-1) var(--space-5);
  padding-block: var(--space-3);
  border-top: 1px solid var(--color-border);
}
.term-list__row:first-child { border-top: 0; padding-top: 0; }
.term-list dt { font-weight: 700; }
.term-list dd { margin: 0; }
@media (min-width: 640px) {
  .term-list--wide .term-list__row { grid-template-columns: 12rem minmax(0, 1fr); }
}

/* Timeline: a real sequence from LMP to due date */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
  counter-reset: none;
}
.timeline__step {
  position: relative;
  display: grid;
  gap: var(--space-1);
  padding-left: var(--space-6);
  margin: 0;
}
.timeline__step::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 0.45rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--color-surface);
  border: 3px solid var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-soft);
}
.timeline__step:last-child::before { background: var(--color-accent); }
.timeline__step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(0.4rem + 0.375rem - 1px);
  top: 1.35rem;
  bottom: calc(-1 * var(--space-4) + 0.2rem);
  border-left: 2px solid var(--color-border-strong);
}
.timeline__marker { font-size: var(--text-sm); font-weight: 650; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.timeline__title { font-weight: 700; }
@media (min-width: 760px) {
  .timeline { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); }
  .timeline__step { padding-left: 0; padding-top: var(--space-6); }
  .timeline__step::before { left: 0; top: 0; }
  .timeline__step:not(:last-child)::after {
    left: 1.25rem;
    right: calc(-1 * var(--space-5));
    top: 0.55rem;
    bottom: auto;
    border-left: 0;
    border-top: 2px solid var(--color-border-strong);
  }
}

/* Worked example */
.example {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius);
  background: var(--color-tint);
}
.example > * + * { margin-top: var(--space-2); }
.example__label { font-size: 0.8125rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-muted); }

/* Short list of next-step links */
.plain-links { list-style: none; margin: 0; padding: 0; }
.plain-links li + li { margin-top: 0; }

/* Note / caveat */
.note {
  background: var(--color-note-bg);
  border: 1px solid var(--color-note-border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
}
.note > * + * { margin-top: var(--space-2); }
.note__title { font-weight: 700; }

/* Links with descriptions (tools, guides): cards. The title link covers the whole card, so the
   card is one large target while the link text stays the accessible name. */
.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: var(--space-4);
}
.link-list__item {
  position: relative;
  margin: 0;
  padding: var(--space-5) var(--space-5) var(--space-5);
  padding-right: var(--space-7);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.link-list li + li { margin-top: 0; }
.link-list__item::after {
  content: "";
  position: absolute;
  top: calc(var(--space-5) + 0.35rem);
  right: var(--space-5);
  width: 0.5rem;
  height: 0.5rem;
  border-top: 2px solid var(--color-accent);
  border-right: 2px solid var(--color-accent);
  transform: rotate(45deg);
  transition: transform 0.25s var(--ease);
}
.link-list__item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border)); }
.link-list__item:hover::after { transform: translateX(3px) rotate(45deg); }
.link-list__item:focus-within { border-color: var(--color-accent); }
.link-list__title { font-family: var(--font-display); font-size: var(--text-h3); font-weight: 700; line-height: var(--leading-tight); }
.link-list__title a,
.link-list__title a:visited { color: var(--color-text); text-decoration: none; }
.link-list__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.link-list__title a:hover { color: var(--color-accent); }
.link-list__title a:focus-visible { outline: none; }
.link-list__title a:focus-visible::after { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius); }
.link-list__text { margin-top: var(--space-2); color: var(--color-text-muted); font-size: var(--text-sm); }
/* Home calculators: three cards with an accent cap */
.link-list--tools .link-list__item { border-top: 4px solid var(--color-accent); background: linear-gradient(180deg, var(--color-tint) 0%, var(--color-surface) 55%); }
@media (min-width: 900px) { .link-list--tools { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Article cards (blog hub, home): photo, topic label, title link covering the card, summary */
.article-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: var(--space-5); }
.article-card { position: relative; margin: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease); }
.article-cards li + li { margin-top: 0; }
.article-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border)); }
.article-card:focus-within { border-color: var(--color-accent); }
.article-card__img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: var(--color-surface-muted); }
.article-card__body { padding: var(--space-4) var(--space-5) var(--space-5); }
.article-card__body > * + * { margin-top: var(--space-2); }
.article-card__topic { font-size: var(--text-sm); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-accent); }
.article-card__title { font-family: var(--font-display); font-size: var(--text-h3); font-weight: 700; line-height: var(--leading-tight); }
.article-card__title a, .article-card__title a:visited { color: var(--color-text); text-decoration: none; }
.article-card__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.article-card__title a:hover { color: var(--color-accent); }
.article-card__title a:focus-visible { outline: none; }
.article-card__title a:focus-visible::after { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius); }
.article-card__text { color: var(--color-text-muted); font-size: var(--text-sm); }
.content--wide { max-width: none; }
.content--wide > .section > :not(.article-cards):not(.link-list) { max-width: 48rem; }
.content--home .article-cards { max-width: none; }

/* Article photo below the article header, and the calculator call to action */
.article-figure { margin: var(--space-6) 0 0; }
.article-figure img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); background: var(--color-surface-muted); }
.article-figure figcaption { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); }
.article-cta { margin-top: var(--space-8); }

/* Call to action band */
.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4) var(--space-6);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(90% 140% at 100% 0%, color-mix(in srgb, var(--color-accent-hover) 70%, transparent) 0%, transparent 60%),
    var(--color-accent);
  color: var(--color-accent-contrast);
  box-shadow: var(--shadow-md);
}
.cta__text { flex: 1 1 22rem; min-width: 0; }
.cta__text > * + * { margin-top: var(--space-2); }
.cta__heading { font-size: var(--text-h3); color: var(--color-accent-contrast); }
.cta .button--primary,
.cta .button--primary:visited { background: var(--color-surface); color: var(--color-accent); box-shadow: var(--shadow-md); }
.cta .button--primary:hover { background: var(--color-tint); }
/* Dark theme: the light-accent band would glare on a dark page; use a deep tinted panel with a
   regular primary button instead. */
:root[data-theme="dark"] .cta { background: linear-gradient(135deg, var(--color-tint-strong), var(--color-tint)); border: 1px solid var(--color-border); color: var(--color-text); }
:root[data-theme="dark"] .cta__heading { color: var(--color-text); }
:root[data-theme="dark"] .cta .button--primary,
:root[data-theme="dark"] .cta .button--primary:visited { background: var(--color-accent); color: var(--color-accent-contrast); }
:root[data-theme="dark"] .cta .button--primary:hover { background: var(--color-accent-hover); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cta { background: linear-gradient(135deg, var(--color-tint-strong), var(--color-tint)); border: 1px solid var(--color-border); color: var(--color-text); }
  :root:not([data-theme="light"]) .cta__heading { color: var(--color-text); }
  :root:not([data-theme="light"]) .cta .button--primary,
  :root:not([data-theme="light"]) .cta .button--primary:visited { background: var(--color-accent); color: var(--color-accent-contrast); }
  :root:not([data-theme="light"]) .cta .button--primary:hover { background: var(--color-accent-hover); }
}
.cta--final { padding: var(--space-7) var(--space-6); }
.cta--final .cta__heading { font-size: var(--text-h2); }

/* Card: reserved for one self-contained object per view (e.g. a calculator) */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-5);
}

/* Questions and answers */
.qa { display: grid; gap: var(--space-3); }
.qa__item {
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.qa__item > * + * { margin-top: var(--space-2); }
.qa__question { font-size: var(--text-h3); }
.qa__item p { color: var(--color-text-muted); }

/* Citations */
.cite-group { font-size: 0.72em; line-height: 0; margin-left: 0.1em; }
.cite { font-weight: 600; text-decoration: none; padding: 0 0.1em; }
.cite + .cite::before { content: ","; color: var(--color-text-muted); margin-right: 0.1em; }
.cite:hover { text-decoration: underline; }

.references {
  margin-top: var(--space-8);
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.references__heading { font-size: var(--text-h3); margin-bottom: var(--space-3); }
.references__list { font-size: var(--text-sm); color: var(--color-text-muted); padding-left: 1.5em; }
.references__list li { padding-left: var(--space-1); }
.references__list li:target { background: var(--color-accent-soft); outline: 2px solid var(--color-accent-soft); }
.references__publisher { color: var(--color-text); }

/* Medical disclaimer */
.disclaimer {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-note-border);
  border-radius: var(--radius);
  background: var(--color-note-bg);
  font-size: var(--text-sm);
}
.disclaimer > * + * { margin-top: var(--space-2); }

/* Tables (foundation for later pages) */
.table-wrap {
  overflow-x: auto;
  margin-block: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
caption { padding: var(--space-3) var(--space-4) 0; text-align: left; font-weight: 650; color: var(--color-text-muted); }
th, td { padding: var(--space-3) var(--space-4); text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: top; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
thead th { font-size: 0.8125rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-text-muted); }
th { font-weight: 650; color: var(--color-text); }

/* ---------- 9. Forms foundation (used by the calculators in a later phase) ---------- */
.field { display: grid; gap: var(--space-2); }
.field + .field { margin-top: var(--space-5); }
label, legend { font-weight: 650; }
.hint { font-size: var(--text-sm); color: var(--color-text-muted); }

input, select, textarea, button { font: inherit; }

input[type="date"],
input[type="number"],
input[type="text"],
input[type="email"],
select {
  width: 100%;
  max-width: 22rem;
  min-height: 3.25rem;
  padding: var(--space-2) var(--space-4);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease);
}
input:hover, select:hover { border-color: var(--color-text-muted); }
input:focus, select:focus, textarea:focus { border-color: var(--color-accent); box-shadow: 0 0 0 4px var(--color-accent-soft); }
/* Filled: a valid date or address gets a quiet accent edge */
input[type="date"]:valid, input[type="email"]:not(:placeholder-shown):valid { border-color: color-mix(in srgb, var(--color-accent) 55%, var(--color-border-strong)); }
input[aria-invalid="true"], select[aria-invalid="true"] { border: 2px solid var(--color-error); background: color-mix(in srgb, var(--color-error-bg) 60%, var(--color-surface)); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: var(--space-2); }

/* Segmented choice built from real radio inputs */
.choice { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.choice label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-weight: 550;
  cursor: pointer;
}
.choice input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--color-accent); }
.choice label:has(input:checked) { border: 2px solid var(--color-accent); background: var(--color-accent-soft); }

.field-error {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--color-error-bg);
  color: var(--color-error);
  font-size: var(--text-sm);
  font-weight: 600;
}
.field-error[hidden],
.result[hidden] { display: none; }

/* Contact form (BUILD-LOCK v4.5) */
textarea {
  display: block;
  width: 100%;
  min-height: 10rem;
  padding: var(--space-2) var(--space-3);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  resize: vertical;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
textarea:hover { border-color: var(--color-text-muted); }
.form-card { padding: var(--space-5); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
@media (min-width: 640px) { .form-card { padding: var(--space-7); } }
.form-card input[type="text"], .form-card input[type="email"] { max-width: none; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-form__note { margin-top: var(--space-5); }
.contact-error { margin-top: var(--space-4); }
.contact-error:focus { outline: none; }
.contact-error:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.button[aria-busy="true"] { opacity: 0.75; cursor: progress; }

/* Same-page confirmation after the form is sent */
.contact-success {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--color-accent-soft) 0%, var(--color-surface) 75%);
  animation: contact-rise 0.45s ease-out both;
}
.contact-success[hidden] { display: none; }
.contact-success__icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  box-shadow: 0 0 0 6px var(--color-accent-soft);
  animation: contact-pop 0.5s 0.1s ease-out both;
}
.contact-success__icon path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: contact-check 0.4s 0.4s ease-out forwards; }
.contact-success__title { font-size: var(--text-h2); }
.contact-success__title:focus { outline: none; }
.contact-success__title:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 4px; }
.contact-success__text { max-width: 34rem; color: var(--color-text-muted); }
@keyframes contact-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes contact-pop { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@keyframes contact-check { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .contact-success, .contact-success__icon, .contact-success__icon path { animation: none; }
  .contact-success__icon path { stroke-dashoffset: 0; }
}

/* Page intros (calculators, guides, legal and trust pages): a soft tinted header panel */
.tool-intro {
  margin-top: var(--space-5);
  padding: var(--space-6) var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(100% 120% at 100% 0%, var(--color-tint-strong) 0%, transparent 50%),
    linear-gradient(160deg, var(--color-tint) 0%, var(--color-surface) 70%);
}
.tool-intro > * + * { margin-top: var(--space-3); }
.tool-intro .breadcrumbs + h1 { margin-top: var(--space-4); }
.tool-intro .lead { max-width: 62ch; }
@media (min-width: 640px) { .tool-intro { padding: var(--space-7) var(--space-6); } }
/* Guides: an editorial header with a byline row */
.article-header .meta { display: inline-flex; flex-wrap: wrap; gap: var(--space-2); padding-top: var(--space-2); }

/* The calculator card is the product: raised above the page, with an accent cap */
.tool-layout { max-width: 44rem; margin-top: calc(-1 * var(--space-4)); position: relative; }
.calculator {
  position: relative;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.calculator::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-hover));
}
@media (min-width: 640px) { .calculator { padding: var(--space-7); } }
.calculator__title { font-size: var(--text-h2); margin-bottom: var(--space-5); }
.calculator .field label { font-size: 1.0625rem; }
.calculator input[type="date"] { font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.calculator__actions { margin-top: var(--space-6); }
.calculator__actions .button--primary { min-height: 3.25rem; padding-inline: var(--space-6); }
.calculator__noscript { margin-top: var(--space-4); }

/* Result: a highlighted panel that rises in when shown */
.result {
  margin-top: var(--space-6);
  padding: var(--space-5);
  border: 1px solid var(--color-tint-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--color-tint) 0%, var(--color-surface) 80%);
  animation: result-in 0.4s var(--ease) both;
}
@media (min-width: 640px) { .result { padding: var(--space-6); } }
@keyframes result-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.result > * + * { margin-top: var(--space-3); }
.result__label {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.result__label:focus { outline: none; }
.result__label:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 4px; }
.result__label { color: var(--color-accent); }
.result__value {
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 1.4rem + 2.2vw, 2.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--color-text);
}
.result__equation {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); /* wraps to two lines on narrow phones; a pill would turn oval */
  font-size: var(--text-sm);
}
.result .term-list { padding: var(--space-3) var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.result .term-list__row:first-child { padding-top: var(--space-1); }
.result .note { margin-top: var(--space-4); }

.back-link { margin-top: var(--space-6); }

/* ---------- 10. Footer ---------- */
.site-footer {
  position: relative;
  margin-top: var(--space-8);
  padding-block: var(--space-8) var(--space-6);
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-tint) 100%);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-sm);
}
.site-footer__top { display: grid; gap: var(--space-7); }
@media (min-width: 960px) { .site-footer__top { grid-template-columns: minmax(0, 1fr) minmax(0, 2.6fr); } }
.site-footer__brand > * + * { margin-top: var(--space-3); }
.site-footer__tagline { max-width: 30ch; color: var(--color-text-muted); }
.site-footer__nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr));
  gap: var(--space-6);
}
.site-footer__heading {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}
.site-footer__list { list-style: none; margin: 0; padding: 0; }
.site-footer__list li + li { margin-top: 0; }
.site-footer__list a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem; /* 44px target */
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.site-footer__list a:hover { text-decoration: underline; color: var(--color-accent); }
.site-footer__note {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

/* ---------- 11. Motion and print ---------- */
/* Entrance: the home hero and page intros rise in once, staggered; transform/opacity only (no layout shift). */
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.intro__main > *, .intro .facts, .tool-intro > *, .tool-layout { animation: rise-in 0.6s var(--ease) both; }
.intro__main > :nth-child(2), .tool-intro > :nth-child(2) { animation-delay: 0.05s; }
.intro__main > :nth-child(3), .tool-intro > :nth-child(3) { animation-delay: 0.1s; }
.intro__main > :nth-child(4), .tool-intro > :nth-child(4) { animation-delay: 0.15s; }
.intro__main > :nth-child(n + 5), .tool-intro > :nth-child(n + 5) { animation-delay: 0.2s; }
.intro .facts, .tool-layout { animation-delay: 0.18s; }
@media (prefers-reduced-motion: reduce) {
  .intro__main > *, .intro .facts, .tool-intro > *, .tool-layout, .result, .site-nav { animation: none !important; }
  .button, .link-list__item, .link-list__item::after, .brand__mark, .article-card { transition: none; }
  .button--primary:hover, .link-list__item:hover, .article-card:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  :root {
    --color-bg: #fff; --color-surface: #fff; --color-text: #000; --color-text-muted: #333;
    --color-link: #000; --color-border: #999; --color-accent-soft: #fff;
  }
  .site-header, .site-footer__nav, .skip-link, .button-row, .cta .button, .icon-button { display: none !important; }
  .site-footer { margin-top: 2rem; padding: 0; border: 0; }
  body { font-size: 11pt; }
  a { color: #000; }
  .references__list a::after { content: " (" attr(href) ")"; word-break: break-all; }
  .section, .qa__item, .term-list__row, .timeline__step { break-inside: avoid; }
}
