/* ==========================================================================
   Your Personal Finance MBA · site stylesheet
   The brand is Jose's Financial Strategy deck (site/financialstrategy/assets/deck.css).
     Color   white paper, charcoal ink, lime as a mark only (accent line, highlighter, answer chip,
             primary button, corner square, Next band). Red only for losses, negatives and costs;
             olive for totals and good outcomes; violet only for content not from Jose's classes.
     Type    Montserrat 800 for titles and featured numbers, DM Sans for reading and interface.
             Monospace only for literal Excel formulas.
     Layout  rules, not boxes: a block opens with a rule and a label; only tools and tables get a
             frame. No shadows, square corners, one 6px radius for small buttons and chips.
   Spec: _build/design/spec-1-foundation.md (tokens, type, spacing) and parts 2 to 4.
   ========================================================================== */

:root {
  color-scheme: light;
  /* brand: these never change with the theme */
  --lime: #C5E756;  --lime-2: #D9F08F;  --lime-3: #EEF8CE;
  --lime-ink: #5E7A12;              /* lime at text level, 4.9:1 on white */
  --olive: #76923C;  --olive-2: #8FAE4E;   /* non-text fills only */
  --charcoal: #2A2A2A;  --night: #121417;  --night-2: #1C1F24;
  --gold: #E3B23C;                  /* review marks only, never text */
  --on-lime: #232323;               /* text on any lime fill, both themes */
  /* surfaces */
  --paper: #FFFFFF;  --paper-2: #FAFAF7;  --paper-3: #EFEFEF;
  --band: #121417;                  /* home title band, footer */
  --story: #121417;                 /* case panels */
  --on-dark: #D8D8D8;  --on-dark-2: #BFC3C9;  --on-dark-3: #8D939B;
  --on-dark-red: #FF6B66;  --on-dark-rule: rgba(255, 255, 255, .14);
  /* text */
  --ink: #232323;                   /* headings, figures, math */
  --text: #333333;                  /* running text */
  --ink-2: #4A4A4A;                 /* secondary text */
  --ink-3: #6E6E6E;                 /* labels, captions, sources, axis text */
  /* rules */
  --rule: #DADADA;                  /* hairlines and table grid */
  --rule-strong: #BDBDBD;           /* tool frame */
  --field: #8A8A8A;                 /* input edges: 3.3:1 on the control column (WCAG 1.4.11) */
  --rule-ink: #232323;              /* rules that open a block */
  /* bands */
  --bar: #2A2A2A;  --bar-ink: #FFFFFF;          /* title bars and table header rows */
  --total-bg: #5E7A12;  --total-ink: #FFFFFF;   /* tr.total */
  /* meaning */
  --red: #D7332F;  --blood: var(--red);         /* losses, negatives, costs, fees, shortfalls */
  --red-wash: #FBEEEE;  --pink: #F3D9D8;  --sec-red: #C0504D;
  --violet: #5A48C9;  --violet-wash: #F4F2FD;   /* Review mode only */
  --green: var(--lime-ink);                     /* legacy alias, do not use in new rules */
  --focus: #5E7A12;
  /* charts (JS reads these through slots; never hex in JS) */
  --chart-surface: var(--paper);
  --series-1: #2A2A2A;  --series-2: #76923C;  --series-3: #6E6E6E;  --series-4: #8C8C8C;   /* 4 is 3.4:1 on white */
  --series-muted: #949494;          /* context marks the text still points at: 3:1 on white */
  --bar-base: #2A2A2A;              /* the home timeline's money put in */
  --loss: var(--red);  --gain: var(--olive);  --hi: var(--lime);
  --zone-loss: #FBEEEE;  --zone-gain: #EEF8CE;
  --grid: #EFEFEF;  --axis: #6E6E6E;
  /* drawings in the part openers (sources and each token's job: _build/art/); inline SVG uses them as fill="var(--art-ink)" */
  --art-ink: #2A2A2A;  --art-slate: #3A3F45;  --art-gray: #A6A6A6;  --art-gray-2: #DADADA;  --art-ground: #EFEFEF;
  --art-cream: #F4F6EC;  --art-white: #FFFFFF;  --art-lime: #C5E756;  --art-lime-2: #D9F08F;  --art-olive: #76923C;
  --art-red: #D7332F;  --art-on-lime: #232323;  --art-on-ink: #FFFFFF;  --art-on-red: #FFFFFF;

  /* type */
  --font-head: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --font-body: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;   /* .excel only */
  --fs-hero: clamp(2.6rem, 1.2rem + 6vw, 6rem);            /* title band only */
  --fs-display: clamp(2.25rem, 1.35rem + 2.8vw, 3.5rem);   /* page h1 */
  --fs-h2: clamp(1.625rem, 1.3rem + 1vw, 2rem);
  --fs-statement: clamp(1.3rem, 1.1rem + .6vw, 1.625rem);  /* key insight: the deck's statement-to-title ratio (s13), above h3, below h2 */
  --fs-h3: clamp(1.25rem, 1.15rem + .3vw, 1.375rem);
  --fs-bar: clamp(1.0625rem, .98rem + .35vw, 1.25rem);
  --fs-lede: clamp(1.1875rem, 1.05rem + .45vw, 1.375rem);
  --fs-body: clamp(1.0625rem, 1rem + .2vw, 1.125rem);
  --fs-table: 1rem;  --fs-ui: .9375rem;  --fs-small: .875rem;  --fs-label: .8125rem;  --fs-micro: .75rem;
  --fs-num-hero: clamp(2.25rem, 1.5rem + 2.6vw, 3.5rem);
  --fs-num: clamp(1.5rem, 1.25rem + .9vw, 2rem);

  /* space and layout */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;  --sp-5: 20px;  --sp-6: 24px;
  --sp-7: 32px; --sp-8: 40px; --sp-9: 48px;  --sp-10: 64px; --sp-11: 80px; --sp-12: 96px;
  --measure: 35rem;                 /* about 69 characters of 18px DM Sans */
  --figure: 46rem;
  --wide: 61.25rem;
  --rail: 264px;
  --gutter: clamp(16px, 4vw, 56px);
  --bar-h: 56px;
  --accent-w: 96px;  --accent-h: 4px;   /* the deck's 160 x 6 line at the guide's scale: long and thin */
  --radius: 6px;
  --ease: cubic-bezier(.2, .8, .2, 1);  --dur-ui: .2s;  --dur-explain: .7s;
}

/* dark: the same declarations in both blocks (system setting, and the reader's own choice) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --lime-ink: #C5E756;  --olive: #8FAE4E;
    --paper: #121417;  --paper-2: #1A1D22;  --paper-3: #23272E;
    --band: #0C0D10;  --story: #1C1F24;
    --ink: #FFFFFF;  --text: #D8D8D8;  --ink-2: #C4C7CC;  --ink-3: #8D939B;
    --rule: #2A2E35;  --rule-strong: #3F454E;  --rule-ink: #8D939B;  --field: #6B727C;
    --bar: #2A2E35;  --bar-ink: #FFFFFF;          /* a dark band, never a lime slab */
    --total-bg: #2C3514;  --total-ink: #C5E756;
    --red: #FF6B66;  --red-wash: #2E1817;  --pink: #2E1817;
    --violet: #A79BF6;  --violet-wash: #1B1836;
    --focus: #C5E756;
    --series-1: #EDEDED;  --series-2: #8FAE4E;  --series-3: #8D939B;  --series-4: #5F656E;
    --series-muted: #5F656E;  --bar-base: #5F656E;   /* muted grey fills, never white blocks (deck s04) */
    --gain: #8FAE4E;  --zone-loss: #2E1817;  --zone-gain: #1F2614;
    --grid: #23272E;  --axis: #8D939B;
    --art-ink: #3F454E;  --art-slate: #5F656E;  --art-gray: #8D939B;  --art-gray-2: #2F343B;  --art-ground: #23272E;
    --art-cream: #EDEDED;  --art-white: #FFFFFF;  --art-lime: #C5E756;  --art-lime-2: #8FA83E;  --art-olive: #8FAE4E;
    --art-red: #FF6B66;  --art-on-lime: #232323;  --art-on-ink: #FFFFFF;  --art-on-red: #121417;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --lime-ink: #C5E756;  --olive: #8FAE4E;
  --paper: #121417;  --paper-2: #1A1D22;  --paper-3: #23272E;
  --band: #0C0D10;  --story: #1C1F24;
  --ink: #FFFFFF;  --text: #D8D8D8;  --ink-2: #C4C7CC;  --ink-3: #8D939B;
  --rule: #2A2E35;  --rule-strong: #3F454E;  --rule-ink: #8D939B;  --field: #6B727C;
  --bar: #2A2E35;  --bar-ink: #FFFFFF;
  --total-bg: #2C3514;  --total-ink: #C5E756;
  --red: #FF6B66;  --red-wash: #2E1817;  --pink: #2E1817;
  --violet: #A79BF6;  --violet-wash: #1B1836;
  --focus: #C5E756;
  --series-1: #EDEDED;  --series-2: #8FAE4E;  --series-3: #8D939B;  --series-4: #5F656E;
  --series-muted: #5F656E;  --bar-base: #5F656E;
  --gain: #8FAE4E;  --zone-loss: #2E1817;  --zone-gain: #1F2614;
  --grid: #23272E;  --axis: #8D939B;
  --art-ink: #3F454E;  --art-slate: #5F656E;  --art-gray: #8D939B;  --art-gray-2: #2F343B;  --art-ground: #23272E;
  --art-cream: #EDEDED;  --art-white: #FFFFFF;  --art-lime: #C5E756;  --art-lime-2: #8FA83E;  --art-olive: #8FAE4E;
  --art-red: #FF6B66;  --art-on-lime: #232323;  --art-on-ink: #FFFFFF;  --art-on-red: #121417;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--bar-h) + 28px); }
/* the bar is always in view, so focus inside it must not scroll the page; larger than the largest scroll padding (208px, Library pages under 360px) */
#site-header :is(a, button) { scroll-margin-top: -240px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--paper); color: var(--text); font: 400 var(--fs-body)/1.6 var(--font-body);
  font-optical-sizing: auto; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; }

/* links in prose; chrome links (nav, rail, lists, pager, buttons) set their own */
a { color: inherit; text-decoration: underline; text-decoration-color: var(--lime-ink); text-decoration-thickness: 1.5px; text-underline-offset: .18em;
  transition: text-decoration-color var(--dur-ui) var(--ease); }
