/* ==========================================================================
   BASE – fonts, tokens, layout, header, footer, forms base, cards
   Calculator chrome lives in calculators.css (calculator pages load it via $extra_css)
   fonts.css + tokens.css merged here (fewer HTTP requests on every page)
   ========================================================================== */

/* Self-hosted fonts */

/* Body — Inter (readable). WOFF2 first (smallest); WOFF/TTF fallback.
   Metric overrides keep system-ui fallback close so font-display:swap
   does not shift calc-hero .lead / body text (CLS / LCP). */
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter/Inter-Variable.woff2") format("woff2"),
       url("/assets/fonts/Inter/Inter-Variable.woff") format("woff"),
       url("/assets/fonts/Inter/Inter-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  size-adjust: 107%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}

/* Headings — Plus Jakarta Sans (premium)
   Metric overrides keep fallback (system-ui) close to the real face so
   font-display:swap does not shift the large calc-hero H1 (CLS). */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/assets/fonts/plus-jakarta-sans/PlusJakartaSans-Variable.woff2") format("woff2"),
       url("/assets/fonts/plus-jakarta-sans/PlusJakartaSans-Variable.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  size-adjust: 100%;
  ascent-override: 95%;
  descent-override: 20%;
  line-gap-override: 0%;
}

/* ==========================================================================
   DESIGN TOKENS  (single source of truth: components never hardcode values)
   Light theme only. To add dark mode later, add ONE block at the bottom that
   redefines the colour tokens under :root[data-theme="dark"].
   ========================================================================== */
:root {
  /* ---- Brand + neutrals (from the brief) ---- */
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;

  --accent: #4F46E5;          /* primary buttons (white text), links, icons, active */
  --accent-strong: #4338CA;   /* hover / pressed */
  --accent-soft: #EEF2FF;     /* chips, icon backgrounds, result tint */
  --accent-ink: #3730A3;      /* text on --accent-soft */

  --success: #15803D;
  --warning: #B45309;
  --error: #B91C1C;

  /* ---- Supporting tokens (derived, still niche-neutral) ---- */
  --on-accent: #FFFFFF;
  --text-soft: #475569;       /* small text on tinted backgrounds (AA on --bg / --accent-soft) */
  --accent-border: #C7D2FE;
  --error-soft: #FEF2F2;
  --success-soft: #F0FDF4;
  --warning-soft: #FFFBEB;
  --overlay: rgba(15, 23, 42, .45);
  --ad-border: #CBD5E1;

  /* ---- Spacing scale (4px base) ---- */
  --space-1: 4px;   --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
  --space-5: 20px;  --space-6: 24px;  --space-8: 32px;  --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-20: 80px;

  /* ---- Type scale (Plus Jakarta Sans, local) ---- */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
  --fs-xs: .75rem;    /* 12 */
  --fs-sm: .875rem;   /* 14 */
  --fs-md: 1rem;      /* 16 */
  --fs-lg: 1.125rem;  /* 18 */
  --fs-xl: 1.25rem;   /* 20 */
  --fs-2xl: 1.5rem;   /* 24 */
  --fs-3xl: 1.875rem; /* 30 */
  --fs-4xl: 2.5rem;   /* 40 */
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;

  /* ---- Radius ---- */
  --radius-sm: 8px;
  --radius-md: 12px;   /* "rounded-xl" cards, inputs, buttons */
  --radius-lg: 16px;   /* hero, result card */
  --radius-full: 999px;

  /* ---- Shadows (soft) ---- */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 6px 18px -6px rgba(15, 23, 42, .12), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 18px 40px -14px rgba(15, 23, 42, .20);

  /* ---- Premium layer tokens (derived from the brand color) ---- */
  --shadow-accent: 0 10px 22px -10px rgb(79 70 229 / .55);
  --shadow-inset: inset 0 1px 2px rgb(15 23 42 / .05);
  --shadow-card-hover: 0 18px 36px -18px rgb(15 23 42 / .22), 0 4px 10px -6px rgb(79 70 229 / .18);
  --glass: color-mix(in srgb, var(--surface) 84%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-dot: color-mix(in srgb, var(--accent) 22%, transparent);
  --grad-accent: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);

  /* ---- Layout ---- */
  --container: 1200px;
  --header-h: 64px;
  --bottom-nav-h: 64px;
  --tap: 44px;               /* minimum touch target */
  --ease: 160ms ease;

  /* ---- Ad slot sizes (fixed => zero layout shift) ---- */
  --ad-leaderboard-h: 100px; /* 320x100 mobile */
  --ad-rect-h: 280px;        /* 336x280 mobile */
  --ad-sidebar-h: 250px;     /* 300x250 (use size="sidebar-tall" for 300x600) */
}
@media (min-width: 768px) {
  :root {
    --ad-leaderboard-h: 90px; /* 728x90 desktop */
    --ad-rect-h: 250px;       /* 300x250 desktop */
  }
}

/* ---- Dark mode (NOT enabled; add later by filling this block) ----
:root[data-theme="dark"] {
  --bg:#0B1120; --surface:#111827; --text:#F1F5F9; --text-muted:#94A3B8; --border:#1F2937;
  --accent:#818CF8; --accent-strong:#A5B4FC; --accent-soft:#1E1B4B; --accent-ink:#C7D2FE;
  --on-accent:#0B1120; ...
}
-------------------------------------------------------------------- */

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: var(--fw-regular);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* Headings use display family; body stays Inter */
h1, h2, h3, h4, h5, h6,
.brand,
.calc-hero h1,
.sec__head h2,
.calc__head h2,
.btn--primary {
  font-family: var(--font-display);
}


img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.02em; }
p { margin: 0 0 var(--space-4); color: var(--text-soft); }
p:last-child { margin-bottom: 0; }

