:root {
  color-scheme: light dark;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --text: #1c2530;
  --muted: #5b6673;
  --rule: #d9dde2;
  --link: #1d4f91;
  /* chart roles: locked (contractual), restricted (walled-off funds), discretionary (Council can cut), gap */
  --locked: #7d8895;
  --restricted: #2a7f8a;
  --discretionary: #5a6bb0;
  --gap: #b01e55;
  --font-body: Charter, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: 16px;
  /* section 1 map categories: dataviz reference hues 1-8 plus cyan and brown, validated adjacent-pair against --bg
     in both modes (scripts/validate_palette.js). Text inside a fill uses --on-fill-dark or -light by contrast. */
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a; --cat-4: #eda100; --cat-5: #e87ba4;
  --cat-6: #008300; --cat-7: #6250d6; --cat-8: #e34948; --cat-9: #0f8fa6; --cat-10: #a5672e;
  --on-fill-dark: #1c2530;
  --on-fill-light: #ffffff;
  /* section 2: the context segments of the cents bar and the other cities' rate bars (the highlight is --gap) */
  --cents-a: #8a95a1; --cents-b: #b4bcc5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161c;
    --surface: #1a212a;
    --text: #e6e9ed;
    --muted: #9aa5b1;
    --rule: #2e3844;
    --link: #8ab4f0;
    --locked: #8c97a5;
    --restricted: #4fb3bf;
    --discretionary: #8e9de0;
    --gap: #ff6f9c;
    --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500; --cat-5: #d55181;
    --cat-6: #008300; --cat-7: #9085e9; --cat-8: #e66767; --cat-9: #1597ae; --cat-10: #b07434;
    --cents-a: #6b7682; --cents-b: #4a5561;
  }
}
* { box-sizing: border-box; }
/* overflow-x on html propagates to the viewport; on body it would make body the sticky containing block (no sticky bars). */
html { scroll-behavior: smooth; scroll-padding-top: 56px; overflow-x: hidden; } /* scroll-padding: under the sticky section bar */
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.65 var(--font-body);
  -webkit-text-size-adjust: 100%;
}
/* Layout: one centred text column (--col) on a wider stage. Charts marked .wide break out to the stage width on
   both sides of the column; everything else, including charts that are narrow by nature, stays in the column.
   On a phone the column and the stage are the same width. */
:root { --col: 47rem; } /* about 42em of 18px body text, roughly 90 characters a line */
.masthead, main, #load-error { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 900px) {
  :root { --gutter: 32px; }
  body { font-size: 1.125rem; line-height: 1.7; }
}
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* Section bar: scrolls with the masthead, then sticks to the top; the reading-progress line is its bottom edge. */
.secbar { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--rule); }
.secbar ul {
  list-style: none; margin: 0 auto; padding: 0 var(--gutter); max-width: 1200px;
  display: flex; gap: 0 22px; overflow-x: auto; scrollbar-width: none; font: 0.85rem/1.2 var(--font-ui);
}
.secbar ul::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .secbar ul { justify-content: center; } } /* under the centred title; narrow screens scroll it */
.secbar a { display: block; padding: 13px 0 11px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.secbar a:hover { color: var(--text); }
.secbar a[aria-current="true"] { color: var(--text); border-bottom-color: var(--text); }
#progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--gap); }

.masthead { padding-top: 40px; padding-bottom: 24px; }
h1, h2 { font-family: var(--font-ui); letter-spacing: -0.015em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.9rem, 7vw, 2.5rem); font-weight: 750; }
.hero { margin: 20px 0 0; }
.hero img { display: block; width: 100%; height: auto; border-radius: 3px; }
@media (max-width: 639.98px) { .hero img { aspect-ratio: 3 / 2; object-fit: cover; } } /* the panorama is too thin on a phone */
.hero figcaption { margin: 8px auto 0; font: 0.85rem/1.45 var(--font-ui); color: var(--muted); }
.intro { margin: 16px 0 0; }
.intro + .intro { margin-top: 12px; }
.dek { font-size: 1.1875rem; line-height: 1.55; margin: 16px 0 0; }

.chapter { padding: 40px 0 8px; }
.chapter + .chapter { border-top: 1px solid var(--rule); margin-top: 32px; }
h2 { font-size: clamp(1.4rem, 5vw, 1.75rem); font-weight: 700; }
.lead { margin: 12px 0 20px; }
.chart { margin: 20px 0; padding: 0; min-height: 0; }

