/**
 * Election results (ADR-136 §7, TMS-1146): the hub, contest pages and the homepage strip.
 * Enqueued only on those pages (`tms_news_elections_enqueue_assets()`). Tokens with light fallbacks;
 * the two literal pairs are the Live chip (the `.tms-flag--breaking` red, 4.8:1 in both schemes) and
 * the Certified chip's dark values. Party is a bordered letter, never a colour fill: the series colours follow
 * ballot order, and red is not one of them, so no two candidates read as Democrat and Republican. The one party
 * fill is the seat tally (ADR-188), which counts parties rather than candidates, in blue and orange. Nothing animates.
 */

.tms-elections {
	--tms-elections-share: 0;
}

/* ── Status line and chips ───────────────────────────────────────────────── */

.tms-elections__status {
	align-items: baseline;
	color: var(--tms-color-muted, #6b7280);
	display: flex;
	flex-wrap: wrap;
	font-size: 0.875rem;
	gap: 0.35rem 0.75rem;
	margin: 0.75rem 0 0;
}

.tms-elections__live {
	background: #dc2626;
	border: 1px solid #dc2626;
	border-radius: 3px;
	color: #fff;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	padding: 0.15rem 0.45rem;
	text-transform: uppercase;
}

.tms-elections__live--paused,
.tms-elections__live--counting,
.tms-elections__live--upcoming {
	background: var(--tms-color-surface, #f7f7f7);
	border-color: var(--tms-color-border, #e5e7eb);
	color: var(--tms-color-text, #111);
}

.tms-elections__live--certified {
	background: var(--tms-color-text, #111);
	border-color: var(--tms-color-text, #111);
	color: var(--tms-color-background, #fff);
}

@media (prefers-color-scheme: dark) {
	.tms-elections__live--certified {
		background: #f9fafb;
		border-color: #f9fafb;
		color: #0b1120;
	}
}

.tms-elections__updated,
.tms-elections__quiet,
.tms-elections__cadence {
	font-family: var(--tms-font-list, inherit);
}

.tms-elections__notice {
	background: var(--tms-color-surface, #f7f7f7);
	border-left: 3px solid var(--tms-color-border, #e5e7eb);
	color: var(--tms-color-text, #111);
	flex-basis: 100%;
	margin: 0.25rem 0 0;
	padding: 0.5rem 0.75rem;
}

.tms-elections__notice--no-local {
	margin: 1.5rem 0 0;
}

.tms-elections__explainer {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.9375rem;
	margin: 0.5rem 0 0;
	max-width: 60ch;
}

.tms-elections__unofficial {
	font-style: normal;
	font-weight: 700;
	text-decoration: underline;
}

/* ── Sections and grids ──────────────────────────────────────────────────── */

.tms-elections__jump {
	margin-top: 1.25rem;
}

.tms-elections__section {
	margin-top: 2.5rem;
	scroll-margin-top: 5rem;
}

.tms-elections__section-header {
	align-items: baseline;
	display: flex;
	gap: 1rem;
	justify-content: space-between;
}

.tms-elections__count {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	margin: 0;
}

.tms-elections__grid {
	display: grid;
	gap: 1.5rem 2rem;
	margin-top: 1rem;
}

.tms-elections__grid--2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tms-elections__grid--3,
.tms-elections__grid--dense {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tms-elections__group {
	margin-top: 1.75rem;
}

.tms-elections__group-title {
	font-size: 1.125rem;
	margin: 0;
}

.tms-elections__group-site {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	font-weight: 400;
}

.tms-elections__more {
	margin-top: 1rem;
}

.tms-elections__more-summary {
	align-items: center;
	cursor: pointer;
	display: flex;
	font-weight: 600;
	min-height: 44px;
}

/* ── Race card ───────────────────────────────────────────────────────────── */

.tms-elections__race {
	border-top: 2px solid var(--tms-color-border, #e5e7eb);
	min-width: 0;
	padding-top: 1rem;
}

.tms-elections__race--full {
	border-top-color: var(--tms-color-accent, #b91c1c);
}

.tms-elections__race--called,
.tms-elections__race--certified {
	border-top-color: var(--tms-color-text, #111);
}

.tms-elections__race-kicker {
	color: var(--tms-color-accent, #b91c1c);
	font-size: 0.75rem;
	font-weight: var(--tms-weight-label, 600);
	letter-spacing: 0.08em;
	margin: 0;
	text-transform: uppercase;
}

.tms-elections__threshold {
	color: var(--tms-color-text, #111);
	letter-spacing: 0;
	margin-left: 0.35rem;
	text-transform: none;
}

.tms-elections__race-title {
	font-family: var(--tms-font-headline, inherit);
	font-size: 1.3rem;
	line-height: 1.2;
	margin: 0.25rem 0 0.75rem;
}

.tms-elections__race--full .tms-elections__race-title,
.tms-elections__race--page .tms-elections__race-title {
	font-size: clamp(1.35rem, 2vw, 1.6rem);
}

.tms-elections__race-title a {
	color: inherit;
	text-decoration: none;
}

.tms-elections__race-title a:hover,
.tms-elections__race-title a:focus-visible {
	text-decoration: underline;
}

.tms-elections__call {
	font-weight: 700;
	margin: -0.5rem 0 0.75rem;
}

.tms-elections__cands {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tms-elections__cand {
	align-items: baseline;
	column-gap: 0.75rem;
	display: grid;
	font-family: var(--tms-font-list, inherit);
	font-variant-numeric: tabular-nums;
	grid-template-areas:
		"name party votes pct"
		"mark mark mark mark";
	grid-template-columns: minmax(0, 1fr) auto auto auto;
	padding: 0.4rem 0;
}

.tms-elections__cand-name {
	grid-area: name;
	overflow-wrap: anywhere;
}

.tms-elections__cand--leading .tms-elections__cand-name,
.tms-elections__cand--winner .tms-elections__cand-name {
	font-weight: 700;
}

.tms-elections__inc {
	border: 1px solid var(--tms-color-border, #e5e7eb);
	border-radius: 50%;
	color: var(--tms-color-muted, #6b7280);
	display: inline-block;
	font-size: 0.625rem;
	line-height: 1rem;
	text-align: center;
	width: 1rem;
}

.tms-elections__party {
	border: 1px solid currentColor;
	border-radius: 3px;
	font-size: 0.6875rem;
	font-weight: 700;
	grid-area: party;
	padding: 0 0.3rem;
}

.tms-elections__votes {
	grid-area: votes;
	text-align: right;
}

.tms-elections__pct {
	font-weight: 700;
	grid-area: pct;
	min-width: 3.5rem;
	text-align: right;
}

.tms-elections__mark {
	color: var(--tms-color-accent, #b91c1c);
	font-size: 0.75rem;
	font-weight: 700;
	grid-area: mark;
}

.tms-elections__mark:empty {
	display: none;
}

/* The precinct bar is a quiet progress line, not a fourth vote bar: thin, and half-strength in both schemes. */
.tms-elections__precincts-bar {
	background: var(--tms-color-surface-alt, #f1f5f9);
	display: block;
	height: 3px;
	margin-top: 0.3rem;
}

.tms-elections__bar-fill {
	background: var(--tms-color-muted, #6b7280);
	display: block;
	height: 100%;
	opacity: 0.55;
	width: calc(var(--tms-elections-share) * 100%);
}

/* ── Head-to-head bar and measure meter (TMS-1261) ─────────────────────────
 * One bar per race: every candidate's share side by side, adding to 100%, in the swatch colour beside their
 * name; a measure's Yes and No with the passing line drawn on it. The sentence under it carries the number. */

.tms-elections__swatch {
	border-radius: 2px;
	display: inline-block;
	height: 0.6rem;
	margin-right: 0.4rem;
	vertical-align: 0.05em;
	width: 0.6rem;
}

.tms-elections__swatch--s1 { background: var(--tms-elections-s1); }
.tms-elections__swatch--s2 { background: var(--tms-elections-s2); }
.tms-elections__swatch--s3 { background: var(--tms-elections-s3); }
.tms-elections__swatch--s4 { background: var(--tms-elections-s4); }
.tms-elections__swatch--s5 { background: var(--tms-elections-s5); }
.tms-elections__swatch--s6 { background: var(--tms-elections-s6); }

.tms-elections__swatch--other {
	background: var(--tms-color-border, #d1d5db);
}

.tms-elections__bar-box {
	margin-top: 0.6rem;
}

.tms-elections__bars {
	display: flex;
	gap: 2px;
	height: 12px;
	position: relative;
}

.tms-elections__seg {
	display: block;
	flex: var(--tms-elections-share) 1 0;
	min-width: 2px;
}

.tms-elections__seg--s1 { background: var(--tms-elections-s1); }
.tms-elections__seg--s2 { background: var(--tms-elections-s2); }
.tms-elections__seg--s3 { background: var(--tms-elections-s3); }
.tms-elections__seg--s4 { background: var(--tms-elections-s4); }
.tms-elections__seg--s5 { background: var(--tms-elections-s5); }
.tms-elections__seg--s6 { background: var(--tms-elections-s6); }

.tms-elections__seg--other {
	background: var(--tms-color-border, #d1d5db);
}

.tms-elections__meter-line {
	background: var(--tms-color-text, #111);
	bottom: -4px;
	left: calc(var(--tms-elections-share) * 100% - 1px);
	position: absolute;
	top: -4px;
	width: 2px;
}

.tms-elections__margin {
	font-family: var(--tms-font-list, inherit);
	font-size: 0.875rem;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	margin: 0.45rem 0 0;
}

.tms-elections__race--compact .tms-elections__cand {
	grid-template-areas: "name party pct" "mark mark mark";
	grid-template-columns: minmax(0, 1fr) auto auto;
}

.tms-elections__race--compact .tms-elections__votes {
	display: none;
}

.tms-elections__race-footer {
	color: var(--tms-color-muted, #6b7280);
	font-family: var(--tms-font-list, inherit);
	font-size: 0.8125rem;
	margin-top: 0.75rem;
}

.tms-elections__precincts,
.tms-elections__credit {
	margin: 0.3rem 0 0;
}

.tms-elections__precincts-bar {
	margin: 0 0 0.3rem;
}

.tms-elections__lag {
	font-style: italic;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.tms-elections__table-wrap {
	margin-top: 1rem;
	overflow-x: auto;
}

.tms-elections__table {
	border-collapse: collapse;
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
	width: 100%;
}

.tms-elections__table th,
.tms-elections__table td {
	border-bottom: 1px solid var(--tms-color-border, #e5e7eb);
	padding: 0.55rem 0.75rem;
	text-align: left;
}

.tms-elections__table thead th {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.tms-elections__table .tms-elections__num {
	text-align: right;
}

.tms-elections__table-pct {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
}

.tms-elections__row--total th,
.tms-elections__row--total td {
	border-top: 2px solid var(--tms-color-text, #111);
	font-weight: 700;
}

/* ── Local sites links ───────────────────────────────────────────────────── */

.tms-elections__links {
	display: grid;
	gap: 1.5rem 2rem;
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	margin-top: 1rem;
}

.tms-elections__links-heading {
	font-size: 1rem;
	margin: 0 0 0.5rem;
}

.tms-elections__links-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tms-elections__links-list li {
	padding: 0.2rem 0;
}

/* ── Homepage strip ──────────────────────────────────────────────────────── */

.tms-elections--strip {
	background: var(--tms-color-surface, #f7f7f7);
	border-top: 3px solid var(--tms-color-accent, #b91c1c);
	margin: 1.5rem 0;
	padding: 18px 22px 20px;
}

.tms-elections__strip-header {
	align-items: baseline;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
}

.tms-elections__strip-title {
	align-items: center;
	display: flex;
	font-size: 1.25rem;
	gap: 0.5rem;
	margin: 0;
}

.tms-elections--strip .tms-elections__status {
	margin: 0;
}

.tms-elections__strip-more {
	font-weight: 600;
	margin-left: auto;
}

.tms-elections__credit--strip {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	margin-top: 1rem;
}

/* ── The race timeline, "How the count came in" (TMS-1260) ────────────────
 * A plain SVG drawn by inc/elections-timeline.php (and rebuilt by elections-refresh.js). Line colours follow
 * ballot order among the drawn leaders, never party (two Democrats can meet in a top-two race); the rest are
 * muted. The viewBox scales with the column; text keeps its size through the SVG's font-size. */

.tms-elections {
	/* Validated as a set for colour-blind separation (TMS-1261). Some sit under 3:1 on white, so every series
	 * is named in text beside it (the swatch's candidate, the chart's label); the labels themselves stay ink. */
	--tms-elections-s1: #2a78d6;
	--tms-elections-s2: #eb6834;
	--tms-elections-s3: #1baf7a;
	--tms-elections-s4: #eda100;
	--tms-elections-s5: #e87ba4;
	--tms-elections-s6: #008300;
}

@media (prefers-color-scheme: dark) {
	.tms-elections {
		--tms-elections-s1: #3987e5;
		--tms-elections-s2: #d95926;
		--tms-elections-s3: #199e70;
		--tms-elections-s4: #c98500;
		--tms-elections-s5: #d55181;
		--tms-elections-s6: #008300;
	}
}

.tms-elections__timeline {
	border-top: 2px solid var(--tms-color-border, #e5e7eb);
	margin: 1.5rem 0 0;
	padding-top: 0.75rem;
}

.tms-elections__timeline-head {
	margin-bottom: 0.5rem;
}

.tms-elections__timeline-title {
	display: block;
	font-family: var(--tms-font-headline, inherit);
	font-size: 1.125rem;
	font-weight: 700;
}

.tms-elections__timeline-lede {
	color: var(--tms-color-text, #111);
	font-size: 0.9375rem;
}

.tms-elections__timeline-svg {
	display: block;
	height: auto;
	overflow: visible;
	width: 100%;
}

.tms-elections__timeline-svg--page {
	font-family: var(--tms-font-list, inherit);
	font-size: 11px;
	max-width: 760px;
}

.tms-elections__timeline-svg text {
	fill: var(--tms-color-muted, #6b7280);
	font-variant-numeric: tabular-nums;
}

.tms-elections__timeline-grid {
	stroke: var(--tms-color-border, #e5e7eb);
	stroke-width: 1;
}

.tms-elections__timeline-break {
	stroke: var(--tms-color-muted, #6b7280);
	stroke-dasharray: 2 3;
	stroke-width: 1;
}

.tms-elections__timeline-threshold {
	stroke: var(--tms-color-text, #111);
	stroke-dasharray: 5 4;
	stroke-width: 1;
}

.tms-elections__timeline-line {
	fill: none;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2.5;
	vector-effect: non-scaling-stroke;
}

.tms-elections__timeline-line--other {
	stroke: var(--tms-color-border, #d1d5db);
	stroke-width: 1.5;
}

.tms-elections__timeline-line--s1 { stroke: var(--tms-elections-s1); }
.tms-elections__timeline-line--s2 { stroke: var(--tms-elections-s2); }
.tms-elections__timeline-line--s3 { stroke: var(--tms-elections-s3); }
.tms-elections__timeline-line--s4 { stroke: var(--tms-elections-s4); }
.tms-elections__timeline-line--s5 { stroke: var(--tms-elections-s5); }
.tms-elections__timeline-line--s6 { stroke: var(--tms-elections-s6); }

.tms-elections__timeline-mark {
	fill: var(--tms-color-background, #fff);
	stroke-width: 2.5;
}

.tms-elections__timeline-mark--s1 { stroke: var(--tms-elections-s1); }
.tms-elections__timeline-mark--s2 { stroke: var(--tms-elections-s2); }
.tms-elections__timeline-mark--s3 { stroke: var(--tms-elections-s3); }
.tms-elections__timeline-mark--s4 { stroke: var(--tms-elections-s4); }
.tms-elections__timeline-mark--s5 { stroke: var(--tms-elections-s5); }
.tms-elections__timeline-mark--s6 { stroke: var(--tms-elections-s6); }

.tms-elections__timeline-svg .tms-elections__timeline-label {
	font-weight: 600;
}

/* Labels wear the text colour; the line ending beside each one carries the series colour. */
.tms-elections__timeline-svg .tms-elections__timeline-label {
	fill: var(--tms-color-text, #111);
}

.tms-elections__timeline-svg .tms-elections__timeline-note {
	fill: var(--tms-color-text, #111);
}

.tms-elections__timeline-band-track {
	fill: var(--tms-color-surface-alt, #f1f5f9);
}

.tms-elections__timeline-band {
	fill: var(--tms-color-muted, #6b7280);
	fill-opacity: 0.45;
}

.tms-elections__spark {
	margin: 0.5rem 0 0;
}

.tms-elections__spark .tms-elections__timeline-svg {
	height: 36px;
	max-width: 160px;
}

.tms-elections__spark .tms-elections__timeline-line {
	stroke-width: 1.75;
}

.tms-elections__spark .tms-elections__timeline-line--other {
	stroke-width: 1;
}

/* ── Lead tracker, "Who's ahead, report by report" (TMS-1261) ──────────────── */

.tms-elections__lead-zero {
	stroke: var(--tms-color-text, #111);
	stroke-width: 1;
}

.tms-elections__lead-line {
	fill: none;
	stroke: var(--tms-color-text, #111);
	stroke-linejoin: round;
	stroke-width: 2;
	vector-effect: non-scaling-stroke;
}

.tms-elections__lead-dot {
	fill: var(--tms-color-text, #111);
}

.tms-elections__lead-dot--change {
	fill: var(--tms-color-background, #fff);
	stroke: var(--tms-color-accent, #b91c1c);
	stroke-width: 2.5;
}

.tms-elections__timeline-svg .tms-elections__lead-end {
	fill: var(--tms-color-text, #111);
	font-weight: 700;
}

/* ── Closest races (TMS-1261) ─────────────────────────────────────────────
 * Each row joins the runner-up's share (hollow) to the leader's (solid) on a 0–100% track with a 50% tick. */

.tms-elections__closest-note {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	margin: 0 0 0.5rem;
}

.tms-elections__closest {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tms-elections__closest-row {
	align-items: center;
	border-top: 1px solid var(--tms-color-border, #e5e7eb);
	column-gap: 1rem;
	display: grid;
	font-family: var(--tms-font-list, inherit);
	font-variant-numeric: tabular-nums;
	grid-template-areas: "name track margin";
	grid-template-columns: minmax(0, 1.3fr) minmax(8rem, 1fr) minmax(0, 0.9fr);
	padding: 0.55rem 0;
}

.tms-elections__closest-name {
	color: inherit;
	font-weight: 600;
	grid-area: name;
	overflow-wrap: anywhere;
}

.tms-elections__closest-track {
	background: linear-gradient(var(--tms-color-border, #e5e7eb), var(--tms-color-border, #e5e7eb)) center / 100% 1px no-repeat;
	display: block;
	grid-area: track;
	height: 14px;
	position: relative;
}

.tms-elections__closest-track::after {
	background: var(--tms-color-border, #d1d5db);
	content: "";
	height: 10px;
	left: 50%;
	position: absolute;
	top: 2px;
	width: 1px;
}

.tms-elections__closest-gap {
	background: var(--tms-color-text, #111);
	height: 3px;
	left: calc(var(--tms-elections-from) * 100%);
	position: absolute;
	top: 5.5px;
	width: calc((var(--tms-elections-share) - var(--tms-elections-from)) * 100%);
	z-index: 1;
}

.tms-elections__closest-gap::before,
.tms-elections__closest-gap::after {
	border: 2px solid var(--tms-color-text, #111);
	border-radius: 50%;
	box-sizing: border-box;
	content: "";
	height: 11px;
	position: absolute;
	top: -4px;
	width: 11px;
}

.tms-elections__closest-gap::before {
	background: var(--tms-color-background, #fff);
	left: -5.5px;
}

.tms-elections__closest-gap::after {
	background: var(--tms-color-text, #111);
	right: -5.5px;
}

.tms-elections__closest-margin {
	font-size: 0.875rem;
	grid-area: margin;
}

/* ── Who leads California's seats and the regional roll-up (ADR-188) ─────────────
 * The one party-coloured view: Democrats blue from the left, Republicans orange from the right (never red/blue),
 * solid where the seat is settled and light where the party is only ahead. Every number is also in the words
 * under the bar, so the colours are never the only carrier. */

.tms-elections {
	--tms-elections-party-d: #2a78d6;
	--tms-elections-party-r: #eb6834;
}

@media (prefers-color-scheme: dark) {
	.tms-elections {
		--tms-elections-party-d: #3987e5;
		--tms-elections-party-r: #d95926;
	}
}

.tms-elections__seats {
	display: grid;
	font-family: var(--tms-font-list, inherit);
	font-variant-numeric: tabular-nums;
	gap: 1rem;
	max-width: 44rem;
}

.tms-elections__seats-title {
	font-size: 1rem;
	margin: 0 0 0.35rem;
}

.tms-elections__seats-total {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	font-weight: 400;
	margin-left: 0.25rem;
}

.tms-elections__seats-track {
	background: var(--tms-color-surface-alt, #f1f5f9);
	border-radius: 3px;
	display: flex;
	height: 14px;
	overflow: hidden;
}

.tms-elections__seats-part {
	display: block;
	height: 100%;
	width: calc(var(--tms-elections-share) * 100%);
}

.tms-elections__seats-part--d {
	background: var(--tms-elections-party-d);
}

.tms-elections__seats-part--d-ahead {
	background: color-mix(in srgb, var(--tms-elections-party-d) 45%, transparent);
}

.tms-elections__seats-part--r {
	background: var(--tms-elections-party-r);
}

.tms-elections__seats-part--r-ahead {
	background: color-mix(in srgb, var(--tms-elections-party-r) 45%, transparent);
}

.tms-elections__seats-part--other {
	background: var(--tms-color-muted, #6b7280);
}

.tms-elections__seats-part--none {
	background: transparent;
}

.tms-elections__seats-line {
	font-size: 0.875rem;
	margin: 0.4rem 0 0;
}

.tms-elections__seats-note,
.tms-elections__rollup-note {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	margin: 0.6rem 0 0;
	max-width: 44rem;
}

.tms-elections__rollup-wrap {
	overflow-x: auto;
}

.tms-elections__rollup {
	border-collapse: collapse;
	font-family: var(--tms-font-list, inherit);
	font-size: 0.875rem;
	font-variant-numeric: tabular-nums;
	min-width: 100%;
}

.tms-elections__rollup th,
.tms-elections__rollup td {
	border-bottom: 1px solid var(--tms-color-border, #e5e7eb);
	padding: 0.4rem 0.5rem;
	text-align: right;
	white-space: nowrap;
}

.tms-elections__rollup th[scope="row"],
.tms-elections__rollup thead th:first-child {
	text-align: left;
	white-space: normal;
}

.tms-elections__rollup thead th {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.75rem;
	font-weight: 600;
}

.tms-elections__rollup tfoot th,
.tms-elections__rollup tfoot td {
	border-bottom: 0;
	border-top: 2px solid var(--tms-color-border, #e5e7eb);
	font-weight: 700;
}

/* ── Turnout so far (TMS-1261) ────────────────────────────────────────────
 * One bar from 0 to every registered voter, filled to the ballots counted. Ink, not a series colour: turnout is not a
 * candidate. */

.tms-elections__turnout {
	font-family: var(--tms-font-list, inherit);
	font-variant-numeric: tabular-nums;
	max-width: 40rem;
}

.tms-elections__turnout-figure {
	margin: 0 0 0.4rem;
}

.tms-elections__turnout-figure strong {
	font-size: 1.75rem;
	font-weight: 700;
	line-height: 1;
	margin-right: 0.25rem;
}

.tms-elections__turnout-track {
	background: var(--tms-color-surface-alt, #f1f5f9);
	border-radius: 3px;
	display: block;
	height: 10px;
	overflow: hidden;
}

.tms-elections__turnout-fill {
	background: var(--tms-color-text, #111);
	display: block;
	height: 100%;
	width: calc(var(--tms-elections-share) * 100%);
}

.tms-elections__turnout-line {
	font-size: 0.875rem;
	margin: 0.45rem 0 0;
}

.tms-elections__turnout-note {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	margin: 0.35rem 0 0;
}

/* Past general elections' final turnout (ADR-191): a thin upright tick on the track per year, solid for the most
 * recent (2022) and hollow for the one before (2018), keyed in the list under the line. */
.tms-elections__section--turnout .tms-elections__turnout-track {
	overflow: visible;
	position: relative;
}

.tms-elections__section--turnout .tms-elections__turnout-fill {
	border-radius: 3px;
}

/* Taller than the track and edged in the page colour, so a tick inside the ink fill still shows. */
.tms-elections__turnout-tick {
	border-left: 2px solid var(--tms-color-text, #111);
	bottom: -5px;
	box-shadow: 1px 0 0 var(--tms-color-background, #fff), -3px 0 0 -1px var(--tms-color-background, #fff);
	left: calc(var(--tms-elections-share) * 100% - 1px);
	position: absolute;
	top: -5px;
	width: 0;
}

.tms-elections__turnout-tick--2 {
	border-left-style: dotted;
}

.tms-elections__turnout-past {
	display: flex;
	flex-wrap: wrap;
	font-size: 0.8125rem;
	gap: 0.25rem 1.25rem;
	list-style: none;
	margin: 0.45rem 0 0;
	padding: 0;
}

.tms-elections__turnout-key {
	border-left: 2px solid var(--tms-color-text, #111);
	display: inline-block;
	height: 0.8em;
	margin-right: 0.4rem;
	vertical-align: -0.05em;
}

.tms-elections__turnout-key--2 {
	border-left-style: dotted;
}

.tms-elections__turnout-compare {
	font-size: 0.875rem;
	font-weight: 700;
	margin: 0.45rem 0 0;
}

/* ── Ballots left to count (ADR-191) ─────────────────────────────────────
 * The Secretary of State's estimate, county facts only. Ink like the gauge: ballots are not a candidate. */

.tms-elections__left {
	font-family: var(--tms-font-list, inherit);
	font-variant-numeric: tabular-nums;
	max-width: 40rem;
}

.tms-elections__left-figure {
	margin: 0 0 0.4rem;
}

.tms-elections__left-figure strong {
	font-size: 1.75rem;
	font-weight: 700;
	line-height: 1;
	margin-right: 0.25rem;
}

.tms-elections__left-track {
	background: repeating-linear-gradient(135deg, var(--tms-color-surface-alt, #f1f5f9) 0 4px, var(--tms-color-border, #e5e7eb) 4px 6px);
	border-radius: 3px;
	display: block;
	height: 10px;
	overflow: hidden;
}

.tms-elections__left-fill {
	background: var(--tms-color-text, #111);
	display: block;
	height: 100%;
	width: calc(var(--tms-elections-share) * 100%);
}

.tms-elections__left-line,
.tms-elections__left-cure,
.tms-elections__left-next,
.tms-elections__left-more {
	font-size: 0.875rem;
	margin: 0.45rem 0 0;
}

.tms-elections__left-types {
	border-top: 1px solid var(--tms-color-border, #e5e7eb);
	font-size: 0.875rem;
	list-style: none;
	margin: 0.6rem 0 0;
	padding: 0;
}

.tms-elections__left-types li {
	border-bottom: 1px solid var(--tms-color-border, #e5e7eb);
	display: flex;
	gap: 1rem;
	justify-content: space-between;
	padding: 0.3rem 0;
}

.tms-elections__left-n {
	font-weight: 700;
	white-space: nowrap;
}

.tms-elections__left-table {
	border-collapse: collapse;
	font-size: 0.875rem;
	margin-top: 0.75rem;
	width: 100%;
}

.tms-elections__left-table th,
.tms-elections__left-table td {
	border-bottom: 1px solid var(--tms-color-border, #e5e7eb);
	padding: 0.3rem 0.5rem 0.3rem 0;
	text-align: left;
}

.tms-elections__left-table td {
	text-align: right;
	white-space: nowrap;
}

.tms-elections__left-table thead th {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.75rem;
	font-weight: 600;
}

.tms-elections__left-table thead th + th {
	text-align: right;
}

.tms-elections__left-credit {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	margin: 0.6rem 0 0;
}

/* ── Breakpoints: 960, 800, 640 ──────────────────────────────────────────── */

@media (max-width: 960px) {
	.tms-elections__grid--3,
	.tms-elections__grid--dense {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 800px) {
	.tms-elections__grid--2,
	.tms-elections__grid--3 {
		grid-template-columns: minmax(0, 1fr);
	}

	.tms-elections__jump {
		overflow-x: auto;
	}

	.tms-elections__strip-header {
		flex-direction: column;
	}

	.tms-elections__strip-more {
		margin-left: 0;
	}

	.tms-elections__table th:first-child {
		background: var(--tms-color-background, #fff);
		left: 0;
		position: sticky;
	}
}

@media (max-width: 640px) {
	.tms-elections__grid--dense {
		grid-template-columns: minmax(0, 1fr);
	}

	.tms-elections__closest-row {
		grid-template-areas: "name name" "track margin";
		grid-template-columns: minmax(6rem, 1fr) auto;
		row-gap: 0.35rem;
	}
}

/* ── The late count (ADR-187) ─────────────────────────────────────────────────
 * The card's "Late count" line, the race page's election-night split, net gains and ledger, and the hub's two
 * boards. Ballot-order series colours, never party; every number is also in words. */

.tms-elections__late {
	color: var(--tms-color-muted, #6b7280);
	font-family: var(--tms-font-list, inherit);
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
	margin: 0.35rem 0 0;
}

.tms-elections__split-body,
.tms-elections__gains-body,
.tms-elections__ledger-body {
	font-family: var(--tms-font-list, inherit);
	font-variant-numeric: tabular-nums;
	margin-top: 0.6rem;
}

.tms-elections__split-row + .tms-elections__split-row {
	margin-top: 0.9rem;
}

.tms-elections__split-label,
.tms-elections__split-shares {
	font-size: 0.875rem;
	margin: 0 0 0.35rem;
}

.tms-elections__split-shares {
	color: var(--tms-color-muted, #6b7280);
	margin: 0.35rem 0 0;
}

.tms-elections__gains-key {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	margin: 0 0 0.5rem;
}

.tms-elections__gains {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tms-elections__gain-row {
	align-items: center;
	border-top: 1px solid var(--tms-color-border, #e5e7eb);
	column-gap: 0.75rem;
	display: grid;
	font-size: 0.875rem;
	grid-template-areas: "when track net lead";
	grid-template-columns: 5.5rem minmax(8rem, 1fr) minmax(0, 8rem) minmax(0, 9rem);
	padding: 0.4rem 0;
}

.tms-elections__gain-when { grid-area: when; }
.tms-elections__gain-net { font-weight: 600; grid-area: net; }
.tms-elections__gain-lead { color: var(--tms-color-muted, #6b7280); grid-area: lead; }

/* A centre line; the bar grows left for the first candidate on the ballot, right for the second. */
.tms-elections__gain-track {
	display: block;
	grid-area: track;
	height: 14px;
	position: relative;
}

.tms-elections__gain-track::after {
	background: var(--tms-color-text, #111);
	content: "";
	height: 100%;
	left: calc(50% - 0.5px);
	position: absolute;
	top: 0;
	width: 1px;
}

.tms-elections__gain-bar {
	height: 10px;
	min-width: 2px;
	position: absolute;
	top: 2px;
	width: calc(var(--tms-elections-share) * 50%);
}

.tms-elections__gain-bar--a { right: 50%; }
.tms-elections__gain-bar--b { left: 50%; }

.tms-elections__ledger-scroll {
	overflow-x: auto;
}

.tms-elections__ledger {
	border-collapse: collapse;
	font-size: 0.875rem;
	width: 100%;
}

.tms-elections__ledger th,
.tms-elections__ledger td {
	border-top: 1px solid var(--tms-color-border, #e5e7eb);
	padding: 0.4rem 0.5rem 0.4rem 0;
	text-align: right;
	white-space: nowrap;
}

.tms-elections__ledger thead th {
	border-top: 0;
	color: var(--tms-color-muted, #6b7280);
	font-weight: 600;
}

.tms-elections__ledger th[scope="row"],
.tms-elections__ledger thead th:first-child {
	text-align: left;
}

.tms-elections__ledger td:nth-last-child(3) {
	min-width: 6rem;
	width: 30%;
}

.tms-elections__ledger td:nth-last-child(2),
.tms-elections__ledger td:last-child {
	font-weight: 600;
}

.tms-elections__bars--ledger {
	height: 10px;
}

.tms-elections__flips,
.tms-elections__handful {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tms-elections__flips-row,
.tms-elections__handful-row {
	align-items: baseline;
	border-top: 1px solid var(--tms-color-border, #e5e7eb);
	column-gap: 1rem;
	display: grid;
	font-family: var(--tms-font-list, inherit);
	font-variant-numeric: tabular-nums;
	padding: 0.55rem 0;
}

.tms-elections__flips-row {
	grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr);
}

.tms-elections__handful-row {
	grid-template-columns: minmax(0, 1.4fr) minmax(0, 7rem) minmax(0, 1fr);
}

.tms-elections__flips-name,
.tms-elections__handful-name {
	color: inherit;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.tms-elections__flips-line,
.tms-elections__handful-detail {
	font-size: 0.875rem;
}

.tms-elections__handful-gap {
	font-weight: 700;
	text-align: right;
}

@media (max-width: 640px) {
	/* On a phone the ledger drops its split bar; every count, candidate, winner and lead stays. */
	.tms-elections__ledger {
		font-size: 0.8125rem;
	}

	.tms-elections__ledger th,
	.tms-elections__ledger td {
		padding-right: 0.35rem;
	}

	.tms-elections__ledger th:nth-last-child(3),
	.tms-elections__ledger td:nth-last-child(3) {
		display: none;
	}

	/* Six candidates still scroll sideways: the count's label stays in view. */
	.tms-elections__ledger th[scope="row"],
	.tms-elections__ledger thead th:first-child {
		background: var(--tms-color-background, #fff);
		left: 0;
		position: sticky;
	}

	.tms-elections__gain-row {
		grid-template-areas: "when net" "track track" "lead lead";
		grid-template-columns: minmax(0, 1fr) auto;
		row-gap: 0.3rem;
	}

	.tms-elections__flips-row,
	.tms-elections__handful-row {
		grid-template-columns: minmax(0, 1fr) auto;
		row-gap: 0.25rem;
	}

	.tms-elections__flips-line,
	.tms-elections__handful-detail {
		grid-column: 1 / -1;
	}
}

/* ── The homepage during the count (ADR-186) ──────────────────────────────────
 * The ribbon (top) and the block after the lead, printed by inc/elections-home.php from the document's `home`.
 * Bars reuse the card's ballot-order series; "Too close to call" is the one status colour, always with its words.
 * Nothing animates. */

.tms-elections--ribbon,
.tms-elections--home {
	--tms-elections-close: #a16207;
	--tms-elections-close-soft: rgba(161, 98, 7, 0.1);
}

@media (prefers-color-scheme: dark) {
	.tms-elections--ribbon,
	.tms-elections--home {
		--tms-elections-close: #fbbf24;
		--tms-elections-close-soft: rgba(251, 191, 36, 0.1);
	}
}

.tms-elections__chip {
	border: 1px solid var(--tms-color-border, #e5e7eb);
	border-radius: 3px;
	display: inline-block;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	line-height: 1.4;
	padding: 0.05rem 0.4rem;
	text-transform: uppercase;
	white-space: nowrap;
}

.tms-elections__chip--close {
	background: var(--tms-elections-close-soft);
	border-color: var(--tms-elections-close);
	color: var(--tms-elections-close);
}

.tms-elections__chip--won {
	background: var(--tms-color-text, #111);
	border-color: var(--tms-color-text, #111);
	color: var(--tms-color-background, #fff);
}

.tms-elections__bars--home {
	border-radius: 4px;
	height: 8px;
	overflow: visible;
}

.tms-elections__bars--home .tms-elections__seg:first-child {
	border-radius: 4px 0 0 4px;
}

.tms-elections__bars--home .tms-elections__seg:last-of-type {
	border-radius: 0 4px 4px 0;
}

/* The ribbon: one row, scrolling sideways on a phone. */

.tms-elections--ribbon {
	/* Not a section's 2xl padding: the ribbon sits tight under the header, and the lead module's own top
	 * padding is the gap below it. */
	margin: 0;
	padding-block: var(--tms-space-md, 1rem) 0;
}

.tms-elections__ribbon {
	align-items: stretch;
	background: var(--tms-color-surface, #f7f7f7);
	border: 1px solid var(--tms-color-border, #e5e7eb);
	border-radius: 6px;
	border-top: 3px solid var(--tms-color-accent, #b91c1c);
	display: flex;
	overflow-x: auto;
}

.tms-elections__ribbon-head {
	border-right: 1px solid var(--tms-color-border, #e5e7eb);
	flex: 0 0 auto;
	max-width: 15rem;
	padding: 0.75rem 1rem;
}

.tms-elections__ribbon-title {
	font-family: var(--tms-font-headline, inherit);
	font-size: 1.125rem;
	margin: 0.35rem 0 0.1rem;
}

.tms-elections__ribbon-asof {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	margin: 0;
}

.tms-elections__ribbon-items {
	display: flex;
	/* Never narrower than its cards: a shrunk list let the cards spill under "All results" on a phone. */
	flex: 1 0 auto;
	list-style: none;
	margin: 0;
	padding: 0;
}

.tms-elections__ribbon-item {
	border-right: 1px solid var(--tms-color-border, #e5e7eb);
	display: flex;
	flex: 1 0 12.5rem;
	flex-direction: column;
	gap: 0.3rem;
	padding: 0.7rem 1rem;
}

.tms-elections__ribbon-name {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	font-weight: 600;
	text-decoration: none;
}

a.tms-elections__ribbon-name:hover {
	text-decoration: underline;
}

.tms-elections__ribbon-lead {
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
}

.tms-elections__ribbon-item .tms-elections__chip {
	align-self: flex-start;
}

.tms-elections__ribbon-item .tms-elections__bars,
.tms-elections__ribbon-item .tms-elections__turnout-track {
	margin-top: auto;
}

.tms-elections__ribbon-more {
	align-self: center;
	flex: 0 0 auto;
	padding: 0 1rem;
	white-space: nowrap;
}

/* The block after the lead. */

.tms-elections--home {
	border-top: 3px solid var(--tms-color-accent, #b91c1c);
	margin: 1.5rem 0 2rem;
	padding-top: 0.9rem;
}

.tms-elections__home-head {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.75rem;
}

.tms-elections__home-title {
	font-family: var(--tms-font-headline, inherit);
	font-size: 1.5rem;
	margin: 0;
}

.tms-elections__home-asof {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.875rem;
	margin: 0.35rem 0 1rem;
}

.tms-elections__home-close {
	display: grid;
	gap: 1rem;
	grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
	margin-bottom: 1.25rem;
}

.tms-elections__home-close:has(> :only-child) {
	grid-template-columns: minmax(0, 1fr);
}

.tms-elections__home-hero,
.tms-elections__home-also-item,
.tms-elections__home-city,
.tms-elections__home-measure {
	background: var(--tms-color-surface, #f7f7f7);
	border: 1px solid var(--tms-color-border, #e5e7eb);
	border-radius: 6px;
}

.tms-elections__home-hero {
	border-left: 3px solid var(--tms-elections-close);
	padding: 1rem 1.1rem;
}

.tms-elections__home-hero-title {
	font-size: 1.0625rem;
	margin: 0.5rem 0 0.25rem;
}

.tms-elections__home-race-name {
	color: inherit;
}

.tms-elections__home-gap {
	font-size: 0.9375rem;
	margin: 0 0 0.6rem;
}

.tms-elections__home-gap strong {
	font-family: var(--tms-font-headline, inherit);
	font-size: 2.5rem;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	margin-right: 0.35rem;
}

.tms-elections__home-cands {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tms-elections__home-cand {
	font-size: 0.9375rem;
	padding: 0.1rem 0;
}

.tms-elections__home-cand-votes {
	color: var(--tms-color-muted, #6b7280);
	font-variant-numeric: tabular-nums;
}

.tms-elections__home-lead {
	border-top: 0;
	margin-top: 0.75rem;
	padding-top: 0;
}

.tms-elections__home-also {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.tms-elections__home-also-item {
	border-left: 3px solid var(--tms-elections-close);
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	padding: 0.8rem 1rem;
}

.tms-elections__home-also-item .tms-elections__chip {
	align-self: flex-start;
}

.tms-elections__home-also-gap {
	font-family: var(--tms-font-headline, inherit);
	font-size: 1.5rem;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
}

.tms-elections__home-also-line {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.875rem;
}

.tms-elections__home-cities--many {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
}

.tms-elections__home-city {
	padding: 1rem 1.1rem;
}

.tms-elections__home-cities--one .tms-elections__home-city {
	display: grid;
	gap: 0.5rem 1.5rem;
	grid-template-columns: 14rem minmax(0, 1fr);
}

.tms-elections__home-city-name {
	font-family: var(--tms-font-headline, inherit);
	font-size: 1.25rem;
	margin: 0;
}

.tms-elections__home-cities--one .tms-elections__home-city-name {
	font-size: 1.75rem;
	line-height: 1.1;
}

.tms-elections__home-city-tally {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.875rem;
	margin: 0.25rem 0 0.5rem;
}

.tms-elections__home-squares {
	display: flex;
	flex-wrap: wrap;
	gap: 3px;
}

.tms-elections__home-square {
	background: var(--tms-color-muted, #6b7280);
	border-radius: 2px;
	display: block;
	height: 12px;
	width: 12px;
}

.tms-elections__home-square--close {
	background: var(--tms-elections-close);
}

.tms-elections__home-square--won,
.tms-elections__home-square--runoff {
	background: var(--tms-color-text, #111);
}

.tms-elections__home-square--waiting {
	background: var(--tms-color-border, #e5e7eb);
}

.tms-elections__home-rows {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tms-elections__home-row {
	align-items: center;
	border-bottom: 1px solid var(--tms-color-border, #e5e7eb);
	display: grid;
	gap: 0.25rem 0.75rem;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr) 7rem 9.5rem;
	padding: 0.5rem 0;
}

.tms-elections__home-row:last-child {
	border-bottom: 0;
}

.tms-elections__home-row-name {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
}

.tms-elections__home-row-lead {
	font-size: 0.9375rem;
	font-weight: 700;
}

.tms-elections__home-row-margin {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.tms-elections__home-row .tms-elections__chip {
	justify-self: end;
}

.tms-elections__home-cities--many .tms-elections__home-row {
	grid-template-columns: minmax(0, 1fr) auto;
}

.tms-elections__home-cities--many .tms-elections__home-row .tms-elections__bars {
	grid-column: 1 / -1;
}

.tms-elections__home-cities--many .tms-elections__home-row-lead {
	grid-column: 1 / -1;
	grid-row: 2;
}

.tms-elections__home-city-more {
	display: inline-block;
	font-size: 0.875rem;
	font-weight: 600;
	margin-top: 0.6rem;
}

.tms-elections__home-measures {
	display: grid;
	gap: 0.6rem;
	grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.tms-elections__home-measure {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	padding: 0.7rem 0.75rem;
}

.tms-elections__home-measure--close {
	border-color: var(--tms-elections-close);
}

.tms-elections__home-measure-name {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.03em;
}

.tms-elections__home-measure-lead {
	font-family: var(--tms-font-headline, inherit);
	font-size: 1.0625rem;
	font-weight: 700;
}

.tms-elections__home-measure .tms-elections__chip {
	align-self: flex-start;
}

@media (max-width: 800px) {
	.tms-elections__ribbon-head {
		max-width: 11rem;
	}

	.tms-elections__home-close,
	.tms-elections__home-cities--one .tms-elections__home-city {
		grid-template-columns: minmax(0, 1fr);
	}

	.tms-elections__home-row {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.tms-elections__home-row .tms-elections__bars {
		grid-column: 1 / -1;
		grid-row: 3;
	}

	.tms-elections__home-row-lead {
		grid-column: 1 / -1;
		grid-row: 2;
	}
}

/* Narrow rows (a phone, or a regional site's city card): the chip or margin sits beside the race name, not on
 * a line of its own under the bar. */
.tms-elections__home-cities--many .tms-elections__home-row .tms-elections__bars {
	grid-row: 3;
}

.tms-elections__home-cities--many .tms-elections__home-row > :is(.tms-elections__chip, .tms-elections__home-row-margin) {
	grid-column: 2;
	grid-row: 1;
}

@media (max-width: 800px) {
	.tms-elections__home-row > :is(.tms-elections__chip, .tms-elections__home-row-margin) {
		grid-column: 2;
		grid-row: 1;
	}
}

/* ── Propositions by county (ADR-190) ──────────────────────────────────────
 * A measure is Yes = series 1, No = series 2 everywhere; the map shades each by how far past 50% the county went,
 * by opacity over the page so it holds in light and dark. A county without votes is a faint ink wash. Every share is
 * also in words: the <title> per county, the sentence, and the list under the map. */

.tms-elections__map {
	margin: 0;
	max-width: 26rem;
}

.tms-elections__map-svg {
	display: block;
	height: auto;
	width: 100%;
}

.tms-elections__map-county {
	fill: currentColor;
	fill-opacity: 0.08;
	stroke: var(--tms-color-background, #fff);
	stroke-linejoin: round;
	stroke-width: 0.8;
}

.tms-elections__map-county--y3,
.tms-elections__map-key--y3 { fill: var(--tms-elections-s1); fill-opacity: 1; background: var(--tms-elections-s1); }
.tms-elections__map-county--y2 { fill: var(--tms-elections-s1); fill-opacity: 0.62; }
.tms-elections__map-county--y1 { fill: var(--tms-elections-s1); fill-opacity: 0.32; }
.tms-elections__map-county--n1 { fill: var(--tms-elections-s2); fill-opacity: 0.32; }
.tms-elections__map-county--n2 { fill: var(--tms-elections-s2); fill-opacity: 0.62; }
.tms-elections__map-county--n3,
.tms-elections__map-key--n3 { fill: var(--tms-elections-s2); fill-opacity: 1; background: var(--tms-elections-s2); }
.tms-elections__map-county--even { fill: currentColor; fill-opacity: 0.3; }

.tms-elections__map-key--y2 { background: color-mix(in srgb, var(--tms-elections-s1) 62%, transparent); }
.tms-elections__map-key--y1 { background: color-mix(in srgb, var(--tms-elections-s1) 32%, transparent); }
.tms-elections__map-key--n1 { background: color-mix(in srgb, var(--tms-elections-s2) 32%, transparent); }
.tms-elections__map-key--n2 { background: color-mix(in srgb, var(--tms-elections-s2) 62%, transparent); }
.tms-elections__map-key--even { background: color-mix(in srgb, currentColor 30%, transparent); }
.tms-elections__map-key--none { background: color-mix(in srgb, currentColor 8%, transparent); }

.tms-elections__map-outline {
	fill: none;
	pointer-events: none;
	stroke: currentColor;
	stroke-width: 2.5;
}

.tms-elections__map-legend {
	display: flex;
	font-size: 0.75rem;
	font-variant-numeric: tabular-nums;
	gap: 2px;
	margin-top: 0.5rem;
	max-width: 26rem;
}

.tms-elections__map-legend .tms-elections__map-key {
	flex: 1;
	padding: 0.2rem 0;
	text-align: center;
}

.tms-elections__map-legend-end {
	font-weight: 600;
	padding: 0.2rem 0.4rem;
}

.tms-elections__map-line {
	margin-top: 0.75rem;
}

.tms-elections__map-list {
	margin-top: 0.75rem;
	max-width: 26rem;
}

.tms-elections__map-table {
	border-collapse: collapse;
	font-size: 0.875rem;
	width: 100%;
}

.tms-elections__map-table th,
.tms-elections__map-table td {
	border-bottom: 1px solid var(--tms-color-border, #e5e7eb);
	font-weight: 400;
	padding: 0.3rem 0;
	text-align: left;
}

.tms-elections__map-table td {
	text-align: right;
}

.tms-elections__map-table .tms-elections__map-key {
	border-radius: 2px;
	display: inline-block;
	height: 0.625rem;
	margin-right: 0.4rem;
	width: 0.625rem;
}

.tms-elections__map-note {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
	margin-top: 0.75rem;
}

.tms-elections__maps {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
	list-style: none;
	margin: 1rem 0 0;
	padding: 0;
}

.tms-elections__maps-link {
	color: inherit;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	text-decoration: none;
}

.tms-elections__maps-link:hover .tms-elections__maps-name,
.tms-elections__maps-link:focus-visible .tms-elections__maps-name {
	text-decoration: underline;
}

.tms-elections__maps-name {
	font-weight: 600;
	margin-top: 0.25rem;
}

.tms-elections__maps-caption {
	color: var(--tms-color-muted, #6b7280);
	font-size: 0.8125rem;
}