.sr-only, .sr-only-sm {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
@media (min-width: 640px) {
  .sr-only-sm { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; }
}

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
@media (min-width: 768px) {
  .container { padding-inline: var(--space-6); }
}

.layout {
  display: grid;
  gap: var(--space-8);
  padding-block: var(--space-6) var(--space-12);
}
@media (min-width: 1024px) {
  .layout {
    grid-template-columns: 1fr 280px;
    align-items: start;
  }
}

/* ---- Icons ---- */
.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}
.icon.sm { width: 1rem; height: 1rem; }
.icon.lg { width: 1.5rem; height: 1.5rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  transition: background var(--ease), color var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
  /* solid fill — avoids gradient→solid hover blink */
}
.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--accent-strong); /* #4338CA */
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
}
.btn--primary:active {
  background: var(--accent-strong);
  color: var(--on-accent);
}
.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--ghost:hover { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-ink); }
.btn--lg { min-height: 52px; padding-inline: var(--space-6); font-size: var(--fs-lg); }
.btn--sm { min-height: 36px; padding-inline: var(--space-3); font-size: var(--fs-sm); }
.btn--icon { width: var(--tap); padding: 0; }

/* ---- Header (matches design sample) ---- */
.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 200;
  background: var(--text);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
}
.skip:focus { left: 16px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  text-decoration: none !important;
  min-height: var(--tap);
  flex-shrink: 0;
}
.brand:hover { color: var(--text); }
.brand__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--grad-accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent), inset 0 1px 0 rgb(255 255 255 / .25);
}
.brand__mark .icon { width: 20px; height: 20px; }

.header__search {
  display: none;
  flex: 1;
  max-width: 520px;
  margin-left: var(--space-4);
}
.header__nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
#menu-btn { display: none; }
@media (min-width: 768px) {
  .header__search { display: block; }
  .nav-toggle { display: none; }
}
@media (min-width: 1024px) {
  #menu-btn { display: inline-flex; }
}