.figure { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; } /* the surrounding face, a little heavier */
.fn {
  position: relative;
  width: 1.15em; height: 1.15em; padding: 0; margin-left: 0.3em;
  font: italic 700 0.8em/1 var(--font-body);
  background: none; border: 1px solid var(--muted); color: var(--muted);
  border-radius: 50%; cursor: pointer; vertical-align: 0.1em;
}
.fn::after { content: ""; position: absolute; inset: -14px; } /* 44px minimum hit target */
.fn:hover, .fn[aria-expanded="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
/* A sourced number is wrapped in its own button: a dotted underline, no mark. */
.fn.fn-fig {
  display: inline; width: auto; height: auto; margin: 0; padding: 0; vertical-align: baseline;
  font: inherit; color: inherit; background: none; border: 0; border-radius: 0; text-align: inherit;
  text-decoration: underline dotted var(--muted); text-decoration-thickness: 1px; text-underline-offset: 0.18em;
}
.fn.fn-fig::after { content: none; }
.fn.fn-fig:hover, .fn.fn-fig[aria-expanded="true"] { background: none; color: inherit; text-decoration-style: solid; text-decoration-color: var(--text); }
.popover {
  position: absolute; z-index: 60; width: min(280px, calc(100vw - 2 * var(--gutter)));
  background: var(--surface); color: var(--text);
  border: 1px solid var(--rule); border-radius: 6px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.18);
  padding: 10px 12px; font: 0.85rem/1.45 var(--font-ui);
  white-space: normal; overflow-wrap: anywhere; text-align: left;
}
.popover p { margin: 0 0 4px; }
.popover .pop-doc { font-weight: 650; }
.popover .pop-meta { color: var(--muted); }
.popover a { display: inline-block; padding: 4px 0; }

