:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --page: #f5f3ee;
  --surface: #fbfaf7;
  --surface-muted: #ebece4;
  --ink: #24251f;
  --ink-soft: #555950;
  --muted: #687267;
  --accent: #41604f;
  --accent-strong: #26372e;
  --accent-soft: #778c77;
  --line: #e0ded5;
  --line-strong: #aeb9ad;
  --page-width: 800px;
  --reading-width: 680px;
  --body-size: 16px;
  --heading-size: clamp(32px, 4.8vw, 44px);
  --radius: 14px;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
body { margin: 0; font-size: var(--body-size); line-height: 1.65; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
a:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 4px; }
h1, h2, p { margin: 0; }
h1 { max-width: var(--reading-width); margin: 12px 0 18px; font-size: var(--heading-size); font-weight: 700; line-height: 1.15; letter-spacing: -.035em; text-wrap: balance; }
h2 { max-width: var(--reading-width); margin: 32px 0 12px; font-size: 21px; line-height: 1.35; letter-spacing: -.02em; text-wrap: pretty; }
p { max-width: var(--reading-width); margin: 0 0 16px; color: var(--ink-soft); }
.wrap { width: min(calc(100% - 48px), var(--page-width)); margin: 0 auto; padding: 28px 0 24px; }

/* Shared page navigation. */
.site-nav { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 22px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 17px; font-weight: 650; letter-spacing: -.02em; text-decoration: none; }
.mark { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: 10px; background: var(--accent-strong); color: var(--page); font-size: 18px; }
.site-nav > div { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.site-nav > div a, .footer-nav a { color: var(--muted); font-size: 13px; text-decoration: none; }
.site-nav > div a:hover, .footer-nav a:hover { color: var(--accent-strong); text-decoration: underline; }
.site-nav a[aria-current] { color: var(--accent-strong); font-weight: 650; }
.back { display: inline-block; margin-bottom: 24px; color: var(--muted); font-size: 13px; text-decoration: none; }
.back:hover { text-decoration: underline; }
.footer-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.footer-nav span { margin-left: auto; }

/* Page titles and reading rhythm. */
.intro { padding: 12px 0 24px; }
.eyebrow, .card-label { color: var(--muted); font-size: 11px; font-weight: 650; line-height: 1.5; letter-spacing: .1em; }
.eyebrow { margin: 0; }
.intro > p:last-child, .lede { max-width: var(--reading-width); margin-bottom: 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.article > .lede { margin-bottom: 28px; }
.note, .updated { color: var(--muted); font-size: 14px; }
.method-note { margin-top: 28px; }
.contact { display: inline-block; margin: 4px 0 24px; font-size: clamp(18px, 4vw, 22px); font-weight: 600; overflow-wrap: anywhere; }

/* Reusable content panels. */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card { display: flex; min-width: 0; flex-direction: column; gap: 10px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .16s ease, background-color .16s ease; }
.card:hover { border-color: var(--line-strong); background: #f0f2eb; }
.card strong { font-size: 19px; line-height: 1.35; letter-spacing: -.02em; overflow-wrap: anywhere; hyphens: auto; }
.card > span:last-child { color: var(--muted); font-size: 14px; line-height: 1.55; }
.card-featured { grid-column: 1 / -1; background: var(--surface-muted); }
.method-cards { margin-top: 16px; }
.chapter-list { display: grid; gap: 12px; }
.chapter-list .card { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 20px; }
.chapter-list .card-label { grid-row: span 2; padding-top: 5px; }
.chapter-list .card > span:last-child { grid-column: 2; }
.start-links { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin: 24px 0; font-size: 14px; }
.primary-link { padding: 12px 18px; border-radius: 10px; background: var(--accent-strong); color: var(--surface); font-weight: 600; text-decoration: none; }
.primary-link:hover { background: var(--accent); color: var(--surface); }
.chapter-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.chapter-nav a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 13px; text-decoration: none; }
.chapter-nav a:hover { border-color: var(--line-strong); color: var(--accent-strong); }
.chapter-nav a[aria-current] { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--surface); }
.chapter-nav span { font-size: 11px; font-variant-numeric: tabular-nums; }
#sections { scroll-margin-top: 24px; }
.callout { max-width: var(--reading-width); margin: 28px 0; padding: 20px 22px; border: 1px solid var(--line); border-left: 3px solid var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface-muted); }
.callout p { margin: 0; }
.callout p + p { margin-top: 12px; }
.callout strong, .steps strong { color: var(--ink); }
.steps { display: grid; max-width: var(--reading-width); gap: 12px; margin: 16px 0 28px; padding-left: 24px; color: var(--ink-soft); }
.steps li { padding-left: 4px; }
.type-list { display: grid; gap: 12px; margin: 24px 0 32px; }
.type-card { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.type-number { padding-top: 3px; color: var(--accent); font-size: 12px; font-weight: 650; }
.type-card h2 { margin: 0 0 8px; }
.type-card p { margin: 0; }
.next-links { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 32px; }
.next-links a { font-size: 14px; font-weight: 600; text-decoration: none; }
.next-links a:hover { text-decoration: underline; }
.example-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin: 24px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.example-inputs > div { display: flex; min-width: 0; flex-direction: column; gap: 6px; padding: 18px; background: var(--surface); }
.example-inputs span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.example-inputs strong { font-size: 20px; line-height: 1.35; }
.calculation { margin: 12px 0 18px; padding: 14px 18px; border-radius: 10px; background: var(--surface-muted); color: var(--accent-strong); font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .wrap { width: calc(100% - 32px); padding-top: 20px; }
  .site-nav { flex-wrap: wrap; gap: 16px; margin-bottom: 28px; padding-bottom: 18px; }
  .site-nav > div a, .footer-nav a, .next-links a { display: inline-flex; align-items: center; min-height: 44px; }
  .site-nav > div { gap: 0 18px; }
  .footer-nav { gap: 0 20px; }
  .next-links { flex-direction: column; align-items: flex-start; gap: 4px; }
  .intro { padding-top: 4px; }
  .cards, .example-inputs { grid-template-columns: 1fr; }
  .chapter-list .card { grid-template-columns: minmax(0, 1fr); }
  .chapter-list .card-label { grid-row: auto; padding-top: 0; }
  .chapter-list .card > span:last-child { grid-column: auto; }
  .chapter-nav a { min-height: 44px; }
  .card { padding: 20px; }
  .type-card { gap: 10px; padding: 18px; }
  .callout { padding: 18px; }
  .footer-nav span { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Interactive sprint example. */
[hidden] { display: none !important; }
.calculator { margin-top: 36px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); scroll-margin-top: 24px; }
.calculator h2 { margin-top: 10px; }
.calculator-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.calculator label { display: grid; gap: 6px; font-size: 14px; color: var(--ink-soft); }
.calculator input { width: 100%; min-width: 0; padding: 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--page); color: var(--ink); font: inherit; font-size: 18px; font-variant-numeric: tabular-nums; }
.calculator input[aria-invalid="true"] { border-color: #9c4632; }
.calculator button { min-height: 44px; margin: 12px 0 20px; padding: 8px 0; border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.calculator :is(input, button):focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 3px; }
.income-node { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 16px; border-radius: 10px; background: var(--accent-strong); color: var(--surface); }
.flow-caption { margin: 12px 0; color: var(--muted); font-size: 13px; text-align: center; max-width: none; }
.allocation-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.allocation-flow > div { padding: 16px; border: 1px solid var(--line); border-radius: 10px; }
.allocation-flow dt, .allocation-flow small { color: var(--muted); font-size: 12px; }
.allocation-flow dd { margin: 6px 0; font-size: 19px; font-weight: 650; overflow-wrap: anywhere; }
.balance-result { margin-top: 16px; padding: 18px; border-radius: 10px; background: var(--surface-muted); }
.balance-result strong { font-size: 20px; }
.balance-result p { margin: 8px 0 0; font-size: 14px; }
[data-state="shortfall"] .balance-result { background: #f7e9e3; border-left: 3px solid #9c4632; }
[data-state="shortfall"] .balance-result strong, .calculator-error { color: #813b29; }
.calculator-note { margin: 16px 0 0; }
@media (max-width: 560px) {
  .calculator { padding: 18px; }
  .calculator-fields, .allocation-flow { grid-template-columns: minmax(0, 1fr); }
  .allocation-flow > div { padding: 12px 16px; }
}

/* Calendar explanation and preparation for extra weeks. */
#extra-week, #week-calculator { scroll-margin-top: 24px; }
.week-illustration { margin: 24px 0 32px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.week-illustration figcaption { display: grid; gap: 6px; }
.week-illustration figcaption > span, .sprint-strip p { font-size: 14px; color: var(--muted); }
.sprint-strip { margin: 24px 0; }
.sprint-strip p { margin: 8px 0 12px; }
.week-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.week-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.week-grid > span, .week-grid > li { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); font-size: 13px; }
.week-grid .extra-week { border-color: var(--accent); background: var(--accent-strong); color: var(--surface); }
.week-grid small { display: block; font-size: 12px; }
.week-illustration > p:last-child { margin-bottom: 0; }
.calculated-weeks { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); list-style: none; padding: 0; margin: 18px 0; }
.calculated-weeks span { font-size: 12px; }
.calculator select { width: 100%; min-width: 0; padding: 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--page); color: var(--ink); font: inherit; font-size: 18px; }
.calculator select:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 3px; }
#week-form > .note { margin-top: 14px; }
@media (max-width: 560px) {
  .week-illustration { padding: 18px; }
  .week-grid, .week-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calculator input[type="date"] { max-width: 100%; }
}

/* Home: understand the method, then make a first plan. */
.home-hero { padding: 12px 0 16px; }
.home-hero h1 { font-size: clamp(34px, 5vw, 48px); }
.home-section { margin-top: 36px; scroll-margin-top: 24px; }
.home-section > h2 { margin-top: 10px; font-size: 25px; }
.home-budget { margin: 22px 0 16px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.home-budget figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px; background: var(--accent-strong); color: var(--surface); }
.home-budget figcaption strong { font-size: 24px; }
.home-budget-weeks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 20px 20px 0; }
.home-budget-weeks > div { display: grid; gap: 6px; padding: 14px; border-radius: 8px; background: var(--surface-muted); }
.home-budget-weeks span { color: var(--muted); font-size: 12px; }
.home-budget-weeks strong { font-size: 18px; }
.home-budget-other { margin: 0; padding: 8px 22px; }
.home-budget-other > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.home-budget-other dt { color: var(--ink-soft); font-size: 14px; }
.home-budget-other dd { margin: 0; font-weight: 650; }
.home-budget > p { max-width: none; margin: 0; padding: 12px 22px 22px; font-size: 14px; }
.home-text-link { display: inline-block; padding: 8px 0; font-size: 14px; font-weight: 600; }
.home-rule { margin: 32px 0; padding-left: 22px; border-left: 3px solid var(--accent-soft); }
.home-rule h2 { margin-top: 0; }
.home-rule p:last-child { margin-bottom: 0; }
.home-first-steps { list-style: none; counter-reset: first-plan; margin: 20px 0; padding: 0; display: grid; gap: 20px; }
.home-first-steps li { counter-increment: first-plan; position: relative; padding-left: 48px; }
.home-first-steps li::before { content: counter(first-plan); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--accent); font-size: 14px; }
.home-first-steps h3 { margin: 0 0 6px; font-size: 18px; line-height: 1.5; }
.home-first-steps p { margin: 0; font-size: 15px; }
#first-plan { scroll-margin-top: 24px; }
.home-extra { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 24px; margin: 36px 0; padding: 24px; border-radius: var(--radius); background: var(--surface-muted); }
.home-extra h2 { margin-top: 10px; }
.home-extra p:not(.eyebrow) { margin-bottom: 8px; font-size: 15px; }
.home-week-symbol { display: grid; grid-template-columns: 1fr 1fr; align-content: center; gap: 8px; }
.home-week-symbol span { display: grid; place-items: center; min-height: 48px; border: 1px solid var(--line-strong); border-radius: 8px; }
.home-week-symbol span:last-child { grid-column: 1 / -1; background: var(--accent-strong); color: var(--surface); }
.home-contents { border-top: 1px solid var(--line); }
.home-contents a { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.home-contents a:hover strong { color: var(--accent); text-decoration: underline; }
.home-contents span { color: var(--muted); font-size: 13px; }
@media (max-width: 560px) {
  .home-hero { padding-top: 0; }
  .home-section > h2 { font-size: 22px; }
  .home-budget-weeks { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 16px 16px 0; }
  .home-budget figcaption, .home-budget-other { padding-left: 16px; padding-right: 16px; }
  .home-budget > p { padding: 12px 16px 16px; }
  .home-extra { grid-template-columns: minmax(0, 1fr); padding: 20px; gap: 16px; }
  .home-week-symbol { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .home-week-symbol span:last-child { grid-column: auto; }
  .home-contents a { grid-template-columns: 24px minmax(0, 1fr); gap: 4px 10px; }
  .home-contents a > span:first-child { grid-row: span 2; align-self: start; padding-top: 3px; }
  .home-contents a > span:last-child { grid-column: 2; }
  .home-hero .start-links > a { min-height: 44px; display: inline-flex; align-items: center; }
}

.home-plan-items { margin: 0; padding: 4px 22px; }
.home-plan-items > div { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.home-plan-items dt { display: grid; gap: 4px; }
.home-plan-items dt span { color: var(--muted); font-size: 13px; }
.home-plan-items dd { margin: 0; flex-shrink: 0; font-size: 19px; font-weight: 650; }
@media (max-width: 560px) {
  .home-plan-items { padding: 4px 16px; }
  .home-plan-items > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .home-plan-items dd { font-size: 17px; }
}

.home-rhythms { display: grid; gap: 18px; margin: 20px 0 24px; max-width: var(--reading-width); }
.home-rhythms > div { padding-left: 18px; border-left: 3px solid var(--accent-soft); }
.home-rhythms dt { margin-bottom: 6px; font-weight: 650; font-size: 18px; }
.home-rhythms dd { margin: 0; color: var(--ink-soft); font-size: 15px; }