a:hover { text-decoration-color: var(--ink); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
:is(.titleband, .case, .footer) :focus-visible { outline-color: var(--lime); }
.ctl__num:focus-visible, .ref-search:focus-visible { outline-offset: 0; border-color: var(--ink); }
::selection { background: var(--lime); color: var(--on-lime); }

h1, h2, h3, h4 { margin: 0; }
:is(h1, h2, h3) { font-family: var(--font-head); font-weight: 800; color: var(--ink); text-wrap: balance; text-transform: none; }
p { margin: 0; }
:is(p, li, .insight, .opener__lede) { text-wrap: pretty; }
ul, ol { margin: 0; padding-left: 1.375em; }
li + li { margin-top: .44em; }
ul > li::marker { color: var(--ink); }
ol > li::marker { font: 800 1em var(--font-head); color: var(--lime-ink); }
strong { font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.mono, .num { font-family: inherit; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.skip { position: absolute; left: -100vw; top: 0; z-index: 100; padding: var(--sp-2) var(--sp-3); background: var(--bar); color: var(--bar-ink);
  font: 600 var(--fs-ui)/1.2 var(--font-body); text-decoration: none; }
.skip:focus { left: var(--sp-2); top: var(--sp-2); }

/* the deck's highlighter (deck .hl-lime, or <mark>): a few marked words, hover on list titles */
.hl-lime, mark { background: linear-gradient(transparent 58%, var(--lime) 58%, var(--lime) 92%, transparent 92%);
  -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 .08em; color: inherit; }
/* the deck's accent line: opens a page or a major section, never inside a panel.
   Not named .accent: KaTeX puts class="accent" on every \bar and \hat symbol. */
.opener::before, h2.h-roman::before, .accent-line { content: ''; display: block; width: var(--accent-w); height: var(--accent-h); background: var(--lime); margin-bottom: var(--sp-5); }

/* the one label style (deck .eyebrow): letter-spaced DM Sans, gray; lime on night, violet for Added */
.eyebrow, .opener__eyebrow, .tool__eyebrow, .case__tag, .deeper__tag,
.rail__label, .lib-filter__label, .pager small, .herotl__label, .lib-kind, h4 {
  font: 700 var(--fs-label)/1.2 var(--font-body); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
h4 { color: var(--ink-2); }
:is(.titleband, .case, .footer) :is(.eyebrow, .case__tag) { color: var(--lime); }
/* names of any length use the sentence-case label; so do the labels inside a tool, which keeps one caps eyebrow (its head) */
.formula__label, .tile__label, .example__tag, .callout__t, .math-live__t, .tool__notice h4 { font: 700 var(--fs-small)/1.35 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--ink-3); }
.opener__eyebrow, .deeper__tag, .case__tag { text-wrap: balance; }

/* math (KaTeX): ink, left-aligned, notation untouched */
.katex { color: inherit; }
:is(.formula__math, .steps, .math-live__m, .herotl__math) { color: var(--ink); }
:is(.formula__math, .math-live__m, .herotl__math, .steps) .katex-display { margin: 0; text-align: left; overflow-x: auto; overflow-y: hidden; }
:is(.formula__math, .math-live__m, .herotl__math, .steps) .katex-display > .katex { text-align: left; }
/* containers that already scroll: the inner KaTeX block must not add a second scrollbar (after the rule above) */
.math-live__m > .katex-display, .formula__math > .katex-display, .steps .v > .katex-display, .herotl__math > .katex-display, .tablewrap .katex-display { overflow: visible; margin: 0; }
/* display formulas are set inline (ui.js), so a long one wraps after = or +; the wrapped lines keep some room between them */
:is(.formula__math, .math-live__m, .steps .v, .herotl__math) .katex-html > .base { margin-block: .2em; }
/* a formula that still scrolls (aligned blocks, very long lines) shows a bar, so the reader can see it continues.
   No scrollbar-width or scrollbar-color here: either one makes Chrome ignore these rules and hide the bar again. */
.formula__math::-webkit-scrollbar, .math-live__m::-webkit-scrollbar, .steps .v::-webkit-scrollbar { height: 8px; }
.formula__math::-webkit-scrollbar-thumb, .math-live__m::-webkit-scrollbar-thumb, .steps .v::-webkit-scrollbar-thumb { background: var(--rule-strong); }
:is(p, li, td) .katex { font-size: 1.12em; }
.katex .text { font-family: var(--font-body); }
.formula__vars b { font: italic 400 1.15em/1 KaTeX_Math, "Times New Roman", serif; color: var(--ink); }
.formula__vars b[data-tex] { font: inherit; font-style: normal; }   /* keys written as TeX are rendered by KaTeX (site.js) */
.formula__vars b[data-tex] .katex { font-size: 1.1em; }

/* ---------- header: solid paper bar, the deck's corner square as the brand mark ---------- */
#site-header { position: sticky; top: 0; z-index: 40; }      /* the host sticks, so the bar really stays */
.topbar { position: relative; display: flex; align-items: stretch; gap: var(--sp-6); height: var(--bar-h);
  padding: 0 var(--gutter) 0 0; background: var(--paper); border-bottom: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; color: var(--ink); text-decoration: none; }
.brand::before { content: ''; flex: none; align-self: flex-start; width: var(--bar-h); height: var(--bar-h); margin-bottom: -1px;
  background: linear-gradient(315deg, rgba(238, 248, 206, .7) 0 50%, transparent 50%) 0 0 / 50% 50% no-repeat,
              linear-gradient(135deg, rgba(217, 240, 143, .85) 0 50%, transparent 50%), #C5E756; }   /* deck .deco-corner, both facets; covers the hairline */
.brand__mark { font: 800 1rem/1 var(--font-head); letter-spacing: -.01em; white-space: nowrap; }
.topbar__spacer { flex: 1 1 0; }
.topnav { display: flex; align-items: stretch; gap: var(--sp-5); }
.topnav a, .iconbtn, .menubtn { display: flex; align-items: center; margin: 0; padding: 0; border: 0; border-radius: 0; background: none;
  font: 600 var(--fs-ui)/1 var(--font-body); color: var(--ink-2); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: color var(--dur-ui) var(--ease), box-shadow var(--dur-ui) var(--ease); }
.topnav a:hover, .iconbtn:hover { color: var(--ink); }
.topnav a[aria-current] { color: var(--ink); box-shadow: inset 0 -4px 0 var(--lime); }          /* nav mark */
#theme-toggle { margin-left: var(--sp-2); }
#theme-toggle::before { content: ''; width: 1px; height: 20px; margin-right: var(--sp-6); background: var(--rule-strong); }  /* nav | switch */
.iconbtn[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 -4px 0 var(--lime); }
.iconbtn[data-toggle="review"][aria-pressed="true"] { color: var(--violet); box-shadow: inset 0 -4px 0 var(--violet); }
.topbar :focus-visible { outline-offset: -3px; }
.menubtn { display: none; color: var(--ink); font-weight: 700; }
.menubtn[aria-expanded="true"] { box-shadow: inset 0 -4px 0 var(--lime); }
@media (max-width: 980px) {
  .topnav, .topbar > .iconbtn { display: none; }
  .menubtn { display: flex; margin-left: auto; margin-right: calc(-1 * var(--sp-3)); padding: 0 var(--sp-3); }
}

/* ---------- shell: rail + main ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); max-width: 1360px; margin: 0 auto; }
/* rail: a plain list (deck .rd-step.now), no dots, no line; the 3px current mark hangs in the left padding */
.rail { position: sticky; top: var(--bar-h); align-self: start; height: calc(100vh - var(--bar-h)); overflow-y: auto; overscroll-behavior: contain;
  padding: var(--sp-7) var(--sp-5) var(--sp-9) var(--sp-6); border-right: 1px solid var(--rule); font-family: var(--font-body); }
.rail__top { display: none; }
.rail__label { margin: var(--sp-8) 0 var(--sp-3); }
.rail__label:first-child, .rail__top + .rail__label { margin-top: 0; }
.timeline { list-style: none; margin: 0 0 0 calc(-1 * (var(--sp-3) + 3px)); padding: 0; }
.timeline li { margin: 0; }
.timeline li::before { content: none; }
.timeline a { display: block; padding: 6px var(--sp-2) 6px var(--sp-3); border-left: 3px solid transparent;
  font: 500 var(--fs-ui)/1.3 var(--font-body); color: var(--ink-2); text-decoration: none; transition: color var(--dur-ui) var(--ease); }
.timeline a:hover { color: var(--ink); }
.timeline a[aria-current="page"] { border-left-color: var(--lime); color: var(--ink); font-weight: 700; }   /* current mark */
/* the two tracks: a hanging numeral (deck ol.steps-list) in its own column, so wrapped titles line up */
.timeline--num a { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr); column-gap: var(--sp-2); align-items: baseline; }
.timeline .t-num { margin: 0; font: 800 var(--fs-small)/1.3 var(--font-head); letter-spacing: 0; text-transform: none; color: var(--ink-3); font-variant-numeric: tabular-nums lining-nums; }
.timeline a[aria-current="page"] .t-num { color: var(--lime-ink); }
.timeline--num .subtoc { margin-left: calc(1.25rem + var(--sp-2)); }   /* the page's contents line up under its title */
.subtoc { list-style: none; margin: 2px 0 var(--sp-3) var(--sp-3); padding: 0; border: 0; }
.subtoc li + li { margin-top: 0; }
.subtoc a { display: block; padding: 4px var(--sp-2) 4px var(--sp-3); border-left: 3px solid transparent;
  font: 400 var(--fs-small)/1.35 var(--font-body); color: var(--ink-3); text-decoration: none; transition: color var(--dur-ui) var(--ease); }
.subtoc a:hover { color: var(--ink); }
.subtoc a.is-active { border-left-color: var(--lime); color: var(--ink); font-weight: 600; }
.rail a:focus-visible { outline-offset: -3px; }               /* the rail scrolls; keep rings inside it */
html:not(.review) .review-only { display: none; }

.main { min-width: 0; padding: 0 var(--gutter) var(--sp-12); }

/* ---------- page opener: the white-slide heading stack (accent line, label, title, lede) ---------- */
.opener { max-width: var(--wide); padding: 4rem 0 0; }
.opener__eyebrow { margin-bottom: var(--sp-3); }
.opener h1 { margin: 0; max-width: 16em; font: 800 var(--fs-display)/1.04 var(--font-head); letter-spacing: -.02em; text-transform: none; color: var(--ink); }
.opener__lede { margin-top: var(--sp-5); max-width: var(--measure); font: 400 var(--fs-lede)/1.5 var(--font-body); color: var(--text); }
.opener__meta { display: none; }   /* counts under a title ("5 tools", "515 formulas") read as stat padding; the page shows what it has */
.opener > .src[data-from="review"] { margin-top: var(--sp-3); }
@media (max-width: 720px) { .opener { padding-top: 2.5rem; } }
/* a part's drawing (.opener__art, put in by _build/art/inline.py): to the right of the heading stack with its bottom on the end of the text.
   At full width the text column is the 35rem measure and the drawing takes the rest. If the drawing is the taller one, the first row takes the difference, so the text still ends level with it. */
.opener:has(> .opener__art) { display: grid; grid-template-columns: minmax(min-content, 1fr) minmax(0, min(40%, 23.75rem)); grid-template-rows: 1fr repeat(4, auto); column-gap: var(--sp-8); }
.opener:has(> .opener__art)::before { grid-area: 2 / 1; }
.opener:has(> .opener__art) > .opener__eyebrow { grid-area: 3 / 1; }
.opener:has(> .opener__art) > h1 { grid-area: 4 / 1; }
.opener:has(> .opener__art) > .opener__lede { grid-area: 5 / 1; }
.opener:has(> .opener__art) > .src { grid-column: 1 / -1; }   /* the Review mode note site.js adds under the text */
.opener__art { grid-area: 1 / 2 / 6 / 3; align-self: end; }
.opener__art svg { display: block; width: 100%; height: auto; }
.opener__art svg text { font-family: var(--font-head); }   /* the files name Montserrat alone; this keeps the fallbacks the headings have while it loads */
/* the rail leaves the least room from 981px to 1099px, so the drawing gives way to keep "Diversification" clear of it */
@media (min-width: 981px) and (max-width: 1099px) { .opener:has(> .opener__art) { grid-template-columns: minmax(min-content, 1fr) minmax(0, 36%); column-gap: var(--sp-7); } }
/* phones: the drawing above the accent line, on the same left edge */
@media (max-width: 720px) {
  .opener:has(> .opener__art) { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .opener__art { grid-area: 1 / 1; width: 15rem; max-width: 100%; margin-bottom: var(--sp-6); }
}

/* ---------- section rhythm: block flow, margins collapse; a heading sits close to what it introduces ---------- */
.section, .prose { display: block; padding: 0; }
.section > *, .prose > * { margin-block: 0; min-width: 0; }
.section > * + *, .prose > * + * { margin-top: 1em; }
.section > :where(.tool, .tablewrap, .formula, .example, .compare, .ledger, .insight, .case, .added, .callout, details.deeper) { margin-block: 2rem; }
.section > .takeaways { margin-top: 3rem; }
.section > .src { margin-top: .5rem; }
.section > h4 { margin-top: 1.75rem; }      .section > h4 + * { margin-top: .5rem; }
.section > h3 { margin-top: 2.5rem; }       .section > h3 + * { margin-top: .625rem; }
.section > h2.bar { margin-top: 4.5rem; }   .section > h2.h-roman { margin-top: 5rem; }
.section > :is(h2.bar, h2.h-roman) + * { margin-top: 1.25rem; }
.opener + .section > :first-child { margin-top: 3rem; }

/* three widths from one left edge: text, figure, wide */
:is(.section, .deeper__body, .added, .callout, .case, .example__body, .compare > div, .takeaways, .lib-item) > :is(p, ul, ol, dl, h3, h4, .lead, .aside-note, .src) { max-width: var(--measure); }
.section > :is(p, ul, ol, h3, h4, .lead, .insight, .takeaways, .aside-note, .src) { max-width: var(--measure); }
.section > :is(h2.h-roman, .example, .ledger, .callout, .case, .added, details.deeper) { max-width: var(--figure); }
.section > :is(h2.bar, .tool, .tablewrap, .compare, .cards, .wide) { max-width: var(--wide); }   /* .formula sets the wide column itself */
.prose { max-width: var(--measure); }

/* flow inside containers: the same steps as the section */
:is(.deeper__body, .lib-item, .added, .case, .example__body, .callout, .compare > *) > * { margin-block: 0; }
:is(.deeper__body, .lib-item, .added, .case, .example__body, .callout, .compare > *) > * + * { margin-top: 1em; }
:is(.deeper__body, .lib-item) > :where(.tool, .tablewrap, .formula, .example, .compare, .ledger, .insight, .case, .added, .callout, details.deeper) { margin-block: 2rem; }
:is(.added, .case, .example__body) > :where(.tablewrap, .formula, .example, .compare, .ledger, .callout) { margin-block: 1.5rem; }
:is(.deeper__body, .lib-item) > h3 { margin-top: 2.5rem; }
:is(.deeper__body, .lib-item) > h4 { margin-top: 1.75rem; }
:is(.deeper__body, .lib-item, .added, .case, .example__body, .callout, .compare > *) > h3 + * { margin-top: .625rem; }
:is(.deeper__body, .lib-item, .added, .case, .example__body, .callout, .compare > *) > h4 + * { margin-top: .5rem; }
:is(.deeper__body, .lib-item, .added, .case, .example__body, .callout, .compare > *) > .src { margin-top: var(--sp-2); }
:is(.deeper__body, .lib-item, .added, .case, .example__body, .callout, .compare > *) > :first-child { margin-top: 0; }
:is(.deeper__body, .lib-item, .added, .case, .example__body, .callout, .compare > *) > :last-child { margin-bottom: 0; }
/* panels fill their container; text keeps the measure */
:is(.deeper__body, .lib-item, .added, .case, .compare > *) > :is(.tool, .tablewrap, .compare, .formula, .example, .callout, .case, .added, details.deeper) { max-width: 100%; }
.example .example__body > ol.steps { max-width: none; }

/* bullets (deck ul.bullets): ink dots, hanging; component lists (.formula__vars, .steps, .presets) stay bare */
:is(.section, .deeper__body, .added, .callout, .case, .example__body, .compare > div, .tool__notice, .lib-item) > ul { list-style: none; padding-left: 1.375em; }
:is(.section, .deeper__body, .added, .callout, .case, .example__body, .compare > div, .tool__notice, .lib-item) > ul > li { position: relative; }
:is(.section, .deeper__body, .added, .callout, .case, .example__body, .compare > div, .tool__notice, .lib-item) > ul > li::before {
  content: ''; position: absolute; left: -1.05em; top: .72em; width: .34em; height: .34em; border-radius: 50%; background: var(--ink); }
:is(.section, .deeper__body, .added, .callout, .case, .example__body, .compare > div, .tool__notice, .lib-item) > :is(ul, ol) li > ul { list-style: none; padding-left: 1.375em; margin-top: .44em; }
:is(.section, .deeper__body, .added, .callout, .case, .example__body, .compare > div, .tool__notice, .lib-item) > :is(ul, ol) li > ul > li { position: relative; }
:is(.section, .deeper__body, .added, .callout, .case, .example__body, .compare > div, .tool__notice, .lib-item) > :is(ul, ol) li > ul > li::before {
  content: ''; position: absolute; left: -1.05em; top: .72em; width: .34em; height: .34em; border-radius: 50%; background: none; border: 1.5px solid var(--ink-3); box-sizing: border-box; }

/* ---------- headings and text blocks ---------- */
/* the black title bar from Jose's PDF = the deck's charcoal table header; no lime stripe */
.bar { display: block; max-width: var(--wide); margin: 0; padding: 14px 20px; border: 0; border-radius: 0; box-shadow: none;
  background: var(--bar); color: var(--bar-ink); font: 800 var(--fs-bar)/1.2 var(--font-head); letter-spacing: .02em; text-transform: uppercase; text-wrap: balance; }
/* roman section: accent line on top, the numeral hangs so a wrapped title lines up under its first word */
h2.h-roman { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .4em; align-items: baseline;
  max-width: var(--figure); margin: 0; padding: 0; border: 0;
  font: 800 var(--fs-h2)/1.12 var(--font-head); letter-spacing: -.015em; text-transform: none; color: var(--ink); }
h2.h-roman::before { grid-column: 1 / -1; }
h2.h-roman .roman { font: inherit; letter-spacing: inherit; color: var(--lime-ink); }
h2.h-roman:not(:has(.roman)) { display: block; }              /* no numeral (glossary letters, home closing): accent line over the title */
h3 { margin: 0; font: 800 var(--fs-h3)/1.25 var(--font-head); letter-spacing: -.01em; text-transform: none; color: var(--ink); }
h4 { margin: 0; }
.lead { font: 400 var(--fs-lede)/1.5 var(--font-body); color: var(--text); }
.aside-note { font: 400 var(--fs-small)/1.5 var(--font-body); font-style: normal; color: var(--ink-2); }

/* key insight: Jose's green bold line, now the deck's statement (Montserrat 800, a size between h3 and h2).
   The highlighter marks only the words an author wraps in <mark>, as the deck marks one word (slide 22). */
.insight { max-width: var(--measure); padding: 0; border: 0;
  font: 800 var(--fs-statement)/1.28 var(--font-head); letter-spacing: -.015em; color: var(--ink); text-wrap: pretty; }
.insight a { text-decoration-color: currentColor; }

/* ---------- formula: class notation in ink, opened by a 2px ink rule (deck slide 13 formula row) ---------- */
.formula { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); max-width: var(--wide);   /* the wide column, as in the Library: fewer formulas need to scroll */
  padding: var(--sp-3) 0 0; background: none; border: 0; border-top: 2px solid var(--rule-ink); border-radius: 0; }
.formula__label { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-1) var(--sp-3); }
.formula__label .src { flex-basis: 100%; }                     /* Review mode: the source gets its own line */
.formula__math { padding: var(--sp-1) 0; font-size: 1.3rem; color: var(--ink); overflow-x: auto; overflow-y: hidden; }
.formula__vars { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); font: 400 var(--fs-ui)/1.45 var(--font-body); color: var(--text); }
.formula__vars li { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: var(--sp-3); align-items: baseline;
  margin: 0; padding: var(--sp-2) 0; border-bottom: 1px solid var(--rule); }
.formula__note { font: 400 var(--fs-small)/1.45 var(--font-body); font-style: normal; color: var(--ink-3); }

/* literal Excel text typed in class: the monospace face alone marks it */
.excel { font-family: var(--font-mono); font-size: .92em; font-weight: 400; letter-spacing: 0; color: var(--ink);
  background: none; border: 0; border-radius: 0; padding: 0; white-space: normal; }

/* ---------- worked example: givens, formula, plug in, answer (the answer is the deck's lime chip) ---------- */
.example { max-width: var(--figure); background: none; border: 0; border-top: 2px solid var(--rule-ink); border-radius: 0; overflow: visible; }
.example__head { display: grid; gap: var(--sp-3); padding: var(--sp-3) 0 0; background: none; border: 0; }   /* tag above title */
.example__title { font: 800 var(--fs-h3)/1.25 var(--font-head); letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }
.example__body { display: block; padding: var(--sp-4) 0 0; }
.example__q { font-style: normal; color: var(--text); }
.steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.steps > li { display: grid; grid-template-columns: 6rem minmax(0, 1fr); column-gap: var(--sp-4); align-items: baseline;
  margin: 0; padding: var(--sp-3) 0; border-bottom: 1px solid var(--rule); }
.steps > li > .k { padding: 0; font: 700 var(--fs-micro)/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.steps .v { min-width: 0; padding-block: var(--sp-1); color: var(--ink); overflow-x: auto; overflow-y: hidden; }
table.data .katex-display { margin: 0; text-align: left; }
table.data .katex-display > .katex { text-align: left; }
/* ink on a lime chip, both themes; inline so a long answer wraps line by line (deck .s13-rem span) */
.answer { display: inline; padding: .12em .4em; background: var(--lime); color: var(--on-lime);
  border: 0; border-radius: var(--radius); transform: none;
  font: 800 1.375rem/1.5 var(--font-head); letter-spacing: -.01em; font-variant-numeric: tabular-nums lining-nums;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.answer .katex { color: inherit; }

/* ---------- ledger (deck slide 16, s04-lr): DM Sans labels, Montserrat amounts, a 2px ink rule over the total ---------- */
.ledger { display: block; max-width: 30rem; font: 400 var(--fs-table)/1.4 var(--font-body); color: var(--text); }
.ledger > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-4);
  padding: var(--sp-2) 0; border-bottom: 1px solid var(--rule); }
.ledger > div > :first-child:not(:last-child) { flex: 1 1 0; }   /* the label takes the squeeze, so a figure never shrinks */
.ledger > div > :last-child:not(:first-child) { flex: 0 1 auto; text-align: right; white-space: normal; overflow-wrap: normal;   /* figures have no break point; long worded values wrap at spaces */
  font: 800 1.0625rem/1.4 var(--font-head); font-variant-numeric: tabular-nums lining-nums; color: var(--ink); }
.ledger > div:has(+ .total) { border-bottom: 0; }
.ledger > div.total { margin: 0; padding-top: var(--sp-3); border-bottom: 0; border-top: 2px solid var(--rule-ink); }
.ledger > div.total > :first-child { font-weight: 700; color: var(--ink); }
.ledger > div.total > :last-child:not(:first-child) { font-size: 1.25rem; }
.ledger > div > .neg:last-child { color: var(--red); }
.ledger > div > .excel:last-child:not(:first-child) { min-width: 0; font: 400 .92em/1.45 var(--font-mono); letter-spacing: 0; color: var(--ink); }   /* typed Excel keeps its face */
@media (max-width: 720px) {
  .ledger > div:has(> .excel:last-child) { flex-wrap: wrap; row-gap: var(--sp-1); }
  .ledger > div:has(> .excel:last-child) > * { flex: 1 1 100%; text-align: left; }
}

/* ---------- Added: content not from Jose's classes. Readers see plain text; the violet rule and label are for Review mode ---------- */
.added { position: static; display: block; max-width: var(--figure); padding: 0; background: none; border: 0; border-radius: 0; }
.section > .added { margin-block: 1em; }
.added__why { display: none; }
.added-inline { padding: 0; background: none; border: 0; }
.tool__foot .added { display: none; }   /* notes to Jose on how a tool goes beyond class */

/* Review mode: Jose's extra provenance */
html.review .added { padding: var(--sp-1) var(--sp-4) var(--sp-1) var(--sp-5); background: var(--violet-wash); border-left: 4px solid var(--violet);
  outline: 2px dashed var(--violet); outline-offset: 4px; }
html.review .section > .added { margin-block: 2rem; }
html.review .tool__foot .added { display: block; }
html.review .added::before { content: "Added · not from Jose’s MBA classes · review"; position: static; display: block; margin-bottom: var(--sp-2);
  padding: 0; background: none; font: 700 var(--fs-small)/1.35 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--violet); }
