/*
 * TEP 2026: [tep_region_map] interactive US / Canada maps (classes/class-tep-maps.php, js/tep-maps.js).
 * Figma: Home 2625:11793 (clicked Missouri card), 3253:5151. Light-blue states, the clicked one dark
 * blue, and a white card listing red tags above it.
 */

.tep-regionmap {
	display: grid;
	grid-template-columns: 682fr 455fr; /* Figma panel widths */
	gap: 50px;
	align-items: stretch;
}

.tep-regionmap__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 20px 12px 40px;
	border: 1px solid color-mix(in srgb, var(--ds-color-secondary-light) 60%, transparent);
	border-radius: var(--ds-radius-sm);
	background: var(--ds-color-surface);
}

.tep-regionmap__label {
	margin: 0;
	font-family: var(--ds-font-heading);
	font-size: var(--ds-text-base);
	font-weight: var(--ds-weight-semibold);
	letter-spacing: var(--ds-letter-caps);
	line-height: 1.2;
	text-transform: uppercase;
	color: var(--ds-color-primary-dark); /* red text under 24px (A11Y-10) */
}

.tep-regionmap__canvas {
	position: relative;
	margin-top: auto;
	margin-bottom: auto;
}

.tep-regionmap__svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.tep-regionmap__region {
	fill: var(--ds-color-secondary-light);
	stroke: color-mix(in srgb, var(--ds-color-secondary) 60%, var(--ds-color-black));
	stroke-width: 0.5;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
	cursor: pointer;
}

.tep-regionmap__region.is-active {
	fill: var(--ds-color-secondary);
}

/* Keyboard / screen-reader access: a picker that only appears when it has focus */
.tep-regionmap__picker {
	position: absolute;
	top: 14px;
	right: 12px;
	z-index: 3;
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: var(--ds-font-body);
	font-size: var(--ds-text-sm);
	color: var(--ds-color-text);
}

.tep-regionmap__picker:not(:focus-within) {
	clip-path: inset(50%);
	width: 1px;
	height: 1px;
	overflow: hidden;
	white-space: nowrap;
}

.tep-regionmap__picker select {
	padding: 6px 10px;
	border: 1px solid var(--ds-color-secondary-light);
	border-radius: var(--ds-radius-sm);
	background: var(--ds-color-surface);
	font: inherit;
}

/* Card (Figma: Missouri example) */
.tep-regionmap__card {
	position: absolute;
	z-index: 2;
	width: 295px;
	max-width: calc(100% - 16px);
	padding: 15px;
	border: 1px solid color-mix(in srgb, var(--ds-color-secondary-light) 45%, transparent);
	border-radius: var(--ds-radius-sm);
	background: var(--ds-color-surface);
	box-shadow: var(--ds-shadow-card);
}

.tep-regionmap__card[hidden] {
	display: none;
}

.tep-regionmap__name {
	margin: 0 0 10px;
	padding-bottom: 10px;
	border-bottom: 1px solid color-mix(in srgb, var(--ds-color-secondary-light) 45%, transparent);
	font-family: var(--ds-font-heading);
	font-size: var(--ds-text-sm);
	font-weight: var(--ds-weight-semibold);
	line-height: 1.3;
	color: var(--ds-color-black);
}

.tep-regionmap__heading {
	margin: 0 0 8px;
	font-family: var(--ds-font-body);
	font-size: 11px;
	letter-spacing: 0.1em;
	line-height: 1.2;
	text-transform: uppercase;
	color: var(--ds-color-text);
}

.tep-regionmap__text {
	margin: 0 0 12px;
	font-family: var(--ds-font-body);
	font-size: var(--ds-text-sm);
	line-height: 1.4;
	color: var(--ds-color-text);
}

.tep-regionmap__tags {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

body .tep-regionmap__tag,
body .tep-regionmap__tag:hover,
body .tep-regionmap__tag:focus-visible {
	display: inline-block;
	padding: 5px 10px;
	border-radius: var(--ds-radius-sm);
	background: var(--ds-color-primary);
	font-family: var(--ds-font-body);
	font-size: 13px;
	line-height: 1.3;
	color: var(--ds-color-surface);
	text-decoration: none;
}

/* Figma panels are 592px tall with the map low in the box, leaving room for the card above a state */
@media (min-width: 993px) {
	.tep-regionmap__panel {
		min-height: 592px;
	}
}

@media (max-width: 768px) {
	.tep-regionmap {
		grid-template-columns: 1fr;
		gap: 25px;
	}

	.tep-regionmap__card {
		width: 260px;
	}
}
