/* vicpol component CSS beyond base.css. Tokens only; no pink. Added here because base.css lacks them. */

.site-title-sub { font-weight: 400; font-size: var(--fs-sm); color: var(--text-muted); }
.site-title a:hover { text-decoration: none; }
.tabs { scrollbar-width: thin; }
.tab { text-decoration: none; display: inline-flex; align-items: center; }
.tab:hover { text-decoration: none; }
.tabpanel:focus { outline: none; }
.tabpanel:focus-visible { outline: 3px solid var(--focus); }
main:focus { outline: none; }
.stack > * + * { margin-top: var(--sp-5); }
.align-start { align-items: start; }
.nowrap { white-space: nowrap; }
.small-note { font-size: var(--fs-xs); line-height: 1.5; }
.tile-gap { margin-top: var(--sp-4); }
.section-gap { margin-top: var(--sp-5); }
.tight-top { margin-top: var(--sp-2); }
.meta-warn { color: var(--stale); font-weight: 600; }
.hero-num { font-size: var(--fs-xl); font-weight: 700; color: var(--brand); line-height: var(--lh-tight); margin-bottom: var(--sp-3); }
.card .small-note { margin-top: var(--sp-3); margin-bottom: 0; }
.card > * + * { margin-top: var(--sp-3); }
.card > .card-head { margin-top: 0; }
.card > .card-head + * { margin-top: 0; }
.card .grid-4, .card .grid-3 { margin-top: 0; }
/* The forecast tiles on Predictions: a party bar three times the usual 4px, so Labor's red and One Nation's orange are told apart. */
.stats-forecast .stat { border-left-width: 12px; }
.card .tile-gap { margin-top: var(--sp-4); }
.card .section-gap { margin-top: var(--sp-5); }

