/* BudgetBee — shared design system
   Self-contained, no external deps (fast, CSP-safe). Light + dark. Mobile-first. */

:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f4f1ea;
  --ink: #1a1f24;
  --muted: #5b6570;
  --border: #e7e3da;
  --accent: #e8930c;      /* honey */
  --accent-ink: #7a4d00;
  --good: #109c6a;        /* growth / positive money */
  --good-soft: #e3f6ee;
  --bad: #d0454b;
  --bad-soft: #fbe8e8;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20,25,30,.05), 0 6px 20px rgba(20,25,30,.06);
  --maxw: 960px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a; --surface: #1c2126; --surface-2: #232a30;
    --ink: #eef1f3; --muted: #9aa4ad; --border: #2c343b;
    --accent: #f5b445; --accent-ink: #f5b445;
    --good: #35c08a; --good-soft: #16302a; --bad: #e97078; --bad-soft: #3a2023;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 26px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink);
  line-height: 1.55; font-size: 17px; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: .2em 0 .3em; }
h2 { font-size: clamp(1.3rem, 3.5vw, 1.7rem); margin: 1.6em 0 .5em; }
a { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; }
p { margin: .6em 0; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 80%, transparent); position: sticky; top: 0; backdrop-filter: saturate(1.2) blur(8px); z-index: 20; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand .logo { width: 30px; height: 30px; display: grid; place-items: center; background: var(--accent); border-radius: 9px; font-size: 18px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; margin-left: 18px; }
.nav a:hover { color: var(--ink); }

/* Hero */
.hero { padding: 46px 0 20px; }
.hero .kicker { color: var(--accent-ink); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }

/* Cards / tools grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 22px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); display: block; transition: transform .12s ease, border-color .12s ease; }
a.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .ico { font-size: 26px; }
.card h3 { margin: 8px 0 4px; font-size: 1.12rem; }
.card p { color: var(--muted); font-size: .95rem; margin: 0; }
.card .soon { display: inline-block; margin-top: 10px; font-size: .74rem; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 3px 9px; border-radius: 20px; }

/* Calculator */
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin: 22px 0; }
.debt-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 10px; }
.debt-row .field label { display: block; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
@media (max-width: 620px) { .debt-row { grid-template-columns: 1fr 1fr; } .debt-row .field.name { grid-column: 1 / -1; } }
input[type=text], input[type=number] {
  width: 100%; padding: 10px 11px; font-size: 16px; font-family: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); -moz-appearance: textfield;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 1rem; padding: 12px 22px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.btn-primary { background: var(--accent); color: #2a1a00; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); padding: 8px 14px; font-size: .9rem; }
.btn-icon { background: var(--bad-soft); color: var(--bad); border: none; width: 40px; height: 42px; border-radius: var(--radius-sm); cursor: pointer; font-size: 18px; font-weight: 700; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 14px; }
.budget-field { display: flex; flex-direction: column; gap: 3px; }
.budget-field label { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.budget-field input { max-width: 180px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; }
.seg button { border: none; background: transparent; font-family: inherit; font-weight: 700; font-size: .9rem; color: var(--muted); padding: 8px 16px; border-radius: 7px; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Results */
.results { margin-top: 20px; }
.headline { background: var(--good-soft); border: 1px solid color-mix(in srgb, var(--good) 30%, transparent); border-radius: var(--radius); padding: 18px 20px; }
.headline .big { font-size: clamp(1.5rem, 5vw, 2.1rem); font-weight: 800; color: var(--good); letter-spacing: -.02em; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; }
.stat .k { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat .v { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; margin-top: 3px; }
.compare { margin-top: 16px; border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; }
.compare .save { color: var(--good); font-weight: 800; }
.order { margin-top: 16px; padding: 0; list-style: none; }
.order li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.order li .n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #2a1a00; display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; }
.order li .when { margin-left: auto; color: var(--muted); font-size: .9rem; }
.msg { padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 600; margin-top: 14px; }
.msg.error { background: var(--bad-soft); color: var(--bad); }
.hidden { display: none !important; }

/* Monetization blocks (placeholders — swap in real code) */
.ad-slot { margin: 26px 0; min-height: 90px; display: grid; place-items: center; background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--muted); font-size: .8rem; }
.affiliate { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 16px 18px; margin: 20px 0; box-shadow: var(--shadow); }
.affiliate .tag { font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.affiliate h3 { margin: 4px 0 6px; font-size: 1.05rem; }
.affiliate p { color: var(--muted); font-size: .93rem; margin: 0 0 10px; }

/* Email capture / lead magnet */
.capture { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface)); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin: 28px 0; }
.capture h3 { margin: 0 0 4px; }
.capture p { color: var(--muted); margin: 0 0 14px; }
.capture form { display: flex; gap: 10px; flex-wrap: wrap; }
.capture input { max-width: 320px; flex: 1 1 220px; }

/* Content / prose */
.prose { max-width: 720px; }
.prose h2 { border-top: 1px solid var(--border); padding-top: 1.2em; }
.faq details { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 50px; padding: 30px 0; color: var(--muted); font-size: .9rem; }
.site-footer a { color: var(--muted); }
.disclaimer { font-size: .82rem; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 16px; margin-top: 18px; }

/* ---------- Deep-content components (methodology, examples, glossary, sources) ---------- */

/* Byline / transparency strip under the H1 */
.byline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: .84rem; color: var(--muted); margin: 14px 0 0; padding: 10px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.byline strong { color: var(--ink); font-weight: 700; }
.byline .dot { opacity: .45; }

/* Tables — must scroll on their own, never push the page sideways */
.table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.prose table { border-collapse: collapse; width: 100%; min-width: 460px; font-size: .93rem; background: var(--surface); }
.prose th, .prose td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.prose th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td.num { font-variant-numeric: tabular-nums; }
.prose .win { color: var(--good); font-weight: 700; }
.prose .lose { color: var(--bad); font-weight: 700; }
.prose caption { caption-side: bottom; padding: 10px 14px; font-size: .82rem; color: var(--muted); text-align: left; }

/* Key-insight callout */
.callout { border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 18px; margin: 20px 0; }
.callout h3 { margin: 0 0 6px; font-size: 1rem; }
.callout p:last-child { margin-bottom: 0; }
.callout.good { border-left-color: var(--good); background: var(--good-soft); }
.callout.warn { border-left-color: var(--bad); background: var(--bad-soft); }

/* Published formula blocks — the trust differentiator */
.formula { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin: 16px 0; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; line-height: 1.7; }
.formula .cmt { color: var(--muted); }

/* Glossary */
.glossary dt { font-weight: 700; margin-top: 14px; }
.glossary dd { margin: 4px 0 0; color: var(--muted); }

/* Source citations */
.sources { list-style: none; padding: 0; font-size: .9rem; }
.sources li { padding: 9px 0; border-bottom: 1px solid var(--border); color: var(--muted); }
.sources li:last-child { border-bottom: 0; }

/* Related tools */
.related { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); padding: 0; list-style: none; margin: 16px 0; }
.related a { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 600; text-decoration: none; }
.related a:hover { border-color: var(--accent); }
.related a span { display: block; font-weight: 400; font-size: .84rem; color: var(--muted); margin-top: 2px; }

/* On-page contents nav */
.toc { background: var(--surface-2); border-radius: var(--radius-sm); padding: 16px 20px; margin: 24px 0; }
.toc h2 { margin: 0 0 8px !important; border-top: 0 !important; padding-top: 0 !important; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 26px; font-size: .92rem; }
.toc li { margin: 5px 0; break-inside: avoid; }
@media (max-width: 560px) { .toc ol { columns: 1; } }