/* Search (design sample) */
.search { position: relative; width: 100%; }
.search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
  pointer-events: none;
  display: flex;
}
.search__input {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-4) 0 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  font-size: var(--fs-md);
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.search__input::placeholder { color: var(--text-soft); opacity: 1; }
.search__input:focus {
  background: var(--surface);
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search__list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 70;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  max-height: min(420px, 70vh);
  overflow: auto;
  padding: var(--space-2);
  margin: 0;
  list-style: none;
}
.search__list[hidden] { display: none !important; }
.search__opt {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: var(--tap);
}
.search__opt .chip-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.search__opt .chip-icon .icon { width: 18px; height: 18px; }
.search__opt strong {
  display: block;
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  font-size: var(--fs-sm);
}
.search__opt small {
  display: block;
  color: var(--text-soft);
  font-size: var(--fs-xs);
}
.search__opt:hover,
.search__opt[aria-selected="true"] {
  background: var(--accent-soft);
}
.search__empty {
  padding: var(--space-4);
  color: var(--text-soft);
  font-size: var(--fs-sm);
}
.search__label {
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Mega menu */
.mega {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--surface);
  overflow-y: auto;
}
.mega[hidden] { display: none !important; }
.mega__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.mega__inner { padding: var(--space-4); }
.mega__grid {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: 1fr;
}
.mega__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none !important;
}
.mega__link:hover { background: var(--accent-soft); color: var(--accent-ink); }
.mega__link strong { display: block; font-size: var(--fs-sm); }
.mega__link small { color: var(--text-muted); font-size: var(--fs-xs); }
@media (min-width: 1024px) {
  .mega {
    inset: auto;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: auto;
    max-height: calc(100vh - var(--header-h));
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
  .mega__bar { display: none; }
  .mega__inner {
    max-width: var(--container);
    margin-inline: auto;
    padding: var(--space-6);
  }
  .mega__grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
}

/* Mobile nav */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--surface);
  padding: var(--space-4);
  overflow-y: auto;
}
.mobile-nav[hidden] { display: none !important; }
.mobile-nav__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}
.mobile-nav nav { display: flex; flex-direction: column; gap: var(--space-1); }
.mobile-nav a {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text);
  font-weight: var(--fw-medium);
}
.mobile-nav a:hover { background: var(--accent-soft); color: var(--accent-ink); }

/* ---- Breadcrumbs ---- */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-4) 0 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.crumbs a { color: var(--text-muted); display: inline-flex; align-items: center; gap: 2px; }
.crumbs a:hover { color: var(--accent); }
.crumbs li { display: inline-flex; align-items: center; gap: var(--space-1); }
.crumbs [aria-current] { color: var(--text); font-weight: var(--fw-medium); }

/* ---- Page head ---- */
.page-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin: var(--space-4) 0 var(--space-6);
}
.page-head h1 {
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  font-weight: var(--fw-bold);
  color: var(--text);
}
.page-head .lead {
  margin-top: var(--space-2);
  font-size: var(--fs-lg);
  color: var(--text-soft);
}
.page-head #save-btn {
  flex-shrink: 0;
  margin-top: 4px;
}
.page-head #save-btn.is-saved {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}
.chip-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: linear-gradient(150deg, var(--accent-soft), var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent-border);
  color: var(--accent);
  flex-shrink: 0;
  transition: background var(--ease), color var(--ease), box-shadow var(--ease);
}
.chip-icon .icon { width: 24px; height: 24px; }
.page-head .chip-icon { width: 56px; height: 56px; border-radius: 16px; }

/* Jump chips (category sections) */
.chip {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: background var(--ease), border-color var(--ease), color var(--ease);
  text-decoration: none !important;
  white-space: nowrap;
}
.chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-ink);
}
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.jump {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  margin: 0 calc(var(--space-4) * -1) var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--bg);
}
@media (min-width: 768px) {
  .jump { margin-inline: calc(var(--space-6) * -1); padding-inline: var(--space-6); }
}
.jump__row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: 2px;
}
.jump__row::-webkit-scrollbar { display: none; }
.jump .chip { flex: none; }
.jump .chip[aria-current="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-ink);
}