/* skeletons: reserve space so nothing jumps when data lands */
.skeleton { background: linear-gradient(90deg, var(--surface-alt), var(--surface), var(--surface-alt)); background-size: 200% 100%; border-radius: var(--radius-lg); animation: sk 1.6s ease-in-out infinite; }
.sk-tall { min-height: 11rem; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
body.ready .skeleton { animation: none; }

/* filters */
.filters { display: grid; gap: var(--sp-4); }
.filter-group { min-width: 0; }
.filter-title { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: var(--sp-2); display: block; }
.chips { align-items: center; }
.chip { display: inline-flex; align-items: center; gap: var(--sp-1); }
.chip .swatch { margin-right: 0; }
.chip[aria-pressed="true"] .swatch { outline: 1.5px solid #ffffff; }
.shape-icon { flex: none; }
.chip .shape-icon { color: var(--text-muted); }
.chip[aria-pressed="true"] .shape-icon { color: #ffffff; }
.chips-actions { display: inline-flex; gap: var(--sp-3); margin-left: var(--sp-2); }
.btn-link { background: none; border: 0; padding: var(--sp-2); min-height: var(--tap); font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--link); cursor: pointer; text-decoration: underline; }
select { min-height: var(--tap); max-width: 100%; padding: var(--sp-1) var(--sp-3); font: inherit; font-size: var(--fs-sm); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.legend li { display: inline-flex; align-items: center; gap: var(--sp-2); }
.legend .swatch { margin-right: 0; }

/* charts */
.chart-host { position: relative; width: 100%; }
.chart-svg { display: block; overflow: visible; }
.chart-svg:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.chart-axis text { fill: var(--text-muted); font-size: 11px; font-family: var(--font-sans); }
.chart-label { fill: var(--text); font-size: 11px; font-weight: 600; font-family: var(--font-sans); }
.chart-strong { font-weight: 700; }
.chart-grid { stroke: var(--grid); stroke-width: 1; }
.chart-zero { stroke: var(--text-muted); stroke-width: 1.5; }
.chart-rowline { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 2 4; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line-thin { stroke-width: 1.25; }
.chart-dot { stroke: var(--chart-surface); stroke-width: 1.5; fill-opacity: 0.85; }
.chart-marker, .chart-end, .chart-ring-fill { stroke: var(--chart-surface); stroke-width: 2; }
.chart-ring { fill: none; stroke: var(--text); stroke-width: 2; }
.chart-cross line { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.chart-empty { display: flex; align-items: center; justify-content: center; min-height: 12rem; color: var(--text-muted); text-align: center; padding: var(--sp-4); }
.polls-chart-area { min-height: 22rem; }
.small-multiples { gap: var(--sp-4); }
.multiple { margin: 0; min-width: 0; }
.multiple figcaption { font-size: var(--fs-sm); margin-bottom: var(--sp-1); }
.tooltip { position: absolute; z-index: 5; pointer-events: none; max-width: 16rem; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); line-height: 1.4; }
.tooltip[hidden] { display: none; }
.tip-title { font-weight: 700; margin-bottom: 2px; }
.tip-row { display: flex; gap: var(--sp-2); align-items: baseline; }
.tip-sw { flex: none; width: 0.6rem; height: 0.6rem; border-radius: 2px; }
.tip-sw-none { background: transparent; }
.spark { width: 100%; max-width: 10rem; height: 2.5rem; display: block; }
.spark-wrap { display: grid; gap: var(--sp-1); margin-top: var(--sp-3); }

/* bars */
.bars { display: grid; gap: var(--sp-2); }
.bar-row { display: grid; grid-template-columns: minmax(5.5rem, 9rem) 1fr 3.2rem; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); margin-top: var(--sp-2); }
.bar-label { overflow-wrap: anywhere; }
.bar-track { display: block; height: 0.75rem; background: var(--surface-alt); border-radius: 2px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--text-muted); border-radius: 2px; }
.bar-value { text-align: right; font-weight: 600; }

/* markets, news */
.tag { display: inline-block; font-size: var(--fs-xs); font-weight: 600; padding: 0 var(--sp-2); border-radius: var(--radius-sm); background: var(--brand); color: var(--text-on-brand); }
.tag-alt { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border-strong); }
.market-top { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.market h3 { margin-bottom: var(--sp-1); }
.market-q { margin: 0 0 var(--sp-2); }
.news-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.news-list li { padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border); }
.news-list li:last-child { border-bottom: 0; }

/* tables */
.th-btn { font: inherit; font-weight: 600; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.th-btn:hover { color: var(--brand); text-decoration: underline; }
th[aria-sort="ascending"] .th-btn::after { content: " \25B2"; font-size: 0.7em; }
th[aria-sort="descending"] .th-btn::after { content: " \25BC"; font-size: 0.7em; }
th .swatch { margin-right: var(--sp-1); }
.table-wrap:focus-visible { outline: 3px solid var(--focus); }
.row-strong td, .row-strong th { background: var(--surface-alt); font-weight: 600; }
tbody th { font-weight: 600; color: var(--text); white-space: nowrap; border-bottom: 1px solid var(--border); }
.table-wrap + .table-wrap { margin-top: var(--sp-4); }

/* study: error colours are not party colours; the sign is always printed */
:root { --err-over: #8a4b00; --err-under: #0e3a6c; }
@media (prefers-color-scheme: dark) { :root { --err-over: #f0b45f; --err-under: #8db9d8; } }
.err { font-size: var(--fs-xs); font-weight: 700; padding: 0 4px; border-radius: var(--radius-sm); border: 1px solid currentColor; }
.err-over { color: var(--err-over); }
.err-under { color: var(--err-under); }
.err-zero { color: var(--text-muted); }
.prose { max-width: 46rem; }
.prose ul { padding-left: var(--sp-5); line-height: var(--lh-loose); }
.prose li + li { margin-top: var(--sp-2); }
@media (min-width: 48em) { .filters { grid-template-columns: 1fr 1fr; } .filters > :first-child { grid-column: 1 / -1; } }
@media (max-width: 30em) { .bar-row { grid-template-columns: 1fr 3rem; } .bar-track { grid-column: 1 / -1; grid-row: 2; } .bar-label { grid-row: 1; } .bar-value { grid-row: 1; grid-column: 2; } }

/* ---- 2026-11-11 dashboard revision ---------------------------------------
   Tab bar sits inside .container so its text lines up with the header and the
   content. The full-width rule under it is an inset shadow on the nav, drawn
   behind the tabs, so the active tab's 4px underline paints over it and is not
   clipped by .tabs' overflow-x. */
.tabs-bar { background: var(--surface); box-shadow: inset 0 -2px 0 var(--border-strong); }
.tabs-bar .tabs { background: none; border-bottom: 0; padding: 0; margin-left: calc(-1 * var(--sp-4)); }
.tabs-bar .tab { margin-bottom: 0; }
/* Phone navigation: below 40em the tab bar is a menu behind one button that names the current page. */
.nav-toggle { display: none; }
@media (max-width: 39.99em) {
  .nav-toggle { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: var(--tap); padding: var(--sp-2) 0; font: inherit; font-weight: 600; color: var(--brand); background: none; border: 0; cursor: pointer; text-align: left; }
  .nav-toggle:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: 2px; }
  .nav-burger, .nav-burger::before, .nav-burger::after { display: block; width: 1.25rem; height: 2px; background: currentColor; border-radius: 1px; }
  .nav-burger { position: relative; flex: none; }
  .nav-burger::before, .nav-burger::after { content: ""; position: absolute; left: 0; }
  .nav-burger::before { top: -6px; }
  .nav-burger::after { top: 6px; }
  .tabs-bar .tabs { display: none; flex-direction: column; gap: 0; margin-left: 0; overflow: visible; padding-bottom: var(--sp-2); }
  .tabs-bar.is-open .tabs { display: flex; }
  .tabs-bar .tabs .tab { min-height: var(--tap); display: flex; align-items: center; padding: var(--sp-2) var(--sp-3); border-bottom: 0; border-left: 3px solid transparent; }
  .tabs-bar .tabs .tab[aria-selected="true"] { border-left-color: var(--accent); background: var(--surface-alt); }
}

/* Dashboard: main column plus a narrow right-hand column (countdown, next key
   date, market). Single column below 60em, with the side column after the main one. */
.dash { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 60em) { .dash { grid-template-columns: minmax(0, 1fr) 20rem; } }
.dash-main > * + *, .dash-side > * + * { margin-top: var(--sp-5); }
.dash-side .hero-num { font-size: var(--fs-lg); }
.dash-side .bar-row { grid-template-columns: minmax(4.5rem, 7rem) 1fr 2.6rem; gap: var(--sp-2); }

/* Poll-average bars: party, bar, share, change. Biggest share on top. All bars
   share one scale, so their lengths compare directly. */
.avg-bars { margin-top: var(--sp-2); }
.avg-row { grid-template-columns: minmax(6rem, 13rem) 1fr 3.4rem 5.2rem; }
.avg-row .bar-track { height: 1.25rem; }
.card .avg-delta { text-align: right; color: var(--text-muted); white-space: nowrap; margin: 0; }
.avg-scale { display: flex; justify-content: space-between; font-size: var(--fs-xs, 0.75rem); color: var(--text-muted); }
.avg-tpp { margin-top: var(--sp-4); }
@media (max-width: 30em) {
  .avg-row { grid-template-columns: 1fr auto auto; }
  .avg-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .avg-row .bar-label { grid-row: 1; }
  .avg-row .bar-value { grid-row: 1; grid-column: 2; }
  .avg-row .avg-delta { grid-row: 1; grid-column: 3; }
}

/* ---- 2026-11-11 Polls tab revision ----------------------------------------
   Legends double as filters: a party or pollster entry is a toggle button.
   Pressed = shown. Unpressed is dimmed with a hollow marker, so state reads
   without relying on colour. */
.legend-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); margin: var(--sp-2) 0; }
.legend-pollsters { margin-top: var(--sp-1); }
.ltoggle, .legend-static {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2rem; padding: 0.15rem 0.55rem;
  font: inherit; font-size: var(--fs-sm); color: var(--text); background: none;
  border: 1px solid transparent; border-radius: 999px;
}
.ltoggle { cursor: pointer; transition: background-color var(--transition), opacity var(--transition); }
.ltoggle:hover { background: var(--surface-alt); border-color: var(--border); }
.ltoggle[aria-pressed="false"] { opacity: 0.5; text-decoration: line-through; text-decoration-thickness: 1px; }
.ltoggle[aria-pressed="false"] .swatch { background: none !important; box-shadow: inset 0 0 0 1.5px var(--text-muted); }
.ltoggle[aria-pressed="false"] .shape-icon path { fill: none; stroke: currentColor; stroke-width: 1.5; }
.ltoggle .shape-icon { color: var(--text-muted); }
.ltoggle:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: 1px; }
.ctl-label { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-right: var(--sp-1); }

/* One compact bar of chart options, wrapping to two lines on narrow screens. */
.ctl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5);
  margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.ctl { display: inline-flex; align-items: center; gap: var(--sp-2); }
