:root {
  --bg: #F7F4EC;
  --card: #FFFFFF;
  --ink: #1C2B24;
  --muted: #45554D;
  --soft: #5C6A63;
  --green: #1F5A43;
  --green-dark: #143D2D;
  --gold: #A5630E;
  --sand: #F2D9AE;
  --sand-soft: #F2E3C8;
  --line: #DDD6C6;
  --field: #C9C1AE;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.6; }
a { color: var(--green); text-underline-offset: 3px; }
a:hover { color: var(--green-dark); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
img, svg { max-width: 100%; }
.wrap { width: min(1200px, 100% - 40px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 72px; flex-wrap: wrap; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand span { font-family: var(--serif); font-weight: 600; font-size: 23px; letter-spacing: -0.01em; }
.brand b { color: var(--gold); font-weight: 600; }
.brand small { font-family: var(--sans); font-size: 13px; color: var(--soft); font-weight: 500; }
.nav { display: flex; gap: 6px 22px; flex-wrap: wrap; font-weight: 500; font-size: 15px; }
.nav a { color: var(--ink); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a[aria-current="page"] { color: var(--green); border-bottom-color: var(--green); }
.btn { display: inline-block; background: var(--green); color: #fff; text-decoration: none; font-weight: 600; padding: 11px 18px; border-radius: 8px; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--green-dark); color: #fff; }
.btn-quiet { background: transparent; color: var(--green); border: 1px dashed var(--green); }
.btn-quiet:hover { background: var(--card); color: var(--green-dark); }

/* Hero */
.hero { padding: 48px 0 28px; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(34px, 5vw, 56px); line-height: 1.08; margin: 0 0 14px; max-width: 24ch; letter-spacing: -0.01em; }
.hero p { margin: 0; font-size: 19px; color: var(--muted); max-width: 62ch; }
.crumbs { font-size: 14px; color: var(--soft); margin-bottom: 14px; }
.crumbs a { color: var(--soft); }

/* Calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 28px; align-items: start; padding-bottom: 40px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.panel h2 { font-size: 17px; margin: 0 0 12px; font-family: var(--sans); }
.fieldset { border: 0; padding: 0; margin: 0 0 24px; }
.fieldset legend { font-weight: 600; font-size: 17px; margin-bottom: 12px; padding: 0; }
.grid { display: grid; align-items: end; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input, select { font: inherit; font-size: 16px; color: var(--ink); height: 46px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; background: #fff; width: 100%; min-width: 0; }
input:focus, select:focus { border-color: var(--green); }
.hint { font-size: 12px; line-height: 18px; color: var(--soft); min-height: 18px; }
.help { font-size: 13px; color: var(--soft); margin: 4px 0 0; }
.toggle { display: flex; background: #F1ECE0; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.toggle label { flex: 1; flex-direction: row; justify-content: center; align-items: center; margin: 0; cursor: pointer; padding: 10px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle input:checked + span { color: var(--ink); }
.toggle label:has(input:checked) { background: #fff; }
.toggle label:has(input:focus-visible) { outline: 3px solid var(--gold); }
.goal-row { display: grid; grid-template-columns: 2fr 1fr 1.3fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.remove-goal { height: 46px; padding: 0 12px; background: transparent; border: 1px solid var(--field); border-radius: 8px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; }
.errors { background: #FBEAE5; border: 1px solid #E3B4A6; color: #6E2412; border-radius: 10px; padding: 12px 16px 12px 34px; margin: 0 0 16px; font-size: 15px; }

.result { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px; }
.result-main { background: var(--ink); color: var(--bg); border-radius: 16px; padding: 28px; }
.result-main .label { color: #C9D4CD; font-size: 15px; }
.result-main .big { font-family: var(--serif); font-size: clamp(38px, 4.4vw, 52px); font-weight: 600; line-height: 1.05; margin: 6px 0 16px; }
.breakdown { list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid #3A4B43; display: grid; gap: 8px; font-size: 15px; }
.breakdown li { display: flex; justify-content: space-between; gap: 12px; }
.breakdown li span:last-child { white-space: nowrap; text-align: right; }
.breakdown li span:first-child { color: #C9D4CD; }
.result-note { font-size: 14px; color: #C9D4CD; margin: 14px 0 0; }
.summary { font-size: 16px; margin: 0; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat .label { font-size: 14px; color: var(--muted); }
.stat .val { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.share { height: 12px; border-radius: 6px; background: #7FA892; overflow: hidden; margin: 6px 0 10px; }
.share div { height: 100%; background: var(--sand); }
.callout { background: var(--sand-soft); border-radius: 14px; padding: 20px 22px; color: #3F2606; }
.callout p { margin: 4px 0 12px; color: #5A3A10; font-size: 15px; }
.callout .btn { background: var(--ink); }

.chart-panel { padding: 22px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #ECE6D8; stroke-width: 1; }
.chart .axis { font-family: var(--sans); font-size: 16px; fill: var(--soft); }
.chart .line-main { fill: none; stroke: var(--green); stroke-width: 3; stroke-linejoin: round; }
.chart .line-alt { fill: none; stroke: #B8761F; stroke-width: 2.5; stroke-dasharray: 6 5; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--green); vertical-align: middle; margin-right: 6px; }
.legend i.alt { border-top: 3px dashed #B8761F; }
details.table { margin-top: 12px; }
details.table summary { cursor: pointer; font-weight: 600; color: var(--green); }
.table-scroll { overflow-x: auto; max-height: 360px; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid #ECE6D8; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { position: sticky; top: 0; background: var(--card); color: var(--muted); font-weight: 600; }

/* Article content */
.content { padding: 24px 0 64px; border-top: 1px solid var(--line); }
.prose { max-width: 72ch; }
.prose h2 { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.2; margin: 44px 0 12px; }
.prose h3 { font-size: 19px; margin: 28px 0 8px; }
.prose p, .prose li { color: #2B3A33; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose .example { background: var(--card); border-left: 4px solid var(--green); border-radius: 0 12px 12px 0; padding: 16px 20px; margin: 20px 0; }
.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.related a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; text-decoration: none; color: var(--ink); }
.related a strong { display: block; font-size: 16px; margin-bottom: 4px; color: var(--green); }
.related a span { font-size: 14px; color: var(--muted); }

/* Waitlist */
.waitlist { background: var(--ink); color: var(--bg); padding: 48px 0; }
.waitlist .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.waitlist h2 { font-family: var(--serif); font-size: 34px; margin: 0 0 10px; line-height: 1.15; }
.waitlist p { color: #C9D4CD; margin: 0; }
.waitlist form { display: grid; gap: 12px; }
.waitlist label { color: #C9D4CD; }
.waitlist .check { flex-direction: row; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.5; }
.waitlist .check input { width: 18px; height: 18px; margin-top: 3px; flex-shrink: 0; }
.waitlist .check a { color: var(--sand); }
.waitlist .btn { background: var(--sand); color: #3F2606; justify-self: start; }
.waitlist .btn:hover { background: #F7E6C6; color: #3F2606; }
.hidden-field { position: absolute; left: -9999px; }

/* Footer */
.site-footer { background: #15211B; color: #C9D4CD; padding: 40px 0; font-size: 14px; }
.site-footer .wrap { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.site-footer a { color: #F7F4EC; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.site-footer h2 { font-size: 15px; color: #F7F4EC; margin: 0 0 10px; font-family: var(--sans); }
.legal-page .prose { padding: 8px 0 64px; }

@media (max-width: 900px) {
  .calc { grid-template-columns: 1fr; }
  .result { position: static; }
  .waitlist .wrap, .site-footer .wrap { grid-template-columns: 1fr; }
  .goal-row { grid-template-columns: 1fr 1fr; }
  .goal-row label:first-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .site-header .wrap { gap: 8px; min-height: 0; }
  .site-header .btn { padding: 8px 12px; font-size: 14px; }
  .nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 18px; padding-bottom: 2px; }
  .nav a { white-space: nowrap; }
  .hint:empty { display: none; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .site-header .btn { display: none; }
  .panel, .result-main { padding: 20px; }
  .hero { padding-top: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
