/* WealthIndex — minimal, fast, mobile-first */
:root {
  --bg: #0f172a;
  --bg-soft: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --accent: #16a34a;
  --accent-dark: #15803d;
  --gold: #b45309;
  --line: #e2e8f0;
  --radius: 12px;
  --wrap: 960px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  line-height: 1.6;
  background: #fff;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: #fff; padding: .5rem 1rem; z-index: 99; }
.skip:focus { left: 0; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

/* ad slots */
.ad-slot { min-height: 0; text-align: center; }
.ad-slot:empty { display: none; }

/* header */
.site-header { background: var(--bg); color: #fff; position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: .6rem; padding-bottom: .6rem; }
.brand { margin: 0; font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; }
.brand span { color: var(--accent); }
.site-header nav a { color: #cbd5e1; text-decoration: none; margin-left: 1rem; font-size: .95rem; }
.site-header nav a:hover { color: #fff; text-decoration: underline; }

/* hero */
.hero { background: linear-gradient(135deg, var(--bg) 0%, #1e3a5f 100%); color: #fff; padding: 4rem 0 3.5rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.15; margin: 0 0 1rem; letter-spacing: -.02em; max-width: 20ch; }
.hero-stats { display: grid; gap: 1rem; margin: 0 0 1.25rem; }
@media (min-width: 560px) { .hero-stats { grid-template-columns: 1fr 1fr; } }
.hero-stat { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.hero-stat-kicker { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; font-weight: 700; }
.hero-stat-num { margin: .2rem 0 .3rem; font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; color: #86efac; letter-spacing: -.02em; }
.hero-stat-src { margin: 0; font-size: .85rem; color: #cbd5e1; }
.hero-stat-src a { color: #bae6fd; }
.hero-sub { color: #cbd5e1; max-width: 60ch; margin: 0 0 1.75rem; }
.cta { display: inline-block; background: var(--accent); color: #fff; font-weight: 700; font-size: 1.1rem; padding: .85rem 1.75rem; border-radius: var(--radius); text-decoration: none; }
.cta:hover { background: var(--accent-dark); }
.hero-notes { margin-top: 1.5rem; font-size: .85rem; color: #94a3b8; }
.footnote-ref { font-size: .7em; vertical-align: super; color: #86efac; }
.hero-notes a { color: #bae6fd; }

/* sections */
.section { padding: 3.25rem 0; }
.section--alt { background: var(--bg-soft); }
.section h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); letter-spacing: -.02em; margin: 0 0 .5rem; }
.section-lede { color: var(--muted); max-width: 64ch; margin: 0 0 1.5rem; }
.estimate-tag { font-size: .65rem; background: #fef3c7; color: #92400e; border-radius: 999px; padding: .25rem .6rem; vertical-align: middle; font-weight: 600; }

/* calculator */
.calc-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; max-width: 560px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.tabs { display: flex; gap: .5rem; margin-bottom: 1.25rem; }
.tabs button { flex: 1; padding: .6rem; border: 1px solid var(--line); background: #f8fafc; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 1rem; }
.tabs button[aria-selected="true"] { background: var(--bg); color: #fff; border-color: var(--bg); }
.money-label { display: block; font-weight: 600; margin-bottom: .4rem; }
.calc-row { display: flex; align-items: stretch; gap: .4rem; }
.currency { align-self: center; font-weight: 700; font-size: 1.2rem; color: var(--muted); }
#nw-input { flex: 1; font-size: 1.15rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
#calc-btn, #copy-btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 0 1.25rem; font-weight: 700; font-size: 1rem; cursor: pointer; white-space: nowrap; }
#calc-btn:hover, #copy-btn:hover { background: var(--accent-dark); }
.calc-hint { font-size: .85rem; color: var(--muted); margin: .75rem 0 0; }
.calc-result { margin-top: 1.25rem; padding: 1rem 1.25rem; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; }
.calc-result .big { font-size: 1.5rem; font-weight: 800; margin: 0 0 .25rem; }
.calc-result .detail { margin: 0; color: var(--muted); font-size: .95rem; }
.calc-actions { margin-top: .75rem; display: flex; align-items: center; gap: .75rem; }
.copied { color: var(--accent-dark); font-weight: 600; margin: 0; }

/* net-worth definition balloon tooltip */
.nw-tip-trigger { background: none; border: 0; padding: 0; font: inherit; color: inherit; border-bottom: 1px dotted currentColor; cursor: help; }
.nw-tip-trigger:hover { color: var(--accent-dark); }
.nw-tip-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.def-tip { position: fixed; z-index: 60; max-width: 320px; background: #0f172a; color: #fff; padding: .85rem 1rem; border-radius: 10px; font-size: .88rem; line-height: 1.55; box-shadow: 0 10px 28px rgba(0,0,0,.3); }
.def-tip[hidden] { display: none; }
.def-tip p { margin: .35rem 0; color: #e2e8f0; }
.def-tip p:first-child { margin-top: 0; }
.def-tip .def-tip-title { font-weight: 800; color: #fff; }
.def-tip strong { color: #fff; }

/* complete-the-picture fields */
.calc-fields { display: grid; gap: .8rem; margin-bottom: 1rem; }
@media (min-width: 560px) { .calc-fields { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
.field .req { color: #b91c1c; }
.field input { width: 100%; font-size: 1.05rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px; }
.calc-btn-full { width: 100%; background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: .7rem 1.25rem; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.calc-btn-full:hover { background: var(--accent-dark); }
.calc-hint a { color: var(--accent-dark); }

/* charts */
.chart-legend p { margin: .4rem 0; max-width: 72ch; }
.swatch { display: inline-block; width: .9em; height: .9em; border-radius: 2px; margin-right: .4rem; }
.swatch-a { background: #2563eb; }
.swatch-b { background: #16a34a; }
.charts { display: grid; gap: 1.5rem; margin-top: 1.25rem; }
@media (min-width: 760px) { .charts { grid-template-columns: 1fr 1fr; } }
.chart-box { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.chart-box figcaption { font-weight: 700; margin-bottom: .5rem; }
.chart-box figcaption span { color: var(--muted); font-weight: 400; font-size: .9em; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-note { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }
.chart-note a { color: var(--accent-dark); }
.chart-tip { position: fixed; pointer-events: none; background: var(--bg); color: #fff; padding: .35rem .6rem; border-radius: 6px; font-size: .8rem; z-index: 50; white-space: nowrap; display: none; }

/* status chip */
.status-chip { display: inline-block; background: #fef3c7; color: #92400e; font-size: .9rem; font-weight: 600; padding: .35rem .8rem; border-radius: 999px; }
.bill-totals { font-size: 1.1rem; margin: 0 0 1.25rem; color: var(--muted); }
.bill-totals strong { color: var(--ink); }

/* tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; background: var(--card); font-size: .95rem; }
.data-table caption { text-align: left; font-weight: 700; padding: .5rem 0; }
.data-table th, .data-table td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); }
.data-table thead th { background: var(--bg); color: #fff; }
.data-table tbody tr:nth-child(even) { background: #f8fafc; }
.data-table.sortable th[role="button"] { cursor: pointer; user-select: none; }
.data-table.sortable th[role="button"]:hover { background: #1e293b; }
.sort-hint { font-size: .85rem; color: var(--muted); }
.state-label { display: block; font-weight: 600; margin-bottom: .4rem; }
#state-select { font-size: 1.05rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px; max-width: 320px; width: 100%; margin-bottom: 1rem; }
.state-result { margin: 0 0 1.5rem; padding: 1rem 1.25rem; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; max-width: 560px; }
.state-result:empty { display: none; }
.state-result .big { font-size: 1.35rem; font-weight: 800; margin: 0 0 .25rem; }
.state-result .detail { margin: 0; color: var(--muted); }

/* context */
.stat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.stat-num { font-size: 2rem; font-weight: 800; margin: 0; color: var(--accent-dark); letter-spacing: -.02em; }
.stat-label { margin: .25rem 0 0; color: var(--muted); font-size: .95rem; }
.stat-label strong { color: var(--ink); }

/* fortune & folly */
.story-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; max-width: 680px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.story-date { margin: 0 0 .5rem; font-size: .85rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.story-chip { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; border-radius: 999px; padding: .25rem .7rem; }
.story-chip--sudden { background: #dcfce7; color: #166534; }
.story-chip--lost { background: #fee2e2; color: #991b1b; }
.story-title { margin: .5rem 0 .5rem; font-size: 1.35rem; letter-spacing: -.01em; }
.story-summary { color: var(--ink); }
.story-lesson { background: #f8fafc; border-left: 3px solid var(--accent); padding: .6rem .9rem; border-radius: 0 8px 8px 0; font-size: .95rem; }
.story-source { margin-bottom: 0; }
.story-source a { color: var(--accent-dark); font-weight: 600; }
.story-loading { color: var(--muted); }
.archive-h { margin: 2rem 0 .75rem; font-size: 1.2rem; }
.story-archive details { background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin-bottom: .5rem; padding: .7rem 1rem; max-width: 680px; }
.story-archive summary { cursor: pointer; font-weight: 600; }
.story-archive summary .story-chip { margin-left: .5rem; vertical-align: middle; }
.story-archive .story-lesson { margin: .6rem 0; }

/* affiliates */
.aff-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.aff-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; text-decoration: none; color: inherit; position: relative; transition: transform .1s ease, box-shadow .1s ease; }
.aff-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.aff-card .sponsored { position: absolute; top: .75rem; right: .75rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #92400e; background: #fef3c7; border-radius: 4px; padding: .15rem .45rem; }
.aff-card h3 { margin: 0 0 .4rem; font-size: 1.15rem; padding-right: 5rem; }
.aff-card p { margin: 0 0 .75rem; color: var(--muted); font-size: .95rem; }
.aff-card .aff-cta { color: var(--accent-dark); font-weight: 700; }

/* newsletter */
.news-form { display: flex; gap: .5rem; max-width: 520px; }
#news-email { flex: 1; font-size: 1.05rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.news-form button { background: var(--bg); color: #fff; border: 0; border-radius: 8px; padding: 0 1.25rem; font-weight: 700; font-size: 1rem; cursor: pointer; white-space: nowrap; }
.news-msg { min-height: 1.5em; color: var(--accent-dark); font-weight: 600; }

/* footer */
.site-footer { background: var(--bg); color: #cbd5e1; padding: 2.5rem 0 1.5rem; }
.footer-cols { display: grid; gap: 1.75rem; margin-bottom: 1.5rem; }
@media (min-width: 760px) { .footer-cols { grid-template-columns: 1fr 1.4fr; } }
.site-footer h3 { color: #fff; margin: 0 0 .5rem; font-size: 1.05rem; }
.site-footer a { color: #bae6fd; }
.site-footer p, .site-footer li { font-size: .9rem; }
.site-footer ul { margin: 0; padding-left: 1.2rem; }
.site-footer li { margin-bottom: .35rem; }
.site-footer strong { color: #fff; }
.site-footer code { background: #1e293b; padding: .1rem .35rem; border-radius: 4px; font-size: .8em; }
.footer-meta { border-top: 1px solid #1e293b; padding-top: 1rem; margin: 0; font-size: .85rem; color: #94a3b8; }

@media (max-width: 560px) {
  .site-header nav { display: none; }
  .calc-row { flex-wrap: wrap; }
  #calc-btn { width: 100%; padding: .7rem; }
  .news-form { flex-direction: column; }
  .news-form button { padding: .7rem; }
}