.ctl-select { font: inherit; font-size: var(--fs-sm); min-height: 2rem; padding: 0.15rem 1.75rem 0.15rem 0.6rem;
  color: var(--text); background-color: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm, 4px); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm, 4px); overflow: hidden; }
.seg-btn { font: inherit; font-size: var(--fs-sm); min-height: 2rem; padding: 0.15rem 0.7rem; color: var(--text);
  background: var(--surface); border: 0; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border-strong); }
.seg-btn:hover { background: var(--surface-alt); }
.seg-btn[aria-pressed="true"] { color: var(--text-on-brand); background: var(--brand); }
.seg-btn:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: -2px; }
.ctl-check { font-size: var(--fs-sm); cursor: pointer; }
.ctl-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); margin: 0; }
.ctl-check.is-disabled { opacity: 0.5; cursor: default; }
@media (pointer: coarse) { .ltoggle, .seg-btn, .ctl-select { min-height: 2.5rem; } }
.ltoggle .swatch, .legend-static .swatch { margin-right: 0; }
.legend-row .btn-link { min-height: 2rem; padding: 0 0.35rem; }
@media (pointer: coarse) { .legend-row .btn-link { min-height: 2.5rem; } }
.seg-btn { white-space: nowrap; }

/* Two columns that cards flow into, each sitting directly under the one above.
   A grid row is as tall as its tallest card and leaves gaps under the shorter
   one (Petr, 2026-11-11). Cards keep markets.json order (government, premier,
   seats, other), reading down the left column and then the right. */
