:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e1e5eb;
  --border-strong: #c7cdd7;
  --text: #16202e;
  --text-soft: #5b6577;
  --text-faint: #8993a4;

  --navy: #0f1f3d;
  --navy-soft: #16294d;
  --gold: #f0a83a;
  --gold-soft: #fbe3bd;
  --teal: #0e9488;
  --teal-soft: #d7f0ec;
  --red: #c94f4f;
  --red-soft: #f6dede;
  --purple: #6a5acd;
  --purple-soft: #e3ddf7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

h1, h2, h3 {
  font-family: "Inter", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}

.mono, .figure {
  font-family: "IBM Plex Mono", "SF Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.gradient-text {
  color: var(--gold);
}

a { color: var(--navy); }

/* ---------- Site header ---------- */

.site-header {
  background: #0e0b1e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 24px;
}

.site-header .inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.site-header .brand {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.24rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
}

.site-header .brand .ampersand {
  color: var(--gold);
  font-style: normal;
}

.site-header nav a {
  color: #cfd6e6;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  margin-left: 20px;
}

.site-header nav a:hover { color: var(--gold); }

/* ---------- Layout ---------- */

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 0 80px;
}

/* ---------- Hero banner (dark, professional) ---------- */

.hero {
  background:
    radial-gradient(ellipse at 10% -20%, rgba(var(--accent-rgb), 0.42), transparent 58%),
    radial-gradient(ellipse at 92% 15%, rgba(var(--accent-rgb), 0.20), transparent 52%),
    linear-gradient(150deg, #171334 0%, #0e0b1e 55%, #0a0816 100%);
  position: relative;
  overflow: hidden;
  padding: 62px 24px 58px;
  margin: 0 0 32px;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.35);
}

/* subtle grid texture over the glow */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 30% 0%, #000 10%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 0%, #000 10%, transparent 75%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  right: -140px;
  top: -120px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.30), transparent 68%);
  filter: blur(10px);
  pointer-events: none;
}

.hero .inner {
  max-width: 1040px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--accent-lift);
  background: rgba(var(--accent-rgb), 0.13);
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  padding: 6px 15px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.hero .eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-lift);
  box-shadow: 0 0 8px var(--accent-lift);
}

.hero h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 2.85rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  max-width: 700px;
  color: #fff;
}