html.review .added[data-kind="formula"]::before { content: "Added formula · not used in Jose’s classes · review"; }
html.review .added[data-kind="data"]::before { content: "Added fact · not from Jose’s class materials · review"; }
html.review .added[data-kind="tool"]::before { content: "Added tool logic · goes beyond Jose’s classes · review"; }
html.review .added__why { display: block; font: 500 var(--fs-small)/1.45 var(--font-body); color: var(--violet); }
html.review .added-inline { background: var(--violet-wash); text-decoration: underline dashed var(--violet) 2px; text-underline-offset: .22em; text-decoration-skip-ink: none; }
html.review table.data :is(thead th, tr.total td) .added-inline { color: var(--ink); }

/* ---------- sources (deck slide 19 source line): Review mode only ---------- */
.src { display: none; width: auto; max-width: var(--measure); margin: 0; padding: 0; border: 0; border-radius: 0; background: none;
  font: 500 var(--fs-label)/1.45 var(--font-body); font-style: normal; letter-spacing: 0; text-transform: none; color: var(--ink-3); }
.src::before { content: "Source: "; font-weight: 700; color: var(--ink-3); }
.src[data-from="pdf"]::before { content: "Jose’s draft: "; }
.src[data-from="review"]::before { content: none; }           /* the additions count is a note, not a source */
html.review .src { display: block; }   /* sources are for Review mode; readers do not need them */

/* Review mode: a gold mark in the left gutter on passages written from the course materials; the text stays put */
html.review [data-origin="expanded"] { border-left: 3px solid var(--gold); margin-left: -14px; padding-left: 11px; }
html.review .case[data-origin="expanded"] { margin-left: 0; padding-left: calc(var(--sp-6) - 3px); border-left: 3px solid var(--gold); }
html.review li[data-origin="expanded"]::before { margin-left: 11px; }
html.review :is(ul, ol)[data-origin="expanded"] { padding-left: calc(1.375em + 11px); }   /* lists keep their bullet indent */
html.review .takeaways ul[data-origin="expanded"] { padding-left: 11px; }
html.review span[data-origin="expanded"] { margin-left: 0; padding-left: 0; border-left: 0;
  text-decoration-line: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: .22em; }

/* ---------- callouts: one form for every kind, a 1px ink rule and a name label (the label names the kind) ---------- */
.callout, .callout--analogy, .callout--watch, .callout--class { display: block; max-width: var(--figure);
  padding: var(--sp-3) 0 0; background: none; border: 0; border-top: 1px solid var(--rule-ink); border-radius: 0;
  font-size: 1rem; line-height: 1.55; }
.callout__t, .callout--analogy .callout__t, .callout--watch .callout__t, .callout--class .callout__t { color: var(--ink-3); }
.callout > .callout__t + * { margin-top: var(--sp-2); }

/* ---------- takeaways: accent line, section-size title, a ruled list ---------- */
.takeaways { display: block; max-width: var(--measure); padding: 0; border: 0; }
.takeaways h3 { margin: 0; font: 800 var(--fs-h2)/1.12 var(--font-head); letter-spacing: -.015em; text-transform: none; color: var(--ink); }
.takeaways h3::before { content: ''; display: block; width: var(--accent-w); height: var(--accent-h); margin-bottom: var(--sp-5); background: var(--lime); }
.takeaways ul { list-style: none; margin: var(--sp-5) 0 0; padding: 0; border-top: 1px solid var(--rule); }
.takeaways li { position: static; margin: 0; padding: var(--sp-3) 0; border-bottom: 1px solid var(--rule); }
.takeaways li::before { content: none; }