details.dig { margin: 24px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
/* A chapter that ends in Dig deeper would otherwise draw two rules a few lines apart. */
.chapter > details.dig:last-child, .part > details.dig:last-child { border-bottom: 0; margin-bottom: 0; }
details.dig > summary {
  cursor: pointer; padding: 12px 0; font: 600 0.95rem/1.3 var(--font-ui);
  list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px;
}
details.dig > summary::-webkit-details-marker { display: none; }
details.dig > summary::before { content: "+"; width: 1em; color: var(--muted); font-weight: 400; }
details.dig[open] > summary::before { content: "\2212"; }
.dig-body { padding-bottom: 16px; }

#load-error { margin-top: 16px; padding: 12px var(--gutter); border-left: 4px solid var(--gap); background: var(--surface); font-family: var(--font-ui); }
#load-error[hidden] { display: none; }
.render-error { margin: 8px 0; padding: 8px 12px; border-left: 4px solid var(--gap); background: var(--surface); font: 0.9rem/1.4 var(--font-ui); }

dl { margin: 0; }
dt { font: 650 1rem/1.4 var(--font-ui); margin-top: 16px; }
dd { margin: 2px 0 0; }
#sources-list { padding-left: 1.2em; font: 0.9rem/1.45 var(--font-ui); }
#sources-list li { margin: 0 0 8px; overflow-wrap: anywhere; }
.src-pages { color: var(--muted); }
a.gl { color: inherit; text-decoration: underline dotted var(--link); text-underline-offset: 3px; }
a.gl:hover { color: var(--link); }
#glossary-list dt { scroll-margin-top: 60px; }
#glossary-list dt:target, #glossary-list dt:target + dd { background: var(--surface); }
#glossary-list dt:target { outline: none; box-shadow: -8px 0 0 var(--surface), -12px 0 0 var(--gap); }
.g-back { font: 0.85rem/1.4 var(--font-ui); white-space: nowrap; display: inline-block; padding: 6px 0; }
p.legend { display: block; }
main { padding-bottom: 80px; }

/* chart legend, tooltip, markers */
.legend { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font: 0.8rem/1.3 var(--font-ui); color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend svg { flex: none; }
.tip { position: absolute; z-index: 20; width: 220px; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 4px 16px rgb(0 0 0 / 0.18); padding: 8px 10px; font: 0.78rem/1.4 var(--font-ui); }
.tip[hidden] { display: none; }
.marker-list { list-style: none; margin: 10px 0 0; padding: 0; font: 0.8rem/1.4 var(--font-ui); color: var(--muted); }
.marker-list li { display: flex; gap: 8px; margin: 3px 0; }
.marker-list .ml { flex: none; width: 1.5em; height: 1.5em; border: 1px solid var(--text); border-radius: 50%; text-align: center; font-weight: 700; font-size: 0.7rem; line-height: 1.4em; color: var(--text); }
.marker-list .figure { white-space: normal; }
.small { font: 0.85rem/1.4 var(--font-ui); color: var(--muted); }
.notes dt { font-size: 0.9rem; }
.notes dd { font: 0.8rem/1.45 var(--font-ui); color: var(--muted); overflow-wrap: anywhere; }
.legend li.legend-note { flex-basis: 100%; display: block; }
.chart-cap { margin: 10px 0 0; font: 0.85rem/1.45 var(--font-ui); color: var(--muted); }

/* chapter 2 funnel. On a wide screen it is scrollytelling: four steps of text scroll past one bar that stays put
   and changes with each step; on a phone the four bars stack with their captions. */
.scrolly-stage { position: relative; } /* before the sticky rule below, which must win */
@media (min-width: 900px) {
  .scrolly { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); column-gap: 56px; align-items: start; }
  .scrolly-steps { padding: 4vh 0 24vh; }
  .step { min-height: 56vh; display: flex; flex-direction: column; justify-content: center; color: var(--muted); }
  @media (prefers-reduced-motion: no-preference) { .step { transition: color 0.3s; } }
  .step.is-active { color: var(--text); }
  .step-n { margin: 0 0 6px; font: 0.8rem/1.2 var(--font-ui); }
  .step-text { margin: 0; font: 1.0625rem/1.6 var(--font-body); }
  .step .figure { color: inherit; }
  .scrolly-stage { position: sticky; top: max(72px, calc(50vh - 150px)); }
}
.stage-title { margin: 0 0 10px; font: 650 1rem/1.3 var(--font-ui); }
.stage-n { display: inline-block; min-width: 1.5em; margin-right: 6px; color: var(--muted); font-weight: 500; }
.scrolly-stage .legend { margin-top: 10px; }
/* chapter 2 funnel, stacked */
.fbar { margin: 0 0 22px; }
.fbar .legend { margin: 8px 0 0; }
.fbar .chart-cap { margin-top: 8px; }

/* chapter 2 dig-deeper: sankey, flow panel, tables */
.sankey .ribbon { outline: none; }
.sankey .ribbon:focus-visible .ribbon-sel { stroke-opacity: 1; }
.sankey .ribbon:hover .ribbon-vis { stroke-opacity: 0.75; }
@media (prefers-reduced-motion: no-preference) { .sankey .ribbon-vis, .sankey .ribbon-sel { transition: stroke-opacity 0.15s; } }
.flow-panel { margin: 8px 0 20px; padding: 12px var(--gutter); border-left: 4px solid var(--gap); background: var(--surface); font: 0.9rem/1.5 var(--font-ui); overflow-wrap: anywhere; }
.flow-panel p { margin: 0 0 6px; }
.flow-title { font-weight: 650; font-size: 1rem; }
.flow-year { color: var(--muted); font-size: 0.8rem; }
.table-h { font: 650 1.05rem/1.3 var(--font-ui); margin: 28px 0 0; }
/* Wide: a plain table that fits the column (no sideways scroll). Narrow: each row of the cut tables (.cut-table)
   stacks into a block whose cells carry their column name (data-label, set in cuts.js), the item as its heading. */
.table-wrap { overflow-x: auto; margin: 10px 0 20px; max-width: 100%; }
.table-wrap table { border-collapse: collapse; width: 100%; font: 0.82rem/1.45 var(--font-ui); }
.table-wrap th, .table-wrap td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); overflow-wrap: break-word; }
.table-wrap thead th { color: var(--muted); font-weight: 650; border-bottom-color: var(--muted); }
.table-wrap tbody th { font-weight: 600; min-width: 9em; }
.table-wrap td .figure { white-space: normal; } /* source labels such as "IBA-recommended Council modification" wrap */
@media (max-width: 639.98px) {
  .cut-table table, .cut-table tbody, .cut-table tr, .cut-table th, .cut-table td { display: block; }
  .cut-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .cut-table tbody tr { padding: 12px 0 10px; border-top: 1px solid var(--rule); }
  .cut-table tbody tr:last-child { border-bottom: 1px solid var(--rule); }
  .cut-table th, .cut-table td { padding: 0; border: 0; }
  .cut-table tbody th { min-width: 0; font: 600 0.92rem/1.4 var(--font-ui); margin: 0 0 6px; }
  .cut-table td { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); column-gap: 10px; margin: 3px 0; font-size: 0.85rem; }
  .cut-table td::before { content: attr(data-label); color: var(--muted); font-size: 0.78rem; line-height: 1.6; }
}
.sankey-key { margin: 0 0 8px; }
.sankey-key ol.legend { list-style: none; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.swatch { display: inline-block; width: 14px; height: 14px; flex: none; }
.flowlist { margin: 12px 0 20px; font: 0.85rem/1.45 var(--font-ui); }
.flowlist > summary { cursor: pointer; padding: 10px 0; font-weight: 600; min-height: 44px; }
.flowlist.narrow > summary { display: none; }
.flowlist h3 { margin: 18px 0 4px; font: 650 0.95rem/1.3 var(--font-ui); }
.flowlist ul { list-style: none; margin: 0; padding: 0; }
.flowlist li { padding: 8px 0; border-bottom: 1px solid var(--rule); overflow-wrap: break-word; }
.flowlist li.is-highlight { border-left: 4px solid var(--gap); padding-left: 8px; }
.flowlist p { margin: 0 0 2px; }
.flowlist .flow-rule { color: var(--muted); }

/* ---- Chapter 3: gap calculator ---- */
.seg { display: flex; gap: 0; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); padding: 3px; margin-bottom: 16px; }
.seg-opt { flex: 1; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: 600 0.9rem/1.25 var(--font-ui); cursor: pointer; }
.seg-opt[aria-checked="true"] { background: var(--text); color: var(--bg); }
.gap-cols { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .gap-cols.n2 { grid-template-columns: 1fr 1fr; } }
.gap-col { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 16px; min-width: 0; }
.gap-framing { margin: 0; font: 650 0.85rem/1.3 var(--font-ui); color: var(--muted); }
.gap-amount { margin: 4px 0 12px; font: 1.1rem/1.3 var(--font-ui); }
.gap-amount .figure { font-size: 2.1rem; color: var(--gap); }
.gap-rows { margin: 0; }
.gap-rows dt { font: 0.8rem/1.4 var(--font-ui); color: var(--muted); margin-top: 10px; }
.gap-rows dd { margin: 0; font-size: 1rem; }
.gap-rows .figure { white-space: normal; }
.gap-compare { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); font-size: 0.95rem; line-height: 1.5; }
.gap-reserve, .gap-note { margin: 14px 0 0; font-size: 0.95rem; }
.gap-note { color: var(--muted); }

