/* Shared by every page that draws charts (see linechart.js).
   Chart tokens: validated palette (light surface #ffffff). The site is light-only. */
.viz-root {
    --surface-1: #ffffff;
    --text-primary: #0b0b0b;
    --text-secondary: #52514e;
    --text-muted: #898781;
    --gridline: #e1e0d9;
    --baseline: #c3c2b7;
    --party-dem: #2a78d6;
    --party-rep: #e34948;
    --party-una: #4a3aa7;
    --party-minor: #52514e;
    --series-new: #1baf7a;
    --series-removed: #eb6834;
    /* the pace chart's elections: the one in progress in ink, the earlier ones off the party colours */
    --pace-now: #1f1e1c;
    --pace-1: #1baf7a;
    --pace-2: #c27f17;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text-primary);
}
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: end;
    margin-bottom: 1rem;
}
.filters form { margin: 0; }
.filters fieldset { width: auto; padding: 0; border: 0; }
.filters label { margin: 0; font-size: 0.85rem; color: var(--text-secondary); }
.filters select { margin: 0.25rem 0 0; min-width: 14rem; }
.filters fieldset { margin: 0; display: flex; gap: 1rem; }
.filters fieldset legend { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.filters fieldset label { color: var(--text-primary); font-size: 0.95rem; }
.viz-card {
    background: var(--surface-1);
    border: 1px solid rgba(11, 11, 11, 0.10);
    border-radius: 8px;
    padding: 1rem 1rem 0.5rem;
    margin-bottom: 1.5rem;
}
.viz-card h2 { font-size: 1.05rem; margin: 0 0 0.25rem; }
.viz-card .sub { font-size: 0.85rem; color: var(--text-secondary); margin: 0 0 0.5rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.85rem;
          color: var(--text-secondary); margin: 0 0 0.25rem; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.legend .key { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
             gap: 1rem; }
.multiples .wide { grid-column: 1 / -1; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between;
                align-items: end; gap: 0.5rem 1.5rem; margin: 2rem 0 0.75rem; }
.section-head h2 { font-size: 1.25rem; margin: 0; }
.note { font-size: 0.85rem; color: var(--text-secondary); }
.multiples .viz-card { margin: 0; padding: 0.75rem 0.75rem 0.25rem; }
.multiples h3 { font-size: 0.95rem; margin: 0; }
.multiples .sub { margin: 0; }

.lc { position: relative; }
.lc-svg { display: block; overflow: visible; outline: none; }
.lc-svg:focus-visible { outline: 2px solid var(--party-dem); outline-offset: 2px; border-radius: 4px; }
.lc-gridline { stroke: var(--gridline); stroke-width: 1; shape-rendering: crispEdges; }
.lc-baseline { stroke: var(--baseline); stroke-width: 1; shape-rendering: crispEdges; }
.lc-tick { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.lc-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lc-rule { stroke: var(--text-muted); stroke-width: 1; }
.lc-dot { stroke: var(--surface-1); stroke-width: 2; }
.lc-key { stroke-width: 2; stroke-linecap: round; }
.lc-leader { stroke: var(--baseline); fill: none; stroke-width: 1; }
.lc-endtext { fill: var(--text-secondary); font-size: 12px; }
.lc-endvalue { fill: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.lc-tip {
    position: absolute; pointer-events: none; z-index: 2;
    background: var(--surface-1); color: var(--text-primary);
    border: 1px solid rgba(11, 11, 11, 0.10); border-radius: 6px;
    box-shadow: 0 4px 16px rgba(11, 11, 11, 0.08);
    padding: 0.4rem 0.6rem; font-size: 0.8rem; white-space: nowrap;
}
.lc-tip-date { color: var(--text-secondary); margin-bottom: 0.2rem; }
.lc-tip-row { display: flex; align-items: center; gap: 0.4rem; line-height: 1.5; }
.lc-tip-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.lc-tip-row strong { font-variant-numeric: tabular-nums; }
.lc-tip-name { color: var(--text-secondary); }

.data-table { font-size: 0.8rem; }
.data-table td, .data-table th { padding: 0.25rem 0.5rem; white-space: nowrap;
                                 text-align: right; font-variant-numeric: tabular-nums; }
.data-table td:first-child, .data-table th:first-child { text-align: left; }

/* Election markers on a chart (see the markers option in linechart.js). */
.lc-marker { stroke: var(--text-muted); stroke-width: 1; shape-rendering: crispEdges; }
.lc-marker-primary { stroke-dasharray: 3 3; }
.lc-marker-general { stroke: var(--baseline); stroke-dasharray: 1 3; }
.lc-marker-label { fill: var(--text-secondary); font-size: 10px; paint-order: stroke;
                   stroke: var(--surface-1); stroke-width: 3px; }

/* A table cell whose background is a bar sized to the percent (see the bar macro). */
.barcell { background: linear-gradient(to right, color-mix(in srgb, #2a78d6 24%, transparent) var(--w), transparent var(--w)); }
.muted { color: #898781; }
.pct { color: var(--text-secondary); font-size: 0.8em; }
.year-table td, .year-table th { padding: 0.3rem 0.55rem; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.year-table td:not(:first-child), .year-table th:not(:first-child) { text-align: right; }
.year-table th { white-space: normal; vertical-align: bottom; }
.year-table tbody tr:hover { background: rgba(61, 126, 166, 0.06); }
.year-table td.total, .year-table th.total { font-weight: 600; }
.lead { font-size: 1.05rem; }
