/* ---- tokens.css ---- */
/* ==========================================================================
   MyPersonalCalculator.com — Design Tokens
   Signature concept: the "readout" — every result renders inside a dark
   instrument panel with warm amber tabular-monospace numerals, echoing a
   real calculator's LED/VFD display. Used in the hero, in every
   calculator's result card, and for key stats across the site.
   ========================================================================== */

:root {
  /* ---- Color: light mode (default) ---- */
  --ink-950: #10192e;
  --ink-900: #16223d;
  --ink-800: #1e2c4d;
  --ink-700: #2b3c63;

  --paper-0: #f8f7f2;
  --paper-50: #f1eee3;
  --paper-100: #e9e4d5;
  --paper-200: #dad3be;

  --line: #e1ddce;
  --line-strong: #cfc9b6;

  --text-primary: var(--ink-950);
  --text-secondary: #4b5169;
  --text-muted: #7c8098;
  --text-on-ink: #edeff6;
  --text-on-ink-muted: #9096b3;

  --surface: var(--paper-0);
  --surface-raised: #ffffff;
  --surface-sunken: var(--paper-50);
  --surface-ink: var(--ink-950);
  --surface-ink-raised: var(--ink-900);

  /* Primary interactive accent: precision blue — links, buttons, focus */
  --accent-500: #2f5fd6;
  --accent-400: #4c76e2;
  --accent-300: #8ba3ec;
  --accent-glow: rgba(47, 95, 214, 0.28);

  /* Signature accent: warm amber — reserved for the readout's own numerals,
     styled after a real calculator's LED/VFD display. Never used for
     ordinary UI so it keeps its meaning. */
  --amber-500: #e3a73c;
  --amber-400: #edba5e;
  --amber-glow: rgba(227, 167, 60, 0.35);

  --danger-500: #d1483a;
  --danger-050: #fbeae7;

  --focus-ring: #2f5fd6;

  /* ---- Typography ---- */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --step--1: clamp(0.78rem, 0.765rem + 0.08vw, 0.8125rem);
  --step-0: clamp(0.9375rem, 0.92rem + 0.1vw, 1rem);
  --step-1: clamp(1.0625rem, 1.03rem + 0.15vw, 1.1875rem);
  --step-2: clamp(1.25rem, 1.2rem + 0.3vw, 1.4375rem);
  --step-3: clamp(1.5rem, 1.4rem + 0.5vw, 1.75rem);
  --step-4: clamp(1.75rem, 1.55rem + 1vw, 2.25rem);
  --step-5: clamp(2.1rem, 1.75rem + 1.9vw, 2.75rem);

  /* Dedicated scale for the readout numerals — the one place a larger
     tabular-numeral display is intentional, kept separate so ordinary
     headings never inherit an oversized readout scale. */
  --step-readout: clamp(1.65rem, 1.4rem + 1.4vw, 2.35rem);

  /* ---- Spacing (8pt-derived scale) ---- */
  --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;
  --space-9: 6.5rem;

  /* ---- Shape & elevation ---- */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(16, 25, 46, 0.06), 0 1px 1px rgba(16, 25, 46, 0.04);
  --shadow-md: 0 10px 24px -12px rgba(16, 25, 46, 0.22);
  --shadow-lg: 0 22px 44px -18px rgba(16, 25, 46, 0.3);
  --shadow-readout: 0 20px 44px -22px rgba(16, 25, 46, 0.5);

  --container-max: 1200px;
  --content-max: 780px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 140ms;
  --dur-med: 260ms;
}

/* ---- Dark mode ---- */
:root[data-theme="dark"] {
  --text-primary: var(--text-on-ink);
  --text-secondary: #b4bad2;
  --text-muted: #7f86a4;

  --surface: var(--ink-950);
  --surface-raised: var(--ink-900);
  --surface-sunken: #0d1526;
  --surface-ink: #060a14;
  --surface-ink-raised: #0a0f1d;

  --line: #263252;
  --line-strong: #354570;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 24px -12px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 22px 44px -18px rgba(0, 0, 0, 0.6);
}

@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;
  }
}