/* Chapter 4 claim cards */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.chip { font: 600 0.9rem/1.2 var(--font-ui); min-height: 44px; padding: 8px 14px; border-radius: 22px; border: 1px solid var(--rule); background: var(--surface); color: var(--text); cursor: pointer; }
.chip[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip:focus-visible, .claim-q:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.claim-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 16px; scroll-margin-top: 56px; }
.claim-card[hidden] { display: none; }
.claim-q { font: 700 1.2rem/1.3 var(--font-ui); margin: 0 0 12px; outline-offset: 4px; }
.claim-finding { margin: 0 0 12px; }
.claim-fig { margin: 16px 0; }
.claim-matched { margin: 12px 0; font: 0.9rem/1.4 var(--font-ui); }
.claim-matched summary, .claim-table summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.claim-caveat { border-left: 4px solid var(--muted); padding-left: 12px; margin: 16px 0; }
.claim-src-h { font: 650 0.9rem/1.3 var(--font-ui); margin: 16px 0 6px; }
.claim-sources { margin: 0; padding-left: 20px; font: 0.8rem/1.45 var(--font-ui); color: var(--muted); overflow-wrap: anywhere; }
.claim-sources li { margin-bottom: 6px; }
.claim-table { margin-top: 8px; font: 0.85rem/1.4 var(--font-ui); }
.claim-table table { border-collapse: collapse; width: 100%; }
.claim-table td { white-space: nowrap; }
.claim-table th, .claim-table td { text-align: left; padding: 4px 8px 4px 0; border-bottom: 1px solid var(--rule); font-weight: 400; }
.claim-table thead th, .claim-table tr:first-child th { font-weight: 650; }

/* section 4 parts: three sub-sections under one chapter heading */
.part { padding: 28px 0 0; }
.part + .part { border-top: 1px solid var(--rule); margin-top: 28px; }
.part h3 { font: 700 clamp(1.15rem, 4vw, 1.35rem)/1.2 var(--font-ui); letter-spacing: -0.01em; margin: 0; }
/* empty mounts take no room until a later task fills them */
.chart:empty, #s1-panel:empty { margin: 0; }

/* ---- Section 1: pots bar, twin money maps, details panel ---- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hint { margin: -8px 0 0; font: 0.9rem/1.4 var(--font-ui); color: var(--muted); }
#s1-pots { margin: 16px 0 0; }
.potbar, .map { display: block; max-width: 100%; height: auto; overflow: visible; }
.potbar text, .map text { fill: var(--ink); font: 600 13px/1 var(--font-ui); pointer-events: none; }
.map-tip {
  position: absolute; z-index: 60; max-width: 260px; pointer-events: none;
  background: var(--text); color: var(--bg); border-radius: 4px; padding: 6px 9px;
  font: 0.85rem/1.35 var(--font-ui); box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
}
.map-tip[hidden] { display: none; }
.potbar .cell-amt, .map .cell-amt { font-weight: 400; font-variant-numeric: tabular-nums; }
.pot, .cell { cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) {
  .potbar:hover .pot:not(:hover) { opacity: 0.5; }
  .map .cell:hover > rect:first-child { opacity: 0.82; }
}
@media (prefers-reduced-motion: no-preference) { .pot { transition: opacity 0.15s; } }
/* Two-tone rings: on every category fill, one of --surface / --text clears 3:1 in both themes (WCAG 1.4.11).
   Selected = two rings inside the box; keyboard focus = an overlay outside it (budget-map.js focusOverlay). */
.sel-a, .sel-b, .focus-ring rect { fill: none; stroke: none; stroke-width: 2; pointer-events: none; }
[aria-pressed="true"] > .sel-a { stroke: var(--surface); }
[aria-pressed="true"] > .sel-b { stroke: var(--text); }
.focus-ring .fr-inner { stroke: var(--surface); }
.focus-ring .fr-outer { stroke: var(--text); }
.pot-legend { margin: 8px 0 0; }
.pot-legend .swatch { width: 10px; height: 10px; border-radius: 2px; }

