/* Plan My Retirement — static pages (home, about, privacy, methodology).
   Tokens copied verbatim from DESIGN.md §5–§8. The React app has its own
   copy in src/index.css; these must stay in step. Self-hosted fonts, per
   DESIGN.md's loading strategy — no Google Fonts CDN, no render-blocking
   third-party request. */

@font-face {
  font-family: 'Fraunces Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/fraunces-latin-opsz-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-display: swap; font-weight: 400;
  src: url('/fonts/dm-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-display: swap; font-weight: 500;
  src: url('/fonts/dm-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-display: swap; font-weight: 700;
  src: url('/fonts/dm-sans-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 400;
  src: url('/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}

/* DESIGN.md §6.1 */
:root {
  --bg: #FAF8F3;
  --surface: #FFFFFF;
  --surface-2: #F2EEE4;
  --border: #E4DFD3;
  --border-strong: #8F8570;
  --ink: #1C1B19;
  --ink-muted: #5B5750;
  --accent: #0F5D45;
  --accent-ink: #FFFFFF;
  --copper: #8C6829;
  --copper-graphic: #A87C3F;
  --gain: #187A50;
  --loss: #B3462C;
  --warning: #8A6A1E;
  --info: #3D5A73;
}

/* DESIGN.md §6.2 — dark mode is re-tuned, not inverted. Note the accent
   takes DARK text in dark mode: white on #2FBE8F is only 2.36:1. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #14120D;
    --surface: #1C1A14;
    --surface-2: #242019;
    --border: #2A251C;
    --border-strong: #6E6350;
    --ink: #F2EEE4;
    --ink-muted: #A79E8E;
    --accent: #2FBE8F;
    --accent-ink: #0B140F;
    --copper: #D6A968;
    --copper-graphic: #D6A968;
    --gain: #34B37B;
    --loss: #E07856;
    --warning: #E0B355;
    --info: #7FA8C9;
  }
}
:root[data-theme='dark'] {
  --bg: #14120D;
  --surface: #1C1A14;
  --surface-2: #242019;
  --border: #2A251C;
  --border-strong: #6E6350;
  --ink: #F2EEE4;
  --ink-muted: #A79E8E;
  --accent: #2FBE8F;
  --accent-ink: #0B140F;
  --copper: #D6A968;
  --copper-graphic: #D6A968;
  --gain: #34B37B;
  --loss: #E07856;
  --warning: #E0B355;
  --info: #7FA8C9;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 72ch; margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: 100ch; margin: 0 auto; padding: 0 20px; }

/* ── Header ───────────────────────────────────────────────────────── */
header.site {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
header.site .inner {
  max-width: 100ch; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  font-weight: 700; font-size: 1.0625rem; color: var(--ink);
  text-decoration: none; letter-spacing: -0.01em;
}
.brand span { color: var(--accent); }
nav.site a {
  color: var(--ink-muted); text-decoration: none; font-size: 0.875rem;
  font-weight: 500; margin-left: 18px;
}
nav.site a:hover { color: var(--accent); text-decoration: underline; }

/* ── Type scale, DESIGN.md §5 ─────────────────────────────────────── */
h1 {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 600;
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}
h2 {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 600; font-size: 1.625rem; line-height: 1.15;
  letter-spacing: -0.01em; margin: 44px 0 14px;
}
h3 {
  font-family: 'DM Sans', sans-serif; font-weight: 500;
  font-size: 1.125rem; line-height: 1.3; margin: 28px 0 8px;
}
p { margin: 0 0 16px; }
.lede { font-size: 1.1875rem; line-height: 1.55; color: var(--ink-muted); }
.eyebrow {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.6875rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--copper); margin: 0 0 12px;
}
a { color: var(--accent); }
strong { font-weight: 700; }
ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin-bottom: 8px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 40px 0; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 1rem; text-decoration: none;
  padding: 14px 26px; border-radius: 8px; min-height: 48px;
  border: 1px solid transparent; line-height: 1.4;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent; color: var(--accent);
  border: 1px solid var(--border-strong);
}
.btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}

/* ── Blocks ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 22px 24px; margin: 0 0 16px;
}
.note {
  background: var(--surface-2); border-left: 3px solid var(--info);
  border-radius: 0 8px 8px 0; padding: 16px 20px; margin: 0 0 20px;
  font-size: 0.9375rem;
}
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

.stat { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }

/* ── Page furniture ───────────────────────────────────────────────── */
main { padding: 48px 0 72px; }
footer.site {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 28px 0; font-size: 0.875rem; color: var(--ink-muted);
}
footer.site a { color: var(--ink-muted); margin-right: 16px; }
.updated {
  font-family: 'IBM Plex Mono', monospace; font-size: 0.75rem;
  color: var(--ink-muted); margin-bottom: 28px;
}
table.simple { width: 100%; border-collapse: collapse; font-size: 0.9375rem; margin: 0 0 20px; }
table.simple th, table.simple td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.simple th { font-weight: 500; font-size: 0.8125rem; color: var(--ink-muted); }

/* Narrow screens: the brand was breaking across two lines and the nav was
   wrapping around it. Stack the two instead of letting them fight for the
   same row. */
@media (max-width: 560px) {
  header.site .inner {
    flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 20px;
  }
  nav.site { display: flex; flex-wrap: wrap; gap: 0 16px; }
  nav.site a { margin-left: 0; }
  main { padding: 32px 0 56px; }
  h2 { margin-top: 36px; }
}
.brand { white-space: nowrap; }

/* ── Shared shell: wide container used by every page's header and footer ── */
.shell { max-width: 1320px; margin: 0 auto; padding: 0 40px; }
@media (max-width: 720px) { .shell { padding: 0 20px; } }
header.site .inner { max-width: 1320px; padding: 14px 40px; }
@media (max-width: 720px) { header.site .inner { padding: 12px 20px; } }
header.site .inner nav.site { display: flex; align-items: center; }

/* Theme toggle, shared by every static page. */
.theme-btn {
  background: transparent; border: 1px solid var(--border-strong); color: var(--ink-muted);
  border-radius: 8px; width: 44px; height: 44px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; padding: 0; margin-left: 18px;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .moon { display: none; }
:root[data-theme='dark'] .theme-btn .moon { display: block; }
:root[data-theme='dark'] .theme-btn .sun { display: none; }


/* Leave room above a heading reached by a #link, so it is not flush with the top. */
h2[id], h3[id] { scroll-margin-top: 32px; }

/* ── Shared chrome: header call to action and four-column footer ── */
.nav-cta { margin-left: 22px; padding: 10px 18px; min-height: 44px; font-size: 0.9375rem; white-space: nowrap; }
nav.site a.nav-cta, nav.site a.nav-cta:hover { color: var(--accent-ink); text-decoration: none; }
nav.site a[aria-current='page'] { color: var(--ink); }
/* ── Footer, four columns ───────────────────────────────────────────── */
.foot-cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; padding: 8px 0 24px; }
.foot-cols h4 { font-size: 0.8125rem; font-weight: 500; color: var(--ink); margin: 0 0 10px; }
.foot-cols a { display: block; margin: 0 0 6px; }
.foot-legal { border-top: 1px solid var(--border); padding-top: 18px; font-size: 0.8125rem; }
@media (max-width: 960px) { .foot-cols { grid-template-columns: 1fr 1fr; } }
/* Phones: the hero button sits below the fold, so the header carries the one
   action instead. Brand, button and theme toggle on a single row; the text
   links move out (they are all in the footer). */
@media (max-width: 560px) {
  header.site .inner { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
  header.site .brand { font-size: 0.9375rem; }
  nav.site a:not(.nav-cta) { display: none; }
  nav.site { flex-wrap: nowrap; gap: 0; }
  .nav-cta { margin-left: 0; padding: 8px 11px; font-size: 0.8125rem; min-height: 44px; display: inline-flex; align-items: center; }
  .theme-btn { margin-left: 10px; }
}

/* ── Methodology: wide shell, sticky contents on the left ─────────── */
.doc-head { padding: 8px 0 40px; border-bottom: 1px solid var(--border); }
.doc-head h1 { max-width: 20ch; }
.doc-head .lede { max-width: 62ch; margin: 0 0 12px; }
.doc-head .updated { margin: 0; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin: 36px 0 0; }
.facts p { margin: 0; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--ink-muted); font-size: 0.875rem; line-height: 1.4; }
.facts b { display: block; font-family: 'Fraunces Variable', Georgia, serif; font-size: 1.5rem; font-weight: 600; color: var(--ink); line-height: 1.15; margin-bottom: 4px; }
.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 64px; padding-top: 40px; }
.toc { position: sticky; top: 24px; align-self: start; font-size: 0.875rem; }
.toc p { margin: 0 0 10px; font-weight: 500; color: var(--ink); }
.toc a { display: block; padding: 6px 0 6px 12px; border-left: 2px solid var(--border); color: var(--ink-muted); text-decoration: none; }
.toc a:hover { color: var(--accent); border-color: var(--accent); }
.doc section + section { margin-top: 56px; }
.doc h2 { margin: 0 0 14px; }
.doc section > p { max-width: 72ch; font-size: 1.0625rem; }
.doc h3 { margin: 28px 0 12px; }
/* Short statements, two across: they are scanned, not read in order. */
.pts { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; }
.pts li { margin: 0; padding: 14px 0; border-top: 1px solid var(--border); }
.pts li strong { display: block; font-weight: 500; margin-bottom: 2px; }
.pts li span { color: var(--ink-muted); font-size: 0.9375rem; }
.doc-end { margin-top: 64px; padding: 28px 32px; border-radius: 14px; background: var(--surface-2); display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.doc-end p { margin: 0; font-size: 1.0625rem; }
@media (max-width: 960px) {
  .doc { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .facts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .pts { grid-template-columns: 1fr; }
}

.toc a[aria-current] { color: var(--accent); border-color: var(--accent); font-weight: 500; }
.pos { color: var(--gain); }
.neg { color: var(--loss); }
/* Weak vs good start: the same 1,000 runs, split in two. */
.split { max-width: 72ch; margin: 4px 0 24px; padding: 8px 24px 20px; border-radius: 14px; background: var(--surface-2); }
.split-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.split p { margin: 0; }
.split-k { font-weight: 500; }
.split-k span, .split-v { display: block; font-weight: 400; font-size: 0.875rem; color: var(--ink-muted); }
.split-v { text-align: right; white-space: nowrap; }
.split-v b { display: block; font-family: 'Fraunces Variable', Georgia, serif; font-size: 1.75rem; font-weight: 600; line-height: 1.1; }
.split-v.neg b { color: var(--loss); }
.split-v.pos b { color: var(--gain); }
.split-f { padding-top: 14px; font-size: 0.875rem; color: var(--ink-muted); }
/* Which way each simplification pushes the result: one table, grouped. */
.lean-t { width: 100%; border-collapse: collapse; }
.lean-t th, .lean-t td { text-align: left; vertical-align: top; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--border); }
.lean-t thead th { font-size: 0.8125rem; font-weight: 500; color: var(--ink-muted); padding-top: 0; }
.lean-t tr.grp th { font-family: 'Fraunces Variable', Georgia, serif; font-size: 1.125rem; font-weight: 600; padding-top: 28px; border-bottom: 1px solid var(--border-strong); }
.lean-t td:first-child { width: 62%; }
.lean-t td strong { display: block; font-weight: 500; }
.lean-t td span:not(.fx):not(.st) { color: var(--ink-muted); font-size: 0.9375rem; }
.fx { white-space: nowrap; font-weight: 500; font-size: 0.9375rem; }
.fx-up { color: var(--loss); }
.fx-down { color: var(--info); }
.st { white-space: nowrap; font-family: 'IBM Plex Mono', monospace; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); }
.st-n { color: var(--loss); }
@media (max-width: 720px) {
  .lean-t thead { display: none; }
  .lean-t tr:not(.grp) { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
  .lean-t tr:not(.grp) td { border: 0; padding: 0; width: auto; }
  .lean-t tr:not(.grp) td:first-child { grid-column: 1 / -1; }
  .split-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .split-v { text-align: left; }
}

/* Short pages (About, Privacy): heading on the left, content on the right. */
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 64px; padding: 40px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row h2 { margin: 0; }
.row p { max-width: 72ch; font-size: 1.0625rem; }
.row p:last-child { margin-bottom: 0; }
@media (max-width: 960px) {
  .row { grid-template-columns: 1fr; gap: 14px; padding: 32px 0; }
}

/* Feedback form (About). Single column, native validation. */
.fb { display: grid; gap: 8px; max-width: 60ch; margin-top: 8px; }
.fb label { font-weight: 500; font-size: 0.9375rem; margin-top: 8px; }
.fb label span { font-weight: 400; color: var(--ink-muted); }
.fb textarea, .fb input { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 12px 14px; min-height: 48px; width: 100%; }
.fb textarea { resize: vertical; }
.fb textarea:focus-visible, .fb input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.fb-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.fb-go { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.fb .btn { cursor: pointer; }
.fb .btn:disabled { opacity: 0.6; cursor: default; }
.fb-status { margin: 0; font-size: 0.9375rem; color: var(--ink-muted); }
.fb-status[data-tone='ok'] { color: var(--gain); }
.fb-status[data-tone='err'] { color: var(--loss); }
.pts.pts-1 { grid-template-columns: 1fr; }

/* 404: the same head block as other pages, with the two ways back. */
.nf { border-bottom: 0; padding-bottom: 96px; }
.nf-go { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 0; }
.page-nf { min-height: 100vh; display: flex; flex-direction: column; }
.page-nf main { flex: 1; }
