/* ==========================================================================
   mortgagor.ca — "Ledger" design system
   A modern financial-utility system: tool-first, data-forward, restrained.
   Plain CSS. No preprocessor, no build step. Served from R2 as /assets/site.css.

   01 Tokens          08 Cards
   02 Reset           09 Calculator
   03 Type            10 Data tables
   04 Layout          11 Prose
   05 Buttons         12 FAQ
   06 Header          13 CTA & disclosure
   07 Hero            14 Footer
                      15 Responsive / print
   ========================================================================== */

/* 01 · Tokens -------------------------------------------------------------- */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;

  /* surfaces */
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-sunk: #f1f3f6;
  --surface: #ffffff;

  /* ink */
  --ink: #0b1220;
  --ink-2: #475467;
  --ink-3: #667085;
  --on-dark: #f8fafc;
  --on-dark-2: rgb(248 250 252 / 0.72);

  /* lines */
  --line: #e4e7ec;
  --line-2: #d0d5dd;
  --line-dark: rgb(248 250 252 / 0.14);

  /* brand */
  --brand: #e31e24;
  --brand-dark: #b4131a;
  --brand-ink: #7a0d12;
  --brand-soft: #fef3f2;
  --brand-line: #fecdca;

  /* semantic */
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --ok-line: #abefc6;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --warn-line: #fedf89;

  /* type */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* shape */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgb(11 18 32 / 0.06);
  --shadow: 0 1px 3px rgb(11 18 32 / 0.08), 0 1px 2px rgb(11 18 32 / 0.04);
  --shadow-lg: 0 12px 28px -8px rgb(11 18 32 / 0.14), 0 4px 10px -4px rgb(11 18 32 / 0.06);

  /* metrics */
  --wrap: 1180px;
  --gut: clamp(1rem, 4vw, 2rem);
  --hdr-h: 64px;
  --sec-y: clamp(3rem, 6vw, 5.5rem);

  --ease: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* 02 · Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}
img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; border-spacing: 0; }
[hidden] { display: none !important; }
[id] { scroll-margin-top: calc(var(--hdr-h) + 1.5rem); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand); color: #fff; }

/* 03 · Type ---------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 4.2vw, 3.25rem); font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }
p { text-wrap: pretty; }
strong, b { font-weight: 600; }

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
}
.lede { font-size: clamp(1.0625rem, 1.5vw, 1.1875rem); line-height: 1.6; color: var(--ink-2); max-width: 46rem; }
.muted { color: var(--ink-2); }
.tnum { font-variant-numeric: tabular-nums; }

/* 04 · Layout -------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gut); }
.section { padding-block: var(--sec-y); }
.section--soft { background: var(--bg-soft); border-block: 1px solid var(--line); }
.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }

.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.sec-head h2 { font-size: clamp(1.375rem, 2.4vw, 1.875rem); }
.sec-head p { color: var(--ink-2); font-size: 0.9375rem; max-width: 44rem; margin-top: 0.4rem; }
.sec-head__link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
}
.sec-head__link:hover { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 3px; }

.grid { display: grid; gap: 1rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); }

.stack { display: grid; gap: 1rem; }
.split { display: grid; gap: clamp(1.5rem, 4vw, 3rem); }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .split--wide { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
}

/* 05 · Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  transition: background var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.btn:hover { background: var(--bg-sunk); border-color: var(--ink-3); }
.btn--brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn--dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--dark:hover { background: #1d2939; border-color: #1d2939; color: #fff; }
.btn--sm { padding: 0.5rem 0.875rem; font-size: 0.875rem; }
.btn--lg { padding: 0.9375rem 1.75rem; font-size: 1rem; }
.btn--block { width: 100%; }

/* 06 · Header -------------------------------------------------------------- */
.hdr {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.hdr__in {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: var(--wrap);
  margin-inline: auto;
  padding: 0.5rem var(--gut);
  min-height: var(--hdr-h);
}
.hdr__logo { display: flex; align-items: center; flex: none; }
.hdr__logo img { height: 38px; width: auto; }
.hdr__nav { display: none; }
.hdr__actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.hdr__burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--ink);
}
.hdr__burger:hover { background: var(--bg-sunk); }

@media (min-width: 1000px) {
  .hdr__burger { display: none; }
  .hdr__nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 1rem;
  }
  .hdr__nav a {
    padding: 0.5rem 0.75rem;
    border-radius: var(--r-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--ink-2);
    transition: background var(--ease), color var(--ease);
  }
  .hdr__nav a:hover { background: var(--bg-sunk); color: var(--ink); }
  .hdr__nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
}