/* Category section blocks */
.group {
  margin-top: var(--space-10);
  scroll-margin-top: calc(var(--header-h) + var(--space-12));
}
.group:first-of-type { margin-top: var(--space-4); }
.group__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.group__title h2 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.group__title p {
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: 1.4;
  margin: 0;
}
@media (max-width: 480px) {
  .group__title p { display: none; }
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.form-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
}
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field[hidden] { display: none !important; }
.field--wide { grid-column: 1 / -1; }
.field label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text);
}
.field label .optional {
  font-weight: var(--fw-normal);
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
/* Single control: [ number input          [ft ▾] ]  or  [ number  | % ] */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 4px 4px 4px 0;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-inset);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input-wrap.is-invalid {
  border-color: var(--error);
  background: var(--error-soft);
}

/* Number input – no own border, fills left side */
.field .input-wrap input[type="text"],
.field .input-wrap input[type="email"],
.field .input-wrap input[type="number"] {
  display: block;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 0 var(--space-3) 0 var(--space-4);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-variant-numeric: tabular-nums;
}
.field .input-wrap input:focus {
  outline: none;
  box-shadow: none;
}

/* Full-width selects (mix ratio) */
.field > select {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-inset);
  appearance: auto;
}
.field > select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Fixed % suffix */
.suffix {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 40px;
  margin-right: 2px;
  padding: 0 var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  pointer-events: none;
}
.prefix {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 40px;
  margin-left: 2px;
  padding: 0 var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  pointer-events: none;
}

/* ---- Custom unit select (matches design sample) ---- */
.cselect {
  position: relative;
  flex: 0 0 auto;
}
.cselect__native {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
/* Pill button inside the input */
.cselect__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 3.25rem;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease), color var(--ease), box-shadow var(--ease);
}
.cselect__btn:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.cselect.open .cselect__btn,
.cselect__btn[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--accent-ink);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.cselect__btn .icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}
.cselect.open .cselect__btn .icon {
  transform: rotate(180deg);
}
/* Popup list */
.cselect__list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 100%;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}
.cselect__list[hidden] { display: none !important; }
.cselect__opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text);
  cursor: pointer;
}
.cselect__opt:hover,
.cselect__opt.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.cselect__opt[aria-selected="true"] {
  color: var(--accent-ink);
  font-weight: var(--fw-semibold);
}
.cselect__opt .icon { width: 14px; height: 14px; opacity: 0; }
.cselect__opt[aria-selected="true"] .icon { opacity: 1; color: var(--accent); }

.err {
  min-height: 1.25em;
  font-size: var(--fs-sm);
  color: var(--error);
  margin: 0;
}


.form-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
  margin-top: var(--space-6);
}
.form-actions .btn--primary {
  width: 100%;
}
.form-actions .btn--ghost.reset {
  align-self: center;
  border: 0;
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}
.form-actions .btn--ghost.reset:hover {
  color: var(--accent);
  background: transparent;
}