#s1-maps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px 16px; margin: 24px 0 0; }
@media (min-width: 640px) { #s1-maps { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.map-col { min-width: 0; }
.map-title { margin: 0; font: 700 1.05rem/1.3 var(--font-ui); }
.crumbs { margin: 2px 0 0; font: 0.85rem/1.5 var(--font-ui); overflow-wrap: anywhere; }
.crumb { padding: 0; border: 0; background: none; color: var(--link); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; position: relative; }
.crumb::after { content: ""; position: absolute; inset: -12px -4px; } /* larger touch target */
.crumb-sep { color: var(--muted); }
.crumb-cur { font-weight: 650; }
.map-head { margin: 0 0 8px; font: 0.8rem/1.4 var(--font-ui); color: var(--muted); }
.map-head .figure { color: var(--text); }
.map-box { margin: 0; }

.maplist { margin: 10px 0 0; font: 0.85rem/1.4 var(--font-ui); }
.maplist > summary { cursor: pointer; padding: 8px 0; min-height: 44px; display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); list-style: none; }
.maplist > summary::-webkit-details-marker { display: none; }
.maplist > summary::before { content: "+"; width: 1em; font-weight: 400; }
.maplist[open] > summary::before { content: "\2212"; }
.maplist ul { list-style: none; margin: 0; padding: 0; }
.maplist li { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--rule); }
.maplist li:first-child { border-top: 1px solid var(--rule); }
.maplist .swatch { width: 10px; height: 10px; border-radius: 2px; }
.list-item { flex: 1; min-width: 0; min-height: 40px; padding: 6px 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.list-item[aria-pressed="true"] { font-weight: 650; }
.list-item .opens { color: var(--muted); }
.list-amt { flex: none; text-align: right; }

.map-panel { margin: 24px 0 8px; padding: 14px var(--gutter) 16px; background: var(--surface); border-left: 4px solid var(--pot, var(--rule)); border-radius: 0 6px 6px 0; overflow-wrap: anywhere; }
.map-col .map-panel { margin: 12px 0 4px; }
.map-panel > :last-child { margin-bottom: 0; }
.panel-title { margin: 0 0 2px; font: 700 1.15rem/1.3 var(--font-ui); }
.panel-amt { margin: 0 0 10px; font: 0.9rem/1.45 var(--font-ui); color: var(--muted); }
.panel-amt .figure { color: var(--text); font-size: 1.05rem; }
.panel-desc { margin: 0 0 10px; }
.panel-lines { list-style: none; margin: 4px 0 10px; padding: 0; font: 0.85rem/1.35 var(--font-ui); }
.panel-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--rule); }
.panel-note { margin: 0 0 8px; font: 0.85rem/1.45 var(--font-ui); color: var(--muted); }
.panel-note .figure { color: var(--text); }
.panel-answers { margin: 0 0 10px; }
.panel-answers dt { margin: 12px 0 0; font: 650 0.85rem/1.3 var(--font-ui); color: var(--muted); }
.panel-answers dt:first-child { margin-top: 4px; }
.panel-answers dd { margin: 2px 0 0; }
.read-more { display: inline-block; padding: 6px 0; font: 600 0.9rem/1.3 var(--font-ui); }
.dig-intro { margin: 0 0 4px; font-weight: 600; }

/* ---- Section 2: why a wealthy city is short ---- */
/* The cents bar is the section's one picture; the blocks below it stay plain prose. */
#s2-cents { margin: 24px 0 8px; }
.cents-title { margin: 0 0 8px; font: 650 0.95rem/1.35 var(--font-ui); }
.cents { display: block; max-width: 100%; height: auto; }
.cents text { font: 600 12px/1 var(--font-ui); font-variant-numeric: tabular-nums; pointer-events: none; }
.cents-legend { list-style: none; margin: 12px 0 0; padding: 0; font: 0.85rem/1.4 var(--font-ui); }
.cents-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--rule); }
.cents-legend li:first-child { border-top: 1px solid var(--rule); }
.cents-legend .swatch { width: 10px; height: 10px; border-radius: 2px; align-self: center; }
.cents-legend .cl-name { overflow-wrap: anywhere; }
.cents-legend .cl-val { text-align: right; }
.cents-legend .cl-parts { grid-column: 2 / -1; color: var(--muted); font-size: 0.8rem; }
.cents-legend .cl-parts .figure { color: var(--text); font-weight: 600; }
.cents-legend li.is-hi .cl-name { font-weight: 700; }
.cents-legend li.is-hi .cl-val .figure { font-size: 1.05rem; }

.why-block { margin: 28px 0 0; }
.why-block h3 { margin: 0 0 6px; font: 700 1.1rem/1.3 var(--font-ui); letter-spacing: -0.005em; }
.why-block p { margin: 0 0 10px; }
.why-block .chart-cap { margin: 6px 0 14px; }

