/* Reamortize — shared styles. Home: a full-width "stage" band with a lump-sum slider and one big readout, then insight panels.
   Articles: editorial column with a sticky contents sidebar. */
:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --ink: #1b1a2e;
  --muted: #5f5d70;
  --line: #e6e3ee;
  --accent: #4338ca;
  --accent-ink: #ffffff;
  --accent-soft: #ecebfb;
  --highlight: #e0a12b;
  --scen-none: #a09eb0;
  --scen-recast: #4338ca;
  --scen-prepay: #c7700f;
  --stage-a: #eeedfc;
  --stage-b: #faf9f7;
  --footer-bg: #1b1a2e;
  --footer-ink: #c3c1d6;
  --error: #b42318;
  --display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12111c; --surface: #1b1a29; --ink: #ecebf5; --muted: #a3a1b8; --line: #2c2a40;
    --accent: #9fa6ff; --accent-ink: #14123a; --accent-soft: #252347; --highlight: #f2c15e;
    --scen-none: #6f6d85; --scen-recast: #9fa6ff; --scen-prepay: #f0a94a;
    --stage-a: #1e1c38; --stage-b: #12111c; --footer-bg: #0b0a13; --footer-ink: #a3a1b8; --error: #ff8a80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12111c; --surface: #1b1a29; --ink: #ecebf5; --muted: #a3a1b8; --line: #2c2a40;
  --accent: #9fa6ff; --accent-ink: #14123a; --accent-soft: #252347; --highlight: #f2c15e;
  --scen-none: #6f6d85; --scen-recast: #9fa6ff; --scen-prepay: #f0a94a;
  --stage-a: #1e1c38; --stage-b: #12111c; --footer-bg: #0b0a13; --footer-ink: #a3a1b8; --error: #ff8a80;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 17px; line-height: 1.65;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.container {
  max-width: 1120px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Header: sits on the page background, no bar */
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; padding-block: 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; font-size: 15px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 6px 12px; border-radius: 999px; }
.nav a:hover { color: var(--ink); background: var(--accent-soft); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.home .site-header { background: var(--stage-a); }

/* ---------- Home: the stage ---------- */
.stage { background: linear-gradient(180deg, var(--stage-a), var(--stage-b)); padding-block: 12px 40px; }
.stage-inner { max-width: 760px; text-align: center; }
.eyebrow { font: 600 13px var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 16px 0 10px; }
.question { font-family: var(--display); font-weight: 700; font-size: clamp(30px, 5.4vw, 48px); line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; margin: 0 auto 8px; max-width: 20ch; }

.lump-amount { display: inline-flex; align-items: baseline; gap: 2px; border-bottom: 2px solid var(--line); padding: 0 6px; margin-bottom: 18px; }
.lump-amount:focus-within { border-color: var(--accent); }
.lump-amount span { font-family: var(--display); font-size: 34px; color: var(--muted); }
.lump-amount input[type="text"] { font: 700 44px var(--display); color: var(--ink); background: transparent; border: 0; border-radius: 0; width: 5.6ch; max-width: 11ch; text-align: center; padding: 0; font-variant-numeric: tabular-nums; }
.lump-amount input[type="text"]:focus { outline: none; box-shadow: none; }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; margin: 0; cursor: pointer; --pct: 0%; }
.range::-webkit-slider-runnable-track { height: 10px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--pct), var(--line) var(--pct)); }
.range::-moz-range-track { height: 10px; border-radius: 999px; background: var(--line); }
.range::-moz-range-progress { height: 10px; border-radius: 999px; background: var(--accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -10px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(20, 18, 58, .25); }
.range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(20, 18, 58, .25); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 6px var(--accent-soft); }
.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 6px var(--accent-soft); }
.range-ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; }