/* ---- Ad slots (hidden by default until ADS_ENABLED) ---- */
/* Ad placeholders always visible; live ads later via ADS_ENABLED */
.ad {
  display: block;
  margin: var(--space-6) 0;
}
.ad--leaderboard {
  margin: var(--space-4) 0 var(--space-2);
}
.ad__label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
  text-align: center;
}
.ad__box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 1px dashed var(--ad-border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
.ad--leaderboard .ad__box { min-height: var(--ad-leaderboard-h); }
.ad--rectangle .ad__box { min-height: var(--ad-rect-h); max-width: 336px; margin-inline: auto; }
.ad--sidebar .ad__box,
.ad--sidebar-tall .ad__box { min-height: var(--ad-sidebar-h); }
.ad--article .ad__box { min-height: 120px; }

/* ---- Sidebar ---- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
@media (min-width: 1024px) {
  .layout > .sidebar {
    position: sticky;
    top: calc(var(--header-h) + 72px);
    align-self: start;
  }
}
.side-card { padding: var(--space-5); }
.side-card h2 {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}
.side-card a {
  display: block;
  padding: var(--space-2) 0;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border-bottom: 1px solid var(--border);
}
.side-card a:last-child { border-bottom: 0; }
.side-card a:hover { color: var(--accent); }

/* ---- Home hero ---- */
.hero {
  position: relative;
  /* visible so search dropdown can overlap content below */
  overflow: visible;
  z-index: 20;
  background:
    radial-gradient(900px 420px at 88% -10%, var(--accent-glow), transparent 70%),
    linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding-block: var(--space-12) var(--space-16);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(var(--accent-dot) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 85%);
  mask-image: linear-gradient(to bottom, black, transparent 85%);
  pointer-events: none;
}
.hero .container,
.hero__grid { position: relative; z-index: 1; }
.hero__grid {
  display: grid;
  gap: var(--space-10);
  align-items: center;
}
.hero h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  max-width: 17ch;
  color: var(--accent-ink);
  font-weight: var(--fw-bold);
}
.hero .lead {
  max-width: 52ch;
  margin-top: var(--space-4);
  color: var(--text-soft);
  font-size: var(--fs-lg);
}
.hero .search {
  position: relative;
  z-index: 30;
  margin-top: var(--space-6);
  max-width: 640px;
}
.hero .search__list { z-index: 80; }
.hero .search--lg .search__input {
  height: 60px;
  border-radius: 16px;
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
  padding-left: 50px;
  background: var(--surface);
}
.hero .search--lg .search__icon { left: 18px; color: var(--accent); }
.hero .search--lg .search__input:focus {
  box-shadow: 0 0 0 4px var(--accent-glow), var(--shadow-md);
}
.hero .chips { margin-top: var(--space-4); }
.hero__label {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  margin-top: var(--space-5);
  margin-bottom: 0;
}
.trust {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-6);
  font-size: var(--fs-sm);
  color: var(--text-soft);
  font-weight: var(--fw-medium);
  list-style: none;
  padding: 0;
}
.trust li { display: flex; align-items: center; gap: 6px; }
.trust .icon { color: var(--accent); }

.hero-card { display: none; }
@media (min-width: 1024px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: var(--space-16);
  }
  .hero { padding-block: var(--space-16) var(--space-20); }
  .hero-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-6);
    background: var(--surface);
    border: 1px solid var(--accent-border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    color: var(--text);
    text-decoration: none !important;
    transform: rotate(1.2deg);
    transition: transform var(--ease), box-shadow var(--ease);
  }
  .hero-card:hover {
    transform: rotate(0) translateY(-3px);
    color: var(--text);
  }
}
.hero-card__top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.hero-card__top strong { display: block; line-height: 1.25; }
.hero-card__top small { color: var(--text-soft); font-size: var(--fs-xs); }
.hero-card dl { display: grid; gap: var(--space-2); margin: 0; }
.hero-card dl > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--bg);
  border-radius: 12px;
}
.hero-card dl > div.is-main {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}
.hero-card dt { font-size: var(--fs-sm); color: var(--text-soft); }
.hero-card dd {
  margin: 0;
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hero-card dd span {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-soft);
}
.hero-card .is-main dd {
  font-size: var(--fs-2xl);
  color: var(--accent-ink);
}
.hero-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--accent);
}
.hero-card:hover .chip-icon {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
}

/* Home body sections */
.home-body {
  position: relative;
  z-index: 1;
  padding-bottom: var(--space-16);
}
.cat-block { margin-top: var(--space-10); }
.section { margin-block: var(--space-10); }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.section__head h2 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
}
.group__more {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--tap);
  padding-left: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  color: var(--accent);
  text-decoration: none !important;
}
.group__more:hover { color: var(--accent-strong); }
.group__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