/* ---------- compare (deck slide 22): columns opened by a 2px ink rule, no boxes ---------- */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: var(--sp-7); max-width: var(--wide); }
.compare > div { display: block; min-width: 0; padding: var(--sp-3) 0 0; background: none; border: 0; border-top: 2px solid var(--rule-ink); }
/* small titles: compare columns, and headings built inside tools (statement names, worksheet steps), never the caps label */
.compare h4, .tool__out > h4, .tool .prose > h4 { font: 800 1.0625rem/1.3 var(--font-head); letter-spacing: -.005em; text-transform: none; color: var(--ink); }
.compare h4, .tool__out > h4 { margin: 0; }
.tool .prose > * + h4 { margin-top: var(--sp-6); }
.tool .prose > h4 + * { margin-top: var(--sp-2); }
.tool__out > h4 { margin-bottom: calc(var(--sp-2) - var(--sp-7)); }   /* 8px to its table, as in .compare, inside the out column's 32px gap */
.compare > div > :is(p, ul, ol) { font-size: 1rem; line-height: 1.55; }

/* ---------- tables (deck .tbl): charcoal header row, 1px grid, bold first column, olive totals, red only for negatives ---------- */
.tablewrap { max-width: var(--wide); overflow-x: auto; overflow-y: hidden; border: 0; border-radius: 0; }
table.data { width: auto; min-width: min(100%, var(--measure)); border-collapse: separate; border-spacing: 0;
  font: 500 var(--fs-table)/1.35 var(--font-body); font-variant-numeric: tabular-nums lining-nums; color: var(--text); }
table.data :is(th, td) { padding: var(--sp-2) var(--sp-3); text-align: left; vertical-align: top;
  border: 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
table.data :is(th, td):first-child { border-left: 1px solid var(--rule); }
table.data thead th { vertical-align: bottom; background: var(--bar); color: var(--bar-ink);
  border-color: var(--bar); border-top: 1px solid var(--bar);
  font: 700 var(--fs-table)/1.25 var(--font-body); letter-spacing: 0; text-transform: none; white-space: normal; }
table.data thead th:first-child { border-left-color: var(--bar); }
table.data thead th small { display: block; margin-top: var(--sp-1); font: 700 var(--fs-micro)/1.2 var(--font-body);
  letter-spacing: .14em; text-transform: uppercase; color: var(--on-dark-2); }
table.data tbody td:first-child { font-weight: 700; color: var(--ink); }
table.data :is(td, th).n { text-align: right; white-space: nowrap; font-family: inherit; }
table.data td .katex { white-space: nowrap; }
table.data tr.total td { background: var(--total-bg); color: var(--total-ink); font-weight: 700; border-color: var(--total-bg); }
table.data tr.sub td { background: var(--pink); }
table.data tr.sec td:first-child { background: var(--sec-red); color: #FFFFFF; border-color: var(--sec-red); }
table.data td.neg { color: var(--red); font-weight: 700; }
table.data tr.total td.neg { color: var(--total-ink); }        /* red on olive fails contrast; the sign carries it */
/* phones and tablets: under a table that scrolls sideways, one quiet line says so (site.js adds it only when the table overflows) */
.table-hint { display: none; font: 500 var(--fs-label)/1.4 var(--font-body); color: var(--ink-3); }
@media (max-width: 980px) {
  .table-hint { display: block; }
  :is(.section, .deeper__body, .lib-item, .added, .case, .example__body) > .tablewrap:has(+ .table-hint:not([hidden])) { margin-bottom: var(--sp-2); }
  :is(.section, .deeper__body, .lib-item, .added, .case, .example__body) > .table-hint { margin-top: var(--sp-2); margin-bottom: 1.5rem; }
}

/* ---------- glossary term: dotted underline, charcoal tooltip ---------- */
.term { position: relative; cursor: help; text-decoration: none; border-bottom: 1px dotted var(--ink-3); }
.term:hover::after, .term:focus::after { content: attr(data-def); position: absolute; left: 0; top: calc(100% + var(--sp-2)); z-index: 30;
  width: min(20rem, 80vw); padding: var(--sp-3); background: var(--charcoal); color: #FFFFFF;
  border: 0; border-radius: var(--radius); box-shadow: none;
  font: 400 var(--fs-small)/1.45 var(--font-body); font-style: normal; letter-spacing: 0; text-transform: none; text-align: left; white-space: normal; }
.case .term:hover::after, .case .term:focus::after { border: 1px solid var(--rule-strong); }
/* near the right edge the tooltip ends at the term instead (site.js sets .tip-end); on phones it is a sheet at the foot of the screen */
.term.tip-end:hover::after, .term.tip-end:focus::after { left: auto; right: 0; }
/* in a lower table row the table's own box would cut the tooltip off, so it opens above the term (site.js sets .tip-up) */
.term.tip-up:hover::after, .term.tip-up:focus::after { top: auto; bottom: calc(100% + var(--sp-2)); }
@media (max-width: 720px) {
  .term:hover::after, .term:focus::after, .term.tip-end:hover::after, .term.tip-end:focus::after, .term.tip-up:hover::after, .term.tip-up:focus::after {
    position: fixed; left: var(--gutter); right: var(--gutter); top: auto; bottom: var(--sp-4); width: auto; z-index: 50; }
}

/* ---------- pager: Next is the deck's bottom-right lime block (.deco-bar) with the .rd-nextbtn type; Previous is a quiet link ---------- */
.pager { display: flex; align-items: stretch; justify-content: space-between; gap: var(--sp-6); margin: 0;
  padding-left: calc(max(0px, (100% - 1360px) / 2) + var(--rail) + var(--gutter)); }
.pager a { text-decoration: none; }
.pager .prev { align-self: center; display: grid; gap: var(--sp-1); max-width: 30rem; padding: var(--sp-6) 0; color: var(--ink); }
.pager .prev b { font: 600 var(--fs-body)/1.35 var(--font-body); color: var(--ink-2); transition: color var(--dur-ui) var(--ease); }
.pager .prev:hover b { color: var(--ink); text-decoration: underline; text-decoration-color: var(--lime-ink); text-decoration-thickness: 2px; text-underline-offset: .2em; }
.pager .next { flex: 0 1 min(50vw, 720px); margin-left: auto;   /* 50vw is only a basis that can shrink, so no scrollbar overflow */
  display: grid; align-content: center; gap: var(--sp-2); text-align: left;
  padding: var(--sp-7) var(--gutter) var(--sp-7) var(--sp-8); background: var(--lime); color: var(--on-lime);
  transition: background-color var(--dur-ui) var(--ease); }
.pager .next:hover { background: var(--lime-2); }
.pager .next small { color: var(--on-lime); }
.pager .next b { font: 800 clamp(1.25rem, 1rem + 1vw, 1.75rem)/1.15 var(--font-head); letter-spacing: -.01em; }
.pager__arrow { position: relative; left: 0; margin-left: .35em; transition: left var(--dur-ui) var(--ease); }  /* inline: stays on the last word */
.pager .next:hover .pager__arrow { left: 4px; }
.pager .next:focus-visible { outline: 3px solid var(--on-lime); outline-offset: -8px; }
body:not(.has-next) .pager { padding-bottom: var(--sp-10); }   /* room for the static lime block under Previous */

/* ---------- footer (deck .s01-foot with the partners row), on night ---------- */
.footer { position: relative; margin: 0; background: var(--band); color: var(--on-dark); font: 400 var(--fs-small)/1.55 var(--font-body); }
.footer p { margin: 0; }
.footer__inner { max-width: calc(var(--wide) + 2 * var(--sp-6)); margin: 0 auto; padding: var(--sp-10) var(--sp-6) var(--sp-9); display: grid; gap: var(--sp-7); }
.footer__name { font: 800 1.375rem/1.1 var(--font-head); color: #FFFFFF; }
.footer__by { margin-top: var(--sp-1); font-size: var(--fs-ui); color: var(--on-dark-2); }
.footer .eyebrow { margin-bottom: var(--sp-3); }
.footer a { color: var(--lime); text-decoration: none; }
.footer a:hover { text-decoration: underline; text-decoration-color: var(--lime); text-decoration-thickness: 2px; text-underline-offset: .2em; }
/* Review mode, the author switch, sits with the footer links as a text button; on, it turns violet (the night band's violet) */
.footer__look-title { margin: 0; font: 800 var(--fs-h2)/1.12 var(--font-head); letter-spacing: -.015em; text-transform: none; color: #FFFFFF; }
.footer__look-title::before { content: ''; display: block; width: var(--accent-w); height: var(--accent-h); background: var(--lime); margin-bottom: var(--sp-5); }
.footer .refrow { --rule: var(--on-dark-rule); --rule-ink: var(--on-dark-rule); margin-top: var(--sp-6); }
.footer .refrow a { color: #FFFFFF; }
.footer .refrow a:hover { text-decoration: none; }
.footer .refrow span { color: var(--on-dark-2); }
.footer .refrow a:is(:hover, :focus-visible) b { background: none; color: var(--lime); }
.footer__legal { max-width: 40rem; color: var(--on-dark-3); }
/* the deck's lime block bottom-right, on pages with no Next band */
body:not(.has-next) .footer::before { content: ''; position: absolute; right: 0; bottom: 100%; width: min(40%, 560px); height: var(--sp-10); background: var(--lime); }

/* ==========================================================================
   TOOLS: a white slide in a 1px frame. White head, controls on --paper-2, output on --paper
   ========================================================================== */
.tool { border: 1px solid var(--rule-strong); border-radius: 0; background: var(--paper); background-image: none; box-shadow: none; overflow: visible; }
.tool__head { display: block; padding: var(--sp-5) var(--sp-6); background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--rule); }
.tool__eyebrow { display: none; margin-bottom: var(--sp-3); opacity: 1; }   /* says where a tool came from: Review mode only */
html.review .tool__eyebrow { display: block; }
.example__tag { display: none; }   /* "From class · TVM-4" and the like: Review mode only */
html.review .example__tag { display: block; }
.tool__title { margin: 0; font: 800 var(--fs-h3)/1.25 var(--font-head); letter-spacing: -.01em; color: var(--ink); text-transform: none; }
.tool__intro { margin-top: var(--sp-4); max-width: var(--measure); font: 400 1rem/1.5 var(--font-body); color: var(--ink-2); opacity: 1; }
.tool__grid { display: grid; grid-template-columns: minmax(14.5rem, 18.75rem) minmax(0, 1fr); }
.tool__controls { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--sp-5); padding: var(--sp-6); background: var(--paper-2); border-right: 1px solid var(--rule); }
.tool__out { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--sp-7); min-width: 0; padding: var(--sp-6); background: var(--paper); container: toolout / inline-size; }
.tool__foot { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); padding: var(--sp-5) var(--sp-6) var(--sp-6); background: var(--paper); border-top: 1px solid var(--rule); }
.tool__foot .src { max-width: var(--figure); }
.tool__foot:not(:has(> :not(.src, .added))) { display: none; }   /* a foot holding only notes for Review mode is empty for readers */
html.review .tool__foot:not(:has(> :not(.src, .added))) { display: grid; }
html.review .tool__foot .added { max-width: var(--figure); margin: 0; font-size: var(--fs-table); line-height: 1.5; }   /* never louder than What to notice */
/* "What to notice" */
.tool__notice h4 { margin: 0 0 var(--sp-3); }
.tool__notice ul { max-width: var(--measure); margin: 0; }
.tool__notice li { font: 400 var(--fs-table)/1.5 var(--font-body); color: var(--text); }

/* controls: labels, hints, number cells (deck s24 what-if cell: square, bordered, Montserrat value) */
.ctl { display: grid; gap: var(--sp-2); }
/* a long label takes the whole row and its cell drops under it, right-aligned; short labels keep the cell beside them */
.ctl__row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--sp-2) var(--sp-3); }
.ctl label { flex: 1 1 auto; min-width: 0; font: 700 var(--fs-ui)/1.3 var(--font-body); color: var(--ink); }
.ctl__hint { font: 400 var(--fs-label)/1.45 var(--font-body); color: var(--ink-3); }
.ctl__numwrap { flex: none; display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font: 500 var(--fs-small)/1 var(--font-body); color: var(--ink-3); }
.ctl__unit { display: inline-block; min-width: 1.75rem; }
.ctl__num { box-sizing: border-box; padding: 6px 10px; font: 500 1rem/1.2 var(--font-body); color: var(--ink); background: var(--paper); border: 1px solid var(--field); border-radius: 0; }
input[type="number"].ctl__num { width: 6.5rem; font: 700 1rem/1.2 var(--font-head); font-variant-numeric: tabular-nums lining-nums; text-align: right; -moz-appearance: textfield; appearance: textfield; }
input[type="number"].ctl__num::-webkit-inner-spin-button, input[type="number"].ctl__num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select.ctl__num { font: 500 1rem/1.3 var(--font-body); }
.tool input.ref-search { box-sizing: border-box; width: 100%; padding: 8px 10px; font: 400 1rem/1.4 var(--font-body); text-align: left; color: var(--ink); background: var(--paper); border: 1px solid var(--field); border-radius: 0; }