.rate-bars { list-style: none; margin: 12px 0 0; padding: 0; font: 0.85rem/1.3 var(--font-ui); }
.rate-bars li { display: grid; grid-template-columns: 7.2em minmax(0, 1fr) auto; column-gap: 10px; align-items: center; min-height: 28px; }
.rb-track { display: block; }
.rb-bar { display: block; height: 12px; background: var(--cents-a); border-radius: 0 4px 4px 0; }
.rb-val { text-align: right; white-space: nowrap; min-width: 5.6em; }
.rate-bars li.is-hi .rb-city { font-weight: 700; }
.rate-bars li.is-hi .rb-bar { background: var(--gap); }
.why-sub { margin: 20px 0 6px; font: 650 1rem/1.3 var(--font-ui); }
.county-bars { list-style: none; margin: 12px 0 0; padding: 0; font: 0.85rem/1.3 var(--font-ui); }
.county-bars li { display: grid; grid-template-columns: 8.5em minmax(0, 1fr) 5em 5.6em; column-gap: 10px; align-items: center; min-height: 26px; }
.county-bars .cb-head { color: var(--muted); font-size: 0.78rem; min-height: 20px; border-bottom: 1px solid var(--rule); }
.cb-track { display: flex; }
.cb-base, .cb-add { display: block; height: 12px; }
.cb-base { background: var(--cents-b); }
.cb-add { background: var(--restricted); border-radius: 0 4px 4px 0; border-left: 2px solid var(--bg); }
.cb-val, .cb-add-val { text-align: right; white-space: nowrap; }
.cb-add-val { color: var(--muted); }
.county-bars li.is-hi .cb-city { font-weight: 700; }
.county-bars li.is-hi .cb-base { background: var(--gap); border-radius: 0 4px 4px 0; }
@media (max-width: 639.98px) { .county-bars li { grid-template-columns: 6em minmax(0, 1fr) 4.6em 5.5em; column-gap: 6px; } }

.why-quote { margin: 8px 0 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--muted); }
.why-quote p { margin: 0 0 8px; font-size: 1.15rem; line-height: 1.55; font-style: italic; }
.why-quote footer { font: 0.85rem/1.4 var(--font-ui); color: var(--muted); }

#s2-dig h3 { margin: 18px 0 4px; font: 650 0.95rem/1.3 var(--font-ui); }
#s2-dig h3:first-child { margin-top: 4px; }
#s2-dig p { margin: 0 0 10px; }

/* ---- Section 3: the gap ---- */
/* The three questions are the section's memorable element: each reader question set in the body serif, its answer as a
   large sans number. Plain tiles with a top rule (no shadow); they sit in a row from 640px and stack below that. */

.sub-h { margin: 32px 0 6px; font: 700 1.1rem/1.3 var(--font-ui); letter-spacing: -0.005em; }
.hl-cards { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 8px 0 0; align-items: start; } /* each card as tall as its own text */
.hl-card { background: var(--surface); border-top: 3px solid var(--text); padding: 12px 14px 14px; min-width: 0; }
.hl-q { margin: 0 0 6px; font: italic 400 1.05rem/1.35 var(--font-body); letter-spacing: 0; }
.hl-num { margin: 0; font: 750 1.9rem/1.1 var(--font-ui); letter-spacing: -0.02em; }
.hl-num { white-space: nowrap; }
.hl-num .figure { font-variant-numeric: proportional-nums; font-weight: 750; }
.hl-num .fn:not(.fn-fig) { font-size: 0.8rem; vertical-align: 0.9em; }
.hl-sub { margin: 4px 0 0; font: 0.9rem/1.4 var(--font-ui); }
.hl-what, .hl-who { margin: 8px 0 0; font: 0.85rem/1.45 var(--font-ui); color: var(--muted); }
.hl-fy { margin: 0 0 6px; font: 600 0.85rem/1.3 var(--font-ui); color: var(--muted); }
.hl-pair { display: grid; grid-template-columns: 1fr 1fr; }
.hl-pair > div { min-width: 0; padding-right: 12px; }
.hl-pair > div + div { padding: 0 0 0 12px; border-left: 1px solid var(--rule); }
.hl-sett-h { margin: 14px 0 4px; padding-top: 10px; border-top: 1px solid var(--rule); font: 0.85rem/1.45 var(--font-ui); }
.hl-sett { margin: 0; padding-left: 1.1em; font: 0.85rem/1.45 var(--font-ui); }
.hl-sett li { margin: 2px 0; }
.hl-sett .figure { white-space: nowrap; }
.hl-note { margin: 10px 0 0; font: 0.85rem/1.45 var(--font-ui); color: var(--muted); }
.hl-note .figure, .hl-sett .figure, .hl-sub .figure { color: var(--text); }
@media (min-width: 640px) {
  .hl-cards { grid-template-columns: 1fr 1fr 1.75fr; }
  .hl-num { font-size: 1.65rem; }
  .hl-pair > div { padding-right: 10px; }
  .hl-pair > div + div { padding-left: 10px; }
}