.hero h1 .accent-word {
  background: linear-gradient(100deg, var(--accent-lift), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  color: #b6bdd4;
  max-width: 560px;
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .hero { padding: 44px 24px 40px; }
  .hero h1 { font-size: 2.05rem; }
}

/* ---------- Stat strip (hub hero) ---------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 26px;
  max-width: 560px;
}

.stat-strip .stat {
  background: rgba(255, 255, 255, 0.04);
  padding: 16px 20px;
}

.stat .stat-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
}

.stat .stat-label {
  font-size: 0.72rem;
  color: #aeb7cc;
  margin-top: 3px;
}

/* ---------- Body content wrapper ---------- */

.content {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px 88px;   /* bottom room so the footer isn't flush to the edge */
}

/* ---------- Ledger list (hub page) ---------- */

.ledger {
  border-top: 1px solid var(--border);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.ledger-entry {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 18px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease;
}

.ledger-entry:last-child { border-bottom: none; }

.ledger-entry:hover { background: #f8f9fb; }

.ledger-entry .entry-no {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
}

.ledger-entry .entry-body h3 {
  font-size: 1.05rem;
  margin-bottom: 3px;
  font-weight: 700;
}

.ledger-entry .entry-body p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-soft);
}

.ledger-entry .entry-status {
  font-family: "Inter", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-live { background: var(--teal-soft); color: var(--teal); }
.status-soon { background: var(--gold-soft); color: #a9720f; }

/* ---------- Calculator layout ---------- */

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 720px) {
  .calc-grid { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}

.field { margin-bottom: 20px; position: relative; }

.field label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.field label .val {
  font-family: "IBM Plex Mono", monospace;
  color: var(--navy);
  font-weight: 700;
}

.field input[type="number"] {
  width: 100%;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.98rem;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.field input.money-input { padding-left: var(--currency-pad, 28px); }

.field:has(input.money-input)::before {
  content: var(--currency-symbol, "$");
  position: absolute;
  left: 12px;
  top: 38px;
  color: var(--text-faint);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  pointer-events: none;
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--navy);
  margin-top: 8px;
}

.field input:focus { outline: 2px solid var(--navy); outline-offset: 1px; }

.field select {
  width: 100%;
  font-family: "IBM Plex Mono", monospace;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

/* ---------- Result panel ---------- */

.result-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.headline {
  font-family: "Inter", sans-serif;
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--navy);
  margin: 4px 0 0;
}

.ledger-result.is-payoff .headline,
.ledger-result .headline.positive { color: var(--teal); }
.ledger-result .headline.negative { color: var(--red); }

.ledger-result .line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.ledger-result .line:last-child { border-bottom: none; }

.ledger-result .line .label {
  font-size: 0.85rem;
  color: var(--text-soft);
}

.ledger-result .line .amount {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
}

.ledger-result .line.debt .amount { color: var(--red); }
.ledger-result .line.payoff .amount { color: var(--teal); }

.explainer {
  margin-top: 18px;
  font-size: 0.84rem;
  color: var(--text-faint);
}

/* ---------- Donut chart ---------- */

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
}

.donut {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.donut-hole {
  position: absolute;
  inset: 18px;
  background: var(--surface);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.donut-hole .donut-hole-value {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.donut-hole .donut-hole-label {
  font-size: 0.62rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.84rem;
}

.donut-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.donut-legend .legend-item i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
}

.donut-legend .legend-item .legend-amount {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  color: var(--text);
  margin-left: auto;
  padding-left: 16px;
}

/* ---------- Chart / Table toggle ---------- */

.view-toggle {
  display: flex;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  margin: 20px 0 16px;
}

.view-toggle button {
  flex: 1;
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px;
  background: #f6f7f9;
  color: var(--text-soft);
  border: none;
  cursor: pointer;
  border-right: 1px solid var(--border-strong);
}

.view-toggle button:last-child { border-right: none; }

.view-toggle button.active {
  background: var(--gold);
  color: var(--navy);
}

/* ---------- Shared form controls ---------- */

.btn {
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: #f6f7f9;
  color: var(--text);
  cursor: pointer;
}

.btn:hover { border-color: var(--navy); color: var(--navy); }

.btn-primary {
  background: var(--navy);
  border: none;
  color: #fff;
}

.btn-primary:hover { background: var(--navy-soft); color: #fff; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.btn-remove {
  background: var(--red-soft);
  border: 1px solid #e3b9b9;
  color: var(--red);
}

.btn-remove:hover { background: #f2caca; color: var(--red); border-color: var(--red); }

/* ---------- Debt list rows ---------- */

.debt-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.debt-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr 1fr auto;
  gap: 8px;
  align-items: center;
  background: #f8f9fb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

@media (max-width: 640px) {
  .debt-row { grid-template-columns: 1fr 1fr; }
}

.debt-row input {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  width: 100%;
}

.debt-row input[type="text"] { font-family: "Inter", sans-serif; }

.debt-row .field-mini { display: flex; flex-direction: column; gap: 3px; }
.debt-row .field-mini label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

/* ---------- Toggle group (payment mode) ---------- */

.toggle-group {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}

.toggle-btn {
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 9px 16px;
  background: #f6f7f9;
  color: var(--text-soft);
  border: none;
  cursor: pointer;
}

.toggle-btn.active {
  background: var(--navy);
  color: #fff;
}

/* ---------- Strategy comparison (snowball vs avalanche) ---------- */

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

@media (max-width: 640px) { .compare-grid { grid-template-columns: 1fr; } }

.strategy-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: #f8f9fb;
  position: relative;
}

.strategy-card.winner {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px var(--teal);
  background: var(--teal-soft);
}

.strategy-card h4 {
  font-family: "Inter", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.winner-badge {
  font-family: "Inter", sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  background: var(--teal);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.strategy-card .big-figure {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.strategy-card .sub-figure {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.payoff-order {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-top: 20px;
  line-height: 1.8;
}

.payoff-order .step-num {
  font-family: "IBM Plex Mono", monospace;
  color: var(--navy);
  font-weight: 700;
  margin-right: 6px;
}

/* ---------- Split bar (kept as secondary visual under the donut) ---------- */

.split-bar-wrap { margin-top: 20px; }

.split-bar {
  display: flex;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f0f1f4;
}

.split-segment { height: 100%; transition: width 0.35s ease; }

.split-principal { background: var(--teal); }
.split-interest { background: var(--red); }
.split-c { background: var(--purple); }
.split-d { background: var(--gold); }

.split-legend {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--text-soft);
}

.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-item i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend-principal i { background: var(--teal); }
.legend-interest i { background: var(--red); }

/* ---------- Ad slots ---------- */

.ad-slot {
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  padding: 14px;
  text-align: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 32px 0;
  background: #f6f7f9;
}

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--border);
  margin-top: 56px;
  padding: 26px 0 8px;
  font-size: 0.8rem;
  color: var(--text-faint);
  line-height: 1.7;
}

/* ============================================================
   PER-PAGE ACCENT THEMES
   Each calculator gets its own colour identity.
   ============================================================ */

body { --accent: #f0a83a; --accent-deep: #a9720f; --accent-soft: #fdf1dc; --accent-tint: #fbe3bd; --accent-rgb: 240,168,58; --accent-lift: #f7c878; }

body.theme-teal   { --accent: #14a89a; --accent-deep: #0a6d64; --accent-soft: #e6f7f5; --accent-tint: #b9e8e2; --accent-rgb: 20,168,154; --accent-lift: #4fd6c6; }
body.theme-indigo { --accent: #6366e8; --accent-deep: #3f42b5; --accent-soft: #ececfd; --accent-tint: #c9caf8; --accent-rgb: 99,102,232; --accent-lift: #9ea0f6; }
body.theme-green  { --accent: #3fa34d; --accent-deep: #256b30; --accent-soft: #e9f6eb; --accent-tint: #bee3c4; --accent-rgb: 63,163,77; --accent-lift: #7fd18c; }
body.theme-blue   { --accent: #2c7be5; --accent-deep: #17539e; --accent-soft: #e8f1fd; --accent-tint: #bcd8f8; --accent-rgb: 44,123,229; --accent-lift: #7db2f2; }
body.theme-amber  { --accent: #e08e2b; --accent-deep: #96590d; --accent-soft: #fdf2e2; --accent-tint: #f7d9ac; --accent-rgb: 224,142,43; --accent-lift: #f3bd74; }
body.theme-coral  { --accent: #e2574c; --accent-deep: #9d302a; --accent-soft: #fdedec; --accent-tint: #f7c4c0; --accent-rgb: 226,87,76; --accent-lift: #f39189; }
body.theme-orange  { --accent: #e8702a; --accent-deep: #9c440f; --accent-soft: #fdf0e7; --accent-tint: #f8cfb1; --accent-rgb: 232,112,42; --accent-lift: #f79f6b; }
body.theme-cyan    { --accent: #0e9ab8; --accent-deep: #0a6377; --accent-soft: #e6f6fa; --accent-tint: #b3e2ee; --accent-rgb: 14,154,184; --accent-lift: #4fc9e3; }
body.theme-violet  { --accent: #8b5cf6; --accent-deep: #5b32c2; --accent-soft: #f1ecfe; --accent-tint: #d5c6fb; --accent-rgb: 139,92,246; --accent-lift: #b494fa; }
body.theme-magenta { --accent: #c8459b; --accent-deep: #8a2569; --accent-soft: #fbeaf5; --accent-tint: #f2c2e0; --accent-rgb: 200,69,155; --accent-lift: #e07cbe; }

.site-header { box-shadow: inset 0 -1px 0 rgba(var(--accent-rgb), 0.35); }
.site-header .brand .ampersand { color: var(--accent); }
.site-header nav a:hover { color: var(--accent); }

.hero::after { background: linear-gradient(100deg, var(--accent) 0%, var(--accent-tint) 100%); }
.hero .eyebrow { color: var(--accent); }
.stat-strip .stat .stat-value { color: var(--accent-lift); }

.field input[type="range"] { accent-color: var(--accent); }
.field input:focus { outline-color: var(--accent); }
.view-toggle button.active { background: var(--accent); color: #fff; }
.toggle-btn.active { background: var(--accent); color: #fff; }
.ledger-entry .entry-no { color: var(--accent); }

/* ---------- Editorial content sections ---------- */

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  margin-top: 24px;
}

.section h2 {
  font-size: 1.35rem;
  margin-bottom: 6px;
}

.section > p.lede {
  color: var(--text-soft);
  font-size: 0.95rem;
  margin: 0 0 22px;
  max-width: 720px;
}

.section h3 {
  font-size: 1rem;
  margin: 22px 0 6px;
}

.section p, .section li {
  font-size: 0.92rem;
  color: var(--text-soft);
  line-height: 1.65;
}

.section p { margin: 0 0 12px; }
.section ul { padding-left: 20px; margin: 0 0 14px; }
.section li { margin-bottom: 7px; }
.section strong { color: var(--text); font-weight: 700; }

/* ---------- Step cards (how it works) ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } }

.step {
  background: var(--accent-soft);
  border: 1px solid var(--accent-tint);
  border-radius: 8px;
  padding: 18px;
}

.step .step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.step h4 {
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 5px;
  color: var(--text);
}

.step p { font-size: 0.86rem; margin: 0; color: var(--text-soft); }

/* ---------- Worked example box ---------- */

.example-box {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  padding: 20px 22px;
  margin: 20px 0;
}

.example-box .example-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  font-weight: 700;
  margin-bottom: 10px;
}

.example-box p:last-child { margin-bottom: 0; }

.example-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
  margin: 16px 0 4px;
}

.example-figures .fig {
  background: var(--surface);
  border: 1px solid var(--accent-tint);
  border-radius: 6px;
  padding: 12px 14px;
}

.example-figures .fig .fig-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-deep);
}

.example-figures .fig .fig-label {
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-top: 2px;
}

/* ---------- Reference table ---------- */

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
  margin: 14px 0 18px;
}

.ref-table th {
  text-align: left;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 9px 12px;
  border-bottom: 1px solid var(--accent-tint);
}

.ref-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  font-family: "IBM Plex Mono", monospace;
}

.ref-table td:first-child { font-family: "Inter", sans-serif; color: var(--text); }
.ref-table tr:last-child td { border-bottom: none; }

/* ---------- FAQ ---------- */

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.faq-item:last-child { border-bottom: none; }

.faq-item summary {
  cursor: pointer;
  padding: 15px 0;
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.2rem;
  color: var(--accent);
  flex-shrink: 0;
}

.faq-item[open] summary::after { content: "−"; }

.faq-item .faq-body { padding: 0 0 16px; }
.faq-item .faq-body p:last-child { margin-bottom: 0; }

/* ---------- Related calculators ---------- */

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.related-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.related-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.related-card .related-no {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 700;
}

.related-card h4 {
  font-family: "Inter", sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text);
  margin: 4px 0 4px;
}

.related-card p {
  font-size: 0.82rem;
  color: var(--text-soft);
  margin: 0;
}

/* ---------- Key takeaway callout ---------- */

.takeaway {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--accent-soft);
  border: 1px solid var(--accent-tint);
  border-radius: 8px;
  padding: 16px 18px;
  margin: 18px 0;
}

.takeaway .takeaway-mark {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  color: var(--accent-deep);
  flex-shrink: 0;
}

.takeaway p { margin: 0; font-size: 0.9rem; }

/* ============================================================
   HOME PAGE — full dark landing
   ============================================================ */

body.theme-dark {
  --accent: #f472b6;
  --accent-lift: #fb9dd0;
  --accent-rgb: 244,114,182;
  background:
    radial-gradient(ellipse at 12% -5%, rgba(139, 92, 246, 0.22), transparent 50%),
    radial-gradient(ellipse at 95% 10%, rgba(244, 114, 182, 0.14), transparent 45%),
    #0c0a18;
  color: #f2effa;
}

body.theme-dark .site-header {
  background: rgba(12, 10, 24, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}

body.theme-dark .site-header .brand {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
}

body.theme-dark .site-header .brand .ampersand {
  background: linear-gradient(100deg, #fb9dd0, #fbbf5a, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: italic;
}

body.theme-dark .hero {
  background: transparent;
  border-bottom: none;
  padding: 70px 24px 40px;
  margin-bottom: 0;
}

body.theme-dark .hero::after { display: none; }

body.theme-dark .hero h1 {
  font-size: 3.3rem;
  max-width: 780px;
}

body.theme-dark .hero h1 .accent-word {
  background: linear-gradient(100deg, #f472b6 0%, #fb923c 42%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (max-width: 640px) {
  body.theme-dark .hero h1 { font-size: 2.2rem; }
}

body.theme-dark .stat-strip {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.10);
}

body.theme-dark .stat-strip .stat { background: rgba(255, 255, 255, 0.035); }
body.theme-dark .stat-strip .stat:nth-child(1) .stat-value { color: #2dd4bf; }
body.theme-dark .stat-strip .stat:nth-child(2) .stat-value { color: #fb923c; }
body.theme-dark .stat-strip .stat:nth-child(3) .stat-value { color: #f472b6; }
body.theme-dark .stat-strip .stat .stat-label { color: #8f87ad; }

body.theme-dark footer {
  border-top-color: rgba(255, 255, 255, 0.08);
  color: #7d7599;
}

body.theme-dark .ad-slot {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.10);
  color: #6f6791;
}

/* ---------- Section heading on dark ---------- */

.dark-section { margin-top: 56px; }

.dark-section .section-eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #8f87ad;
  margin-bottom: 10px;
}

.dark-section h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.85rem;
  color: #f2effa;
  margin-bottom: 8px;
}

.dark-section > p {
  color: #a49cc2;
  max-width: 620px;
  margin: 0 0 26px;
  font-size: 0.98rem;
}

/* ---------- Tool card grid ---------- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

@media (max-width: 1020px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .tool-grid { grid-template-columns: 1fr; }
}

/* Home page only: a wider container so three cards per row stay comfortable.
   Hero and content share the width so they stay aligned. */
body.theme-dark .content,
body.theme-dark .hero .inner { max-width: 1280px; }

.tool-card {
  --card-rgb: 244,114,182;
  --card: #f472b6;
  position: relative;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 100% 0%, rgba(var(--card-rgb), 0.16), transparent 62%),
    rgba(255, 255, 255, 0.028);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 24px 22px 20px;
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.tool-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--card), transparent 85%);
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: rgba(var(--card-rgb), 0.55);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(var(--card-rgb), 0.22);
}

.tool-card .tool-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.tool-card .tool-no {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--card);
  background: rgba(var(--card-rgb), 0.12);
  border: 1px solid rgba(var(--card-rgb), 0.4);
  padding: 4px 10px;
  border-radius: 999px;
}

.tool-card .tool-tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8f87ad;
}

.tool-card h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.24rem;
  color: #f2effa;
  margin-bottom: 8px;
  line-height: 1.25;
}

.tool-card p {
  font-size: 0.9rem;
  color: #a49cc2;
  margin: 0 0 18px;
  line-height: 1.55;
  flex-grow: 1;
}

.tool-card .tool-answers {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.73rem;
  color: #8f87ad;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 14px;
  margin-bottom: 14px;
  line-height: 1.7;
}

.tool-card .tool-answers span { color: var(--card); }

.tool-card .tool-cta {
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--card);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tool-card:hover .tool-cta .arrow { transform: translateX(4px); }
.tool-card .tool-cta .arrow { transition: transform 0.18s ease; display: inline-block; }

/* per-card colour identities — match each calculator page */
.tool-card.c-teal   { --card: #2dd4bf; --card-rgb: 45,212,191; }
.tool-card.c-indigo { --card: #818cf8; --card-rgb: 129,140,248; }
.tool-card.c-green  { --card: #4ade80; --card-rgb: 74,222,128; }
.tool-card.c-blue   { --card: #60a5fa; --card-rgb: 96,165,250; }
.tool-card.c-amber  { --card: #fbbf24; --card-rgb: 251,191,36; }
.tool-card.c-coral  { --card: #fb7185; --card-rgb: 251,113,133; }
.tool-card.c-orange  { --card: #fb923c; --card-rgb: 251,146,60; }
.tool-card.c-cyan    { --card: #22d3ee; --card-rgb: 34,211,238; }
.tool-card.c-violet  { --card: #a78bfa; --card-rgb: 167,139,250; }
.tool-card.c-magenta { --card: #f0abfc; --card-rgb: 240,171,252; }

/* ---------- Value props row ---------- */

.value-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.value-item {
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  padding-left: 16px;
}

.value-item h4 {
  font-family: "Inter", sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: #f2effa;
  margin: 0 0 6px;
}

.value-item p {
  font-size: 0.88rem;
  color: #a49cc2;
  margin: 0;
  line-height: 1.6;
}

/* ============================================================
   CENTERED HERO
   ============================================================ */

/* Heroes are left-aligned; the home page pairs that with a right-hand panel
   so the asymmetry reads as deliberate rather than lopsided. */
.hero .inner { text-align: left; }

/* ============================================================
   PLAIN-ENGLISH RESULT SUMMARY
   The single sentence that explains the result in words.
   ============================================================ */

.plain-summary {
  background: var(--accent-soft);
  border: 1px solid var(--accent-tint);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 0 0 22px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  text-align: center;
}

.plain-summary strong { color: var(--accent-deep); font-weight: 700; }

.plain-summary .summary-label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-deep);
  margin-bottom: 8px;
  opacity: 0.75;
}

/* ============================================================
   "WHAT YOU NEED" QUICK-START STRIP
   ============================================================ */

.quick-start {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.quick-start .qs-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  font-weight: 700;
}

.quick-start .qs-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.quick-start .qs-item::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ============================================================
   FOOTER NAVIGATION
   ============================================================ */

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.footer-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 600;
}

.footer-nav a:hover { color: var(--accent); text-decoration: underline; }

body.theme-dark .footer-nav a { color: #a49cc2; }
body.theme-dark .footer-nav a:hover { color: #f472b6; }

/* ============================================================
   STATIC CONTENT PAGES (About / Privacy)
   ============================================================ */

/* Flat, not a card — the text sits directly on the page like the home sections */
.prose {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 4px 0 0;
  max-width: none;
  margin: 0;
}

@media (max-width: 760px) { .prose { padding: 4px 0 0; } }

.prose h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.4rem;
  margin: 30px 0 10px;
}

.prose h2:first-child { margin-top: 0; }

.prose h3 { font-size: 1rem; margin: 20px 0 6px; }

.prose p, .prose li {
  font-size: 0.94rem;
  color: var(--text-soft);
  line-height: 1.7;
}

.prose p { margin: 0 0 14px; }
.prose ul { padding-left: 22px; margin: 0 0 16px; }
.prose li { margin-bottom: 8px; }
.prose strong { color: var(--text); font-weight: 700; }
.prose a { color: var(--accent-deep); font-weight: 600; }

.prose .updated {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

/* ============================================================
   CENTERED DARK SECTIONS (home page)
   ============================================================ */

.dark-section { text-align: left; }

.value-item {
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  border-top: none;
  padding-left: 16px;
  padding-top: 0;
}

/* ============================================================
   HEADER NAV — "All Tools" dropdown
   ============================================================ */

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.site-nav > a {
  color: #b9c0d4;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.site-nav > a:hover { color: var(--accent-lift, #f472b6); }

.nav-dropdown { position: relative; }

.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #f2effa;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-trigger:hover,
.nav-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.28);
}

.nav-trigger .chev { font-size: 0.7rem; transition: transform 0.18s ease; }
.nav-trigger[aria-expanded="true"] .chev { transform: rotate(180deg); }

.nav-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  background: #16122c;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.55);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
  z-index: 60;
}

.nav-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }

.nav-menu-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7d7599;
  padding: 8px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.13s ease;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.06); }
.nav-item.is-current { background: rgba(255, 255, 255, 0.09); }

.nav-item .nav-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 9px currentColor;
}

.nav-item .nav-text { display: flex; flex-direction: column; min-width: 0; }

.nav-item .nav-name {
  font-family: "Inter", sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  color: #f2effa;
  line-height: 1.3;
}

.nav-item .nav-desc {
  font-size: 0.74rem;
  color: #8f87ad;
  line-height: 1.35;
  margin-top: 2px;
}

.nav-menu-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  margin-top: 6px;
  padding: 10px 12px 4px;
  display: flex;
  gap: 16px;
}

.nav-menu-footer a {
  font-size: 0.78rem;
  color: #8f87ad;
  text-decoration: none;
  font-weight: 600;
}

.nav-menu-footer a:hover { color: #f2effa; }

@media (max-width: 560px) {
  .nav-menu { width: min(300px, calc(100vw - 32px)); }
  .site-nav { gap: 12px; }
  .site-nav > a { display: none; }
}

/* colour dots matching each calculator */
.dot-teal   { background: #2dd4bf; color: #2dd4bf; }
.dot-indigo { background: #818cf8; color: #818cf8; }
.dot-green  { background: #4ade80; color: #4ade80; }
.dot-blue   { background: #60a5fa; color: #60a5fa; }
.dot-amber  { background: #fbbf24; color: #fbbf24; }
.dot-coral  { background: #fb7185; color: #fb7185; }
.dot-orange  { background: #fb923c; color: #fb923c; }
.dot-cyan    { background: #22d3ee; color: #22d3ee; }
.dot-violet  { background: #a78bfa; color: #a78bfa; }
.dot-magenta { background: #f0abfc; color: #f0abfc; }

/* ============================================================
   HOME SEARCH — jump straight to a calculator
   ============================================================ */

.tool-search {
  position: relative;
  max-width: 460px;
  margin: 0 0 30px;
}

.tool-search .search-field { position: relative; }

.tool-search input {
  width: 100%;
  font-family: "Inter", sans-serif;
  font-size: 0.98rem;
  padding: 15px 18px 15px 46px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #f2effa;
  text-align: left;
}

.tool-search input::placeholder { color: #7d7599; }

.tool-search input:focus {
  outline: none;
  border-color: rgba(244, 114, 182, 0.6);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.14);
}

.tool-search .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #7d7599;
  pointer-events: none;
  transition: color 0.18s ease;
}

.tool-search input:focus + .search-icon,
.tool-search .search-field:focus-within .search-icon { color: #f472b6; }

.tool-search .search-hint {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  color: #7d7599;
  margin-top: 10px;
}

.tool-card.is-hidden { display: none; }

.search-empty {
  color: #8f87ad;
  font-size: 0.92rem;
  padding: 26px 0 6px;
  display: none;
}

.search-empty.show { display: block; }

/* ============================================================
   MOTION
   All animation is opt-out via prefers-reduced-motion (bottom of file).
   ============================================================ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes glowDrift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.85; }
  50%      { transform: translate3d(-26px, 22px, 0) scale(1.08); opacity: 1; }
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 8px var(--accent-lift); opacity: 1; }
  50%      { box-shadow: 0 0 16px var(--accent-lift); opacity: 0.65; }
}

@keyframes valueFlash {
  0%   { background: rgba(var(--accent-rgb), 0.28); }
  100% { background: transparent; }
}

@keyframes donutIn {
  from { transform: scale(0.86) rotate(-14deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}

/* ---------- Hero entrance ---------- */

.hero .eyebrow,
.hero h1,
.hero p,
.hero .stat-strip,
.hero .tool-search {
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero .eyebrow    { animation-delay: 0.05s; }
.hero h1          { animation-delay: 0.14s; }
.hero p           { animation-delay: 0.24s; }
.hero .stat-strip { animation-delay: 0.34s; }
.hero .tool-search{ animation-delay: 0.42s; }

.hero .eyebrow::before { animation: pulseDot 2.6s ease-in-out infinite; }

/* the corner light bloom drifts slowly */
.hero::after { animation: glowDrift 14s ease-in-out infinite; }

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.62s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.reveal.is-visible { opacity: 1; transform: none; }

/* stagger children within a revealed group */
.reveal-group > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-group.is-visible > * { opacity: 1; transform: none; }
.reveal-group.is-visible > *:nth-child(1) { transition-delay: 0.00s; }
.reveal-group.is-visible > *:nth-child(2) { transition-delay: 0.07s; }
.reveal-group.is-visible > *:nth-child(3) { transition-delay: 0.14s; }
.reveal-group.is-visible > *:nth-child(4) { transition-delay: 0.21s; }
.reveal-group.is-visible > *:nth-child(5) { transition-delay: 0.28s; }
.reveal-group.is-visible > *:nth-child(6) { transition-delay: 0.35s; }
.reveal-group.is-visible > *:nth-child(7) { transition-delay: 0.42s; }
.reveal-group.is-visible > *:nth-child(8) { transition-delay: 0.49s; }
.reveal-group.is-visible > *:nth-child(9) { transition-delay: 0.56s; }
.reveal-group.is-visible > *:nth-child(10){ transition-delay: 0.63s; }

/* ---------- Live result feedback ---------- */

.ledger-result .amount,
.plain-summary,
.strategy-card .big-figure {
  border-radius: 4px;
}

.value-updated { animation: valueFlash 0.55s ease-out; }

.headline { transition: color 0.3s ease; }

/* ---------- Donut ---------- */

.donut.donut-animate { animation: donutIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ---------- Search filtering ---------- */

/* NOTE: no base animation here — .reveal-group handles the staggered entrance.
   An always-on `animation: ... both` would override reveal-group's opacity:0
   and break the stagger. This class is applied only when search re-shows a card. */
.tool-card.pop-in {
  animation: fadeUp 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tool-card.is-hidden { display: none; }

/* ---------- Nav menu items stagger in ---------- */

.nav-menu.open .nav-item {
  animation: fadeUp 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.nav-menu.open .nav-item:nth-child(2) { animation-delay: 0.03s; }
.nav-menu.open .nav-item:nth-child(3) { animation-delay: 0.06s; }
.nav-menu.open .nav-item:nth-child(4) { animation-delay: 0.09s; }
.nav-menu.open .nav-item:nth-child(5) { animation-delay: 0.12s; }
.nav-menu.open .nav-item:nth-child(6) { animation-delay: 0.15s; }
.nav-menu.open .nav-item:nth-child(7) { animation-delay: 0.18s; }

/* ---------- Interactive polish ---------- */

.card { transition: box-shadow 0.25s ease; }
.step { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.step:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(16, 24, 40, 0.10); }

.faq-item summary { transition: color 0.15s ease; }
.faq-item summary:hover { color: var(--accent-deep); }
.faq-item[open] .faq-body { animation: fadeIn 0.3s ease both; }

.field input[type="range"]::-webkit-slider-thumb { transition: transform 0.12s ease; }
.field input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }

.btn, .toggle-btn, .nav-trigger { transition: all 0.16s ease; }
.btn:active, .toggle-btn:active { transform: scale(0.97); }

html { scroll-behavior: smooth; }

/* ============================================================
   REDUCED MOTION — respect the OS setting
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .reveal,
  .reveal-group > * {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================================
   BLOG
   ============================================================ */

.post-list { display: flex; flex-direction: column; gap: 16px; }

.post-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 22px 24px;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.post-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(16,24,40,0.09); }

.post-card .post-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent-deep);
  margin-bottom: 8px;
}

.post-card h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.22rem;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.post-card p { font-size: 0.9rem; color: var(--text-soft); margin: 0; line-height: 1.6; }

.article { max-width: none; margin: 0; }

.article .article-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 26px;
}

.article h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.45rem;
  margin: 34px 0 12px;
}

.article h3 { font-size: 1.05rem; margin: 24px 0 8px; }

.article p, .article li {
  font-size: 1rem;
  color: var(--text-soft);
  line-height: 1.75;
}

.article p { margin: 0 0 16px; }
.article ul, .article ol { padding-left: 24px; margin: 0 0 18px; }
.article li { margin-bottom: 9px; }
.article strong { color: var(--text); font-weight: 700; }
.article a { color: var(--accent-deep); font-weight: 600; }

.article .lead {
  font-size: 1.1rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 24px;
}

.tool-cta-box {
  background: var(--accent-soft);
  border: 1px solid var(--accent-tint);
  border-radius: 10px;
  padding: 20px 22px;
  margin: 26px 0;
  text-align: center;
}

.tool-cta-box p { margin: 0 0 12px; font-size: 0.94rem; }

.tool-cta-box a {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 11px 22px;
  border-radius: 8px;
  text-decoration: none;
}

.tool-cta-box a:hover { background: var(--accent-deep); color: #fff; }

/* ============================================================
   TOOL CARD ICONS
   ============================================================ */

.tool-card .tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: rgba(var(--card-rgb), 0.13);
  border: 1px solid rgba(var(--card-rgb), 0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, background 0.2s ease;
}

.tool-card:hover .tool-icon {
  transform: scale(1.06) rotate(-3deg);
  background: rgba(var(--card-rgb), 0.2);
}

/* stroke/fill are set as attributes on the SVG itself so the icons still
   render correctly even if this stylesheet is cached or partially applied */
.tool-card .tool-icon { color: var(--card); }

.tool-card .tool-icon svg {
  width: 21px;
  height: 21px;
}

.tool-card .tool-top { gap: 12px; }
.tool-card .tool-top .tool-left { display: flex; align-items: center; gap: 12px; }

/* ============================================================
   GUIDE LINKS ON CALCULATOR PAGES
   ============================================================ */

.guide-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.guide-link {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  text-decoration: none;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.guide-link:hover { border-color: var(--accent); transform: translateY(-2px); }

.guide-link .guide-arrow {
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.guide-link h4 {
  font-family: "Inter", sans-serif;
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.35;
}

.guide-link p { font-size: 0.82rem; color: var(--text-soft); margin: 0; line-height: 1.5; }

/* ============================================================
   HOME HERO — two column, content left / sample panel right
   ============================================================ */

body.theme-dark .hero .inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: 56px;
  align-items: center;
}

@media (max-width: 900px) {
  body.theme-dark .hero .inner { grid-template-columns: 1fr; gap: 40px; }
  .hero-panel { order: 2; }
}

body.theme-dark .hero h1 { font-size: 3rem; max-width: none; }

@media (max-width: 640px) {
  body.theme-dark .hero h1 { font-size: 2.1rem; }
}

/* ---------- Sample result panel ---------- */

.hero-panel {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  padding: 26px 26px 24px;
  backdrop-filter: blur(6px);
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

.hero-panel .panel-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: #8f87ad;
  margin-bottom: 18px;
}

.panel-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.panel-inputs span {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  color: #cfc9e4;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 5px 11px;
  border-radius: 6px;
}

.panel-result {
  display: flex;
  align-items: center;
  gap: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 18px;
}

.panel-donut {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  background: conic-gradient(#2dd4bf 0% 89%, #fb7185 89% 100%);
}

.panel-donut::after {
  content: "";
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  background: #14112a;
}

.panel-headline {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1.1;
  background: linear-gradient(100deg, #2dd4bf, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.panel-sub { font-size: 0.8rem; color: #8f87ad; margin-top: 4px; }

.panel-lines { display: flex; flex-direction: column; gap: 9px; }

.panel-lines .pline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.82rem;
  color: #a49cc2;
}

.panel-lines .pline b {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  color: #f2effa;
}

.panel-lines .pline.teal b { color: #2dd4bf; }
.panel-lines .pline.pink b { color: #fb7185; }

.panel-foot {
  font-size: 0.72rem;
  color: #6f6791;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* ============================================================
   CURRENCY PICKER (per calculator)
   ============================================================ */

.currency-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.currency-pick {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.currency-pick-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  font-weight: 700;
}

.currency-pick select {
  font-family: "Inter", sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  max-width: 260px;
}

.currency-pick select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.currency-note {
  font-size: 0.76rem;
  color: var(--text-faint);
  line-height: 1.5;
}

.currency-locked {
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.55;
}

.currency-locked strong { color: var(--accent-deep); }

/* if JS fails to run, don't leave a stray divider line */
.currency-row:empty { display: none; }