/* slider: charcoal fill to the thumb, lime thumb with an ink ring; --p (0 to 1) is set by ui.js */
/* 40px tall so a thumb that lands a little off the track still moves it; the negative margin keeps the layout of a 24px slider */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 40px; margin: -8px 0; background: transparent; cursor: pointer; }
/* the unfilled track uses the input-edge gray (3:1 or more), so the reader can see how far the slider goes */
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 0;
  background: linear-gradient(90deg, var(--ink) 0 calc(9px + (100% - 18px) * var(--p, .5)), var(--field) 0); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 0; background: var(--field); }
input[type="range"]::-moz-range-progress { height: 4px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--lime); border: 2px solid var(--ink); box-shadow: none; }
input[type="range"]::-moz-range-thumb { box-sizing: border-box; width: 18px; height: 18px; border-radius: 50%; background: var(--lime); border: 2px solid var(--ink); box-shadow: none; }
input[type="range"]:focus-visible { outline: 3px solid var(--focus); outline-offset: -4px; }   /* inside the 40px box: the ring stays the height it had */
/* checkboxes (p8-fund-screen): charcoal when ticked, a size a thumb can hit */
.tool input[type="checkbox"] { accent-color: var(--ink); width: 18px; height: 18px; margin: 3px 0 0; cursor: pointer; }

/* presets: ruled rows with an arrow; the applied one gets the rail's 3px lime mark (aria-pressed, set by ui.js) */
.presets { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.presets .btn { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); width: 100%; margin: 0; padding: 10px 0 10px 10px;
  text-align: left; font: 600 var(--fs-ui)/1.35 var(--font-body); color: var(--ink); background: none;
  border: 0; border-bottom: 1px solid var(--rule); border-left: 3px solid transparent; border-radius: 0; }
.presets .btn::after { content: "\2192"; flex: none; color: var(--lime-ink); transition: transform var(--dur-ui) var(--ease); }
.presets .btn:hover { background: var(--paper); }
.presets .btn:hover::after { transform: translateX(4px); }
.presets .btn[aria-pressed="true"] { border-left-color: var(--lime); font-weight: 700; }
/* the lime mark alone is faint on the control column, so the applied example also says so in words */
.presets .btn[aria-pressed="true"]::after { content: "Showing"; transform: none; font: 700 var(--fs-small)/1.35 var(--font-body); color: var(--lime-ink); }

/* segmented choice (deck .tag radius): 1px ink outline, pressed = ink fill */
.seg { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.seg button { display: block; width: 100%; margin: 0; padding: 9px 12px; text-align: left; font: 600 var(--fs-ui)/1.3 var(--font-body); color: var(--ink);
  background: none; border: 0; border-top: 1px solid var(--rule); cursor: pointer; transition: background-color var(--dur-ui) var(--ease), color var(--dur-ui) var(--ease); }
.seg button:first-child { border-top: 0; }
.seg button:hover { background: var(--paper-3); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); font-weight: 700; }
.seg button:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.seg button[aria-pressed="true"]:focus-visible { outline-color: var(--lime); }
.seg--row { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.seg--row button { text-align: center; border-top: 0; border-left: 1px solid var(--rule); }
.seg--row button:first-child { border-left: 0; }

/* buttons: Reset, Back */
.btn { display: inline-flex; align-items: center; gap: var(--sp-2); width: fit-content; padding: 8px 14px; font: 600 var(--fs-ui)/1.2 var(--font-body); color: var(--ink);
  background: none; border: 1px solid var(--ink); border-radius: var(--radius); cursor: pointer; transition: background-color var(--dur-ui) var(--ease); }
.btn:hover { background: var(--paper-3); }

/* stats (deck slide 06): no boxes, a 2px ink rule over each, label above, a Montserrat value that never wraps and shrinks to fit */
/* --tw is one stat's width, taken from the toolout container (cqi resolves where --tw is used), so a stat need not be
   a size container itself; a size container cannot be a subgrid, and the subgrid is what lines up a row's figures */
.tiles { --n: 3; --tw: calc((100cqi - (var(--n) - 1) * var(--sp-6)) / var(--n)); display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: var(--sp-5) var(--sp-6); }
.tiles[data-n="0"], .tiles[data-n="1"] { --n: 1; }
.tiles[data-n="2"], .tiles[data-n="4"] { --n: 2; }          /* four stats sit 2 x 2, never 3 + 1 */
.cov-tiles { container-type: inline-size; }                 /* the coverage page's stats sit outside any tool */
.tile { display: block; min-width: 0; padding: var(--sp-3) 0 0; background: none; border: 0; border-top: 2px solid var(--rule-ink); border-radius: 0; }
.tile--hero { grid-column: 1 / -1; --tw: 100cqi; }
.tile__value { margin-top: var(--sp-2); font-family: var(--font-head); font-weight: 800; line-height: 1.05; letter-spacing: -.02em;
  font-size: min(var(--fs-num), calc(var(--tw) * .13), calc(var(--tw) / (var(--chars, 6) * .66)));
  font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; overflow-wrap: normal; color: var(--ink); }
.tile--hero .tile__value { font-size: min(var(--fs-num-hero), calc(var(--tw) / (var(--chars, 6) * .66))); line-height: 1; letter-spacing: -.03em; }
.tile__sub { margin-top: var(--sp-2); font: 400 var(--fs-small)/1.45 var(--font-body); color: var(--ink-2); }
.tile__sub:empty { display: none; }
.delta-up, .tile__value.delta-up { color: var(--lime-ink); }
.delta-down, .neg, .tile__value.delta-down, .tile__value.neg { color: var(--red); }
/* no value yet (en dash, "Not set"): a quiet placeholder in the body face (ui.js sets .is-empty) */
.tile__value.is-empty, .tile--hero .tile__value.is-empty { font: 500 var(--fs-body)/1.4 var(--font-body); letter-spacing: 0; color: var(--ink-3); }
/* narrow output column: supporting stats become ledger rows (deck s04-lr); the hero stays a big number */
@container toolout (max-width: 34.49rem) {
  .tiles[data-n="3"] { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .tiles[data-n="3"] > .tile--hero + .tile { margin-top: var(--sp-4); }
  .tiles[data-n="3"] > .tile:not(.tile--hero) { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--sp-4); align-items: baseline; padding: var(--sp-3) 0; border-top: 1px solid var(--rule); }
  .tiles[data-n="3"] > .tile:first-child:not(.tile--hero) { border-top: 2px solid var(--rule-ink); }
  .tiles[data-n="3"] > .tile:not(.tile--hero) .tile__value { margin-top: 0; font-size: 1.375rem; }
  .tiles[data-n="3"] > .tile:not(.tile--hero) .tile__sub { grid-column: 1 / -1; margin-top: var(--sp-1); }
}
@container toolout (max-width: 22.49rem) {
  .tiles { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .tiles > .tile--hero + .tile { margin-top: var(--sp-4); }
  .tiles > .tile:not(.tile--hero) { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--sp-4); align-items: baseline; padding: var(--sp-3) 0; border-top: 1px solid var(--rule); }
  .tiles > .tile:first-child:not(.tile--hero) { border-top: 2px solid var(--rule-ink); }
  .tiles > .tile:not(.tile--hero) .tile__value { margin-top: 0; font-size: 1.375rem; }
  .tiles > .tile:not(.tile--hero) .tile__sub { grid-column: 1 / -1; margin-top: var(--sp-1); }
}
/* stats side by side share label, figure and note rows, so a label that wraps does not drop its figure below the others */
@container toolout (min-width: 34.5rem) { .tiles > .tile { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; align-content: start; } }
@container toolout (min-width: 22.5rem) { .tiles:not([data-n="3"]) > .tile { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; align-content: start; } }

/* the math, with your numbers: a minor opener rule, ink math */
.math-live { display: grid; gap: var(--sp-2); padding: var(--sp-3) 0 0; background: none; border: 0; border-top: 1px solid var(--rule-ink); border-radius: 0; }
.math-live[hidden] { display: none; }
.math-toggle { justify-self: start; margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--rule-ink); }   /* opens the math boxes under it */
.math-toggle[aria-expanded="true"] + .math-live { border-top: 0; padding-top: 0; }
.math-live__m { color: var(--ink); overflow-x: auto; overflow-y: hidden; padding: 2px 0 4px; }
/* ---------- the bag of chips test (Chapter 1): three places to keep a dollar, side by side. A fixed comparison with nothing to adjust.
   Wide: three columns share two labelled rows (the bag, then your dollar). Narrow: each column becomes its own block. ---------- */
.chips__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--sp-7); padding: var(--sp-6); }
.chips__col { grid-row: 1 / span 6; display: grid; grid-template-rows: subgrid; min-width: 0; }
.chips__col:nth-of-type(1) { grid-column: 1; }
.chips__col:nth-of-type(2) { grid-column: 2; }
.chips__col:nth-of-type(3) { grid-column: 3; }
.chips__opt { grid-row: 1; align-self: end; margin: 0; padding-bottom: var(--sp-4); font: 800 1.125rem/1.25 var(--font-head); letter-spacing: -.01em; text-transform: none; color: var(--ink); }
.chips__opt span { display: block; margin-top: var(--sp-1); font: 500 var(--fs-small)/1.35 var(--font-body); letter-spacing: 0; color: var(--ink-2); }
.chips__row { grid-column: 1 / -1; margin: 0; padding-top: var(--sp-3); font: 700 var(--fs-small)/1.35 var(--font-body); color: var(--ink-2); }
.chips__row--bag { grid-row: 2; border-top: 2px solid var(--rule-ink); }
.chips__row--you { grid-row: 4; margin-top: var(--sp-5); border-top: 1px solid var(--rule); }
.chips__bag { grid-row: 3; margin: var(--sp-2) 0 0; }
.chips__you { grid-row: 5; margin: var(--sp-2) 0 0; }
.chips__bag b, .chips__you b { display: block; font-family: var(--font-head); font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums lining-nums; }
.chips__bag b { font-size: var(--fs-num); letter-spacing: -.02em; color: var(--ink-2); }
.chips__you b { font-size: var(--fs-num-hero); letter-spacing: -.03em; color: var(--ink); }
.chips__verdict { grid-row: 6; margin: var(--sp-3) 0 0; font: 500 var(--fs-ui)/1.45 var(--font-body); color: var(--ink-2); }
.chips__verdict--short { color: var(--red); }
.chips__verdict--ahead { color: var(--lime-ink); }
.chips__lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }   /* read aloud on wide screens, shown on narrow ones */
.chips__foot { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); padding: var(--sp-5) var(--sp-6) var(--sp-6); border-top: 1px solid var(--rule); }
.chips__note { margin: 0; max-width: var(--figure); font: 400 var(--fs-small)/1.5 var(--font-body); color: var(--ink-2); }
/* the math on request, without script */
.work > summary { width: fit-content; list-style: none; cursor: pointer; }
.work > summary::-webkit-details-marker { display: none; }
.work > summary span { padding: 3px 0; font: 600 var(--fs-small)/1.3 var(--font-body); color: var(--ink-2);
  text-decoration: underline; text-decoration-color: var(--lime-ink); text-decoration-thickness: 1.5px; text-underline-offset: .2em; }
.work > summary:hover span { color: var(--ink); text-decoration-color: var(--ink); }
.work[open] .work__show, .work:not([open]) .work__hide { display: none; }
.work__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); margin-top: var(--sp-4); }
.work__body p { margin: 0 0 var(--sp-1); max-width: var(--measure); font: 400 var(--fs-small)/1.5 var(--font-body); color: var(--ink-2); }
@media (max-width: 640px) {
  .chips__grid { grid-template-columns: minmax(0, 1fr); padding: 0 var(--sp-4) var(--sp-2); }
  .chips__row { display: none; }
  .chips__col, .chips__col:nth-of-type(n) { grid-column: 1; grid-row: auto; grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--sp-5); padding: var(--sp-4) 0 var(--sp-5); border-top: 1px solid var(--rule); }
  .chips__col:nth-of-type(1) { border-top: 0; }
  .chips__opt { grid-column: 1 / -1; grid-row: auto; padding-bottom: var(--sp-3); }
  .chips__bag, .chips__you { grid-row: auto; margin-top: 0; }
  .chips__you b { font-size: var(--fs-num); letter-spacing: -.02em; }
  .chips__verdict { grid-column: 1 / -1; grid-row: auto; }
  .chips__lbl { position: static; display: block; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; margin-bottom: var(--sp-1); font: 700 var(--fs-small)/1.35 var(--font-body); color: var(--ink-2); }
  .chips__foot { padding: var(--sp-4); }
}

.math-live__m .katex { color: inherit; font-size: 1.1em; }
.math-live__m + .math-live__m { margin-top: var(--sp-1); }