.readout { margin: 36px auto 0; transition: opacity .2s ease; }
.readout-label { font-size: 15px; color: var(--muted); font-weight: 500; }
.readout-value { font-family: var(--display); font-weight: 700; font-size: clamp(56px, 12vw, 96px); line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin: 6px 0 10px; }
.readout-value small { font-size: .32em; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.readout-delta { font-size: 17px; margin: 0 auto; max-width: 46ch; }
.readout-delta strong { color: var(--accent); }
.chips { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chips li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.chips li strong { font-weight: 600; }

/* Steps: 1 = your loan (open, empty on arrival), 2 = lump sum + fee (locked until step 1 is filled) */
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px 22px; margin-top: 20px; text-align: left; box-shadow: 0 1px 2px rgba(20, 18, 58, .04); transition: opacity .2s ease; }
.step-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.step-head h2 { font-family: var(--display); font-size: 22px; line-height: 1.2; margin: 0; flex: 1 1 0; min-width: 0; text-align: left; }
.step-head h2 label { cursor: inherit; }
.step-head .text-btn { margin-left: auto; }
.step-num { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 700 15px var(--body); background: var(--accent); color: var(--accent-ink); }
.step.done .step-num { font-size: 0; }
.step.done .step-num::before { content: "✓"; font-size: 16px; }
.step-hint { color: var(--muted); font-size: 15px; margin: 6px 0 16px 42px; }
.step-status { font-size: 14.5px; color: var(--muted); margin: 14px 0 0; }
.step-status strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.opt { font-weight: 400; color: var(--muted); }
#step-lump { text-align: center; }
#step-lump .step-head { margin-bottom: 18px; }
.fee-row { display: flex; align-items: center; justify-content: center; gap: 8px 12px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; }
.fee-row label { font-weight: 600; }
.fee-row .input-wrap { width: 120px; }
.fee-row small { color: var(--muted); font-size: 13.5px; }
.is-locked #step-lump, .is-locked .readout { opacity: .4; }
.is-locked #step-lump { pointer-events: none; }
.is-locked .range { cursor: not-allowed; }
.loan-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .loan-grid { grid-template-columns: 1fr 1fr; } .field-wide { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .pre, .input-wrap .post { position: absolute; color: var(--muted); font-size: 16px; pointer-events: none; }
.input-wrap .pre { left: 12px; }
.input-wrap .post { right: 12px; }
.input-wrap .pre + input { padding-left: 28px; }
.input-wrap.has-post input { padding-right: 44px; }
input[type="text"], input[type="number"] {
  width: 100%; font: 500 17px var(--body); color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-variant-numeric: tabular-nums;
}
input::placeholder { color: var(--muted); opacity: .5; font-weight: 400; }
input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.text-btn { background: none; border: 0; padding: 0; color: var(--accent); font: 600 14px var(--body); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.field-error { color: var(--error); font-size: 15px; font-weight: 500; margin: 16px 0 0; }

/* ---------- Home: insights under the stage ---------- */
.insights { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; padding-block: 8px 24px; }
@media (max-width: 880px) { .insights { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; min-width: 0; }
.panel h2 { font-family: var(--display); font-size: 24px; line-height: 1.2; margin: 0 0 4px; }
.panel .sub { color: var(--muted); font-size: 15px; margin: 0 0 18px; }

.path { margin-bottom: 18px; }
.path-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; font-size: 15px; }
.path-head strong { font-size: 16px; }
.path-head span { color: var(--muted); font-variant-numeric: tabular-nums; }
.track { height: 14px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; margin: 8px 0 6px; }
.fill { height: 100%; border-radius: 999px; transition: width .25s ease; }
.path-foot { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.verdict { margin: 22px 0 0; padding: 14px 16px; border-left: 4px solid var(--highlight); background: var(--bg); border-radius: 0 10px 10px 0; font-size: 15.5px; }

.chart-wrap canvas { width: 100%; height: 280px; display: block; }
.legend { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); margin-top: 12px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }

.schedule-wrap { padding-block: 0 8px; }
details.schedule { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
details.schedule summary { cursor: pointer; font-weight: 600; }
details.schedule .table-scroll { max-height: 360px; overflow: auto; margin-top: 10px; }
.compare { width: 100%; border-collapse: collapse; font-size: 15px; }
.compare th, .compare td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.compare th:first-child, .compare td:first-child { text-align: left; }
.compare thead th { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }

/* Ad slots: reserve space so the layout doesn't jump when ads load.
   A slot holding only its placeholder comment counts as :empty and stays hidden until an ad unit is pasted in. */
.ad-slot { margin-block: 28px; min-height: 100px; display: flex; align-items: center; justify-content: center; }
.ad-slot:empty { display: none; }

/* ---------- Articles: editorial column + sticky contents ---------- */
.article-head { padding-block: 36px 8px; }
.article-head .eyebrow { margin: 0 0 12px; }
.article-head .eyebrow a { color: inherit; text-decoration: none; }
.article-head h1 { font-family: var(--display); font-size: clamp(34px, 5.6vw, 56px); line-height: 1.05; margin: 0 0 14px; letter-spacing: -0.025em; text-wrap: balance; max-width: 22ch; }
.article-head .meta { color: var(--muted); font-size: 14px; margin: 0; }
.article-grid { display: grid; grid-template-columns: 220px minmax(0, 720px); gap: 56px; padding-block: 24px 56px; }
@media (max-width: 960px) { .article-grid { grid-template-columns: minmax(0, 1fr); gap: 0; } .toc { display: none; } }
.toc { position: sticky; top: 24px; align-self: start; font-size: 14px; border-top: 2px solid var(--ink); padding-top: 12px; }
.toc p { font-weight: 600; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; color: var(--muted); }
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc a { display: block; padding: 6px 0 6px 12px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

.takeaways { background: var(--accent-soft); border-radius: var(--radius); padding: 18px 22px 8px; margin: 0 0 32px; }
.content .takeaways h2 { font-family: var(--body); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin: 0 0 6px; }
.takeaways ul { padding-left: 20px; margin: 0 0 10px; }

.content { max-width: 720px; padding-block: 8px 48px; }
.article-grid .content { padding-block: 0; }
.content h2 { font-family: var(--display); font-size: clamp(26px, 3.4vw, 32px); line-height: 1.2; margin: 48px 0 12px; letter-spacing: -0.015em; text-wrap: balance; }
.content h3 { font-family: var(--display); font-size: 21px; margin: 28px 0 8px; }
.content p, .content li { color: var(--ink); }
.content ul, .content ol { padding-left: 22px; }
.content li { margin-bottom: 6px; }
.content .lede { font-size: 19.5px; line-height: 1.6; }
.content .callout { background: var(--accent-soft); border-radius: var(--radius); padding: 16px 18px; margin: 20px 0; }
.content table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 16px 0; }
.content th, .content td { border-bottom: 1px solid var(--line); padding: 9px 8px; text-align: left; vertical-align: top; }
.content th { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.content .letter { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; padding: 4px 20px; margin: 20px 0; font-size: 16px; }
.glossary { margin: 8px 0 0; }
.glossary dt { font-family: var(--display); font-weight: 700; font-size: 19px; margin-top: 22px; scroll-margin-top: 24px; }
.glossary dd { margin: 4px 0 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.guide-list { list-style: none; padding: 0 !important; margin: 24px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.guide-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0; }
.guide-list a { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.25; text-decoration: none; }
.guide-list a:hover { text-decoration: underline; }
.guide-list p { margin: 6px 0 0; color: var(--muted); font-size: 15.5px; }
.page-head { padding-block: 36px 8px; }
.page-head h1 { font-family: var(--display); font-size: clamp(34px, 5.6vw, 52px); line-height: 1.06; margin: 0 0 10px; letter-spacing: -0.025em; text-wrap: balance; }
.page-head .meta { color: var(--muted); font-size: 14px; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 17px; }
.faq details p { margin: 10px 0 0; }

/* Footer: dark band, links in a column on the right */
.site-footer { background: var(--footer-bg); color: var(--footer-ink); padding-block: 40px; font-size: 14px; margin-top: 24px; }
.site-footer .container { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 48px; }
.footer-links { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 6px; }
.footer-links a { color: var(--footer-ink); text-decoration: none; }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.site-footer p { margin: 0; }
.disclaimer { max-width: 70ch; font-size: 13px; line-height: 1.55; }
@media (max-width: 640px) {
  .site-footer .container { grid-template-columns: 1fr; gap: 20px; }
  .footer-links { grid-column: 1; grid-row: auto; flex-direction: row; flex-wrap: wrap; gap: 8px 18px; order: -1; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
