/* Financial Wellness 4 a Cause: chaptered editorial on warm paper. Tokens first; the engine's classes are never restyled. */
:root {
  --sc-canvas: #f3ebdd;
  --sc-surface: #faf5ec;
  --sc-ink: #1e2a3a;
  --sc-ink-soft: #5a6472;
  --sc-accent: #0b7a6e;
  --sc-accent-ink: #f7fbfa;
  --sc-font-display: "Fraunces", Georgia, serif;
  --sc-font-text: "Instrument Sans", system-ui, sans-serif;
  --sc-font-mono: "Instrument Sans", ui-monospace, monospace;
  --sc-shadow-color: 35 30% 20%;
  --sc-edge: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --sc-e1: 0 1px 2px hsl(var(--sc-shadow-color) / 0.12), 0 2px 6px -1px hsl(var(--sc-shadow-color) / 0.10);
  --sc-e2: 0 2px 4px hsl(var(--sc-shadow-color) / 0.12), 0 10px 22px -6px hsl(var(--sc-shadow-color) / 0.18);
  --sc-e3: 0 4px 8px hsl(var(--sc-shadow-color) / 0.12), 0 22px 44px -10px hsl(var(--sc-shadow-color) / 0.22);
  --paper-2: #ece2d0;
  --paper-3: #f7f1e6;
  --paper-4: #e6dbc6;
  --red: #b42318;
  --gold: #e9bb68;
  --margin-w: 17.5rem;
}
.sc-display { font-weight: 500; }
.sc-display--xl, .sc-display--lg { font-variation-settings: "opsz" 144; }
.sc-body { font-size: var(--sc-t-base); line-height: 1.65; }
.nums { font-variant-numeric: tabular-nums; }
a.cta-line { color: var(--sc-ink); text-decoration-thickness: 2px; text-underline-offset: 0.18em; text-decoration-color: var(--sc-accent); font-family: var(--sc-font-display); font-weight: 500; letter-spacing: var(--sc-track-snug); }
a.cta-line:hover, a.cta-line:focus-visible { text-decoration-thickness: 3px; color: var(--sc-accent); }
a.cta-line:active { transform: translateY(1px); }

/* ---------------------------------------------------------------- chrome: folio + ledger */
.margin { position: fixed; z-index: var(--sc-z-chrome); left: 0; top: 0; bottom: 0; width: var(--margin-w); padding: var(--sc-6) var(--sc-5); display: flex; flex-direction: column; gap: var(--sc-5); pointer-events: none; }
.folio { display: flex; flex-direction: column; gap: 2px; padding-bottom: var(--sc-3); border-bottom: 1px solid var(--sc-hairline-strong); opacity: 0.95; }
.folio__num { font-family: var(--sc-font-display); font-size: var(--sc-t-sm); color: var(--sc-accent); letter-spacing: 0.04em; }
.folio__title { font-family: var(--sc-font-display); font-size: var(--sc-t-lg); line-height: 1.2; letter-spacing: var(--sc-track-snug); text-wrap: balance; }
.ledger { position: relative; background: var(--sc-surface); border: 1px solid var(--sc-hairline-strong); border-radius: var(--sc-r-sm); padding: var(--sc-4) var(--sc-4) var(--sc-3); box-shadow: var(--sc-e2), var(--sc-edge); font-size: var(--sc-t-sm); transform-origin: 0 0; will-change: transform, opacity; }
.ledger::before { content: ""; position: absolute; left: 0.9rem; top: 0; bottom: 0; width: 1px; background: rgba(190, 80, 70, 0.45); }
.ledger__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sc-2); font-family: var(--sc-font-display); font-size: var(--sc-t-sm); margin: 0 0 var(--sc-3) 0.6rem; }
.ledger__head em { font-style: italic; color: var(--sc-ink-soft); font-size: var(--sc-t-xs); }
.ledger__rows, .ledger__plan { list-style: none; margin: 0 0 0 0.6rem; padding: 0; }
.ledger__rows li, .ledger__plan li { display: flex; justify-content: space-between; gap: var(--sc-3); padding: 0.28rem 0; border-top: 1px solid var(--sc-hairline); opacity: 0; transform: translate3d(0, 6px, 0); transition: opacity 420ms var(--sc-ease-out), transform 420ms var(--sc-ease-out); will-change: transform, opacity; }
.ledger__rows li.is-on, .ledger__plan li.is-on { opacity: 1; transform: none; }
.ledger__rows li span:last-child, .ledger__plan li span:last-child, .ledger__foot b { font-variant-numeric: tabular-nums; }
.ledger__rows li.in span:last-child { color: var(--sc-accent); font-weight: 600; }
.ledger__rows li.in { background: linear-gradient(90deg, rgba(233, 187, 104, 0.35), rgba(233, 187, 104, 0.05)); border-radius: 3px; padding-inline: 0.3rem; margin-inline: -0.3rem; }
.ledger__rows li.is-struck span:last-child { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--red); }
.ledger__rows li.is-red { color: var(--red); }
.ledger__rows li.is-head { font-family: var(--sc-font-display); color: var(--sc-ink-soft); border-top: 0; padding-top: 0.6rem; }
.ledger__foot { display: flex; justify-content: space-between; gap: var(--sc-3); margin: var(--sc-2) 0 0 0.6rem; padding-top: 0.4rem; border-top: 1.5px solid var(--sc-ink); font-weight: 600; }
.ledger__foot.is-red b { color: var(--red); }
.ledger__foot.is-good b { color: var(--sc-accent); }
.ledger__plan { margin-top: var(--sc-3); }
.ledger__plan li { color: var(--sc-accent); font-weight: 500; }
.ledger__cap { display: none; margin: 0 0 var(--sc-3) 0.6rem; font-family: var(--sc-font-display); font-size: var(--sc-t-xl); line-height: 1.1; letter-spacing: var(--sc-track-snug); color: var(--sc-ink); opacity: 0; transform: translate3d(0, 10px, 0); will-change: opacity, transform; }
.ledger.is-stage .ledger__cap { display: block; }
.ledger.is-stage { position: fixed; z-index: 70; pointer-events: none; }