/* ---------- charts: unboxed, zero line only, square bars, direct labels ---------- */
.chart { position: relative; display: block; padding: 0; background: none; border: 0; border-radius: 0; }
.chart__head { display: grid; gap: var(--sp-1); margin-bottom: var(--sp-3); }
.chart__title { font: 800 1.0625rem/1.3 var(--font-head); letter-spacing: -.005em; color: var(--ink); text-wrap: balance; }
.chart__sub { max-width: var(--measure); font: 400 var(--fs-small)/1.45 var(--font-body); color: var(--ink-3); }
.chart__legend { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); margin-top: var(--sp-1); font: 500 var(--fs-small)/1.3 var(--font-body); color: var(--ink-2); }
.chart__legend:empty { display: none; }
.chart__legend span { display: inline-flex; align-items: center; gap: var(--sp-2); }
.chart__legend i { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid currentColor; }
.chart__legend i.sw { width: 10px; height: 10px; border: 0; background: currentColor; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart svg text { font: 500 12.5px var(--font-body); fill: var(--ink-3); font-variant-numeric: tabular-nums lining-nums; }
.chart svg text.lbl { font-weight: 600; fill: var(--ink-2); }
.chart svg .lbl-strong { font: 800 13px var(--font-head); fill: var(--ink); }      /* a text, or the value tspan in a "Bond −27.1%" end label */
.chart svg :is(text.lbl, text.lbl-strong) { paint-order: stroke; stroke: var(--chart-surface); stroke-width: 3px; stroke-linejoin: round; }   /* halo, deck s21-val */
.chart svg :is(text, tspan).lbl-loss { fill: var(--red); }        /* (0,2,2): beats text.lbl on "lbl lbl-loss" */
.chart svg :is(text, tspan).lbl-gain { fill: var(--lime-ink); }
.chart__tools { display: flex; margin-top: var(--sp-2); }
.linkbtn { padding: 3px 0; background: none; border: 0; cursor: pointer; font: 600 var(--fs-small)/1.3 var(--font-body); color: var(--ink-2);
  text-decoration: underline; text-decoration-color: var(--lime-ink); text-decoration-thickness: 1.5px; text-underline-offset: .2em; }
.linkbtn:hover { color: var(--ink); text-decoration-color: var(--ink); }
/* tooltip: charcoal, square key with a ring so the charcoal series stays visible */
.chart__tip { position: absolute; z-index: 5; pointer-events: none; display: grid; gap: 4px; min-width: 9rem; max-width: 17rem; padding: 10px 12px;
  font: 400 var(--fs-small)/1.4 var(--font-body); color: #FFFFFF; background: var(--charcoal); border: 1px solid var(--charcoal); border-radius: var(--radius); box-shadow: none; }
.chart__tip .tip-h { font-weight: 700; color: #FFFFFF; }
.chart__tip .tip-r { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: var(--sp-2); align-items: center; }
.chart__tip .tip-r i { width: 10px; height: 10px; box-sizing: border-box; background: currentColor; border: 1px solid rgba(255, 255, 255, .55); }
.chart__tip .tip-r span { color: var(--on-dark); }
.chart__tip b { font: 800 var(--fs-small)/1.2 var(--font-head); font-variant-numeric: tabular-nums lining-nums; color: #FFFFFF; }
/* the table twin reads like the guide's spreadsheets */
.chart__table { margin-top: var(--sp-3); max-height: 16rem; overflow: auto; border-top: 2px solid var(--rule-ink); }
.chart__table table { width: 100%; border-collapse: collapse; font: 500 var(--fs-small)/1.35 var(--font-body); font-variant-numeric: tabular-nums lining-nums; }
.chart__table th, .chart__table td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--rule); }
.chart__table th { position: sticky; top: 0; font-weight: 700; color: var(--bar-ink); background: var(--bar); white-space: nowrap; }
.chart__table th:first-child, .chart__table td:first-child { text-align: left; font-weight: 700; }

/* p4-age-mix: one split bar for the chosen age (deck slide 08) */
.split { display: flex; height: 40px; background: var(--paper-3); }
.split > span { display: block; min-width: 0; transition: flex-basis var(--dur-explain) var(--ease); }
.split > span:nth-child(1) { background: var(--series-1); }
.split > span:nth-child(2) { background: var(--series-3); }
.split > span:nth-child(3) { background: var(--series-4); }
.split > span + span { border-left: 2px solid var(--chart-surface); }
/* labels under each part (deck .s08-split-l), each as wide as its part; the last one ends at the bar's right edge */
.split-l { display: flex; margin-top: var(--sp-2); }
.split-l > span { display: grid; grid-template-columns: minmax(0, 1fr); flex: none; min-width: 0; padding-right: var(--sp-2); overflow: hidden; white-space: nowrap;   /* the track is the span's width, so a hidden name cannot push the share out */
  transition: flex-basis var(--dur-explain) var(--ease); }
.split-l > span:last-child { padding: 0 0 0 var(--sp-2); text-align: right; }
.split-l i { font: 700 var(--fs-label)/1.3 var(--font-body); font-style: normal; color: var(--ink-2); }
.split-l b { font: 800 1rem/1.25 var(--font-head); font-variant-numeric: tabular-nums lining-nums; color: var(--ink); }

/* p8-framework: a real sequence in a narrow column, so a ruled list like the presets (deck read-along outline .ro-parts):
   steps already passed in ink with an olive mark, later ones gray, the current one with the rail's 3px lime mark */
.tprog { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.tprog button { display: block; width: 100%; margin: 0; padding: 9px 0 9px 10px; text-align: left; font: 600 var(--fs-ui)/1.35 var(--font-body);
  letter-spacing: 0; text-transform: none; color: var(--ink-2); background: none; border: 0; border-bottom: 1px solid var(--rule);
  border-left: 3px solid transparent; border-radius: 0; cursor: pointer; transition: color var(--dur-ui) var(--ease); }
.tprog button:hover { color: var(--ink); background: var(--paper); }
.tprog button.done { color: var(--ink); border-left-color: var(--olive); }
.tprog button[aria-current="step"] { color: var(--ink); font-weight: 700; border-left-color: var(--lime); }
.tool__moves { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); }
.tool__moves:has(> :nth-child(3)) { justify-content: flex-start; }   /* Back / Next spread apart; a row of three tools sits together */

/* ==========================================================================
   HOME: the deck's title slide (flat night, lime parallelogram frame), then a white slide and the contents
   ========================================================================== */
@media (min-width: 981px) {
  body[data-page="home"] .shell { max-width: none; grid-template-columns: minmax(0, 1fr); }   /* band runs edge to edge */
  body[data-page="home"] .rail { display: none; }
}
body[data-page="home"] .main { padding: 0; }
.home { max-width: calc(var(--wide) + 2 * var(--sp-6)); margin: 0 auto; padding: 0 var(--sp-6) var(--sp-12); }   /* same centered column as the title band */
.home .track__head { max-width: 44rem; }

.titleband { background: var(--band); color: var(--on-dark); padding: clamp(40px, 7vw, 88px) var(--gutter) clamp(40px, 6vw, 72px); overflow: hidden; }
.titleband__frame { position: relative; width: min(100% - 40px, 980px); margin: 0 auto; padding: clamp(20px, 3.5vw, 44px) clamp(20px, 4vw, 56px); text-align: center; }
.titleband__frame::before { content: ''; position: absolute; inset: 0; border: 4px solid var(--lime); transform: skewX(-12deg); pointer-events: none;
  animation: titleband-wipe 1s var(--ease) .15s both; }        /* the one entrance motion; reduced motion shows it static */
@keyframes titleband-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.titleband__title { margin: 0; font-family: var(--font-head); font-style: italic; font-weight: 900;
  font-size: min(var(--fs-hero), calc((100vw - 92px) / 6.5));   /* keeps "PRINCIPLES" inside the frame below 360px */
  line-height: .95; letter-spacing: -.01em; text-transform: uppercase; color: #FFFFFF; text-shadow: .04em .04em 0 rgba(255, 255, 255, .14); }
.titleband__sub { margin: var(--sp-4) 0 0; font-family: var(--font-head); font-style: italic; font-weight: 600; font-size: clamp(.9rem, .8rem + .5vw, 1.15rem);
  line-height: 1.2; letter-spacing: .12em; text-transform: uppercase; color: var(--lime); text-wrap: balance; }
.titleband__foot { width: min(100% - 40px, 980px); margin: clamp(28px, 4vw, 48px) auto 0; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: var(--sp-5) var(--sp-7); }
.titleband__name { margin: 0; font: 800 clamp(1.25rem, 1.1rem + .6vw, 1.6rem)/1.1 var(--font-head); color: #FFFFFF; }
.titleband__role { margin: var(--sp-1) 0 0; font: 400 var(--fs-ui)/1.4 var(--font-body); color: var(--on-dark-2); }

/* buttons: secondary is a text link with a 3px lime underline; primary is the deck's lime button */
.cta { display: inline-flex; align-items: center; gap: .4em; font: 600 var(--fs-ui)/1.2 var(--font-body); color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--lime); text-decoration-thickness: 3px; text-underline-offset: .3em;
  transition: color var(--dur-ui) var(--ease), text-decoration-color var(--dur-ui) var(--ease); }
.cta:hover { text-decoration-color: var(--ink); }
.cta--primary { min-height: 52px; padding: 15px 22px; border-radius: var(--radius); background: var(--lime); color: var(--on-lime);
  font: 800 1rem/1.1 var(--font-head); text-decoration: none; transition: background-color var(--dur-ui) var(--ease); }   /* deck .rd-nextbtn */
.cta--primary:hover { background: var(--lime-2); color: var(--on-lime); }
button.cta--primary { border: 0; cursor: pointer; }
.cta__arrow { display: inline-block; transition: transform var(--dur-ui) var(--ease); }
.cta:hover .cta__arrow { transform: translateX(4px); }

.home-note { padding-top: var(--sp-10); }   /* Jose's personal intro to the whole guide */
.track { padding-top: var(--sp-12); }
.track__head { max-width: var(--measure); }
.track__head::before { content: ''; display: block; width: var(--accent-w); height: var(--accent-h); background: var(--lime); margin-bottom: var(--sp-5); }  /* accent line */
.track__head .eyebrow { margin: 0 0 var(--sp-3); }
.track__head h2 { margin: 0; font: 800 var(--fs-h2)/1.12 var(--font-head); letter-spacing: -.015em; text-transform: none; }
.track__head p:not(.eyebrow) { margin: var(--sp-5) 0 0; font: 400 var(--fs-lede)/1.5 var(--font-body); color: var(--text); }
.track > .cards { margin-top: var(--sp-8); }
.home > .section { padding-top: var(--sp-12); }
.home > .section > h2.h-roman:first-child { margin-top: 0; }

/* ---------- page lists (home, library, tools, Part 8): a ruled numbered list (deck ol.steps-list), no cards ---------- */
.cards { display: block; max-width: var(--wide); border-top: 2px solid var(--rule-ink); }
.card { position: relative; display: block; padding: var(--sp-5) 0; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; background: none;
  font: 800 1.125rem/1.3 var(--font-head); color: var(--ink); text-decoration: none; transition: none; }   /* font = title strut, so baselines are exact */
.card:hover { transform: none; }
.card__num { display: block; margin-bottom: var(--sp-1); font: 700 var(--fs-small)/1.35 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--ink-3); }
.card__title { font: 800 1.125rem/1.3 var(--font-head); letter-spacing: -.005em; text-transform: none; color: var(--ink);
  -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background-color var(--dur-ui) var(--ease); }
.card__desc { display: block; max-width: var(--measure); margin-top: var(--sp-1); font: 400 1rem/1.5 var(--font-body); color: var(--ink-2); }
.card__tools { display: block; margin-top: var(--sp-2); font: 600 var(--fs-small)/1.35 var(--font-body); color: var(--ink-3); font-variant-numeric: tabular-nums lining-nums; }
.card__tools:empty { display: none; }
a.card:is(:hover, :focus-visible) .card__title { background: linear-gradient(transparent 58%, var(--lime) 58%, var(--lime) 92%, transparent 92%); }
.cards--steps .card { padding-left: 3.5rem; }
.cards--steps .card__num { position: absolute; left: 0; top: var(--sp-5); margin: 0; font: 800 1.6rem/1rem var(--font-head); letter-spacing: -.02em;
  color: var(--lime-ink); font-variant-numeric: tabular-nums lining-nums; }      /* 1rem line box puts the numeral on the title's first baseline */

/* reference row (deck .s01-partners) */
.refrow { display: flex; flex-wrap: wrap; align-items: stretch; max-width: var(--wide); padding-top: var(--sp-6); border-top: 1px solid var(--rule); }
.refrow a { flex: 1 1 0; min-width: 0; padding: 2px var(--sp-7); border-left: 2px solid var(--rule); color: var(--ink); text-decoration: none; }
.refrow a:first-child { padding-left: 0; border-left: 0; }
.refrow b { display: inline; font: 800 1.125rem/1.25 var(--font-head); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.refrow span { display: block; margin-top: var(--sp-1); font: 500 var(--fs-ui)/1.3 var(--font-body); color: var(--ink-2); font-variant-numeric: tabular-nums lining-nums; }
.refrow a:is(:hover, :focus-visible) b { background: linear-gradient(transparent 58%, var(--lime) 58%, var(--lime) 92%, transparent 92%); }

/* ---------- home hero tool: $10,000 growing, drawn at its real width, bars to scale ---------- */
.herotl { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); padding: var(--sp-6);
  border: 1px solid var(--rule-strong); border-radius: 0; background: var(--paper); background-image: none; box-shadow: none; }
.herotl__top { display: grid; gap: var(--sp-2); }
.herotl__fv { font: 800 var(--fs-num-hero)/1 var(--font-head); letter-spacing: -.03em; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; color: var(--ink); }
.herotl__sub { max-width: var(--measure); font: 400 var(--fs-ui)/1.45 var(--font-body); color: var(--ink-2); }
.herotl__svg svg { display: block; width: 100%; height: auto; overflow: visible; }
.herotl__bar rect { transform-box: fill-box; transform-origin: 50% 100%; transition: transform var(--dur-explain) var(--ease); }
.herotl__tick { font: 500 12.5px var(--font-body); fill: var(--ink-3); font-variant-numeric: tabular-nums lining-nums; }
.herotl__today { font: 700 12.5px var(--font-body); fill: var(--on-lime); }
.herotl__val { font: 800 13px var(--font-head); fill: var(--ink); font-variant-numeric: tabular-nums lining-nums; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
/* the sentence under the total is the key: the money put in in ink, the growth in the growth color */
.herotl__sub b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.herotl__sub b.is-g { color: var(--lime-ink); }
.herotl__ctl { display: grid; gap: var(--sp-3); }
.herotl__ctl label { font: 700 var(--fs-ui)/1.3 var(--font-body); color: var(--ink); }
/* rate buttons are .seg.seg--row (after the .seg rules, equal specificity) */
.herotl__rates button { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 8px 6px; }
.herotl__rates button b { font: 800 1.125rem/1.1 var(--font-head); font-variant-numeric: tabular-nums lining-nums; }
.herotl__rates button span { font: 500 var(--fs-label)/1.25 var(--font-body); }
.herotl__math { padding: var(--sp-3) 0 0; overflow-x: auto; overflow-y: hidden; color: var(--ink); font-size: clamp(.875rem, .8rem + .3vw, 1rem);
  background: none; border: 0; border-top: 1px solid var(--rule); border-radius: 0; }
.herotl__math .katex { color: inherit; }
@media (prefers-reduced-motion: reduce) { .herotl__bar rect, .split > span, .split-l > span { transition: none; } }

/* ---------- Go deeper: a rule-opened row, label above a Montserrat title, "Show" / "Hide" at the right ---------- */
details.deeper { max-width: var(--figure); background: none; border: 0; border-top: 1px solid var(--rule-ink); border-bottom: 1px solid var(--rule); border-radius: 0; }
details.deeper > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--sp-4); row-gap: var(--sp-2);
  align-items: baseline; padding: var(--sp-4) 0; list-style: none; cursor: pointer;
  font: 800 1.0625rem/1.3 var(--font-head); letter-spacing: -.005em; color: var(--ink); }
details.deeper > summary::-webkit-details-marker { display: none; }
details.deeper > summary::before { content: none; }
details.deeper > summary .deeper__tag { grid-row: 1; grid-column: 1; }   /* the title text auto-places into row 2 */
details.deeper > summary::after { content: "Show"; grid-row: 1; grid-column: 2;
  font: 700 var(--fs-small)/1.2 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--ink-3); transition: color var(--dur-ui) var(--ease); }