/* ---- base.css ---- */
/* ==========================================================================
   Base reset & typography
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--surface);
  transition: background var(--dur-med) var(--ease-out), color var(--dur-med) var(--ease-out);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  position: relative;
}
img, svg, picture, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, figure { margin: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 560;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
h1 { font-size: var(--step-5); line-height: 1.1; letter-spacing: -0.015em; font-weight: 570; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); font-weight: 560; }
h4 { font-size: var(--step-1); font-weight: 560; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-500);
}

.lede { font-size: var(--step-0); color: var(--text-secondary); line-height: 1.65; }
.muted { color: var(--text-muted); }

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.prose { max-width: var(--content-max); }

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -60px;
  background: var(--surface-ink);
  color: var(--text-on-ink);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 200;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: var(--space-4); }

section { padding-block: var(--space-8); }
section.tight { padding-block: var(--space-6); }

hr.rule { border: none; border-top: 1px solid var(--line); margin-block: var(--space-6); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th { font-family: var(--font-mono); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.table-wrap table { min-width: 480px; }

code, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

pre {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow-x: auto;
  max-width: 100%;
  margin: 0;
}
pre.num {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  font-size: var(--step--1);
  line-height: 1.7;
}

@media (max-width: 720px) {
  section { padding-block: var(--space-7); }
}


/* ---- components.css ---- */
/* ==========================================================================
   Components
   ========================================================================== */

/* ---- Site header ---- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header__bar {
  display: flex; align-items: center; gap: var(--space-5);
  padding-block: var(--space-3);
}
.brand { display: flex; align-items: center; gap: 0.6em; font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); min-width: 0; }
.brand__mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--surface-ink);
  color: var(--accent-400);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.brand__name span { color: var(--accent-500); }

.main-nav { display: flex; align-items: center; gap: var(--space-5); margin-left: auto; }
.main-nav__list { display: flex; gap: var(--space-5); }
.main-nav__list a {
  font-size: var(--step--1); font-weight: 600; color: var(--text-secondary);
  padding-block: var(--space-2);
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.main-nav__list a:hover, .main-nav__list a[aria-current="page"] { color: var(--text-primary); border-color: var(--accent-500); }

.header-actions { display: flex; align-items: center; gap: var(--space-3); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface-raised);
  cursor: pointer; transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.icon-btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }

.nav-toggle { display: none; }

/* ---- Search ---- */
.search-box {
  position: relative; display: flex; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface-raised);
  padding-inline: var(--space-4);
  min-width: 260px;
}
.search-box svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  border: none; background: transparent; outline: none;
  padding-block: var(--space-3); padding-inline: var(--space-2);
  width: 100%; font-size: var(--step--1);
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface-raised); border: 1px solid var(--line);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  max-height: 340px; overflow-y: auto; z-index: 50;
  display: none;
}
.search-results.is-open { display: block; }
.search-results a { display: block; padding: var(--space-3) var(--space-4); font-size: var(--step--1); }
.search-results a:hover, .search-results a.is-active { background: var(--surface-sunken); }
.search-results__cat { color: var(--text-muted); font-size: 0.8em; }
.search-results__empty { padding: var(--space-4); color: var(--text-muted); font-size: var(--step--1); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0.85em 1.4em; border-radius: var(--radius-pill);
  font-weight: 600; font-size: var(--step--1);
  border: 1px solid transparent; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--ink-950); color: var(--paper-0); box-shadow: 0 10px 24px -10px rgba(16, 25, 46, 0.35); }
.btn-primary:hover { background: var(--ink-800); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text-primary); }
.btn-ghost:hover { border-color: var(--accent-500); color: var(--accent-500); }
.btn-sm { padding: 0.55em 1em; font-size: var(--step--1); border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface-raised); }
.btn-sm:hover { border-color: var(--line-strong); }
.btn-block { width: 100%; }

/* ---- Cards ---- */
.card {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--space-6); }

.calc-card {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-5); border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--surface-raised);
  transition: transform var(--dur-med) var(--ease-out), border-color var(--dur-fast), box-shadow var(--dur-med);
  height: 100%;
}
.calc-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.calc-card__icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface-sunken); color: var(--accent-500);
}
.calc-card__icon svg { width: 20px; height: 20px; }
.calc-card h3 { font-size: var(--step-1); }
.calc-card p { color: var(--text-secondary); font-size: var(--step--1); }
.calc-card__tag { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }

.card-grid { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card-grid > * { min-width: 0; }

/* ---- Category icon cards (instrument-badge style, matches the readout) ---- */
.cat-strip {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.cat-strip > * { min-width: 0; }
.cat-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-5); border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--surface-raised);
  transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.cat-item:hover { border-color: var(--accent-500); transform: translateY(-2px); }
.cat-item__icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface-ink); color: var(--amber-500);
}
.cat-item__icon svg { width: 20px; height: 20px; }
.cat-item__name { font-weight: 600; font-size: var(--step--1); color: var(--text-primary); }
.cat-item__count { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }

/* ---- Readout (signature element) ---- */
.readout {
  background: var(--surface-ink);
  color: var(--text-on-ink);
  border-radius: var(--radius-lg);
  padding: 2px;
  box-shadow: var(--shadow-readout);
}
.readout__inner {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: calc(var(--radius-lg) - 2px);
  padding: var(--space-5) var(--space-6) var(--space-5);
}
.readout__label {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  font-family: var(--font-mono); font-size: var(--step--1);
  color: var(--text-on-ink-muted); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
}
.readout__label::after {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: var(--amber-500); box-shadow: 0 0 8px var(--amber-glow);
}
.readout__value {
  font-family: var(--font-mono); font-weight: 600;
  font-size: var(--step-readout);
  font-variant-numeric: tabular-nums;
  color: var(--amber-500);
  text-shadow: 0 0 18px var(--amber-glow);
  line-height: 1.15;
  letter-spacing: -0.01em;
  word-break: break-word;
}
.readout__sub { margin-top: var(--space-3); font-size: var(--step--1); color: var(--text-on-ink-muted); }
.readout__grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  margin-top: var(--space-5); padding-top: var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.09);
}
.readout__grid > div {
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.readout__grid > div:nth-child(even) {
  padding-left: var(--space-4);
  border-left: 1px solid rgba(255,255,255,0.06);
}
.readout__grid > div:nth-last-child(-n+2) { border-bottom: none; }
.readout__stat-label { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-on-ink-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.readout__stat-value { font-family: var(--font-mono); font-size: var(--step-0); font-weight: 600; color: var(--text-on-ink); margin-top: 3px; letter-spacing: -0.01em; }

/* ---- Calculator form ---- */
.calc-shell {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-6);
  align-items: start;
}
.field { margin-bottom: var(--space-5); }
.field label {
  display: block; font-weight: 600; font-size: var(--step--1);
  margin-bottom: var(--space-2);
}
.field .hint { color: var(--text-muted); font-size: 0.8em; margin-top: var(--space-2); }
.field .error-msg { color: var(--danger-500); font-size: 0.8em; margin-top: var(--space-2); display: none; }
.field.has-error .error-msg { display: block; }
.field.has-error input, .field.has-error select { border-color: var(--danger-500); }

.input-group { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-raised); transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.input-group:focus-within { border-color: var(--accent-500); box-shadow: 0 0 0 3px var(--accent-glow); }
.input-group input, .input-group select {
  border: none; outline: none; background: transparent;
  padding: 0.85em 1em; width: 100%; font-size: var(--step-0);
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.input-group__affix {
  display: flex; align-items: center; padding-inline: 1em;
  background: var(--surface-sunken); color: var(--text-muted);
  font-size: var(--step--1); font-weight: 600; white-space: nowrap;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.field-row > * { min-width: 0; }

.radio-group { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.radio-chip { border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 0.6em 1.1em; cursor: pointer; font-size: var(--step--1); font-weight: 600; transition: all var(--dur-fast); }
.radio-chip input { position: absolute; opacity: 0; pointer-events: none; }
.radio-chip:has(input:checked) { border-color: var(--accent-500); background: var(--surface-sunken); color: var(--accent-500); }

.result-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-5); }

/* ---- Breadcrumbs ---- */
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 0.4em; font-size: var(--step--1); color: var(--text-muted); padding-block: var(--space-4); }
.breadcrumbs a:hover { color: var(--accent-500); }
.breadcrumbs li { display: flex; gap: 0.4em; align-items: center; }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 0.4em; color: var(--line-strong); }

/* ---- FAQ accordion ---- */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center;
  padding-block: var(--space-4); font-weight: 600; font-family: var(--font-display);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3em; color: var(--accent-500); transition: transform var(--dur-fast); flex-shrink: 0; margin-left: var(--space-4); }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding-bottom: var(--space-4); color: var(--text-secondary); }

/* ---- Steps ---- */
.steps { counter-reset: step; display: grid; gap: var(--space-4); }
.steps li { list-style: none; counter-increment: step; display: flex; gap: var(--space-4); }
.steps li::before {
  content: counter(step);
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-ink); color: var(--accent-400);
  display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700; font-size: 0.85em;
}

/* ---- Badge / toast ---- */
.toast {
  position: fixed; bottom: var(--space-5); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-ink); color: var(--text-on-ink);
  padding: 0.9em 1.4em; border-radius: var(--radius-pill);
  font-size: var(--step--1); font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: all var(--dur-med) var(--ease-out);
  z-index: 300;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Footer ---- */
.site-footer { background: var(--surface-ink); color: var(--text-on-ink-muted); padding-block: var(--space-8) var(--space-6); margin-top: var(--space-9); }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: var(--space-6); }
.footer-grid h4 { color: var(--text-on-ink); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--space-4); }
.footer-grid a { display: block; padding-block: 0.35em; font-size: var(--step--1); transition: color var(--dur-fast); }
.footer-grid a:hover { color: var(--accent-400); }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid rgba(255,255,255,0.1); font-size: var(--step--1); }

