/* /tools/<slug>/ calculator pages. Loaded only there (pageCss in tools/tool.njk).
   Source of truth: Paper page "13 · Calculators · LOCKED" (F–N desktop, F-m mobile, Spec · Hero background system).
   Tints and label colors match _data/categories.js. */

/* ---------- category palette ---------- */
/* --tint: hero and chip fill. --tint-text: eyebrow, step numbers, chip sub-lines.
   --glyph / --glyph-shadow: the giant hero glyph, one step darker than the tint so it blends in.
   --accent / --accent-ink: the category's color for chart parts on the navy panel, and the text on top of it. */
.calc-page--debt { --tint: #e3f6ee; --tint-text: #0b6b47; --glyph: #cdedde; --glyph-shadow: #bbe4cf; --icon: #13a873; --icon-fill: #c7f0dd; --accent: #12a672; --accent-ink: var(--paper); }
.calc-page--loans { --tint: #e6efff; --tint-text: #004fd6; --glyph: #d4e3ff; --glyph-shadow: #c2d7ff; --icon: #054cff; --icon-fill: #dce9ff; --accent: #005eff; --accent-ink: var(--paper); }
.calc-page--home { --tint: #fdf1dc; --tint-text: #8a5a00; --glyph: #fae4bc; --glyph-shadow: #f4d69e; --icon: #d78900; --icon-fill: #ffe9b7; --accent: #f4a51c; --accent-ink: var(--navy); }
.calc-page--business { --tint: #ffe9e3; --tint-text: #b23a1f; --glyph: #ffd6ca; --glyph-shadow: #ffc6b6; --icon: #d9502c; --icon-fill: #ffe0d6; --accent: #ff7a59; --accent-ink: var(--navy); }
.calc-page--student { --tint: #eeeaff; --tint-text: #5b3fd6; --glyph: #ddd5ff; --glyph-shadow: #cfc4ff; --icon: #6a4ff0; --icon-fill: #e6e0ff; --accent: #6c4cf5; --accent-ink: var(--paper); }
.calc-page--insurance { --tint: #e0f4f6; --tint-text: #0a6e7d; --glyph: #c6eaee; --glyph-shadow: #b2e0e6; --icon: #0e8fa1; --icon-fill: #d3f0f3; --accent: #14a2b6; --accent-ink: var(--navy); }
.calc-page {
  --on-navy: rgba(255, 253, 250, 0.72);
  --on-navy-dim: rgba(255, 253, 250, 0.6);
  --navy-line: rgba(255, 253, 250, 0.16);
  --mint: #7ee2b8;
  --coral: #ff8a5c;
  --coral-text: #ffb4a2;
  --bad-text: #b23a1f;
  --slate: #46587a;
  font-variant-numeric: tabular-nums;
}

/* ---------- hero ---------- */
/* The glyph and icons sit in a 1440px frame centered on the hero, so the composition holds on wider screens. */
.calc-hero { position: relative; overflow: clip; padding: 24px 0 152px; background: var(--tint); }
.calc-hero__art { position: absolute; inset: 0; max-width: 1440px; margin-inline: auto; pointer-events: none; user-select: none; }
.calc-hero__glyph {
  position: absolute; top: 24px; right: var(--glyph-right, 0px);
  font-size: var(--glyph-size, 360px); line-height: 1; font-weight: 900; letter-spacing: -0.06em; white-space: nowrap;
  color: var(--glyph); text-shadow: 12px 12px 0 var(--glyph-shadow);
}
.calc-hero__icon { position: absolute; display: block; opacity: 0.6; color: var(--icon); --fill: var(--icon-fill); transform-origin: 0 0; }
.calc-hero__icon svg { display: block; width: 100%; height: 100%; }
.calc-hero__icon .f { fill: var(--fill); }
.calc-hero__icon--main { width: 201px; height: 134px; rotate: -8deg; }
.calc-hero__icon--second { width: 73px; height: 100px; rotate: 8deg; }
.calc-hero__icon--compact { width: 120px; height: 116px; rotate: -8deg; }
/* Text paints above the art. The wrap itself stays unpositioned so the art frame measures from the hero. */
.calc-crumbs, .calc-hero__title, .calc-hero__lede { position: relative; }

.calc-crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; line-height: 18px; color: color-mix(in srgb, var(--tint-text) 45%, var(--muted)); }
.calc-crumbs a { transition: color .15s; }
.calc-crumbs a:hover { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.calc-crumbs [aria-current] { color: var(--navy); }

.calc-hero__title { display: flex; flex-direction: column; gap: 16px; max-width: 760px; margin-top: 40px; }
.calc-hero__eyebrow { font-size: 14px; line-height: 18px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tint-text); }
.calc-hero__q { font-size: 68px; line-height: 70px; font-weight: 700; letter-spacing: -0.04em; color: var(--navy); text-wrap: balance; }
.calc-hero__lede { max-width: 600px; margin-top: 16px; font-size: 19px; line-height: 29px; color: color-mix(in srgb, var(--tint-text) 25%, var(--ink)); text-wrap: pretty; }

/* ---------- calculator card ---------- */
/* Two columns on desktop. Left: inputs, with the what-if row pinned to the bottom. Right: the navy result, with the CTA
   right under it. The result and CTA are separate grid cells; both are navy and touch, so the column reads as one panel. */
.calc-wrap { position: relative; z-index: 1; margin-top: -112px; }
.calc-card {
  position: relative; display: grid;
  grid-template-columns: minmax(0, 1fr) 500px; grid-template-rows: auto 1fr auto;
  grid-template-areas: "inputs result" "inputs cta" "whatif cta";
  border: 1px solid #d9ded9; border-radius: 28px; background: #fff; box-shadow: 0 24px 48px rgba(4, 25, 61, 0.1);
}
.calc-card__inputs { grid-area: inputs; display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 40px 40px 0; }
.calc-card__row { display: flex; gap: 12px; }
.calc-card__row > * { flex: 1 1 0; min-width: 0; }
.calc-card__heading { margin: 4px 0 -2px; padding: 0; font-size: 16px; line-height: 20px; font-weight: 600; color: var(--ink); }
.calc-card__whatif { grid-area: whatif; min-width: 0; padding: 14px 40px 40px; transition: opacity .15s; }
/* Stale: an input can't be worked out yet. The last answer stays, faded; the note carries the message. */
.calc-card__whatif.is-stale, [data-tool-aside].is-stale { opacity: 0.45; }
.calc-card__result.is-stale .calc-out > :not(.calc-out__note) { opacity: 0.35; }
.calc-card__result.is-stale .calc-out__note { color: var(--coral-text); }
.calc-card__result { grid-area: result; min-width: 0; padding: 40px 40px 18px; border-radius: 0 27px 0 0; background: var(--navy); color: var(--paper); }
.calc-card__cta { grid-area: cta; display: flex; flex-direction: column; justify-content: flex-start; gap: 10px; padding: 0 40px 40px; border-radius: 0 0 27px 0; background: var(--navy); }
.calc-card__btn {
  display: flex; align-items: center; justify-content: center; min-height: 54px; padding: 0 20px; border-radius: 12px;
  background: var(--pill); color: var(--navy); font-size: 16px; line-height: 20px; font-weight: 600; text-align: center;
  transition: background-color .15s, transform .15s var(--ease);
}
@media (hover: hover) { .calc-card__btn:hover { background: var(--sky); } }
.calc-card__btn:active { transform: scale(0.98); }
.calc-card__btn:focus-visible { outline-color: var(--paper); }
/* The sky ring is too faint on white and tints (about 2:1); blue is 5:1. */
.calc-card__inputs :focus-visible, .calc-card__whatif :focus-visible, .calc-door:focus-visible { outline-color: var(--blue); }
.calc-card__fine { font-size: 12px; line-height: 16px; color: rgba(255, 253, 250, 0.65); text-align: center; }
.calc-card__mini { position: absolute; right: 120px; top: -128px; width: 160px; height: 142px; object-fit: contain; object-position: 50% 100%; pointer-events: none; }

/* Inputs: the shared fields from site.css, sized up to the Paper card. */
.calc-card .amount { padding: 22px 24px 18px; border-radius: 12px; }
.calc-card .amount__head label { font-size: 16px; line-height: 20px; }
/* Proportional figures: a tabular "1" leaves a gap after the "$" in big numbers. */
.calc-card .amount__val { font-size: 34px; line-height: 38px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: proportional-nums; }
.calc-card .field { height: 68px; padding: 0 18px; border-radius: 12px; }
/* One-line labels: the absolute "$" and "%" sit on the input's line only while the label stays on one line. */
.calc-card .field label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.calc-card .field input, .calc-card .field select { font-size: 18px; line-height: 22px; }
.calc-card .field__affix, .calc-card .field__prefix { bottom: 14px; font-size: 18px; line-height: 22px; }
.calc-card .field__affix { right: 18px; }
.calc-card .field__prefix { left: 18px; }
.calc-card .field--prefix input { padding-left: 13px; }

/* Segmented toggle (business loan payment frequency). */
.seg-field { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.seg-field__label { font-size: 16px; line-height: 20px; font-weight: 600; color: var(--ink); }
.seg-field .seg { flex: 0 1 276px; }
.seg__opt { flex: 1 1 0; min-width: 0; border: 0; border-radius: 6px; background: none; font-size: 16px; line-height: 20px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s; }
@media (hover: hover) { .seg__opt:hover { color: var(--ink); } }
.seg__opt[aria-pressed="true"] { background: var(--navy); color: var(--paper); }

/* Debt payoff rows. */
.debts { display: flex; flex-direction: column; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.debts .calc-card__heading { margin-bottom: 4px; }
.debts__rows { display: flex; flex-direction: column; gap: 10px; }
.debt { display: grid; grid-template-columns: 56px minmax(0, 1.3fr) minmax(0, 0.85fr) minmax(0, 0.95fr) 44px; align-items: center; gap: 10px; }
.debt .field { height: 60px; }
.debt .field__prefix, .debt .field__affix { bottom: 10px; }
.debt__n { font-size: 15px; line-height: 20px; font-weight: 600; color: var(--muted); }
/* 44px hit area around a 32px circle. */
.debt__remove { position: relative; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; }
.debt__remove::before { content: ""; position: absolute; inset: 6px; border: 1px solid var(--border); border-radius: 999px; background: #fff; transition: border-color .15s; }
.debt__remove svg { position: relative; }
.debt__remove:hover { color: var(--ink); }
.debt__remove:hover::before { border-color: var(--ink); }
.debt__remove[hidden] { display: flex; visibility: hidden; }
.debts__add { align-self: flex-start; min-height: 44px; padding: 0 18px; border: 1px dashed var(--border-strong); border-radius: 10px; background: none; font-size: 16px; font-weight: 600; color: var(--blue); cursor: pointer; transition: border-color .15s; }
.debts__add:hover { border-color: var(--blue); }
.debts__add[hidden] { display: none; }
.calc-reset { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: auto; padding: 0; border: 0; background: none; font: inherit; font-size: 15px; font-weight: 600; color: var(--blue); cursor: pointer; }
.calc-reset svg { flex: none; }
/* Keeps its space while hidden, so showing it never shifts the card. */
.calc-reset.is-clean, .no-js .calc-reset { visibility: hidden; }
@media (hover: hover) and (pointer: fine) { .calc-reset:hover { text-decoration: underline; text-underline-offset: 3px; } }

/* ---------- block under the inputs ---------- */
.calc-aside { border-radius: 12px; background: var(--stone); font-size: 14px; line-height: 18px; }
.calc-aside b { font-weight: 600; color: var(--ink); }
.calc-aside--split { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; }
.calc-aside__head, .calc-aside__labels { display: flex; justify-content: space-between; gap: 16px; }
.calc-aside__head span { color: var(--muted); }
.calc-aside__labels { font-weight: 600; }
.calc-split { display: flex; gap: 3px; height: 14px; }
.calc-split .calc-part:first-child { border-radius: 4px 2px 2px 4px; }
.calc-split .calc-part:last-child { border-radius: 2px 4px 4px 2px; }
.calc-split .calc-part--bad { background: var(--coral); }
.calc-split .calc-part--good { background: #12a672; }
.calc-aside .is-bad { color: var(--bad-text); }
.calc-aside .is-good { color: var(--success); }
.calc-aside--cash { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; }
.calc-aside--cash p { display: flex; flex-direction: column; gap: 2px; }
.calc-aside--cash b { font-size: 15px; line-height: 20px; }
.calc-aside--cash span { font-size: 13px; line-height: 18px; color: var(--muted); }
.calc-aside--cash strong { font-size: 26px; line-height: 32px; font-weight: 700; letter-spacing: -0.02em; color: var(--navy); }
.calc-aside--notice, .calc-aside--hint { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; background: var(--tint); line-height: 22px; color: var(--ink); }
.calc-aside__mark { flex-shrink: 0; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; background: var(--tint-text); color: #fff; font-size: 13px; line-height: 1; font-weight: 700; }
.calc-aside--hint .calc-dot { margin-top: 7px; }

/* ---------- what-if chips ---------- */
.calc-whatif { display: flex; flex-direction: column; gap: 10px; padding-top: 24px; border-top: 1px solid var(--border); }
.calc-whatif__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.calc-whatif__head h2 { font-size: 16px; line-height: 20px; font-weight: 600; color: var(--ink); }
.calc-whatif__head span { font-size: 13px; line-height: 16px; color: var(--subtle); }
.calc-whatif__chips { display: flex; gap: 8px; }
.calc-chip {
  flex: 1 1 0; min-width: 0; min-height: 56px; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 12px 14px; border: 0; border-radius: 12px; background: var(--tint); text-align: left; cursor: pointer;
  transition: background-color .15s, transform .15s var(--ease);
}
.calc-chip b { font-size: 13px; line-height: 16px; font-weight: 600; color: var(--navy); }
.calc-chip span { font-size: 12px; line-height: 16px; color: var(--tint-text); }
.calc-chip--good span { color: var(--success); }
.calc-chip--bad span { color: var(--bad-text); }
@media (hover: hover) { .calc-chip:not([aria-pressed="true"]):hover { background: color-mix(in srgb, var(--tint-text) 9%, var(--tint)); } }
.calc-chip:active { transform: scale(0.97); }
.calc-chip[aria-pressed="true"] { background: var(--navy); cursor: default; }
.calc-chip[aria-pressed="true"] b { color: var(--paper); }
.calc-chip[aria-pressed="true"] span { color: rgba(255, 253, 250, 0.7); }

/* ---------- result panel ---------- */
.calc-out { display: flex; flex-direction: column; gap: 4px; }
.calc-out__label { font-size: 16px; line-height: 20px; font-weight: 600; color: var(--sky); }
.calc-out__big { display: flex; align-items: baseline; flex-wrap: wrap; font-size: 72px; line-height: 74px; font-weight: 800; letter-spacing: -0.04em; color: var(--paper); font-variant-numeric: proportional-nums; }
.calc-out__big span { white-space: nowrap; }
.calc-out__big small { font-size: 26px; line-height: 30px; font-weight: 600; letter-spacing: 0; color: rgba(255, 253, 250, 0.75); }
.calc-out__big small.is-word { margin-left: 0.25em; }
.calc-out__big.is-good { color: var(--mint); }
.calc-out__big.is-bad { color: var(--coral-text); }
.calc-out.is-blank .calc-out__big { color: rgba(255, 253, 250, 0.45); }
.calc-out__note { font-size: 15px; line-height: 22px; color: rgba(255, 253, 250, 0.8); text-wrap: pretty; }
.calc-out > .calc-chart, .calc-out__stats { margin-top: 14px; }
.calc-out__stats { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 0; border-top: 1px solid var(--navy-line); }
.calc-out__stats div { min-width: 0; padding: 14px 12px 14px 0; border-bottom: 1px solid var(--navy-line); }
.calc-out__stats div:nth-child(even) { padding: 14px 0 14px 18px; border-left: 1px solid var(--navy-line); }
.calc-out__stats dt { font-size: 13px; line-height: 16px; color: var(--on-navy); }
.calc-out__stats dd { margin: 2px 0 0; font-size: 22px; line-height: 28px; font-weight: 700; color: var(--paper); }
.calc-out__stats dd.is-good { color: var(--mint); }
.calc-out__stats dd.is-bad { color: var(--coral-text); }

/* ---------- charts (all on the navy panel) ---------- */
.calc-chart__title { margin-bottom: 10px; font-size: 14px; line-height: 18px; font-weight: 600; color: var(--paper); }
.calc-chart__caption { margin-top: 10px; font-size: 12px; line-height: 16px; color: var(--on-navy-dim); }
.calc-chart__axis { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 12px; line-height: 16px; color: var(--on-navy-dim); }
.calc-dot { display: inline-block; flex-shrink: 0; width: 8px; height: 8px; border-radius: 999px; background: var(--paper); }
.calc-dot--main { background: #4d8dff; }
.calc-dot--light { background: var(--sky); }
.calc-dot--bad { background: var(--coral); }
.calc-dot--accent { background: var(--accent); }
.calc-dot--paper { background: var(--paper); }
.calc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; line-height: 16px; color: var(--on-navy); }
.calc-legend li { display: flex; align-items: center; gap: 6px; }

/* Balance curve */
.calc-curve__plot { position: relative; height: 120px; }
.calc-curve { display: block; width: 100%; height: 100%; overflow: visible; }
.calc-curve__area { fill: rgba(18, 166, 114, 0.22); }
.calc-curve__main { fill: none; stroke: var(--mint); stroke-width: 3; stroke-linejoin: round; }
.calc-curve__alt { fill: none; stroke: rgba(255, 253, 250, 0.7); stroke-width: 2; stroke-dasharray: 5 5; }
.calc-curve__dot { position: absolute; top: 95%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 999px; background: var(--mint); }

/* Snowball vs. avalanche race */
.calc-race__label { margin-bottom: 8px; font-size: 14px; line-height: 18px; color: var(--on-navy); }
.calc-race__label--main { font-weight: 600; color: var(--paper); }
.calc-race__bar { display: flex; gap: 3px; height: 34px; }
.calc-race__bar + .calc-race__label { margin-top: 14px; }
.calc-seg { min-width: 0; overflow: hidden; text-overflow: ellipsis; padding: 0 10px; font-size: 12px; line-height: 34px; font-weight: 600; white-space: nowrap; color: var(--paper); }
.calc-seg:first-child { border-radius: 6px 2px 2px 6px; }
.calc-seg:last-child { border-radius: 2px 6px 6px 2px; }
.calc-seg:only-child { border-radius: 6px; }
.calc-seg.is-unlabeled, .calc-stack .calc-part.is-unlabeled { color: transparent; }
.calc-seg--main-0 { background: #12a672; color: var(--navy); }
.calc-seg--main-1 { background: #5dd3a6; color: var(--navy); }
.calc-seg--main-2 { background: #b4edd5; color: var(--navy); }
.calc-seg--alt-0 { background: #4a5a78; }
.calc-seg--alt-1 { background: #3a4a6a; }
.calc-seg--alt-2 { background: #2b3b5c; }

/* Horizontal bars and one-bar stacks share their part colors. */
.calc-bars { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 16px; }
.calc-bars__label { font-size: 14px; line-height: 18px; font-weight: 600; color: var(--paper); white-space: nowrap; }
.calc-bars__track { display: block; height: 30px; }
.calc-bars__fill { display: flex; gap: 2px; height: 100%; min-width: 6px; }
.calc-bars__value { font-size: 13px; line-height: 16px; font-weight: 600; color: var(--paper); text-align: right; }
.calc-bars .calc-part:first-child { border-radius: 6px 0 0 6px; }
.calc-bars .calc-part:last-child { border-radius: 0 6px 6px 0; }
.calc-bars .calc-part:only-child { border-radius: 6px; }
.calc-stack { display: flex; gap: 3px; height: 40px; }
.calc-stack .calc-part { min-width: 4px; overflow: hidden; text-overflow: ellipsis; padding: 0 12px; font-size: 13px; line-height: 40px; font-weight: 600; white-space: nowrap; color: var(--paper); }
.calc-stack .calc-part:first-child { border-radius: 8px 2px 2px 8px; }
.calc-stack .calc-part:last-child { border-radius: 2px 8px 8px 2px; }
.calc-stack .calc-part:only-child { border-radius: 8px; }
.calc-part { display: block; }
.calc-chart .calc-part--bad { background: var(--coral); color: var(--navy); }
.calc-chart .calc-part--good { background: #12a672; }
.calc-chart .calc-part--good-light { background: var(--mint); }
.calc-chart .calc-part--muted { background: var(--slate); }
.calc-chart .calc-part--accent { background: var(--accent); color: var(--accent-ink); }
.calc-chart .calc-part--light { background: var(--sky); color: var(--navy); }
.calc-chart .calc-part--paper { background: var(--paper); padding: 0; }
.calc-chart .calc-part--dim { background: rgba(255, 253, 250, 0.1); font-weight: 500; color: var(--on-navy); }

/* Loan cost ring */
.calc-chart--ring { display: flex; align-items: center; gap: 28px; }
.calc-ring { flex-shrink: 0; width: 140px; height: 140px; }
.calc-ring circle { fill: none; stroke-width: 14; }
.calc-ring__main { stroke: var(--accent); }
.calc-ring__light { stroke: var(--sky); }
.calc-ring__bad { stroke: var(--coral); }
.calc-legend--stack { flex-direction: column; gap: 10px; margin-top: 0; }
.calc-legend--stack li { display: grid; grid-template-columns: 8px auto; align-items: center; column-gap: 6px; font-size: 13px; line-height: 16px; }
.calc-legend--stack b { grid-column: 2; font-size: 18px; line-height: 22px; font-weight: 700; color: var(--paper); }

/* DTI gauge */
.calc-chart--gauge { display: flex; justify-content: center; }
.calc-gauge { display: block; width: 100%; max-width: 300px; height: auto; overflow: visible; }
.calc-gauge__zone { fill: none; stroke-width: 22; }
.calc-gauge__zone--0 { stroke: #3dcb8a; }
.calc-gauge__zone--1 { stroke: var(--gold); }
.calc-gauge__zone--2 { stroke: var(--coral); }
.calc-gauge__zone--3 { stroke: #ff5a5a; }
.calc-gauge__needle { stroke: var(--paper); stroke-width: 4; stroke-linecap: round; }
.calc-gauge__hub { fill: var(--paper); }
.calc-gauge text { fill: var(--on-navy-dim); font-size: 11px; font-family: var(--font); }

/* ---------- how it works ---------- */
.calc-h2 { font-size: 36px; line-height: 42px; font-weight: 700; letter-spacing: -0.03em; color: var(--navy); }
.calc-how { display: grid; grid-template-columns: minmax(0, 1fr) 420px; align-items: start; gap: 64px; padding-top: 112px; }
.calc-how__steps { margin: 24px 0 0; padding: 0; list-style: none; border-bottom: 1px solid var(--border); }
.calc-how__steps li { display: flex; gap: 20px; padding: 18px 0; border-top: 1px solid var(--border); }
.calc-how__steps li > span { flex: 0 0 32px; font-size: 15px; line-height: 26px; font-weight: 700; color: var(--tint-text); }
.calc-how__steps p { max-width: 720px; font-size: 17px; line-height: 26px; color: var(--ink); text-wrap: pretty; }
.calc-how__box { display: flex; flex-direction: column; gap: 14px; padding: 28px; border-radius: 20px; background: var(--stone); }
.calc-how__box h2 { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.calc-how__box ul { display: flex; flex-direction: column; gap: 14px; }
.calc-how__box li { font-size: 15px; line-height: 22px; color: var(--ink); }
.calc-how__box li a { text-decoration: underline 1px var(--border-strong); text-underline-offset: 3px; transition: color .15s, text-decoration-color .15s; }
.calc-how__box li a:hover { color: var(--blue); text-decoration-color: currentColor; }
.calc-how__box li span { color: var(--muted); }
.calc-how__formula { font-size: 15px; line-height: 22px; color: var(--ink); }
.calc-how__updated { padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; line-height: 20px; color: var(--muted); }

/* ---------- FAQ (partials/faq.njk) ---------- */
.calc-faq .faq > h2 { font-size: 36px; line-height: 42px; font-weight: 700; letter-spacing: -0.03em; }
.calc-faq .faq__item summary { padding: 22px 0; font-size: 20px; line-height: 30px; color: var(--navy); }
.calc-faq .faq__item p { padding: 0 0 22px; font-size: 15px; line-height: 24px; }

/* ---------- related calculators ---------- */
.calc-related { padding: 112px 0 120px; }
.calc-related__head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; }
.calc-related__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.calc-door { display: flex; flex-direction: column; min-height: 300px; overflow: clip; border-radius: 32px; background: var(--tint); transition: transform .25s var(--ease), box-shadow .25s; }
.calc-door--debt { --tint: #e3f6ee; --tint-text: #0b6b47; }
.calc-door--loans { --tint: #e6efff; --tint-text: #004fd6; }
.calc-door--home { --tint: #fdf1dc; --tint-text: #8a5a00; }
.calc-door--business { --tint: #ffe9e3; --tint-text: #b23a1f; }
.calc-door--student { --tint: #eeeaff; --tint-text: #5b3fd6; }
.calc-door--insurance { --tint: #e0f4f6; --tint-text: #0a6e7d; }
.calc-door__desk { padding: 32px 28px 0; font-size: 13px; line-height: 16px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tint-text); }
.calc-door__title { margin-top: 10px; padding: 0 28px; font-size: 26px; line-height: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--navy); }
.calc-door__q { margin-top: 10px; padding: 0 28px; font-size: 15px; line-height: 22px; color: var(--muted); }
.calc-door__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: auto; padding-left: 28px; }
.calc-door__stat { display: flex; flex-direction: column; gap: 2px; padding: 24px 0 32px; }
.calc-door__stat small { font-size: 13px; line-height: 16px; font-weight: 500; color: var(--tint-text); }
.calc-door__stat b { font-size: 40px; line-height: 44px; font-weight: 700; letter-spacing: -0.03em; color: var(--navy); white-space: nowrap; }
.calc-door__foot img { flex-shrink: 0; width: 150px; height: 133px; margin: 16px 16px 0 0; object-fit: contain; object-position: 50% 100%; }
@media (hover: hover) {
  .calc-door:hover { transform: translateY(-3px); box-shadow: 0 16px 32px rgba(4, 25, 61, 0.08); }
}

/* ---------- narrower desktops and tablets ---------- */
@media (max-width: 1240px) {
  .calc-card { grid-template-columns: minmax(0, 1fr) 420px; }
  .calc-card__result { padding-inline: 32px; }
  .calc-card__cta { padding-inline: 32px; }
  .calc-hero__glyph { font-size: calc(var(--glyph-size, 360px) * 0.8); }
  .calc-how { grid-template-columns: minmax(0, 1fr) 360px; gap: 48px; }
  .calc-out__big { font-size: 64px; line-height: 66px; }
  .calc-door__stat b { font-size: 32px; line-height: 36px; }
  .calc-door__foot img { width: 110px; height: 98px; }
}
/* Hero icons sit at fixed offsets from the right edge; below this width they would run into the headline. */
@media (max-width: 1360px) {
  .calc-hero__icon { display: none; }
}
@media (max-width: 1040px) {
  .calc-hero__q { font-size: 52px; line-height: 56px; }
  .calc-hero__glyph { font-size: calc(var(--glyph-size, 360px) * 0.62); top: auto; bottom: 80px; }
}

/* ---------- stacked card (below 1100px, per F-m) ---------- */
/* One column: inputs, then the navy result, what-if, and CTA as one block. The what-if chips switch to the dark style.
   Two columns stop at 1100px: below it the chip titles and field labels start to wrap. */
@media (max-width: 1100px) {
  .calc-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "inputs" "result" "whatif" "cta"; border-radius: 24px; border-color: var(--border); box-shadow: 0 12px 40px rgba(4, 25, 61, 0.1); }
  .calc-card__inputs { padding: 32px 32px 28px; }
  .calc-card__result { padding: 32px 32px 0; border-radius: 0; }
  .calc-card__whatif { padding: 20px 32px 0; background: var(--navy); }
  .calc-card__whatif :focus-visible { outline-color: var(--pill); }
  .calc-card__cta { gap: 12px; padding: 20px 32px 28px; border-radius: 0 0 23px 23px; }
  .calc-card__mini { top: -120px; right: 32px; width: 140px; height: 124px; }

  .calc-whatif { gap: 8px; padding-top: 0; border-top: 0; }
  .calc-whatif__head h2 { font-size: 14px; line-height: 18px; color: var(--paper); }
  .calc-whatif__head span { display: none; }
  .calc-whatif__chips { flex-wrap: wrap; }
  .calc-chip { flex: 1 1 40%; gap: 1px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--navy-line); background: rgba(255, 253, 250, 0.08); }
  .calc-chip b { font-size: 13px; line-height: 17px; font-weight: 700; color: var(--paper); white-space: nowrap; }
  .calc-chip span, .calc-chip--good span { font-size: 11px; line-height: 14px; color: var(--mint); }
  .calc-chip--bad span { color: var(--coral-text); }
  .calc-chip:not([aria-pressed="true"]):not(.calc-chip--good):not(.calc-chip--bad) span { color: var(--on-navy); }
  @media (hover: hover) { .calc-chip:not([aria-pressed="true"]):hover { background: rgba(255, 253, 250, 0.14); } }
  .calc-chip[aria-pressed="true"] { border-color: var(--paper); background: var(--paper); }
  .calc-chip[aria-pressed="true"] b { color: var(--navy); }
  .calc-chip[aria-pressed="true"] span { color: var(--subtle); }
}

@media (max-width: 900px) {
  .calc-hero { padding: 20px 0 56px; }
  .calc-hero__title { margin-top: 20px; gap: 12px; }
  .calc-hero__glyph { top: auto; right: -6px; bottom: -28px; font-size: 170px; text-shadow: 6px 6px 0 var(--glyph-shadow); }
  .calc-wrap { width: calc(100% - 24px); margin-top: -16px; }
  .calc-card__inputs { gap: 10px; padding: 16px 16px 20px; }
  .calc-card__result { padding: 22px 20px 0; }
  .calc-card__whatif { padding: 16px 20px 0; }
  .calc-card__cta { padding: 16px 20px 20px; }
  .calc-card__btn { min-height: 52px; border-radius: 14px; }
  .calc-card__fine { font-size: 11px; line-height: 14px; }
  .calc-card__mini { top: -88px; right: 12px; width: 100px; height: 94px; }

  .calc-how { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 56px; }
  .calc-faq .section { padding-top: 72px; }
  .calc-related { padding: 64px 0 72px; }
  /* Related cards become compact rows: title and question, then the answer on the right. */
  /* "All calculators" moves under the cards, as in F-m. */
  .calc-related { display: flex; flex-direction: column; }
  .calc-related__head { display: contents; }
  .calc-related__head .link { order: 1; display: flex; align-items: center; align-self: center; min-height: 44px; margin-top: 12px; }
  .calc-related__grid { grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 16px; }
  .calc-door { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; min-height: 0; padding: 16px 12px 16px 18px; border-radius: 20px; }
  .calc-door__desk, .calc-door__foot img { display: none; }
  .calc-door__title { grid-column: 1; margin: 0; padding: 0; font-size: 17px; line-height: 22px; }
  .calc-door__q { grid-column: 1; margin-top: 4px; padding: 0; font-size: 13px; line-height: 18px; }
  .calc-door__foot { grid-column: 2; grid-row: 1 / span 2; margin: 0; padding: 0; }
  .calc-door__stat { align-items: flex-end; padding: 0; }
  .calc-door__stat small { font-size: 11px; line-height: 14px; font-weight: 400; }
  .calc-door__stat b { font-size: 22px; line-height: 26px; font-weight: 800; }
}

@media (max-width: 560px) {
  .calc-page .wrap { width: calc(100% - 40px); }
  .calc-page .calc-wrap { width: calc(100% - 24px); }
  .calc-hero { padding-bottom: 44px; }
  .calc-crumbs { gap: 6px; font-size: 12px; line-height: 16px; }
  .calc-hero__eyebrow { font-size: 12px; line-height: 16px; }
  .calc-hero__q { max-width: 260px; font-size: 36px; line-height: 38px; font-weight: 800; }
  /* Leave room for the mini, which stands at the hero's bottom-right corner. */
  .calc-hero__lede { max-width: calc(100% - 112px); margin-top: 12px; font-size: 15px; line-height: 22px; }

  .calc-card .amount { padding: 14px 16px 12px; border-radius: 16px; }
  .calc-card .amount__head label { font-size: 14px; line-height: 18px; font-weight: 500; }
  .calc-card .amount__val { font-size: 26px; line-height: 30px; }
  .calc-card .field { height: 60px; padding: 0 14px; border-radius: 14px; }
  .calc-card .field label { font-size: 11px; line-height: 14px; }
  .calc-card .field input, .calc-card .field select, .calc-card .field__affix, .calc-card .field__prefix { font-size: 17px; line-height: 22px; }
  .calc-card .field__affix { right: 14px; bottom: 11px; }
  .calc-card .field__prefix { left: 14px; bottom: 11px; }
  .calc-card__row { gap: 10px; }
  /* Three fields in a row do not fit at 390px: the third drops to its own line. */
  .calc-card__row { flex-wrap: wrap; }
  .calc-card__row > * { flex: 1 1 calc(50% - 5px); }
  .seg-field { flex-direction: column; align-items: stretch; gap: 8px; }
  .seg-field .seg { flex-basis: auto; }

  .calc-aside--split { gap: 8px; padding: 12px 14px; border-radius: 14px; }
  .calc-aside--split .calc-aside__head { font-size: 13px; line-height: 16px; }
  .calc-aside__head span { display: none; }
  .calc-aside__labels { font-size: 12px; line-height: 16px; }
  .calc-split { height: 10px; }
  .calc-aside--cash { padding: 14px 16px; }
  .calc-aside--cash strong { font-size: 22px; line-height: 28px; }
  .calc-aside--notice, .calc-aside--hint { padding: 12px 14px; font-size: 13px; line-height: 20px; }

  .calc-out__label { font-size: 13px; line-height: 16px; }
  .calc-out__big { font-size: 56px; line-height: 58px; }
  .calc-out__big small { font-size: 22px; line-height: 26px; }
  .calc-out__note { font-size: 14px; line-height: 20px; color: var(--on-navy); }
  .calc-out > .calc-chart, .calc-out__stats { margin-top: 12px; }
  .calc-out__stats div { padding-block: 12px; }
  .calc-out__stats div:nth-child(even) { padding-left: 16px; }
  .calc-out__stats dt { font-size: 12px; }
  .calc-out__stats dd { font-size: 20px; line-height: 24px; }
  .calc-curve__plot { height: 84px; }
  .calc-chart__axis { font-size: 11px; line-height: 14px; }
  .calc-chart--ring { gap: 20px; }
  .calc-ring { width: 112px; height: 112px; }
  .calc-bars { column-gap: 10px; }

  .debt { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
  .debt__n { grid-area: 1 / 1; }
  .debt__remove { grid-area: 1 / 2; justify-self: end; margin: -8px -8px -8px 0; }
  .debt > .field:nth-child(2) { grid-column: 1 / -1; }

  .calc-h2 { font-size: 26px; line-height: 30px; }
  .calc-how { padding-top: 40px; }
  .calc-how__steps { margin-top: 16px; }
  .calc-how__steps li { gap: 16px; padding: 14px 0; }
  .calc-how__steps p { font-size: 15px; line-height: 22px; }
  .calc-how__box { padding: 20px; border-radius: 16px; }
  .calc-how__box li { font-size: 14px; line-height: 20px; }
  .calc-faq .section { padding-top: 48px; }
  .calc-faq .faq > h2 { font-size: 26px; line-height: 30px; }
  .calc-faq .faq__item summary { padding: 16px 0; font-size: 17px; line-height: 24px; }
  .calc-related { padding: 48px 0 56px; }

}

@media (prefers-reduced-motion: reduce) {
  .calc-chip, .calc-card__btn, .calc-door { transition: none; }
  .calc-chip:active, .calc-card__btn:active { transform: none; }
  .calc-door:hover { transform: none; }
}