details.deeper[open] > summary::after { content: "Hide"; }
details.deeper > summary:hover::after { color: var(--ink); }
details.deeper[open] > summary { border-bottom: 0; }
details.deeper > .deeper__body { display: block; padding: var(--sp-2) 0 var(--sp-7); }
details.deeper > .deeper__body > * { min-width: 0; }
@media print { details.deeper > .deeper__body { display: block !important; } }

/* ---------- case panel: the deck's dark story slide, flat. The panel re-points the theme tokens for its subtree ---------- */
.case {
  --paper: var(--story); --ink: #FFFFFF; --text: var(--on-dark); --ink-2: var(--on-dark-2); --ink-3: var(--on-dark-3);
  --rule: var(--on-dark-rule); --rule-strong: #3F454E; --rule-ink: var(--on-dark-3);
  --lime-ink: var(--lime); --red: var(--on-dark-red); --pink: #2E1817;
  --bar: #2A2E35; --bar-ink: #FFFFFF; --total-bg: #2C3514; --total-ink: var(--lime);
  --violet: #A79BF6; --violet-wash: #1B1836; --focus: var(--lime);
  display: block; max-width: var(--figure); padding: var(--sp-6) var(--sp-6) var(--sp-7);
  background: var(--paper); color: var(--text); border: 0; border-radius: 0; }
.case__title { font: 800 var(--fs-h3)/1.25 var(--font-head); letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }   /* subsection size: a case is a panel inside its section, not a new section */
.case > .case__tag + .case__title { margin-top: var(--sp-3); }
.case > .case__title + * { margin-top: var(--sp-4); }
/* one big number from the case, set like a figure on the deck's dark slides (s06b): no box and no rule, with clear room above and below */
.case > .case__title + .case__fig { margin-top: var(--sp-7); }
.case > .case__fig + * { margin-top: var(--sp-7); }
.case__num { display: block; font: 800 clamp(2.5rem, 2rem + 2.2vw, 3.75rem)/1.05 var(--font-head); letter-spacing: -.02em; font-variant-numeric: tabular-nums lining-nums; color: var(--lime); text-wrap: balance; }
.case__num--loss { color: var(--red); }
.case__label { display: block; max-width: var(--measure); margin-top: var(--sp-2); font: 400 var(--fs-body)/1.5 var(--font-body); color: var(--ink-2); text-wrap: pretty; }
.case a, .case .lib-guide a { color: var(--lime); }
.case :is(strong, b) { color: var(--ink); }
.case :is(.hl-lime, mark) { background: none; color: var(--lime); }
@media (max-width: 720px) {
  .case { padding: var(--sp-5) var(--sp-4) var(--sp-6); }
  html.review .case[data-origin="expanded"] { padding-left: calc(var(--sp-4) - 3px); }
}

/* figures: keep a future figure on the system */
figure { margin: 0; max-width: var(--figure); }
figcaption { max-width: var(--measure); margin-top: var(--sp-2); font: 400 var(--fs-small)/1.45 var(--font-body); color: var(--ink-3); }

/* ---------- generated reference pages: formulas, glossary, tools, review ---------- */
.section > .ref-filter, .ref-filter { max-width: 26rem; }
.ref-search, .ref-filter input.ref-search { display: block; box-sizing: border-box; width: 100%; margin-top: var(--sp-2); padding: 10px 12px; text-align: left;
  font: 400 1rem/1.4 var(--font-body); color: var(--ink); background: var(--paper); border: 1px solid var(--field); border-radius: 0; }   /* spreadsheet cell */
.ref-search::placeholder { color: var(--ink-3); opacity: 1; }
.ref-group a { color: var(--ink); text-decoration: none; }        /* tools.html and formulas.html part headings */
.ref-group a:hover { text-decoration: underline; text-decoration-color: var(--lime-ink); text-decoration-thickness: 2px; text-underline-offset: .18em; }
.ref-list { display: block; max-width: var(--wide); }             /* formula sheet: one ruled sheet, as wide as its formulas */
.ref-list > .ref-item + .ref-item { margin-top: var(--sp-7); }
.ref-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
.ref-context { justify-self: start; font: 600 var(--fs-small)/1.35 var(--font-body); color: var(--ink-2); text-decoration: none; transition: color var(--dur-ui) var(--ease); }
.ref-context:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--lime-ink); text-decoration-thickness: 2px; }
.ref-letters { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); max-width: var(--wide); }
.ref-letters a { width: auto; min-width: 1.75rem; padding: var(--sp-1) 2px; border: 0; border-radius: 0; text-align: center; text-decoration: none;
  font: 800 1.125rem/1.2 var(--font-head); color: var(--ink); }
.ref-letters a:is(:hover, :focus-visible) { background: linear-gradient(transparent 58%, var(--lime) 58%, var(--lime) 92%, transparent 92%); }
main .section > dl.ref-gloss { max-width: var(--figure); }
dl.ref-gloss { display: block; margin: 0; border-top: 2px solid var(--rule-ink); }
dl.ref-gloss .ref-item { grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr); gap: var(--sp-1) var(--sp-5); padding: var(--sp-3) 0; border-bottom: 1px solid var(--rule); }
dl.ref-gloss dt { font: 800 1.0625rem/1.3 var(--font-head); letter-spacing: -.005em; color: var(--ink); }
dl.ref-gloss dt::first-letter { text-transform: uppercase; }
dl.ref-gloss dd { margin: 0; color: var(--text); }
.ref-uses { display: block; margin-top: var(--sp-1); font: 400 var(--fs-small)/1.45 var(--font-body); color: var(--ink-3); }
table.ref-review td { font-size: var(--fs-small); }
table.ref-review td:first-child { min-width: 11rem; }
ul.ref-notes { display: block; }

/* ---------- global safety: wide display math scrolls inside its own box, never the page ---------- */
.katex-display { overflow-x: auto; overflow-y: hidden; max-width: 100%; padding-block: 2px; }
.katex-display > .katex { max-width: none; }
/* grid tracks may shrink below their content */
.math-live, .ref-item, .tool__notice { grid-template-columns: minmax(0, 1fr); }
.compare > div, .cards > * { min-width: 0; }
/* KaTeX's hidden MathML copy is position:absolute; give it a positioned ancestor inside every scroller
   so it cannot escape an overflow box and widen the page */
.katex { position: relative; }
.tablewrap, .formula__math, .math-live__m, .steps .v, .herotl__math, .chart__table { position: relative; }