/* ---------------------------------------------------------------- page layout */
main { padding-left: var(--margin-w); }
.chapter { position: relative; }
.chapter__label { font-family: var(--sc-font-display); font-style: italic; color: var(--sc-accent); font-size: var(--sc-t-base); margin: 0 0 var(--sc-3); }
.chapter--title { background: var(--sc-canvas); min-height: 100svh; display: flex; align-items: center; }
.title { max-width: 60rem; }
.masthead { font-family: var(--sc-font-display); font-size: var(--sc-t-base); letter-spacing: 0.06em; text-transform: uppercase; color: var(--sc-ink-soft); margin: 0 0 var(--sc-6); }
.masthead span { color: var(--sc-accent); }
.title__h1 { max-width: 15ch; margin-bottom: var(--sc-5); }
.title__lede { max-width: 42ch; margin-bottom: var(--sc-5); color: var(--sc-ink-soft); }
.byline { color: var(--sc-ink-soft); margin: 0 0 var(--sc-6); font-size: var(--sc-t-sm); }
.runline { font-size: var(--sc-t-xl); margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sc-2) var(--sc-4); }
.runline__or { font-family: var(--sc-font-text); font-size: var(--sc-t-sm); color: var(--sc-ink-soft); max-width: 24ch; }
.runline--big { font-size: var(--sc-t-2xl); }
.cta-line--sm { font-size: var(--sc-t-lg); }