/* waterfall: the plot, then a numbered step list that carries the sourced amounts */
.wf-legend { margin-top: 10px; }
.wf-legend .swatch, .wf-steps .swatch { width: 12px; height: 12px; border-radius: 2px; }
.swatch.is-hatched { background: repeating-linear-gradient(45deg, var(--discretionary) 0 2px, var(--bg) 2px 5px); box-shadow: inset 0 0 0 1px var(--discretionary); }
.wf-plot { margin: 4px 0 0; }
.wf-svg { display: block; max-width: 100%; height: auto; }
.wf-val { font: 600 11px/1 var(--font-ui); font-variant-numeric: tabular-nums; pointer-events: none; }
.wf-num { font: 11px/1 var(--font-ui); pointer-events: none; }
.tip-src { margin-top: 4px; color: var(--muted); }
.wf-steps { list-style: none; margin: 10px 0 0; padding: 0; font: 0.88rem/1.4 var(--font-ui); }
.wf-step { display: grid; grid-template-columns: 1.6em 12px minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--rule); }
.wf-step:first-child { border-top: 1px solid var(--rule); }
.wf-step .swatch { align-self: center; }
.wf-n { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.wf-amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wf-start .wf-name, .wf-subtotal .wf-name, .wf-end .wf-name { font-weight: 650; }
.wf-name .figure { font-weight: 600; }
.wf-after { margin-top: 10px; }
.wf-after .figure { color: var(--text); }



.debt-box { margin: 28px 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--muted); }
.debt-box h3 { margin: 0 0 6px; font: 700 1.05rem/1.3 var(--font-ui); }
.debt-box p { margin: 0 0 10px; }
.debt-box p:last-child { margin-bottom: 0; }

/* dig deeper: definitions and the timeline */
.gap-defs { margin: 4px 0 16px; }
.gap-defs dt { margin-top: 10px; font-size: 0.95rem; }

.tl-host { margin: 12px 0 8px; }
.tl { position: relative; }
.tl-svg { position: absolute; inset: 0 auto auto 0; overflow: visible; }
.tl-axis { stroke: var(--muted); stroke-width: 1; }
.tl-break { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.tl-break-text, .tl-date { font: 11px/1 var(--font-ui); fill: var(--muted); }
.tl-list { list-style: none; margin: 0; padding: 0; }
.tl-pt { position: absolute; font-family: var(--font-ui); }
.tl-pt p { margin: 0; }
.tl-val { font: 650 0.95rem/20px var(--font-ui); }
.tl-val2 { font: 0.8rem/16px var(--font-ui); color: var(--muted); }
.tl-val2 .figure { color: var(--text); font-weight: 600; }
.tl-meta { font: 0.75rem/16px var(--font-ui); color: var(--muted); }
.tl-dot { position: absolute; top: -1px; width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.tl-dot::before { content: ""; position: absolute; left: 7px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--gap); box-shadow: 0 0 0 2px var(--bg); }
.tl-dot[aria-expanded="true"]::before { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--gap); }
.tl-tip { position: absolute; top: calc(100% + 6px); z-index: 30; background: var(--surface); color: var(--text); border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 4px 16px rgb(0 0 0 / 0.18); padding: 8px 10px; font: 0.8rem/1.4 var(--font-ui); }
.tl-tip[hidden] { display: none; }
.tl-tip dl { margin: 4px 0 0; }
.tl-tip dt { margin: 6px 0 0; font: 650 0.75rem/1.3 var(--font-ui); color: var(--muted); }
.tl-tip dd { margin: 0; }

/* ---- Section 4: what piles up. --restricted = money in hand, --gap = what is missing (the same in all three parts). */
.part h4, #piles .dig-body h4 { margin: 22px 0 6px; font: 700 1rem/1.3 var(--font-ui); }
.part .dig-body h4:first-child { margin-top: 4px; }
.tag { font: 650 0.8em/1 var(--font-ui); white-space: nowrap; padding: 1px 5px 2px; border: 1px solid var(--muted); border-radius: 3px; color: var(--muted); }
.pile-title { margin: 0 0 8px; font: 650 0.95rem/1.35 var(--font-ui); }

.pile-copy p { margin: 0 0 12px; }
.pile-chart { margin: 0; }

/* reserve meter: one track in the policy's unit, ticks at the FY2026 target and the FY2030 goal */
.meter { position: relative; padding: 0 0 2px; font: 0.8rem/1.2 var(--font-ui); color: var(--muted); }
.meter-above, .meter-below { position: relative; height: 18px; }
.meter-label { position: absolute; bottom: 3px; white-space: nowrap; }
.meter-below .meter-label { top: 3px; bottom: auto; right: 0; }
.meter-track { position: relative; height: 22px; border-radius: 4px; overflow: hidden; background: var(--bg); }
.meter-seg { position: absolute; top: 0; bottom: 0; }
.meter-seg + .meter-seg { border-left: 2px solid var(--bg); }
.is-balance { background: var(--restricted); }
.is-short { background: color-mix(in srgb, var(--gap) 30%, var(--bg)); }
.is-beyond { background: color-mix(in srgb, var(--locked) 24%, var(--bg)); }
.meter-tick { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -2px; background: var(--text); }
.meter-tick.is-goal { margin-left: -2px; }
.pile-key { list-style: none; margin: 10px 0 0; padding: 0; font: 0.85rem/1.4 var(--font-ui); }
.pile-key li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--rule); }
.pile-key li:first-child { border-top: 1px solid var(--rule); }
.pile-key .swatch { width: 10px; height: 10px; border-radius: 2px; align-self: center; }
.pile-key .swatch.is-tick { border-radius: 0; background: linear-gradient(90deg, transparent 4px, var(--text) 4px, var(--text) 6px, transparent 6px); }
.pile-key .pk-val { text-align: right; white-space: nowrap; }
.pile-key li.is-hi .pk-name { font-weight: 700; }