/* Mobile nav panel */
.mnav {
  display: none;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.mnav[data-open="true"] { display: block; }
.mnav ul { list-style: none; padding: 0.5rem var(--gut) 1rem; max-width: var(--wrap); margin-inline: auto; }
.mnav li + li { border-top: 1px solid var(--line); }
.mnav a { display: block; padding: 0.875rem 0; font-size: 1rem; font-weight: 500; }
.mnav a:hover { color: var(--brand); }
@media (min-width: 1000px) { .mnav { display: none !important; } }

/* 07 · Hero ---------------------------------------------------------------- */
.hero { padding-block: clamp(2.5rem, 5vw, 4.5rem) clamp(2rem, 4vw, 3.5rem); }
.hero__grid { display: grid; gap: clamp(2rem, 4vw, 3.5rem); }
@media (min-width: 940px) {
  .hero__grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); align-items: center; }
}
.hero h1 { margin-bottom: 1rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.hero__points {
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 0;
  display: grid;
  gap: 0.625rem;
}
.hero__points li { display: flex; gap: 0.625rem; align-items: flex-start; font-size: 0.9375rem; color: var(--ink-2); }
.hero__points svg { flex: none; margin-top: 0.15rem; color: var(--ok); }

/* Stat strip */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}
.stats > div { background: var(--bg); padding: 1.25rem 1rem; text-align: center; }
.stats b { display: block; font-family: var(--font-display); font-size: clamp(1.375rem, 2.4vw, 1.75rem); font-weight: 700; letter-spacing: -0.02em; }
.stats span { display: block; margin-top: 0.25rem; font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }

/* 08 · Cards --------------------------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
}
a.card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-2px); }
.card__tag {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card h3 { font-size: 1.0625rem; font-weight: 600; }
a.card:hover h3 { color: var(--brand); }
.card p { font-size: 0.9375rem; line-height: 1.55; color: var(--ink-2); }

/* Icon tile for tool cards */
.card--tool { position: relative; padding-left: 1.25rem; }
.card--tool::before {
  content: "";
  position: absolute;
  inset: 1.25rem auto 1.25rem 0;
  width: 3px;
  border-radius: var(--r-pill);
  background: var(--brand);
  opacity: 0;
  transition: opacity var(--ease);
}
a.card--tool:hover::before { opacity: 1; }

/* 09 · Calculator ---------------------------------------------------------- */
.calc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 3vw, 1.75rem);
}
.calc--hero { box-shadow: var(--shadow-lg); }
.calc__title {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.calc__title::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
  flex: none;
}
.calc__fields { display: grid; gap: 1rem; }
@media (min-width: 560px) { .calc__fields--2 { grid-template-columns: 1fr 1fr; } }

