@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/Archivo-wdth-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/Newsreader-opsz-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/Newsreader-Italic-opsz-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --kraft: #C9A57C;
  --kraft-deep: #B58E64;
  --paper: #F4EFE4;
  --paper-tint: #EBE4D5;
  --newsprint: #E2DCCC;
  --ink: #1F1B16;
  --muted: #524B42;
  --rule: rgba(31, 27, 22, 0.16);
  --rule-strong: rgba(31, 27, 22, 0.36);
  --money: #245B42;
  --copper: #A5691D;
  --stamp: #B43624;
  --blueprint: #254F96;
  --mustard: #D9A93B;

  --surface-desk: var(--kraft) url("/assets/img/kraft.jpg") center top / 1280px 720px repeat;
  --surface-paper: var(--paper) url("/assets/img/paper.jpg") center / 1280px 720px repeat;
  --surface-news: var(--newsprint) url("/assets/img/newsprint.jpg") center / 1280px 720px repeat;
  --shadow-sheet: 6px 8px 0 rgba(31, 27, 22, 0.24);
  --shadow-cut: 3px 4px 0 rgba(31, 27, 22, 0.2);

  /* Strict 2-font system */
  --font-display: "Archivo", system-ui, -apple-system, sans-serif;
  --font-serif: "Newsreader", Georgia, serif;

  /* Strict 3-size body scale below hero */
  --text-heading: clamp(1.75rem, 2.8vw, 2.25rem);
  --text-body: 1.0625rem;
  --text-sm: 0.875rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--surface-desk);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: var(--text-body);
  line-height: 1.62;
  font-variation-settings: "opsz" 16;
  overflow-x: clip;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1.5px;
}

:focus-visible {
  outline: 3px solid var(--stamp);
  outline-offset: 3px;
}

.num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}

.wrap {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 760px) {
  .wrap {
    padding: 0 36px;
  }
}

/* Header: single-line desktop nav, borderless at y=0, clean separation when scrolled */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: transparent;
  transition: background-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.site-header.scrolled {
  background: rgba(244, 239, 228, 0.96);
  box-shadow: 0 1px 0 var(--rule), 0 4px 16px rgba(31, 27, 22, 0.08);
  backdrop-filter: blur(8px);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 900;
  font-stretch: 105%;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}

.brand-icon {
  width: 34px;
  height: 34px;
  flex: none;
  object-fit: contain;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  border-bottom-color: var(--stamp);
}

.nav-toggle {
  display: none;
  background: var(--paper);
  border: 2px solid var(--ink);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
}

@media (max-width: 780px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
  }
  .nav-links {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 68px;
    background: var(--paper);
    border-top: 1px solid var(--rule);
    border-bottom: 2px solid var(--ink);
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 20px 18px;
    gap: 10px;
    box-shadow: 0 10px 24px rgba(31, 27, 22, 0.18);
  }
  .nav-links.open {
    display: flex;
  }
}

/* Primary button (at most 1 per content section) */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--ink);
  padding: 13px 22px;
  font-family: var(--font-display);
  font-size: var(--text-body);
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-cut);
  transition: transform 160ms var(--ease), background-color 160ms var(--ease), color 160ms var(--ease);
}

.btn-primary:hover {
  background: var(--stamp);
  border-color: var(--stamp);
  transform: translate(-1px, -1px);
}

.btn-primary:active {
  transform: translate(1px, 1px);
}

.text-link {
  font-family: var(--font-display);
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.22em;
  transition: color 160ms var(--ease);
}

.text-link:hover {
  color: var(--stamp);
}

/* Home Hero: monumental centered display headline + wide live workbench bleeding from y=0 */
.hero-stage {
  padding: clamp(28px, 5vw, 56px) 0 clamp(40px, 6vw, 72px);
}

.hero-head {
  text-align: center;
  max-width: 960px;
  margin: 0 auto clamp(28px, 4vw, 44px);
}

.hero-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3rem, 7.2vw, 6.2rem);
  font-weight: 900;
  font-stretch: 82%;
  line-height: 0.94;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.hero-cut {
  display: inline-block;
  background: var(--paper);
  padding: 0.04em 0.16em 0.08em;
  box-shadow: var(--shadow-cut);
  transform: rotate(-1.1deg);
}

.hero-sub {
  margin: 20px auto 24px;
  max-width: 46ch;
  font-size: var(--text-body);
  color: var(--ink);
}

/* Paper sheets & layout sections */
.sheet {
  background: var(--surface-paper);
  box-shadow: var(--shadow-sheet);
  padding: clamp(24px, 4vw, 48px);
  margin: 0 0 clamp(32px, 5vw, 56px);
  border: 1px solid rgba(31, 27, 22, 0.12);
}

.sheet-news {
  background: var(--surface-news);
}

.sheet-ink {
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-sheet);
}

.sheet-ink a {
  color: var(--paper);
}

.sheet-ink .muted {
  color: #D2C9BA;
}

.sheet-ink .btn-primary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}

.sheet-ink .btn-primary:hover {
  background: var(--mustard);
  border-color: var(--mustard);
  color: var(--ink);
}

.page-top {
  padding-top: clamp(24px, 4vw, 44px);
}

