/* calc.css — the calculators in the book look (v9.2). Loaded after chapter.css and calc-legacy.css.
   The old pages styled themselves through a handful of variables; here those variables point at the
   book's own tokens, so the calculators follow the book in light and dark mode. */
body.is-calc{--paper:var(--page-2);--panel:var(--page);--ink-2:var(--muted);--rule-2:var(--rule);
  --orange:var(--accent);--orange-text:var(--accent);--orange-ink:var(--accent-ink);--orange-hover:var(--accent);
  --band:var(--cloth);--band-fg:var(--paper-ink);--band-accent:var(--gold);--alert:var(--flag);
  --display:var(--serif-display);--mono:var(--sans);--gutter:0px;--max:1200px}

/* the old pages were built on a zero-margin reset; give the carried parts the same footing, at zero weight */
:where(.calc-stage,.lg) :where(*){margin:0;padding:0;min-width:0}
:where(.calc-stage,.lg) :where(p,li,h3,dd,td,a){overflow-wrap:break-word}
:where(.calc-stage,.lg) :where(button,input,select,textarea){font-family:var(--sans)}
:where(.lg) :where(a){color:var(--accent)}

/* the calculator itself, between the page head and the sections */
.calc-stage{max-width:1200px;margin:0 auto;padding:6px 24px 14px;scroll-margin-top:12px}
.calc-stage .calc-wrap,.calc-stage .fm-calc{margin:6px 0 10px;border:1px solid var(--rule);border-top:4px solid var(--cloth);border-radius:0;background:var(--page-2)}
.calc-stage p{max-width:none}
.calc-stage .consent-note,.calc-stage .tool-note{font:15px/1.55 var(--sans);color:var(--muted);margin:10px 0 0;max-width:62em}
[data-calc]{min-height:120px}

/* the payor's edition: its fields were styled by the old site sheet */
.fm-calc .field{display:grid;gap:6px}
.fm-calc .field label,.fm-calc .out .k{font:600 12px/1.4 var(--sans);letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}
.fm-calc .field input:not([type=range]){width:100%;font:16px/1.4 var(--sans);color:var(--ink);background:var(--page-2);border:1px solid var(--rule);border-radius:3px;padding:11px 13px}
.fm-calc .field input:focus-visible{outline:3px solid var(--focus);outline-offset:2px}
.fm-calc .in{background:var(--page)}

/* inputs: 16px stops the phone from zooming the page when a field is tapped */
body.is-calc main input,body.is-calc main select,body.is-calc main textarea{font-size:16px!important}
body.is-calc main button{font-size:max(15px,1em)}

/* carried sections inside a numbered station */
.lg{font:17px/1.6 var(--serif)}
.lg > * + *{margin-top:16px}
.lg p{max-width:44em}
.lg p + p{margin-top:12px}
.lg ul:not([class]),.lg ol:not([class]){padding-left:22px}
.lg .fm-intro{font:18px/1.6 var(--serif);color:var(--ink);max-width:44em}
.lg h3{font:600 19px/1.3 var(--serif)}
.lg blockquote{border-left:5px solid var(--gold-soft);background:var(--page-2);padding:12px 18px;font:19px/1.5 var(--serif)}
.lg img{max-width:100%;height:auto}
.outcomes .note{font:12.5px/1.5 var(--sans);color:var(--muted);margin-top:12px}
.btn.ghost{background:transparent;color:var(--ink);border-color:var(--ink)}
.btn.ghost:hover{background:var(--ink);color:var(--paper)}
.station p.related{font:15px/1.7 var(--sans);color:var(--muted);margin:14px 0 0}

/* the book styles every <footer>; a quote's footer inside a carried section is not the page footer */
.lg footer,.calc-stage footer{background:none;color:var(--muted);padding:0;border:0;margin-top:8px;display:block}
.lg .mg-pull{margin:22px 0 8px;border-left:5px solid var(--gold-soft);background:var(--page);padding:12px 18px}
.lg .mg-pull p{font:italic 21px/1.4 var(--serif)}
.lg .mg-split{margin-top:18px}
.lg .mg-timeline,.lg .mg-cards,.lg .fm-lists,.lg .cc-ex{margin-top:16px}
.station .panel .ccards,.station .panel .finder{padding-left:0}

/* hub cards and the "which calculator" list */
.ccards{margin:0 0 6px}
.calc-stage.hub .ccards{grid-template-columns:repeat(3,1fr);margin:8px 0 0}
.ccards a .d{display:block;font:400 15.5px/1.5 var(--sans);color:var(--muted);margin-top:6px}
.ccards a .need{display:block;font:600 12.5px/1.4 var(--sans);font-style:normal;color:var(--accent);margin-top:8px}
.finder{list-style:none;padding:0!important;margin:10px 0 0}
.finder li{display:flex;justify-content:space-between;align-items:baseline;gap:8px 16px;flex-wrap:wrap;padding:11px 0;border-bottom:1px solid var(--rule);font:16px/1.4 var(--sans)}
.finder li a{font-weight:600}

@media (max-width:980px){.calc-stage.hub .ccards{grid-template-columns:1fr}}
@media (max-width:760px){
  .calc-stage{padding:4px 10px 10px}
  .lg{font-size:16.5px}
  .lg .mg-timeline li{padding-left:22px}
  .lg .mg-pull p{font-size:19px}
}

/* Nov 25, 2026 phone test: the live result bar (.calc-mini) sat behind the fixed bottom bar (.bbar, 66px) on phones. Lift it above the bar and leave room at the page end. */
@media (max-width:760px){
  .calc-mini{bottom:calc(66px + env(safe-area-inset-bottom,0px));padding-bottom:10px;z-index:60}
  body.has-calc-mini{padding-bottom:calc(150px + env(safe-area-inset-bottom,0px))}
}