.cols-2 { column-gap: var(--sp-5); }
.cols-2 > * { break-inside: avoid; margin: 0 0 var(--sp-5); width: 100%; display: inline-block; }
@media (min-width: 48em) { .cols-2 { column-count: 2; } }

/* Poll-average change: up green, down red (Petr, 2026-11-11). The arrow and
   sign stay, so the direction never relies on colour alone. Both colours meet
   4.5:1 as small text: #15803d 5.0 and #b91c1c 6.5 on white; #4ade80 8.6 and
   #f87171 5.4 on the dark card surface. */
:root { --delta-up: #15803d; --delta-down: #b91c1c; }
@media (prefers-color-scheme: dark) { :root { --delta-up: #4ade80; --delta-down: #f87171; } }
.card .avg-delta.is-up { color: var(--delta-up); }
.card .avg-delta.is-down { color: var(--delta-down); }

/* Header (Petr, 2026-11-11): the subtitle sits under "vicpol". The countdown
   and the election-day line sit together at the right edge, and they move
   under the title, left-aligned, when the header wraps on narrow screens. */
.site-title { line-height: var(--lh-tight, 1.2); }
.site-title-sub { display: block; margin-top: 0.15rem; }
.header-right .countdown, .header-right .site-sub { margin: 0; }
@media (min-width: 40em) { .header-right { text-align: right; } }

/* ---- Electorates map (docs/style-guide.md, "Maps") */
.map-wrap { position: relative; }
.map-grid { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
/* State map at full width, Melbourne below it (Petr, 2026-11-12). Melbourne is roughly square, so cap it. */
.map-fig.map-fig-metro { max-width: 60rem; width: 100%; margin-inline: auto; }
.map-fig { margin: 0; min-width: 0; }
.map-cap { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: var(--sp-1); }
.map-host { width: 100%; min-height: 8rem; background: var(--surface); }
.map-svg { display: block; width: 100%; height: auto; }
.map-district { stroke: var(--surface); stroke-width: 0.6; stroke-linejoin: round; cursor: pointer; transition: opacity var(--transition); }
.map-district.is-vacant { stroke-dasharray: 2 2; }
.map-district.is-hover, .map-district.is-pinned { stroke: var(--text); stroke-width: 2; }
.map-district.is-dim, .map-label.is-dim { opacity: 0.18; }
.map-label { font-family: var(--font-sans); font-size: 10px; font-weight: 700; pointer-events: none; }
.map-label-margin { font-weight: 600; }
.map-pop { position: absolute; z-index: 6; width: min(17rem, 90%); pointer-events: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-2); padding: var(--sp-3); font-size: var(--fs-xs); line-height: 1.45; }
.map-pop[hidden] { display: none; }
.map-pop.is-pinned { pointer-events: auto; }
.pop-cols { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; }
@media (min-width: 40em) { .pop-cols { grid-template-columns: 1fr 1fr; } }
.pop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-2); }
.pop-title { font-size: var(--fs-md, 1rem); font-weight: 700; }
.pop-sub, .pop-muted { color: var(--text-muted); }
.pop-close { min-height: auto; padding: 0 var(--sp-1); font-size: 1.25rem; line-height: 1; text-decoration: none; }
.pop-row { display: flex; gap: var(--sp-2); align-items: baseline; margin-top: var(--sp-1); }
.pop-h { font-weight: 700; margin-top: var(--sp-2); }
.pop-notes { margin: var(--sp-1) 0 0; padding-left: 1.1rem; color: var(--text-muted); }
.pop-cands { margin: var(--sp-1) 0 0; padding-left: 1.4rem; }
.pop-cands li .swatch { margin-right: var(--sp-1); }
.pop-demog { width: 100%; margin-top: var(--sp-1); border-collapse: collapse; }
.pop-demog { font-size: inherit; table-layout: auto; }
.pop-demog th, .pop-demog td { padding: 1px var(--sp-1); border-bottom: 1px solid var(--border); font-weight: 400; text-align: left; white-space: normal; font-size: inherit; }
.pop-demog td.num { white-space: nowrap; }
.pop-demog .num { text-align: right; }
.pop-demog thead th { font-weight: 600; color: var(--text-muted); }
.pop-src { margin-top: var(--sp-2); }
.th-sort { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: inherit; cursor: pointer; text-align: inherit; }
.row-link { cursor: pointer; }
.row-link:hover td, .row-link:hover th, .row-link:focus td, .row-link:focus th { background: var(--surface-alt); }
.source-list { padding-left: 1.1rem; }
.pop-model { margin-top: var(--sp-2); padding: var(--sp-2); background: var(--surface-alt); border-radius: var(--radius); }
.pop-model .pop-h { margin-top: 0; }
.pop-wins { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); margin: var(--sp-1) 0; }
.pop-win { display: inline-flex; align-items: center; gap: var(--sp-1); font-weight: 600; }
.method { margin-top: var(--sp-3); }
.method li { margin-bottom: var(--sp-2); }
.pop-more { margin-top: var(--sp-2); min-height: 2rem; padding: 0.2rem 0.8rem; font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
  color: var(--surface); background: var(--link); border: 0; border-radius: var(--radius); }
.district-detail { font-size: var(--fs-sm); scroll-margin-top: var(--sp-4); }
.district-detail .pop-title { font-size: var(--fs-lg, 1.25rem); }
.district-detail .pop-close { font-size: 1.6rem; }
.table-compact th, .table-compact td { padding-top: var(--sp-1); padding-bottom: var(--sp-1); }
.cell-sub { font-weight: 400; font-size: var(--fs-xs); }

/* ---- 2026-11-12 the model card's method notes fold away; the toggle is bottom right */
.model-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--sp-3); font-size: var(--fs-sm); }
.model-toggle { padding: var(--sp-1) var(--sp-4); }
.method > div { margin: var(--sp-5) 0; }

/* ---- 2026-11-15 Predictions map: two views -------------------------------
   The heading carries the switch (chance of changing hands | projected winners).
   A label on a striped district is outlined in the surface colour, as no one ink reads on stripes. */
.map-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
.map-head h2 { margin: 0; }
.map-label-halo { paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
