/* state-legislatures.css - /state-legislatures/ hub and chamber pages (prefix sl-). Tokens only. */

/* Control fills: map states, legend keys, chips, dots */
.sl-c-D, .sl-s-D { --us-fill: var(--pc-party-dem); }
.sl-c-R, .sl-s-R { --us-fill: var(--pc-party-rep); }
.sl-c-split, .sl-s-split { --us-fill: var(--pc-text-secondary); }
.sl-c-tie, .sl-c-none, .sl-s-no_majority { --us-fill: var(--pc-text-meta); }
.sl-c-nonpartisan, .sl-s-nonpartisan { --us-fill: var(--pc-border-light); }

.us-map path.us-state.sl-s-split { fill: url(#sl-split-pat); }
.sl-map-wrap { max-width: 960px; }
.sl-map a:focus-visible path { stroke: var(--pc-text); stroke-width: 1.6; }
.sl-map-legend i.sl-s-split { background: repeating-linear-gradient(135deg, var(--pc-party-dem) 0 3px, var(--pc-party-rep) 3px 6px); }
.sl-map-legend { margin: 4px 0 12px; }
.sl-map-legend b { font-variant-numeric: tabular-nums; margin-left: 2px; }
.sl-map .us-map-label.sl-halo { paint-order: stroke; stroke: var(--pc-surface); stroke-width: 3px; }


.sl-chip { display: inline-block; font-family: var(--pc-sans); font-size: 12px; font-weight: 600; white-space: nowrap;
    color: var(--pc-text); padding-left: 10px; border-left: 4px solid var(--us-fill); }

/* Tables: editorial rules, no boxes (2px top rule on header-less tables, 2px under the last row) */
.pc-table.sl-table tbody tr:last-child td, .pc-table.sl-table tbody tr:last-child th { border-bottom: 2px solid var(--pc-text); }
.pc-table.sl-kv, .pc-table.sl-court:not(:has(thead)) { border-top: 2px solid var(--pc-text); }
.pc-table.sl-table tbody th { padding: 8px 8px; border-bottom: 1px solid var(--pc-border-light); font-weight: 600;
    color: var(--pc-text); vertical-align: top; text-align: left; }
.sl-nowrap { white-space: nowrap; }
.sl-line { font-family: var(--pc-sans); font-size: 14px; color: var(--pc-text-body); font-variant-numeric: tabular-nums;
    margin: 0 0 12px; max-width: 680px; line-height: 1.5; }
.pc-table.sl-table thead th.sl-left, .pc-table.sl-table tbody td.sl-left { text-align: left; }
.sl-table td { vertical-align: top; }
.sl-table a { color: var(--pc-text); text-decoration: underline; text-underline-offset: 2px; }
.sl-miss { color: var(--pc-text-meta); font-style: italic; }
.sl-note { color: var(--pc-text-meta); font-size: 12px; }
.sl-table tr.is-flagged td, .sl-table tr.is-missing td { color: var(--pc-text-meta); }
.sl-cand { white-space: nowrap; }
.sl-p-d { --party-color: var(--pc-party-dem); }
.sl-p-r { --party-color: var(--pc-party-rep); }
.sl-p-o { --party-color: var(--pc-text-meta); }
.sl-year { margin-top: 8px; }
.sl-year-miss { margin: 8px 0; }
.sl-partial { margin: 0 0 8px; }

/* Seat bar: pc-seatbar, R left, D right, other and vacant in neutral tones between */
.sl-seg-r { --party-color: var(--pc-party-rep); }
.sl-seg-d { --party-color: var(--pc-party-dem); }
.sl-seg-o { --party-color: var(--pc-text-meta); }
.sl-seg-v { --party-color: var(--pc-border); }
.sl-bar-wrap { margin-top: 20px; }
.sl-bar.pc-seatbar { height: 36px; border-radius: 0; }
.sl-bar .pc-seat-seg { color: var(--pc-on-party-dark); font-size: 13px; transition: none; }
.sl-bar .pc-seat-seg.sl-seg-v { color: var(--pc-text); }
.sl-seat-legend { margin-top: 18px; }
.sl-seat-legend .pc-swatch { background: var(--party-color); }
.sl-sib { margin-top: 12px; }

/* History chart (PollLineChart) */
.sl-chart { height: 340px; margin: 8px 0 12px; }
.sl-chart svg { overflow: visible; }
.sl-hist { margin-top: 8px; }

/* Hub map call-outs for the small states (positions as the build-your-own map) */
.sl-map .sl-co-line { stroke: var(--pc-text-meta); stroke-width: 0.6; pointer-events: none; }
.sl-map rect.sl-co { fill: var(--us-fill); stroke: var(--pc-surface); stroke-width: 0.8; }
.sl-map rect.sl-co.sl-s-split { fill: url(#sl-split-pat); }
.sl-map rect.sl-co.sl-s-nonpartisan { stroke: var(--pc-border); }
.sl-map .sl-co-label { font-family: var(--pc-sans); font-size: 9.5px; font-weight: 700; fill: var(--pc-text);
    text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.sl-map .sl-co-label.on-dark { fill: var(--pc-on-party-dark); }
.sl-map .sl-co-label.sl-halo { paint-order: stroke; stroke: var(--pc-surface); stroke-width: 3px; }
.sl-map a text { text-decoration: none; }
.sl-map a:hover rect.sl-co { stroke: var(--pc-text); stroke-width: 1.4; }

/* Chambers: a plain head line and an unboxed seat bar */
.sl-ch { margin: 0 0 28px; }
.sl-ch-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-family: var(--pc-sans); }
.sl-ch-verdict, .sl-ch-name { font-family: var(--pc-serif); font-size: 19px; font-weight: 700; color: var(--pc-text); }
a.sl-ch-name { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.sl-ch-note { font-size: 13px; color: var(--pc-text-secondary); font-variant-numeric: tabular-nums; }
.sl-ov-ch .sl-bar-wrap { margin-top: 26px; }
.sl-ov-ch .sl-bar.pc-seatbar { height: 24px; }
.sl-ov-ch .sl-seat-legend { margin-top: 12px; }
.sl-gov { font-family: var(--pc-sans); font-size: 15px; color: var(--pc-text-body); margin: 0 0 22px; }
.sl-gov .sl-cand b { font-weight: 700; color: var(--pc-text); }
.pc-table.sl-offs tbody th, .pc-table.sl-court tbody th { width: 30%; }

@media (max-width: 768px) {
    .sl-chart { height: 280px; }
    .pc-table.sl-offs tbody th, .pc-table.sl-court tbody th { width: auto; }
}

/* State overview: trifecta, Congress, president, calendar, terms, registration */
.sl-t-D { --us-fill: var(--pc-party-dem); }
.sl-t-R { --us-fill: var(--pc-party-rep); }
.sl-t-divided { --us-fill: var(--pc-text-secondary); }
.sl-t-nonpartisan, .sl-t-unknown { --us-fill: var(--pc-border); }
.sl-tri { margin: 4px 0 8px; }
.sl-tri .sl-chip { font-family: var(--pc-serif); font-size: 22px; font-weight: 700; padding-left: 12px; border-left-width: 5px; }
.sl-sub { font-family: var(--pc-sans); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--pc-text-meta); margin: 18px 0 6px; }
.pc-table.sl-kv tbody th, .pc-table.sl-terms tbody th { width: 34%; }
.pc-table.sl-kv { margin-top: 20px; }
.sl-table tr.sl-total td { font-weight: 700; }
.sl-res .sl-note { margin-top: 2px; }
.sl-pres-lead { font-family: var(--pc-serif); font-size: 19px; font-weight: 700; color: var(--pc-text); margin: 4px 0 8px; }
.sl-reg-link a { color: var(--pc-text); text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 768px) {
    .pc-table.sl-kv tbody th, .pc-table.sl-terms tbody th { width: 40%; }
    .sl-cand { white-space: normal; }
    .sl-m-hide { display: none; }
}

/* Hub: All / House / Senate (pc-seg, accent on the active control only) */
.sl-seg { margin: 0 0 12px; }
.sl-seg .pc-btn { padding: 7px 14px; font-size: 13px; }

/* District maps (chamber pages) and the overview's House map */
.sl-dm-d, .sl-hd-d { --us-fill: var(--pc-party-dem); }
.sl-dm-r, .sl-hd-r { --us-fill: var(--pc-party-rep); }
.sl-dm-o, .sl-hd-o { --us-fill: var(--pc-party-usind); }
.sl-dm-v { --us-fill: var(--pc-surface); }
.sl-dm-na, .sl-hd-nc { --us-fill: var(--pc-nc); }
.sl-dm-nr { --us-fill: var(--pc-tint); }
.sl-map-legend i.sl-dm-mix { background: repeating-linear-gradient(135deg, var(--pc-party-dem) 0 3px, var(--pc-party-rep) 3px 6px); }
.sl-dm-box, .sl-hmap-box { position: relative; }
.sl-dm { display: block; width: 100%; max-width: 760px; height: auto; max-height: 78vh; margin: 4px 0 6px; }
.sl-dm path, .sl-hmap path { fill: var(--us-fill); stroke: var(--pc-surface); stroke-width: 0.6; vector-effect: non-scaling-stroke;
    stroke-linejoin: round; cursor: pointer; outline: none; }
.sl-dm path.sl-dm-mix { fill: url(#sl-mix-pat); }
.sl-dm path.sl-dm-v, .sl-dm path.sl-dm-nr { stroke: var(--pc-border); }
.sl-dm path.is-active, .sl-dm path:focus-visible, .sl-hmap path.is-active, .sl-hmap path:focus-visible {
    stroke: var(--pc-text); stroke-width: 1.6; }
.sl-dm-loading { margin: 0; }
.sl-tip { white-space: normal; max-width: 280px; }
.sl-tip .pc-tooltip-name { flex: 0 1 auto; margin-right: 10px; }
.sl-tip-sub { font-weight: 700; color: var(--pc-text-body); font-size: 11px; margin: 6px 0 2px; }
.sl-tip-note { color: var(--pc-text-meta); font-size: 11px; margin-top: 2px; }

/* Overview: 2026 Senate and governor result bars */
.sl-rbs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 40px; margin: 4px 0 8px; }
.sl-rb { font-family: var(--pc-sans); font-variant-numeric: tabular-nums; }
.sl-rb-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-bottom: 8px; font-size: 14px; }
.sl-rb-office { font-family: var(--pc-serif); font-size: 18px; font-weight: 700; color: var(--pc-text); }
.sl-rb-office a { color: var(--pc-text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.sl-rb-call { color: var(--pc-text-secondary); font-size: 13px; }
.sl-rb-call a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.sl-rb-row { display: grid; grid-template-columns: minmax(0, 150px) 1fr 48px; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 13px; }
.sl-rb-name { color: var(--pc-text-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-rb-track { height: 14px; background: var(--pc-tint); position: relative; }
.sl-rb-track i { display: block; height: 100%; background: var(--party-color); }
.sl-rb-val { text-align: right; font-weight: 700; color: var(--pc-text); }
.sl-rb-note { margin: 2px 0 0; }
.sl-rb-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Overview: US House map and list */
.sl-hlegend { margin: 2px 0 10px; }
.sl-hwrap { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 12px 40px; align-items: start; }
.sl-hwrap.sl-hmap-many { grid-template-columns: 1fr; }
.sl-hwrap.sl-hwrap-nomap { grid-template-columns: 1fr; }
.sl-hmap { display: block; width: 100%; height: auto; max-height: 460px; }
.sl-hmap-many .sl-hmap-box { max-width: 560px; }
.sl-hl { list-style: none; margin: 0; padding: 0; font-family: var(--pc-sans); font-size: 13px; font-variant-numeric: tabular-nums; }
.sl-hmap-many .sl-hl { columns: 2 300px; column-gap: 40px; }
.sl-hl-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; column-gap: 8px; padding: 5px 0;
    border-bottom: 1px solid var(--pc-border-light); break-inside: avoid; }
.sl-hl-d { color: var(--pc-text-meta); font-weight: 600; grid-row: span 2; }
.sl-hl-d a { color: var(--pc-text); text-decoration: underline; text-underline-offset: 2px; }
.sl-hl-s { text-align: right; color: var(--pc-text); font-weight: 600; }
.sl-hl-m { grid-column: 2 / 4; color: var(--pc-text-meta); font-size: 12px; }
.sl-sen { font-family: var(--pc-sans); font-size: 14px; color: var(--pc-text-body); margin: 14px 0 0; line-height: 1.6; }

/* Overview: 2024 president bar (D left, other, R right; tick at half of all votes) */
.sl-pb-labels { display: flex; justify-content: space-between; gap: 12px; font-family: var(--pc-sans); font-size: 14px;
    color: var(--pc-text-body); margin: 0 0 6px; font-variant-numeric: tabular-nums; }
.sl-pb-labels b { color: var(--pc-text); font-size: 17px; }
.sl-pb-l::before { content: ""; display: inline-block; width: 10px; height: 10px; background: var(--party-color); margin-right: 6px; }
.sl-pb-r { text-align: right; }
.sl-pb-r::before { display: none; }
.sl-pb-r::after { content: ""; display: inline-block; width: 10px; height: 10px; background: var(--party-color); margin-left: 6px; }
.sl-pb { position: relative; display: flex; gap: 2px; height: 28px; max-width: 760px; }
.sl-pb-labels { max-width: 760px; }
.sl-pb-seg { display: block; background: var(--party-color); min-width: 1px; }
.sl-pb-mid { position: absolute; left: 50%; top: -4px; bottom: -4px; border-left: 1px solid var(--pc-text); }
.sl-pb-note { margin-top: 8px; }

/* Overview: next elections as a horizontal timeline. Two label rows at most: row 0 below the axis,
   row 1 above (state_overview.timeline_layout). A grid with subgrid rows, so each row is as tall as its
   tallest label. When two rows cannot hold the labels (.is-list), and on narrow screens, a vertical list. */
.sl-tl { display: grid; grid-template-rows: auto 0 auto; margin: 22px 0 8px; --lw: 16%; }
.sl-tl-axis { grid-row: 2; grid-column: 1; position: relative; border-top: 2px solid var(--pc-text); }
.sl-tl-year { position: absolute; left: var(--x); top: 6px; transform: translateX(-50%); font-family: var(--pc-sans);
    font-size: 11px; font-weight: 600; color: var(--pc-text-meta); background: var(--pc-surface); padding: 0 4px; z-index: 1; }
.sl-tl-year::before { content: ""; position: absolute; left: 50%; bottom: 100%; height: 6px; border-left: 1px solid var(--pc-text-meta); }
.sl-tl-items { grid-row: 1 / 4; grid-column: 1; display: grid; grid-template-rows: subgrid; list-style: none; margin: 0; padding: 0; }
.sl-tl-item { grid-row: 1 / 4; grid-column: 1; display: grid; grid-template-rows: subgrid; pointer-events: none; }
.sl-tl-dot { grid-row: 2; position: relative; display: block; margin-left: calc(var(--x) - 5px); top: -6px; width: 10px; height: 10px;
    border-radius: 50%; background: var(--pc-text); box-shadow: 0 0 0 2px var(--pc-surface); z-index: 2; }
.sl-tl-item.is-cond .sl-tl-dot { background: var(--pc-surface); border: 2px solid var(--pc-text); box-sizing: border-box; }
.sl-tl-lab { grid-row: 3; align-self: start; box-sizing: border-box; width: calc(var(--lw) - 0.6%); margin-left: var(--x);
    padding: 26px 0 0 8px; border-left: 1px solid var(--pc-border); pointer-events: auto;
    font-family: var(--pc-sans); font-size: 13px; color: var(--pc-text-body); line-height: 1.35; }
.sl-tl-up .sl-tl-lab { grid-row: 1; align-self: end; padding: 0 0 14px 8px; }
.sl-tl-end .sl-tl-lab { margin-left: calc(var(--x) - var(--lw) + 0.6%); padding-left: 0; padding-right: 8px; border-left: 0;
    border-right: 1px solid var(--pc-border); text-align: right; }
.sl-tl-lab b { display: block; color: var(--pc-text); }
.sl-tl-lab .sl-note { display: block; margin-top: 1px; }
.sl-tl-lab a.sl-tl-page { display: block; margin-top: 2px; pointer-events: auto; color: var(--pc-text); text-underline-offset: 2px; }
@media (max-width: 768px) {
    .sl-hwrap { grid-template-columns: 1fr; }
    .sl-hmap-box { max-width: 420px; }
}
.sl-tl.is-list { display: block; margin-top: 8px; }
.sl-tl.is-list .sl-tl-axis { display: none; }
.sl-tl.is-list .sl-tl-items { display: block; border-left: 2px solid var(--pc-text); margin-left: 5px; }
.sl-tl.is-list .sl-tl-item { display: block; position: relative; padding: 0 0 14px 16px; }
.sl-tl.is-list .sl-tl-dot { position: absolute; left: -6px; top: 4px; margin: 0; }
.sl-tl.is-list .sl-tl-lab { width: auto; margin: 0; padding: 0; border: 0; text-align: left; }
@media (max-width: 768px) {
    .sl-tl { display: block; margin-top: 8px; }
    .sl-tl .sl-tl-axis { display: none; }
    .sl-tl .sl-tl-items { display: block; border-left: 2px solid var(--pc-text); margin-left: 5px; }
    .sl-tl .sl-tl-item { display: block; position: relative; padding: 0 0 14px 16px; }
    .sl-tl .sl-tl-dot { position: absolute; left: -6px; top: 4px; margin: 0; }
    .sl-tl .sl-tl-lab { width: auto; margin: 0; padding: 0; border: 0; text-align: left; }
}

/* District map zoom (state-legislatures.js) */
.sl-zoom { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 6px; }
.sl-zoom .pc-btn { min-width: 34px; padding: 7px 10px; font-weight: 600; }
.sl-zoom .pc-btn:disabled { opacity: 0.45; cursor: default; }
.sl-zoom .sl-note { margin-left: 4px; }
.sl-dm, .sl-hmap { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.sl-dm.is-zoomed, .sl-hmap.is-zoomed { touch-action: none; cursor: grab; }
.sl-hub [hidden], [data-sl-dmap] [hidden], .sl-line[hidden], #sl-table-h [hidden] { display: none !important; }