/* unfunded need by asset: name and amount on one line, the bar under them (long names fit at 375px) */
.asset-bars { list-style: none; margin: 0; padding: 0; font: 0.85rem/1.3 var(--font-ui); }
.asset-bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; padding: 5px 0 6px; }
.ab-name { overflow-wrap: anywhere; }
.ab-val { text-align: right; white-space: nowrap; }
.ab-track { grid-column: 1 / -1; display: block; margin-top: 4px; }
.ab-bar { display: block; height: 10px; min-width: 2px; background: var(--gap); border-radius: 0 4px 4px 0; }
.asset-bars li.is-rest .ab-name { color: var(--muted); }
.asset-bars li.is-rest .ab-bar { background: var(--cents-a); }

/* roads: the PCI mini line */
.pci-host { margin: 4px 0 0; }
.pci { display: block; max-width: 100%; height: auto; overflow: visible; font-family: var(--font-ui); }
.pci-grid { stroke: var(--rule); stroke-width: 1; }
.pci-tick, .pci-year, .pci-goal-label { font-size: 11px; fill: var(--muted); }
.pci-goal { stroke: var(--muted); stroke-width: 1; }
.pci-line { fill: none; stroke: var(--discretionary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pci-line.is-proj { stroke-dasharray: 5 4; }
.pci-pt circle { fill: var(--discretionary); stroke: var(--bg); stroke-width: 2; }
.pci-pt.is-proj circle { fill: var(--bg); stroke: var(--discretionary); }
.pci-val { font-size: 12px; font-weight: 650; fill: var(--text); }

/* pension: promised vs held on one scale, the shortfall marked; who pays, as one stacked bar */
.pension-bars { font: 0.85rem/1.3 var(--font-ui); }
.pb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; padding: 4px 0 6px; }
.pb-val { text-align: right; white-space: nowrap; }
.pb-track { grid-column: 1 / -1; position: relative; display: block; height: 20px; margin-top: 4px; }
.pb-seg { position: absolute; top: 0; bottom: 0; }
.pb-seg.is-promised { background: var(--locked); border-radius: 0 4px 4px 0; }
.pb-seg.is-held { background: var(--restricted); }
.pb-seg.is-gap { background: color-mix(in srgb, var(--gap) 30%, var(--bg)); border-left: 2px solid var(--bg); border-right: 3px solid var(--gap); border-radius: 0 4px 4px 0; }
.pb-gap { display: flex; justify-content: flex-end; padding-top: 2px; color: var(--muted); white-space: nowrap; }
.pb-gap-label .figure { color: var(--text); }
.payer-bar { position: relative; height: 24px; border-radius: 4px; overflow: hidden; }
.payer-seg { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; }
.payer-seg + .payer-seg { border-left: 2px solid var(--bg); }
.payer-in { font: 650 12px/1 var(--font-ui); }
.payer-key { margin-top: 10px; }

/* dig deeper lists */
.pile-list { margin: 0 0 8px; padding-left: 1.1em; }
.pile-list li { margin: 0 0 6px; }
.pl-name { font-weight: 600; }
.pile-steps { margin: 8px 0 12px; padding-left: 1.4em; }
.pile-steps li { margin: 0 0 6px; }
.ps-when { font: 650 0.95rem/1.4 var(--font-ui); }

/* ---- Column layout. !important so it beats the id-specific margin rules above (#s2-dig p and the like):
   these three declarations are the page's only layout and nothing should override them. ---- */
.masthead > *, .chapter > *, .part > *, .dig-body > *, details.dig > summary {
  max-width: var(--col) !important; margin-left: auto !important; margin-right: auto !important;
}
.chapter > .part, .chapter > details.dig, .part > details.dig, .chapter > .wide, .part > .wide, .dig-body > .wide { max-width: none !important; }
.masthead > .hero { max-width: none !important; }
.hero > figcaption { max-width: var(--col); }
.masthead > h1 { max-width: none !important; margin-left: max(0px, calc((100% - var(--col)) / 2)) !important; } /* starts at the column, may run past it */
.wide p, .wide li, .wide dd { max-width: var(--col); }
.wide .wf-steps, .wide .wf-after { max-width: var(--col); margin-left: auto; margin-right: auto; } /* the waterfall's step list reads as text: it sits in the column */