/* ---------- coverage audit page ---------- */
.cov-bar { display: flex; gap: 2px; height: 12px; max-width: var(--wide); overflow: hidden; border-radius: 0; background: var(--paper-3); }
.cov-seg { display: block; min-width: 2px; }
.cov-main { background: var(--olive); }  .cov-held { background: var(--series-1); }  .cov-partial { background: var(--series-4); }  .cov-missing { background: var(--red); }
.cov-legend, .cov-count { font: 500 var(--fs-small)/1.45 var(--font-body); color: var(--ink-2); }
.cov-tiles, .cov-filters { max-width: var(--wide); }
.cov-filters { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); }
.cov-filters .ctl { min-width: 160px; }
.cov-filters :is(select, input).ctl__num { width: 100%; text-align: left; font: 400 1rem/1.4 var(--font-body); }
.cov-table td { font-size: var(--fs-small); }
.cov-table td:first-child { min-width: 22rem; }
.cov-src { font: 400 var(--fs-label)/1.4 var(--font-body); color: var(--ink-3); }
.cov-hv { font-weight: 700; color: var(--lime-ink); }
.cov-pill { display: inline-block; padding: var(--sp-1) var(--sp-2); border-radius: 0; white-space: nowrap; font: 700 var(--fs-micro)/1.2 var(--font-body); letter-spacing: .06em; }
.cov-pill.cov-main { background: var(--total-bg); color: var(--total-ink); }
.cov-pill.cov-held { background: var(--charcoal); color: #FFFFFF; }
.cov-pill.cov-partial { background: var(--paper-3); color: var(--ink); }
.cov-pill.cov-missing { background: var(--sec-red); color: #FFFFFF; }
.cov-digest { margin-top: var(--sp-2); }
.cov-key { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.cov-key span { display: inline-flex; align-items: center; gap: var(--sp-2); }
.cov-sw { display: inline-block; width: 12px; height: 12px; border-radius: 0; }

/* ---------- Library pages: a ruled list, a hairline opens each item; audience tags are plain labels ---------- */
.lib-filter { position: static; display: block; max-width: var(--wide); padding: var(--sp-3) 0 var(--sp-2);
  background: var(--paper); border-bottom: 1px solid var(--rule); }
.section:has(> .lib-filter) { position: sticky; top: var(--bar-h); z-index: 20; }   /* the host sticks, as #site-header does: the filter alone fills its section, so it had no room to stick */
.lib-filter__label { display: block; margin-bottom: var(--sp-2); }
html:has(.lib-filter) { scroll-padding-top: calc(var(--bar-h) + 76px); }   /* anchors land below the sticky filter too */
@media (max-width: 720px) { html:has(.lib-filter) { scroll-padding-top: calc(var(--bar-h) + 116px); } }
@media (max-width: 359px) { html:has(.lib-filter) { scroll-padding-top: calc(var(--bar-h) + 152px); } }   /* the filter wraps to 125px here */
.lib-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); border: 0; border-radius: 0; overflow: visible; background: none; }
.lib-seg button, .lib-seg button:first-child { width: auto; margin: 0; padding: var(--sp-2) var(--sp-1) 0 0; background: none; border: 0; border-top: 3px solid var(--rule-strong); border-radius: 0;
  text-align: left; font: 600 var(--fs-small)/1.25 var(--font-body); color: var(--ink-3); cursor: pointer; transition: color var(--dur-ui) var(--ease), border-color var(--dur-ui) var(--ease); }
.lib-seg button:hover { color: var(--ink); background: none; }
.lib-seg button[aria-pressed="true"] { border-top-color: var(--lime); color: var(--ink); background: none; font-weight: 700; }   /* tab mark */
.lib-group { display: block; }
.section > .lib-item { max-width: var(--wide); }
.lib-item { display: block; padding: var(--sp-5) 0 0; border: 0; border-top: 1px solid var(--rule); }
.lib-group > .lib-item { margin-top: var(--sp-8); }
.section > h2.bar + .lib-item { padding-top: 0; border-top: 0; }   /* no hairline right under a title bar */
.lib-item h3 { display: block; }
.lib-meta { display: flex; flex-wrap: wrap; align-items: baseline; row-gap: var(--sp-1);
  font: 700 var(--fs-micro)/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.lib-meta > * + *::before { content: "·"; margin: 0 .5em; }
.aud, .aud--personal, .aud--business, .aud--pro { display: inline; padding: 0; border: 0; border-radius: 0; color: var(--ink-3); }
.lib-meta .lib-kind { font: inherit; letter-spacing: inherit; color: var(--ink-3); }
.lib-guide { font: 600 var(--fs-small)/1.45 var(--font-body); color: var(--ink-2); }
.lib-guide::before { content: "In the guide · "; font-weight: 700; color: var(--ink-3); }
.lib-guide a { color: var(--ink); text-decoration: none; }
.lib-guide a::after { content: "→"; display: inline-block; margin-left: .35em; color: var(--lime-ink); transition: transform var(--dur-ui) var(--ease); }
.lib-guide a:hover { text-decoration-line: underline; text-decoration-color: var(--lime-ink); text-decoration-thickness: 2px; }
.lib-guide a:hover::after { transform: translateX(4px); }
/* pointers to sections saved for a later level of the guide: hidden from readers, shown in Review mode */
[data-held] { display: none; }
html.review p[data-held], html.review .cards[data-held] { display: block; }
html.review span[data-held] { display: inline; }
html.review p.lib-guide[data-held]::before { content: "Saved for a later level · "; }
html.review [data-held] a { color: var(--ink-3); pointer-events: none; }
html.review [data-held] a::after { content: none; }

/* long URLs and identifiers in prose break instead of widening the page on a phone (never inside a number) */
main { overflow-wrap: break-word; }

/* ==========================================================================
   RESPONSIVE: 980px (the rail becomes the menu panel), 720px (stack, spacing steps down)
   ========================================================================== */
@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: var(--bar-h) 0 0 0; z-index: 35; height: auto; align-self: stretch; overflow-y: auto; overscroll-behavior: contain;
    display: none; padding: var(--sp-5) var(--gutter) var(--sp-9); background: var(--paper); border-right: 0; }
  html.nav-open .rail { display: block; }
  html.nav-open body { overflow: hidden; }                     /* scoped here, so a resize past 980px can never lock the page */
  .rail__top { display: block; margin-bottom: var(--sp-8); }
  .rail__nav { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--sp-6);
    border-top: 2px solid var(--rule-ink); }
  .rail__nav li { margin: 0; border-bottom: 1px solid var(--rule); }
  .rail__nav li::before { content: none; }
  .rail__nav a { display: block; margin-left: calc(-1 * (var(--sp-3) + 3px)); padding: 14px 0 14px var(--sp-3); border-left: 3px solid transparent;
    font: 600 var(--fs-body)/1.2 var(--font-body); color: var(--ink); text-decoration: none; }
  .rail__nav a[aria-current] { border-left-color: var(--lime); font-weight: 700; }
  .rail__toggles { display: flex; flex-wrap: wrap; gap: 0 var(--sp-7); margin-top: var(--sp-3); }
  .rail__toggles .iconbtn { min-height: 44px; align-self: auto; color: var(--ink-2); }
  .rail__toggles .iconbtn[aria-pressed="true"] { box-shadow: none; color: var(--ink); text-decoration: underline; text-decoration-color: var(--lime);
    text-decoration-thickness: 3px; text-underline-offset: 6px; }
  .rail__toggles .iconbtn[data-toggle="review"][aria-pressed="true"] { color: var(--violet); text-decoration-color: var(--violet); }
  .pager { padding-left: var(--gutter); }
  .footer__inner { padding-inline: var(--gutter); }
  .home { padding-inline: var(--gutter); }
  /* numeric tables scroll sideways inside .tablewrap; the first column stays put (tablets too, where wide tables are cut off at the column edge) */
  table.data:has(td.n) :is(th, td):first-child { position: sticky; left: 0; z-index: 1; background: var(--paper); }
  /* wide enough that a long header is not a tall black slab; on tablets only for a table that scrolls anyway (site.js sets .scrolls), so a table that fits keeps fitting */
  .tablewrap.scrolls table.data:has(td.n) :is(th, td):first-child { min-width: 9.5rem; }
  table.data:has(td.n) thead th:first-child { z-index: 2; background: var(--bar); }
  table.data:has(td.n) tr.total td:first-child { background: var(--total-bg); }
  table.data:has(td.n) tr.sub td:first-child { background: var(--pink); }
  table.data:has(td.n) tr.sec td:first-child { background: var(--sec-red); }
  html.review .added table.data:has(td.n) tbody tr:not(.total, .sec, .sub) :is(th, td):first-child { background: var(--violet-wash); }   /* inside the Review wash, no page-colored stripe */
  table.data:has(td.n) :is(th, td):first-child:has(.term:is(:hover, :focus)) { z-index: 3; }   /* an open glossary tooltip sits above the next rows' held cells */
}
@media (max-width: 720px) {
  .section > :is(h2.bar, h2.h-roman) { margin-top: 3.5rem; }
  .section > h3 { margin-top: 2rem; }
  .section > :where(.tool, .tablewrap, .formula, .example, .compare, .ledger, .insight, .case, .added, .callout, details.deeper) { margin-block: 1.5rem; }
  :is(.deeper__body, .lib-item) > :where(.tool, .tablewrap, .formula, .example, .compare, .ledger, .insight, .case, .added, .callout, details.deeper) { margin-block: 1.5rem; }
  .steps > li { grid-template-columns: minmax(0, 1fr); row-gap: var(--sp-1); }
  .compare { grid-template-columns: minmax(0, 1fr); }
  /* tools: results above controls */
  .tool__grid { grid-template-columns: minmax(0, 1fr); }
  .tool__out { order: -1; padding: var(--sp-4); border-bottom: 1px solid var(--rule); }
  /* the one exception: the rates dashboard's only control is the rate, so it comes first and the four results stay in view while it moves */
  .tool[data-tool="rates-dashboard"] .tool__out { order: 0; border-bottom: 0; border-top: 1px solid var(--rule); }
  .tool__controls { border-right: 0; padding: var(--sp-4); }
  .tool__head, .tool__foot { padding: var(--sp-4); }
  dl.ref-gloss .ref-item { grid-template-columns: minmax(0, 1fr); }
  .lib-seg { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--sp-3); }
  table.data:has(td.n) :is(th, td):first-child { min-width: 9.5rem; }   /* phones: the held first column always has its minimum width */
  /* text tables with 3 or more columns: each row becomes a ruled block, every cell labelled */
  table.data:not(:has(td.n)):has(thead th:nth-child(3)) { display: block; min-width: 0; }
  table.data:not(:has(td.n)):has(thead th:nth-child(3)) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  table.data:not(:has(td.n)):has(thead th:nth-child(3)) :is(tbody, tr, td) { display: block; }
  table.data:not(:has(td.n)):has(thead th:nth-child(3)) tr { padding: var(--sp-3) 0; border-top: 1px solid var(--rule); }
  table.data:not(:has(td.n)):has(thead th:nth-child(3)) tr:first-child { border-top: 2px solid var(--rule-ink); }
  table.data:not(:has(td.n)):has(thead th:nth-child(3)) td { padding: var(--sp-1) 0; border: 0; overflow-x: auto; }
  /* the fund screen's checkboxes sit at the left edge: neither box may cut off the left side of their focus ring */
  table.data:not(:has(td.n)):has(thead th:nth-child(3)) td:has(> input[type="checkbox"]) { overflow: visible; }
  .tablewrap:has(input[type="checkbox"]) { overflow: visible; }
  table.data:not(:has(td.n)):has(thead th:nth-child(3)) td:first-child { font: 800 1.0625rem/1.3 var(--font-head); }
  table.data:not(:has(td.n)):has(thead th:nth-child(3)) td[data-label]::before { content: attr(data-label); display: block;
    font: 700 var(--fs-small)/1.35 var(--font-body); letter-spacing: 0; color: var(--ink-3); }
  /* pager: Previous, then the Next band edge to edge */
  .pager { flex-direction: column; gap: 0; padding-left: 0; }
  .pager .prev { align-self: stretch; max-width: none; padding: var(--sp-6) var(--gutter); }
  .pager .next { flex: none; align-self: stretch; margin-left: 0; padding: var(--sp-6) var(--gutter); }
  /* home */
  .titleband__foot { flex-direction: column; align-items: stretch; }
  .titleband__foot .cta--primary { justify-content: center; }
  .track, .home > .section { padding-top: var(--sp-10); }
  .refrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-6); padding-top: 0; border-top: 2px solid var(--rule-ink); }
  .refrow a, .refrow a:first-child { padding: var(--sp-4) 0; border-left: 0; border-bottom: 1px solid var(--rule); }
}

/* ==========================================================================
   DARK MODE: almost everything runs on tokens; these few need rules (same in both blocks)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.hl-lime, mark) { background: none; color: var(--lime); }
  :root:not([data-theme="light"]) .case { border: 1px solid #2A2E35; }   /* the page's dark --rule; --rule is re-pointed inside .case */
  :root:not([data-theme="light"]) .term:hover::after, :root:not([data-theme="light"]) .term:focus::after { background: var(--paper-3); border: 1px solid var(--rule-strong); }
  :root:not([data-theme="light"]) .chart__tip { border-color: var(--rule-strong); }
  :root:not([data-theme="light"]) .seg button[aria-pressed="true"]:focus-visible { outline-color: #5E7A12; }   /* lime on the white pressed fill is 1.4:1 */
  :root:not([data-theme="light"]) .titleband { border-bottom: 1px solid var(--rule); }
  :root:not([data-theme="light"]) .footer { border-top: 1px solid var(--rule); }
  :root:not([data-theme="light"]) a.card:is(:hover, :focus-visible) .card__title,
  :root:not([data-theme="light"]) .refrow a:is(:hover, :focus-visible) b,
  :root:not([data-theme="light"]) .ref-letters a:is(:hover, :focus-visible) { background: none; color: var(--lime); }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]).review .case[data-origin="expanded"] { padding-left: calc(var(--sp-6) - 2px); }   /* the 1px dark edge counts */
}
@media (prefers-color-scheme: dark) and (max-width: 720px) {
  :root:not([data-theme="light"]).review .case[data-origin="expanded"] { padding-left: calc(var(--sp-4) - 2px); }
}
:root[data-theme="dark"].review .case[data-origin="expanded"] { padding-left: calc(var(--sp-6) - 2px); }
@media (max-width: 720px) { :root[data-theme="dark"].review .case[data-origin="expanded"] { padding-left: calc(var(--sp-4) - 2px); } }
:root[data-theme="dark"] :is(.hl-lime, mark) { background: none; color: var(--lime); }
:root[data-theme="dark"] .case { border: 1px solid #2A2E35; }
:root[data-theme="dark"] .term:hover::after, :root[data-theme="dark"] .term:focus::after { background: var(--paper-3); border: 1px solid var(--rule-strong); }
:root[data-theme="dark"] .chart__tip { border-color: var(--rule-strong); }
:root[data-theme="dark"] .seg button[aria-pressed="true"]:focus-visible { outline-color: #5E7A12; }
:root[data-theme="dark"] .titleband { border-bottom: 1px solid var(--rule); }
:root[data-theme="dark"] .footer { border-top: 1px solid var(--rule); }
:root[data-theme="dark"] a.card:is(:hover, :focus-visible) .card__title,
:root[data-theme="dark"] .refrow a:is(:hover, :focus-visible) b,
:root[data-theme="dark"] .ref-letters a:is(:hover, :focus-visible) { background: none; color: var(--lime); }

/* ==========================================================================
   PRINT
   ========================================================================== */
@media print {
  .topbar, .rail, .pager, .tool__controls, .chart__tools, .footer::before, .footer__look, .titleband__frame::before, .opener__art { display: none !important; }
  .shell { display: block; }
  .opener:has(> .opener__art) { display: block; }
  body { font-size: 11pt; }
  .footer, .titleband { background: none; color: #000; }
  .titleband__title, .titleband__name, .footer__name { color: #000; text-shadow: none; }
  .bar, table.data thead th, table.data tr.total td, table.data tr.sec td, .answer, .case, .chart__table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