.fld { display: grid; gap: 0.375rem; }
.fld > label { font-size: 0.8125rem; font-weight: 600; color: var(--ink); }
.fld input, .fld select {
  width: 100%;
  padding: 0.6875rem 0.8125rem;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.fld input:focus, .fld select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.fld .hint { font-size: 0.75rem; color: var(--ink-3); line-height: 1.45; }
.fld select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2398a2b3' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.875rem center; padding-right: 2.25rem; }

.calc__go { margin-top: 1.25rem; }
.calc__out {
  display: none;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.calc__out.is-on { display: block; }
.calc__big {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.calc__big-label { margin-top: 0.25rem; font-size: 0.9375rem; color: var(--ink-2); }
.calc__rows { margin-top: 1.25rem; display: grid; gap: 0; }
.calc__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9375rem;
}
.calc__row:last-child { border-bottom: 0; }
.calc__row > span { color: var(--ink-2); }
.calc__row > strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.calc__note { margin-top: 1rem; font-size: 0.8125rem; line-height: 1.5; color: var(--ink-3); }
.calc__grid2 { display: grid; gap: 1rem; }
@media (min-width: 860px) { .calc__grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

/* Embedded third-party form */
.embed { margin-top: 1.5rem; }
.embed__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.75rem;
}
.embed #lead-scout-form { max-width: 720px; margin-inline: auto; }
.embed button, .embed [role="button"] { border-radius: var(--r-sm) !important; font-family: var(--font) !important; }

/* 10 · Data tables --------------------------------------------------------- */
.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.tbl { width: 100%; font-size: 0.9375rem; }
.tbl th, .tbl td { padding: 0.8125rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.tbl thead th {
  background: var(--bg-soft);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--bg-soft); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td:first-child { font-weight: 500; }

/* Rate cards */
.rates { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); }
.rate {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.rate__label { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.rate__val {
  margin-top: 0.5rem;
  font-family: var(--font-display);
  font-size: 2.125rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.rate__val--sm { font-size: 1.25rem; letter-spacing: -0.01em; }
.rate__sub { margin-top: 0.375rem; font-size: 0.8125rem; line-height: 1.45; color: var(--ink-2); }
.rate__meta { margin-top: 0.75rem; font-size: 0.75rem; color: var(--ink-3); }
.rate__src { margin-top: 0.25rem; font-size: 0.75rem; color: var(--ink-3); }
.rate__src a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.rate__src a:hover { color: var(--brand); }

/* 11 · Prose --------------------------------------------------------------- */
.prose { font-size: 1.0625rem; line-height: 1.75; color: var(--ink); max-width: 68ch; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin-block: 0 1.25em; }
.prose h2 {
  margin-block: 2.5rem 0.875rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: clamp(1.375rem, 2.2vw, 1.625rem);
}
.prose > h2:first-child,
.prose > .cta + h2 { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { margin-block: 1.75rem 0.5rem; font-size: 1.125rem; }
.prose a { color: var(--brand-dark); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { color: var(--brand); }
.prose ul, .prose ol { margin-block: 0 1.25em; padding-left: 1.25rem; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--brand); }
.prose table { width: 100%; margin-block: 1.75rem; font-size: 0.9375rem; border: 1px solid var(--line); border-radius: var(--r); }
.prose th, .prose td { padding: 0.75rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose th { background: var(--bg-soft); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.prose code { padding: 0.125em 0.375em; background: var(--bg-sunk); border-radius: 4px; font-family: var(--mono); font-size: 0.875em; }
.prose blockquote {
  margin-block: 2rem;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 1rem;
  color: var(--ink-2);
}
.prose blockquote p { margin: 0; }

/* Article shell */
.art { padding-block: clamp(1.5rem, 3vw, 2.5rem) clamp(2.5rem, 5vw, 4rem); }
.art__head { max-width: 52rem; padding-bottom: clamp(1.5rem, 3vw, 2rem); border-bottom: 1px solid var(--line); }
.art__head h1 { font-size: clamp(1.875rem, 4vw, 2.75rem); }
.art__head .lede { margin-top: 1rem; }
.art__body { display: grid; gap: clamp(2rem, 4vw, 3rem); margin-top: clamp(2rem, 3.5vw, 3rem); }
@media (min-width: 1020px) {
  .art__body { grid-template-columns: minmax(0, 1fr) 17rem; align-items: start; }
}
.byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--ink-2);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: var(--bg-sunk);
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-2);
}
.chip--brand { background: var(--brand-soft); color: var(--brand-ink); }

/* Breadcrumbs */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.5rem;
  padding-block: 1rem;
  font-size: 0.8125rem;
  color: var(--ink-3);
}
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.crumbs span[aria-hidden] { color: var(--line-2); }

/* ToC */
.toc {
  padding: 1.25rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
@media (min-width: 1020px) { .toc { position: sticky; top: calc(var(--hdr-h) + 1rem); } }
.toc h2 { font-family: var(--font); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.75rem; }
.toc ul { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.toc a { font-size: 0.875rem; line-height: 1.45; color: var(--ink-2); }
.toc a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

/* 12 · FAQ ----------------------------------------------------------------- */
.faq { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.faq > h2 { margin-bottom: 1rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.125rem 0;
  font-size: 1.0625rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 10px; height: 10px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--ease);
}
.faq details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.faq summary:hover { color: var(--brand); }
.faq summary:hover::after { border-color: var(--brand); }
.faq .ans { padding-bottom: 1.25rem; font-size: 0.9375rem; line-height: 1.7; color: var(--ink-2); max-width: 68ch; }

/* Sources */
.srcs { margin-top: clamp(2.5rem, 5vw, 3.5rem); padding-top: 1.5rem; border-top: 1px solid var(--line); }
.srcs h2 { font-size: 1.125rem; margin-bottom: 0.875rem; }
.srcs ol { list-style: none; padding: 0; display: grid; gap: 0.625rem; font-size: 0.875rem; }
.srcs li { padding-left: 1.5rem; position: relative; color: var(--ink-2); line-height: 1.5; }
.srcs li::before {
  content: counter(list-item);
  position: absolute;
  left: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand);
}
.srcs a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.srcs a:hover { color: var(--brand); }

/* 13 · CTA & disclosure ---------------------------------------------------- */
.cta {
  margin-block: clamp(2rem, 4vw, 3rem);
  padding: clamp(1.5rem, 3.5vw, 2.25rem);
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: var(--r-lg);
  color: #fff;
}
.cta h3 { font-size: clamp(1.125rem, 2vw, 1.375rem); color: #fff; }
.cta p { margin-top: 0.5rem; font-size: 0.9375rem; color: rgb(255 255 255 / 0.92); max-width: 46rem; }
.cta .btn { margin-top: 1.25rem; }
.cta__note { margin-top: 1rem; font-size: 0.75rem; line-height: 1.5; color: rgb(255 255 255 / 0.8); }

.disc {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
  border-radius: var(--r);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--ink-2);
}
.disc strong { color: inherit; }

.trust { display: grid; gap: 1rem; max-width: 54rem; }
.trust p { font-size: 1rem; line-height: 1.7; color: var(--ink-2); }

/* 14 · Footer -------------------------------------------------------------- */
.ftr { margin-top: var(--sec-y); background: var(--ink); color: var(--on-dark); }
.ftr__in { max-width: var(--wrap); margin-inline: auto; padding: clamp(2.5rem, 5vw, 3.5rem) var(--gut) 1.5rem; }
.ftr__cols { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); }
.ftr h4 { font-family: var(--font); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.875rem; }
.ftr ul { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.ftr a { font-size: 0.9375rem; color: var(--on-dark-2); }
.ftr a:hover { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.ftr__bottom {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-dark);
  display: grid;
  gap: 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--on-dark-2);
}
.ftr__bottom a { color: var(--on-dark-2); text-decoration: underline; text-underline-offset: 2px; }
.ftr__bottom a:hover { color: #fff; }

/* 15 · Utilities / misc ---------------------------------------------------- */
.skip {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: #fff;
  border-radius: 0 0 var(--r-sm) 0;
}
.skip:focus { left: 0; top: 0; }

.pill-list { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); }
.pill-list a {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.75rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: border-color var(--ease), color var(--ease);
}
.pill-list a:hover { border-color: var(--brand); color: var(--brand); }
.pill-list a small { font-weight: 400; font-size: 0.8125rem; color: var(--ink-3); }

.subhead {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 1.75rem 0 0.75rem;
}
.subhead:first-child { margin-top: 0; }

.prov-grid { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); }
.prov-grid a {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: border-color var(--ease), background var(--ease), color var(--ease);
}
.prov-grid a:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.prov-grid a small { font-weight: 400; font-size: 0.75rem; color: var(--ink-3); }

.city-grid { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(min(11rem, 100%), 1fr)); }
.city-grid a {
  display: block;
  padding: 0.625rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color var(--ease), color var(--ease);
}
.city-grid a:hover { border-color: var(--brand); color: var(--brand); }
.city-grid a small { display: block; font-weight: 400; font-size: 0.75rem; color: var(--ink-3); }

.az { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.az a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding-inline: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: border-color var(--ease), background var(--ease), color var(--ease);
}
.az a:hover { border-color: var(--brand); background: var(--brand); color: #fff; }

.def-list { list-style: none; padding: 0; display: grid; gap: 0; }
.def-list li { border-top: 1px solid var(--line); }
.def-list li:last-child { border-bottom: 1px solid var(--line); }
.def-list a { display: block; padding: 0.875rem 0; }
.def-list a:hover strong { color: var(--brand); }
.def-list strong { font-weight: 600; }
.def-list span { color: var(--ink-2); font-size: 0.9375rem; }

/* Search results */
.sr-group + .sr-group { margin-top: 2rem; }
.sr-group h2 { font-size: 1.125rem; margin-bottom: 0.75rem; }
.sr-status { font-size: 0.9375rem; color: var(--ink-2); }

/* 16 · Responsive & print -------------------------------------------------- */
@media (max-width: 600px) {
  .calc__big { font-size: 2rem; }
  .rate__val { font-size: 1.75rem; }
  .stats > div { padding: 1rem 0.5rem; }
}

@media print {
  :root { --bg: #fff; --bg-soft: #fff; --line: #ccc; --ink: #000; --ink-2: #333; --brand: #000; }
  .hdr, .ftr, .cta, .toc, .embed, .skip, .calc__go, .disc { display: none !important; }
  .art__body { grid-template-columns: 1fr; }
  .prose { max-width: none; font-size: 11pt; }
  a { color: #000; text-decoration: none; }
  .faq details > * { display: block !important; }
  .prose h2 { break-after: avoid; }
  .faq details, .prose table, .rate { break-inside: avoid; }
}

/* ==========================================================================
   17 · Calculator fragment compatibility
   The calculator fragments stored in D1 (tools.body_html) were authored against
   an earlier class vocabulary. These aliases let them render correctly in the
   new system without rewriting 31 stored fragments.
   ========================================================================== */

.tool > h2 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); margin: 2.25rem 0 0.75rem; }
.tool > h2:first-child { margin-top: 0; }
.tool > h3 { font-size: 1.0625rem; margin: 1.5rem 0 0.5rem; }
.tool > p { margin: 0 0 1rem; line-height: 1.7; color: var(--ink-2); max-width: 68ch; }
.tool > ul, .tool > ol { margin: 0 0 1.25rem; padding-left: 1.25rem; color: var(--ink-2); }
.tool > ul li, .tool > ol li { margin-bottom: 0.4rem; line-height: 1.6; }
.tool > .tbl-wrap, .tool > .table-wrap { margin: 1.25rem 0; }

/* old calculator vocabulary */
.calc__grid { display: grid; gap: 1rem; }
@media (min-width: 560px) { .calc__grid { grid-template-columns: 1fr 1fr; } }
.calc__field { display: grid; gap: 0.375rem; margin-bottom: 1rem; }
.calc__field > label { font-size: 0.8125rem; font-weight: 600; color: var(--ink); }
.calc__field input, .calc__field select {
  width: 100%;
  padding: 0.6875rem 0.8125rem;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.calc__field input:focus, .calc__field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.calc__field .hint { font-size: 0.75rem; color: var(--ink-3); line-height: 1.45; }
.calc__btn {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.8125rem 1.25rem;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--r-sm);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background var(--ease), border-color var(--ease);
}
.calc__btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.calc__out { display: none; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.calc__out.show, .calc__out.is-on { display: block; }
.calc__hero-num {
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 4.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.calc__hero-label { margin-top: 0.25rem; font-size: 0.9375rem; color: var(--ink-2); }
.calc__metric, .calc__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9375rem;
}
.calc__row:last-child, .calc__metric:last-child { border-bottom: 0; }
.calc__row > span, .calc__metric > span { color: var(--ink-2); }
.calc__row > strong, .calc__metric > strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.calc__metric strong { text-align: right; }
.calc__note { margin-top: 1rem; font-size: 0.8125rem; line-height: 1.5; color: var(--ink-3); }
.calc__note a { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }

/* old table vocabulary used inside fragments */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  margin: 1.25rem 0;
}
.data-table { width: 100%; font-size: 0.9375rem; }
.data-table th, .data-table td { padding: 0.75rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.data-table thead th {
  background: var(--bg-soft);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg-soft); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* verdict / chip helpers used by a few fragments */
.verdict { padding: 0.875rem 1rem; border-radius: var(--r-sm); font-weight: 600; margin-bottom: 1rem; font-size: 0.9375rem; }
.verdict.ok { background: var(--ok-soft); border: 1px solid var(--ok-line); color: var(--ok); }
.verdict.warn { background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn); }
.verdict.bad { background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--brand-ink); }
.big-num { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.metric { display: flex; justify-content: space-between; gap: 1rem; padding: 0.625rem 0; border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.metric span:first-child { color: var(--ink-2); }
.metric strong { text-align: right; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; gap: 1rem; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.result { display: none; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.result.show { display: block; }
.field { display: grid; gap: 0.375rem; margin-bottom: 1rem; }
.field label { font-size: 0.8125rem; font-weight: 600; }
.field input, .field select {
  width: 100%; padding: 0.6875rem 0.8125rem;
  background: var(--bg); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); font-size: 1rem;
}
.field .hint { font-size: 0.75rem; color: var(--ink-3); }

/* Header burger icon states */
.hdr__burger .i-close { display: none; }
.hdr__burger[data-open="true"] .i-burger { display: none; }
.hdr__burger[data-open="true"] .i-close { display: block; }
.hdr__burger[data-open="true"] { background: var(--bg-sunk); }