/* ---- Chart container ---- */
.chart-wrap { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-5); }
.chart-wrap svg { width: 100%; height: auto; overflow: visible; }
.legend { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-4); font-size: var(--step--1); }
.legend span { display: inline-flex; align-items: center; gap: 0.5em; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---- Theme toggle icon states ---- */
[data-theme="dark"] .icon-sun { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }
:root:not([data-theme="dark"]) .icon-sun { display: none; }
:root:not([data-theme="dark"]) .icon-moon { display: inline; }

/* ---- Related grid ---- */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }
.related-grid > * { min-width: 0; }
.related-card { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-4); background: var(--surface-raised); transition: border-color var(--dur-fast), transform var(--dur-fast); }
.related-card:hover { border-color: var(--accent-500); transform: translateY(-2px); }
.related-card__label { font-weight: 600; font-size: var(--step--1); }
.related-card__cat { font-size: 0.78rem; color: var(--text-muted); }

/* ---- Multi-column field rows that need more than 2 columns on desktop
   (e.g. a/b/c coefficient inputs, a 7-day week grid). Auto-fit + minmax
   means these reflow to fewer columns as space shrinks with no manual
   breakpoint needed — safer against overflow than a fixed column count. */
.field-row-3 { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.field-row-7 { grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); gap: var(--space-2); }

/* ---- Responsive ---- */
@media (max-width: 980px) {
  .calc-shell { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
  .main-nav__list, .search-box { display: none; }
  .nav-toggle { display: inline-flex; }
  .field-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }

  .main-nav.is-open {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
    background: var(--surface-raised);
    border-bottom: 1px solid var(--line);
    padding: var(--space-4) var(--space-5) var(--space-5);
    box-shadow: var(--shadow-md);
    z-index: 99;
  }
  .main-nav.is-open .main-nav__list,
  .main-nav.is-open .search-box {
    display: flex;
  }
  .main-nav.is-open .main-nav__list { flex-direction: column; gap: var(--space-3); }
  .main-nav.is-open .search-results { position: static; box-shadow: none; margin-top: var(--space-2); }
  .main-nav.is-open .search-box { min-width: 0; width: 100%; }
}
@media (max-width: 420px) {
  .brand__name { display: none; }
  .site-header__bar { gap: var(--space-3); }
}


/* ---- home.css ---- */
/* ==========================================================================
   Homepage & marketing sections
   ========================================================================== */

.hero {
  padding-block: var(--space-7) var(--space-6);
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-7); align-items: center;
}
.hero h1 { margin-block: var(--space-4); }
.hero .lede { max-width: 44ch; margin-bottom: var(--space-6); }
.hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-6); }
.hero-trust { display: flex; gap: var(--space-6); flex-wrap: wrap; }
.hero-trust strong { font-family: var(--font-mono); font-size: var(--step-2); display: block; color: var(--accent-500); }
.hero-trust span { font-size: 0.8rem; color: var(--text-muted); }

/* Live mini-calculator inside the hero readout — the signature moment */
.hero-demo .readout__value { display: flex; align-items: baseline; gap: 0.15em; }
.demo-controls { display: grid; gap: var(--space-3); margin-top: var(--space-5); }
.demo-controls label { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-on-ink-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.demo-controls input[type="range"] {
  width: 100%; accent-color: var(--accent-400);
}

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.section-head p { color: var(--text-secondary); margin-top: var(--space-2); }

.stat-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }
.stat-bar .card-pad { text-align: center; }
.stat-bar .stat-num { font-family: var(--font-mono); font-size: var(--step-3); color: var(--accent-500); }
.stat-bar .stat-label { color: var(--text-muted); font-size: var(--step--1); margin-top: var(--space-2); }

.cta-band {
  background: var(--surface-ink); color: var(--text-on-ink);
  border-radius: var(--radius-lg); padding: var(--space-7);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap;
}
.cta-band h2 { color: var(--text-on-ink); }
.cta-band p { color: var(--text-on-ink-muted); margin-top: var(--space-2); }

[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); }
[data-reveal].is-visible { opacity: 1; transform: none; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .stat-bar { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   Print styles — used by the Print button on calculator pages
   ========================================================================== */
@media print {
  .site-header, .site-footer, .result-actions, .breadcrumbs, .related-grid,
  .newsletter, .cta-band, .search-box, .nav-toggle, .header-actions,
  .skip-link, script { display: none !important; }
  body { background: #fff; color: #000; }
  .readout { background: #fff; color: #000; box-shadow: none; border: 1px solid #000; }
  .readout__value { color: #000; text-shadow: none; }
  a { text-decoration: underline; }
  .card, .chart-wrap, .table-wrap { box-shadow: none; border: 1px solid #999; }
}
