/* US State Map */
.usm {
	--usm-active: #c21f30;
	--usm-hover: #e23a48;
	--usm-land: #f0f0f0;
	--usm-border: #cdcdcd;
	--usm-tilt: 30deg;
	--usm-pull: 0%;
	--usm-persp: 1900px;
	--usm-relief: .8;       /* mountain shading strength on the grey map */
	--usm-relief-red: .85;  /* ...and on red states */
	--usm-font: "Helvetica Neue", Helvetica, Arial, sans-serif;
	width: 100%;
	margin-inline: auto;
	container-type: inline-size;
}

.usm-stage {
	/* The tilt shortens the map visually; pull the surrounding content in to match. */
	margin-top: calc(var(--usm-pull) * 1.3);
	margin-bottom: calc(var(--usm-pull) * .7);
	perspective: var(--usm-persp);
	perspective-origin: 50% 40%;
	/* The tilted SVG box spills past the sides (empty area only, see fit() in map.js); keep it from widening the page. */
	overflow-x: clip;
}

.usm-svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
	transform: scale(var(--usm-fit, 1)) rotateX(var(--usm-tilt));
	transform-origin: 50% 50%;
}

.usm-ground,
.usm-slab,
.usm-relief,
.usm-land,
.usm-borders,
.usm-labels-muted {
	pointer-events: none;
}

.usm-land {
	fill: var(--usm-land);
}

/* Mid-grey relief image: lightens and darkens the colour below it. */
.usm-relief {
	mix-blend-mode: hard-light;
	opacity: var(--usm-relief);
	pointer-events: none;
}

.usm-relief--state {
	opacity: var(--usm-relief-red);
}

.usm-borders {
	stroke: var(--usm-border);
	vector-effect: non-scaling-stroke;
	stroke-width: .75px;
}

/* ---- Red states ------------------------------------------------------ */

.usm-state {
	outline: none;
}

.usm-face {
	fill: var(--usm-active);
	stroke: rgba(0, 0, 0, .12);
	stroke-width: .5;
	transition: fill .2s ease;
}

.usm-side use {
	fill: var(--usm-active);
	filter: brightness(.62);
	transform: translateY(calc(var(--r) * 1px));
	transition: transform .22s cubic-bezier(.3, .7, .3, 1);
}

.usm-top {
	transition: transform .22s cubic-bezier(.3, .7, .3, 1);
}

.usm-shadow {
	opacity: 0;
	transition: opacity .22s ease, transform .22s ease;
}

.usm-label {
	fill: #fff;
	font-family: var(--usm-font);
	font-weight: 500;
	letter-spacing: .01em;
	text-anchor: middle;
	dominant-baseline: central;
	pointer-events: none;
	user-select: none;
}

.usm-label--muted {
	fill: #9a9a9a;
}

.usm-label--out {
	fill: var(--usm-active);
	text-anchor: start;
	font-weight: 700;
}

.usm-callout line {
	stroke: var(--usm-active);
	stroke-width: .8;
}

.usm-callout.is-muted line {
	stroke: #9a9a9a;
}

.usm-callout.is-muted .usm-label--out {
	fill: #8c8c8c;
}

/* ---- Linked: hover + keyboard focus ---------------------------------- */

.usm-state.is-linked {
	cursor: pointer;
}

.usm-state.is-linked:hover .usm-top,
.usm-state.is-linked:focus-visible .usm-top {
	transform: translateY(-10px);
}

.usm-state.is-linked:hover .usm-side use,
.usm-state.is-linked:focus-visible .usm-side use {
	transform: translateY(calc(var(--h) * 1px));
}

.usm-state.is-linked:hover .usm-face,
.usm-state.is-linked:focus-visible .usm-face {
	fill: var(--usm-hover);
}

.usm-state.is-linked:hover .usm-side use,
.usm-state.is-linked:focus-visible .usm-side use {
	fill: var(--usm-hover);
}

.usm-state.is-linked:hover .usm-shadow,
.usm-state.is-linked:focus-visible .usm-shadow {
	opacity: .45;
}

.usm-state.is-linked:focus-visible .usm-face {
	stroke: #fff;
	stroke-width: 1.6;
}

/* ---- Small screens -------------------------------------------------- */

.usm-list {
	display: none;
	list-style: none;
	margin: 1.5em 0 0;
	padding: 0;
	grid-template-columns: repeat(auto-fill, minmax(8em, 1fr));
	gap: .5em 1em;
}

.usm-list a {
	display: block;
	padding: .55em .75em;
	border-left: 3px solid var(--usm-active);
	color: inherit;
	text-decoration: none;
	font-weight: 600;
}

.usm-list a:hover,
.usm-list a:focus-visible {
	color: var(--usm-active);
}

@container (max-width: 600px) {
	.usm-label,
	.usm-callout {
		display: none;
	}

	.usm-list {
		display: grid;
	}
}

@media (prefers-reduced-motion: reduce) {
	.usm-top,
	.usm-side use,
	.usm-shadow,
	.usm-face {
		transition: none;
	}
}
