/* vicpol base styles. Mobile-first; works at 360px. Tokens come from tokens.css (load it first). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0 0 var(--sp-3); line-height: var(--lh-tight); font-weight: 700; color: var(--text); }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); font-weight: 600; }
h4 { font-size: var(--fs-base); font-weight: 600; }
p { margin: 0 0 var(--sp-4); line-height: var(--lh-loose); }
small, .text-sm { font-size: var(--fs-sm); }
.text-muted { color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums; }
a { color: var(--link); font-weight: 500; text-decoration: none; transition: color var(--transition); }
a:hover, a:focus { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: var(--sp-2); top: -4rem; background: var(--brand); color: var(--text-on-brand); padding: var(--sp-2) var(--sp-4); z-index: 1000; border-radius: var(--radius); }
.skip-link:focus { top: var(--sp-2); text-decoration: none; }

/* Layout */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.stack > * + * { margin-top: var(--sp-5); }
.grid { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
@media (min-width: 40em) { .grid-2, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60em) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }
main { padding: var(--sp-5) 0 var(--sp-7); }

/* Header band */
.site-header { background: var(--header-bg); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); padding-top: var(--sp-4); padding-bottom: var(--sp-4); }
.site-title { margin: 0; font-size: var(--fs-lg); color: var(--brand); }
.site-title a { color: inherit; font-weight: 700; }
.site-sub { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.countdown { font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }

/* Tab bar: <div class="tabs" role="tablist"><button class="tab" role="tab" aria-selected="true">... */
.tabs { display: flex; gap: var(--sp-1); overflow-x: auto; background: var(--surface); border-bottom: 2px solid var(--border-strong); padding: 0 var(--gutter); scrollbar-width: thin; }
.tab {
  flex: 0 0 auto; min-height: var(--tap); padding: var(--sp-2) var(--sp-4);
  font: inherit; font-weight: 600; font-size: var(--fs-sm); color: var(--text-muted);
  background: none; border: 0; border-bottom: 4px solid transparent; margin-bottom: -2px; cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.tab:hover { color: var(--brand); }
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--accent); }
.tab:focus-visible { outline-offset: -3px; }
.tabpanel { padding-top: var(--sp-5); }
.tabpanel[hidden] { display: none; }

/* Cards and panels */
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); padding: var(--sp-4); }
.card > :last-child, .panel > :last-child { margin-bottom: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.card-head h2, .card-head h3 { margin: 0; }
.card-meta { font-size: var(--fs-xs); color: var(--text-muted); }
.panel-alt { background: var(--surface-alt); box-shadow: none; }
.chart { background: var(--chart-surface); min-height: 12rem; }
.chart svg { display: block; width: 100%; }
.chart-grid { stroke: var(--grid); }

/* Stat tiles */
.stat { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); }
.stat-label { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.stat-value { font-size: var(--fs-xl); font-weight: 700; line-height: var(--lh-tight); color: var(--text); font-variant-numeric: tabular-nums; }
.stat-delta, .stat-note { font-size: var(--fs-sm); color: var(--text-muted); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
caption { text-align: left; font-weight: 600; padding-bottom: var(--sp-2); }
th, td { padding: var(--sp-2) var(--sp-3); text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--text-muted); border-bottom: 2px solid var(--border-strong); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--surface-alt); }
.swatch { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 2px; margin-right: var(--sp-2); vertical-align: -1px; background: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: var(--sp-2) var(--sp-5); font: inherit; font-weight: 600; font-size: var(--fs-sm);
  color: var(--text-on-brand); background: var(--brand); border: 2px solid var(--brand); border-radius: var(--radius); cursor: pointer; text-decoration: none;
  transition: color var(--transition), background-color var(--transition), border-color var(--transition);
}
.btn:hover, .btn:focus { background: var(--brand-hover); border-color: var(--brand-hover); text-decoration: none; }
.btn-secondary { color: var(--brand); background: transparent; }
.btn-secondary:hover, .btn-secondary:focus { color: var(--text-on-brand); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* Filter chips and toggles: <button class="chip" aria-pressed="true"> */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  min-height: var(--tap); padding: var(--sp-1) var(--sp-4); font: inherit; font-size: var(--fs-sm); font-weight: 500;
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); cursor: pointer;
  transition: color var(--transition), background-color var(--transition), border-color var(--transition);
}
.chip:hover { border-color: var(--brand); }
.chip[aria-pressed="true"] { color: var(--text-on-brand); background: var(--brand); border-color: var(--brand); }
.chip[aria-pressed="true"]::before { content: "\2713\00a0"; }
.legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); list-style: none; padding: 0; margin: 0 0 var(--sp-3); }

/* Badges: always carry a text label, never colour alone */
.badge { display: inline-block; padding: 0.1rem var(--sp-2); font-size: var(--fs-xs); font-weight: 600; line-height: 1.5; border-radius: var(--radius-sm); border: 1px solid currentColor; }
.badge-live { color: var(--live); background: var(--live-bg); }
.badge-live::before { content: "\25CF\00a0"; }
.badge-stale { color: var(--stale); background: var(--stale-bg); }
.badge-stale::before { content: "\25D0\00a0"; }
.badge-unavailable { color: var(--unavailable); background: var(--unavailable-bg); }
.badge-unavailable::before { content: "\2715\00a0"; }
.notice { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); background: var(--stale-bg); color: var(--text); border-left: 4px solid var(--stale); font-size: var(--fs-sm); }
.notice-error { background: var(--unavailable-bg); border-left-color: var(--unavailable); }

/* Footer */
.site-footer { background: var(--footer-bg); color: #ffffff; padding: var(--sp-5) 0; font-size: var(--fs-sm); }
.site-footer a { color: #d2e8f6; text-decoration: underline; }
.site-footer a:hover, .site-footer a:focus { color: #ffffff; }
.site-footer p { margin: 0 0 var(--sp-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .tabs, .chips, .site-footer { display: none; }
  body { background: #fff; color: #000; }
}