/* Blog post cards */
.post-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none !important;
  transition: box-shadow var(--ease), border-color var(--ease), transform var(--ease);
}
.post-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--accent-border);
  color: var(--text);
  transform: translateY(-2px);
}
.post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--text-soft);
}
.tag {
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: var(--fw-semibold);
}
.post-card h3 {
  font-size: var(--fs-lg);
  line-height: 1.35;
  font-weight: var(--fw-semibold);
}
.post-card p {
  color: var(--text-soft);
  font-size: var(--fs-sm);
  margin: 0;
}
.post-card .tile__meta {
  margin-top: auto;
  padding-top: var(--space-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--accent);
}

/* ---- Related / grid ---- */
.related { margin-top: var(--space-10); }
.related h2 { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); margin-bottom: var(--space-4); }
.seo .grid {
  margin-top: var(--space-4);
  margin-bottom: var(--space-6);
}
.grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}
.calc-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none !important;
  transition: box-shadow var(--ease), border-color var(--ease), transform var(--ease);
}
.calc-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-card-hover);
  color: var(--text);
  transform: translateY(-2px);
}
.calc-card:hover .chip-icon {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
}
.calc-card:hover .chev {
  color: var(--accent);
  transform: translateX(3px);
}
.calc-card strong { display: block; font-size: var(--fs-sm); }
.calc-card small { display: block; color: var(--text-muted); font-size: var(--fs-xs); }
.calc-card .chev {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform var(--ease), color var(--ease);
}
.mega__link:hover .chip-icon {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
}



/* ---- SEO / prose / FAQ ---- */
.seo { margin-top: var(--space-12); }
.prose h2 { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); margin: var(--space-8) 0 var(--space-3); }
.prose h3 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin: var(--space-6) 0 var(--space-2); }
.prose p { margin-bottom: var(--space-4); }
.prose ol, .prose ul { margin: 0 0 var(--space-4); padding-left: var(--space-6); }
.prose li { margin-bottom: var(--space-2); }
.prose a { color: var(--accent); }
.prose a:hover { text-decoration: underline; }

/* ---- Footer (design sample) ---- */
.site-footer {
  margin-top: var(--space-16);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: var(--space-10);
  position: relative;
}
.site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}
.footer__grid {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .footer__grid { grid-template-columns: 2fr 3fr 1fr; }
}
.site-footer .brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  text-decoration: none !important;
}
.site-footer .brand:hover { color: var(--text); }
.site-footer h2 {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin-bottom: var(--space-3);
  font-weight: var(--fw-semibold);
}
.site-footer ul {
  display: grid;
  gap: 0 var(--space-6);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  list-style: none;
  padding: 0;
  margin: 0;
}
.site-footer ul.footer__company {
  grid-template-columns: 1fr;
}
.site-footer li a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-size: var(--fs-sm);
  color: var(--text);
  text-decoration: none !important;
}
.site-footer li a:hover { color: var(--accent); }
.footer__blurb {
  margin-top: var(--space-3);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  max-width: 44ch;
  line-height: 1.5;
}
.footer__copy {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-soft);
}

/* ---- Disclaimer ---- */
.disclaimer,
.disclaimer--warn {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 20px;
  margin: var(--space-4) 0 var(--space-6);
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: #78350F;
}
.disclaimer .icon,
.disclaimer--warn .icon {
  color: #B45309;
  margin-top: 2px;
  flex-shrink: 0;
}
.disclaimer p,
.disclaimer--warn p {
  margin: 0;
}

/* ---- Print ---- */
@media print {
  .site-header, .sidebar, .form-actions, .mobile-nav, .header-search { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .result { break-inside: avoid; }
}
.print-only { display: none; }
@media print {
  .print-only { display: block; }
}