/* chapter one: scrub over paper. The scrim washes toward the canvas (light page), never darkens. */
.chapter--one { background: #e9dfcd; }
.paper-scrim { background: linear-gradient(to top right, rgba(243, 235, 221, 0.96) 0%, rgba(243, 235, 221, 0.86) 28%, rgba(243, 235, 221, 0.45) 50%, transparent 70%); }
.chapter--one .sc-copy { max-width: min(34rem, 72vw); }
.chapter--one .sc-display { margin-bottom: var(--sc-4); }
.copy-on-stage { color: var(--sc-ink); max-width: 40ch; }

/* two-column spreads: media in its own column with a caption; never under type */
.chapter--two { background: var(--paper-2); }
.chapter--four { background: var(--paper-3); }
.chapter--five { background: var(--paper-4); }
.spread { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: var(--sc-9); align-items: start; }
.spread--flip { grid-template-columns: 0.9fr 1.1fr; }
.spread__text .sc-display { margin-bottom: var(--sc-5); }
.spread__media { margin: 0; }
.spread__media figcaption { font-size: var(--sc-t-xs); color: var(--sc-ink-soft); margin-top: var(--sc-3); max-width: 42ch; }
.bill { width: 100%; max-width: 26rem; height: auto; filter: drop-shadow(0 12px 22px rgba(60, 40, 10, 0.18)); }
.bill text { font-family: var(--sc-font-text); fill: var(--sc-ink); }
.bill__h { font-size: 13px; letter-spacing: 0.14em; font-weight: 600; }
.bill__r { font-size: 13px; fill: var(--sc-ink-soft); }
.bill__t { font-size: 15px; }
.bill__n { font-size: 15px; font-variant-numeric: tabular-nums; }
.bill__s { font-size: 13px; fill: var(--sc-ink-soft); }
.bill__big { font-size: 24px; font-family: var(--sc-font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.bill__big--red { fill: var(--red); }
.bignum { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sc-2) var(--sc-4); margin: var(--sc-5) 0; }
.bignum .sc-nums { font-family: var(--sc-font-display); font-size: var(--sc-t-3xl); line-height: 1; letter-spacing: var(--sc-track-tight); color: var(--sc-ink); }
.bignum__unit { font-size: var(--sc-t-sm); color: var(--sc-ink-soft); max-width: 22ch; }
.timeline svg { width: 100%; max-width: 28rem; height: auto; }
.timeline text { font-family: var(--sc-font-text); fill: var(--sc-ink); }
.tl__h { font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; fill: var(--sc-ink-soft); }
.tl__t { font-size: 15px; } .tl__t--light { fill: #fff; } .tl__t--red { fill: var(--red); }
.tl__n { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; } .tl__n--light { fill: #fff; } .tl__n--red { fill: var(--red); }
.tl__s { font-size: 12px; fill: var(--sc-ink-soft); }
.tl__big { font-size: 40px; font-family: var(--sc-font-display); font-weight: 600; }

/* silence: a ground-only screen with one line, authored */
.chapter--silence { background: var(--paper-2); min-height: 50svh; display: flex; align-items: center; justify-content: center; }
.silence__line { font-family: var(--sc-font-display); font-style: italic; font-size: var(--sc-t-lg); color: var(--sc-ink-soft); margin: 0; }

/* the peak marker: tall, nearly empty on screen; the ledger stage does the work. Static copy stays for readers without JS/motion. */
.chapter--peak { background: #efe3cf; min-height: 360svh; }
.peak__static { position: sticky; top: 0; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; opacity: 0; pointer-events: none; }
.peak__static .sc-display { margin-bottom: var(--sc-4); }
.peak__table { border-collapse: collapse; margin: var(--sc-5) 0; font-size: var(--sc-t-sm); max-width: 40rem; width: 100%; }
.peak__table caption { text-align: left; font-family: var(--sc-font-display); font-style: italic; color: var(--sc-ink-soft); margin-bottom: var(--sc-2); }
.peak__table th, .peak__table td { text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--sc-hairline); }
.peak__table td { text-align: right; font-variant-numeric: tabular-nums; }
.peak__table td:last-child { color: var(--red); }
.peak__total th, .peak__total td { font-weight: 600; border-top: 1.5px solid var(--sc-ink); }
.no-js .peak__static, .peak-static .peak__static { opacity: 1; pointer-events: auto; position: static; }
.no-js .margin, .peak-static .margin .ledger__cap { display: none; }

/* chapter five: type on space */
.drawer { max-width: 44rem; }
.drawer .sc-lede { margin: 0 0 var(--sc-5); font-family: var(--sc-font-display); font-style: italic; }
.drawer .sc-body + .sc-body { margin-top: var(--sc-4); }

/* close + colophon */
.chapter--close { background: var(--sc-canvas); padding-bottom: var(--sc-6); }
.close { display: grid; grid-template-columns: minmax(14rem, 0.7fr) 1.3fr; gap: var(--sc-9); align-items: start; }
.close__trish img { width: 100%; max-width: 18rem; height: auto; border-radius: var(--sc-r-md); box-shadow: var(--sc-e3); }
.close__name { font-family: var(--sc-font-display); font-size: var(--sc-t-xl); margin: var(--sc-5) 0 var(--sc-2); }
.close__role { color: var(--sc-ink-soft); font-size: var(--sc-t-sm); margin: 0 0 var(--sc-3); max-width: 30ch; }
.close__mail { font-size: var(--sc-t-sm); margin: 0; overflow-wrap: anywhere; }
.close__ask .sc-display { margin-bottom: var(--sc-5); }
.close__alt { font-size: var(--sc-t-sm); }
.colophon { grid-column: 1 / -1; margin-top: var(--sc-9); padding-top: var(--sc-5); border-top: 1px solid var(--sc-hairline-strong); color: var(--sc-ink-soft); font-size: var(--sc-t-sm); max-width: 78ch; }
.colophon p { margin: 0 0 var(--sc-3); }
.colophon__brand { font-family: var(--sc-font-display); color: var(--sc-ink); font-size: var(--sc-t-base); }
.colophon__brand span { color: var(--sc-ink-soft); font-style: italic; font-size: var(--sc-t-sm); margin-left: var(--sc-2); }
.colophon__fine { font-size: var(--sc-t-xs); line-height: 1.55; }

/* ---------------------------------------------------------------- phones and narrow screens */
@media (max-width: 1099px) {
  main { padding-left: 0; }
  .margin { top: 2px; bottom: auto; right: 0; width: auto; padding: 0; flex-direction: row; align-items: stretch; gap: 0; background: var(--sc-surface); border-bottom: 1px solid var(--sc-hairline-strong); box-shadow: 0 6px 18px rgba(60, 40, 10, 0.12); }
  .margin { height: 3.25rem; overflow: hidden; }
  .folio { flex: 1 1 auto; padding: 0 0.9rem; border: 0; flex-direction: row; align-items: center; gap: 0.5rem; min-width: 0; }
  .folio__num { white-space: nowrap; font-size: var(--sc-t-xs); }
  .folio__title { font-size: var(--sc-t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ledger { flex: 0 0 auto; border: 0; border-left: 1px solid var(--sc-hairline-strong); border-radius: 0; box-shadow: none; padding: 0 0.9rem; max-width: 46vw; overflow: hidden; display: flex; align-items: center; }
  .ledger::before, .ledger__head, .ledger__rows, .ledger__plan { display: none; }
  .ledger__foot { margin: 0; padding: 0; border: 0; font-size: var(--sc-t-xs); gap: 0.5rem; white-space: nowrap; }
  .ledger.is-stage { position: fixed; inset: 0; max-width: none; border: 0; padding: clamp(1rem, 5vw, 2rem); overflow: auto; display: flex; flex-direction: column; justify-content: center; background: var(--sc-surface); }
  .ledger.is-stage::before, .ledger.is-stage .ledger__head, .ledger.is-stage .ledger__rows, .ledger.is-stage .ledger__plan { display: block; }
  .ledger.is-stage .ledger__head { display: flex; }
  .ledger.is-stage .ledger__foot { margin-top: var(--sc-2); padding-top: 0.4rem; border-top: 1.5px solid var(--sc-ink); font-size: var(--sc-t-base); }
  .ledger.is-stage .ledger__rows li, .ledger.is-stage .ledger__plan li { font-size: var(--sc-t-base); }
  main { padding-top: 3.25rem; }
  .chapter--title { min-height: calc(100svh - 3.25rem); }
}
@media (max-width: 860px) {
  .spread, .spread--flip, .close { grid-template-columns: 1fr; gap: var(--sc-7); }
  .spread--flip .spread__media { order: 2; }
  .title__h1 { font-size: var(--sc-t-2xl); max-width: none; }
  .runline { font-size: var(--sc-t-lg); }
  .runline--big { font-size: var(--sc-t-xl); }
  .chapter--one .sc-copy { max-width: none; bottom: 4.5rem; }
  .chapter--one .sc-display--lg { font-size: var(--sc-t-2xl); }
  .chapter--one .sc-display--md { font-size: var(--sc-t-xl); }
  .paper-scrim { background: linear-gradient(to top, rgba(243, 235, 221, 0.97) 0%, rgba(243, 235, 221, 0.9) 30%, rgba(243, 235, 221, 0.5) 50%, transparent 66%); }
  .bignum .sc-nums { font-size: var(--sc-t-2xl); }
  .chapter--peak { min-height: 320svh; }
}

/* ---------------------------------------------------------------- reduced motion: the peak is real markup, the chrome stays small */
@media (prefers-reduced-motion: reduce) {
  .peak__static { opacity: 1; pointer-events: auto; position: static; }
  .ledger__rows li, .ledger__plan li { transition-duration: 160ms; transform: none; }
  .ledger.is-stage { display: none; }
}