.page-top h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.2vw, 4rem);
  font-weight: 900;
  font-stretch: 86%;
  line-height: 0.98;
  letter-spacing: -0.03em;
}

.page-top p {
  margin: 0 0 28px;
  max-width: 62ch;
}

h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: var(--text-heading);
  font-weight: 850;
  font-stretch: 92%;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: var(--text-body);
  font-weight: 800;
  line-height: 1.3;
}

p, li {
  font-size: var(--text-body);
}

p {
  margin: 0 0 16px;
  max-width: 65ch;
}

p:last-child {
  margin-bottom: 0;
}

.muted {
  color: var(--muted);
}

.meta {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--muted);
}

/* Connected segmented control (non-button selector for modes/calculators) */
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  border: 2px solid var(--ink);
  background: var(--paper-tint);
  max-width: 100%;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  border-right: 1px solid var(--rule-strong);
  text-align: center;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}

.segmented label:last-of-type {
  border-right: none;
}

.segmented input:checked + label {
  background: var(--ink);
  color: var(--paper);
}

.segmented input:focus-visible + label {
  outline: 3px solid var(--stamp);
  outline-offset: -3px;
}

/* Interactive workbench layout */
.workbench {
  background: var(--surface-paper);
  box-shadow: var(--shadow-sheet);
  border: 1px solid rgba(31, 27, 22, 0.14);
  padding: clamp(20px, 3.5vw, 40px);
}

.workbench-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}

.workbench-bar h2 {
  margin: 0;
}

.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px 40px;
  align-items: start;
}

@media (min-width: 860px) {
  .calc-grid {
    grid-template-columns: minmax(270px, 0.85fr) minmax(0, 1.35fr);
  }
}

.controls {
  display: grid;
  gap: 18px;
}

.control-row {
  display: grid;
  gap: 6px;
}

.control-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.control-head label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
}

.control-val {
  font-family: var(--font-display);
  font-size: var(--text-body);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: var(--newsprint);
  border: 1px solid var(--rule-strong);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--ink);
  border: 2px solid var(--paper);
  box-shadow: 2px 2px 0 rgba(31, 27, 22, 0.3);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: var(--ink);
  border: 2px solid var(--paper);
  box-shadow: 2px 2px 0 rgba(31, 27, 22, 0.3);
  cursor: pointer;
}

.formula-strip {
  padding: 14px 16px;
  background: var(--paper-tint);
  border-left: 4px solid var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.formula-strip strong {
  color: var(--ink);
}

.readout-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 16px 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}

.readout-label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: 4px;
}

.readout-num {
  font-family: var(--font-display);
  font-size: var(--text-heading);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.readout-sub {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: 4px;
}

.tone-good { color: var(--money); }
.tone-warn { color: var(--stamp); }
.tone-copper { color: var(--copper); }
.tone-blue { color: var(--blueprint); }

.chart-stage {
  width: 100%;
  background: #FBF8F1;
  border: 1px solid var(--rule);
  padding: 14px 14px 10px;
}

.chart-stage svg {
  display: block;
  width: 100%;
  height: auto;
}

.verdict-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: var(--text-body);
}

.calc-panel[hidden] {
  display: none;
}

/* Asymmetric editorial sections (no generic 3-column card walls) */
.split-editorial {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px 44px;
  align-items: start;
}

@media (min-width: 820px) {
  .split-editorial {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }
}

.ep-feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px 32px;
  padding: 26px 0;
  border-top: 1px solid var(--rule);
  align-items: center;
}

.ep-feature:first-of-type {
  border-top: none;
  padding-top: 8px;
}

@media (min-width: 780px) {
  .ep-feature {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  }
  .ep-feature.flip .ep-media {
    order: 2;
  }
}

.ep-media {
  position: relative;
  background: var(--ink);
  box-shadow: var(--shadow-cut);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.ep-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms var(--ease);
}

.ep-feature:hover .ep-media img {
  transform: scale(1.02);
}

.ep-upcoming-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
}

.ep-upcoming-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px 20px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}

@media (min-width: 720px) {
  .ep-upcoming-list li {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) auto;
    align-items: baseline;
  }
}

/* Reading & tools list */
.book-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.book-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px 24px;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}

.book-row:first-child {
  border-top: none;
}

@media (min-width: 740px) {
  .book-row {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) auto;
  }
}

.disclosure-box {
  padding: 16px 20px;
  background: var(--paper-tint);
  border-left: 4px solid var(--money);
  margin: 0 0 24px;
  font-size: var(--text-sm);
  color: var(--ink);
}

.disclosure-box p {
  font-size: var(--text-sm);
  max-width: 75ch;
}

/* Comparison table (age 40 vs 45, debt comparison) */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--rule);
  font-size: var(--text-sm);
}

.data-table th {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--muted);
}

.data-table td.num,
.data-table th.num {
  text-align: right;
}

/* Footer */
.site-footer {
  padding: 36px 0 56px;
  color: var(--ink);
}

.footer-inner {
  border-top: 2px solid var(--ink);
  padding-top: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px 36px;
}

@media (min-width: 760px) {
  .footer-inner {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    align-items: start;
  }
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
}

.footer-note {
  font-size: var(--text-sm);
  color: var(--ink);
  margin-top: 10px;
  max-width: 62ch;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
