/**
 * Stroud Coverage Map - front end.
 *
 * Everything is scoped to .scm-root so the map can never leak styles into
 * the theme. Colors arrive as CSS custom properties set inline by PHP.
 */

.scm-root {
	--scm-ink: #1d1d1d;
	--scm-muted: #5f6a64;
	--scm-line: #e0e3e0;
	--scm-panel: #f6f7f6;
	--scm-font: inherit;
	--scm-heading-wt: 800;

	font-family: var(--scm-font);
	color: var(--scm-ink);
	container-type: inline-size;
}

.scm-root *,
.scm-root *::before,
.scm-root *::after {
	box-sizing: border-box;
}

/* ---------- intro ---------- */
.scm-heading {
	font-family: inherit;
	font-weight: var(--scm-heading-wt);
	letter-spacing: -0.015em;
	line-height: 1.12;
	margin: 0 0 12px;
}

.scm-root > .scm-intro {
	color: var(--scm-muted);
	max-width: 60ch;
	margin: 0 0 30px;
}

/* ---------- filter buttons ---------- */
.scm-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-bottom: 22px;
}

.scm-filter-label {
	font-size: 0.8rem;
	color: var(--scm-muted);
}

.scm-chip {
	font: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.2;
	background: transparent;
	color: var(--scm-ink);
	border: 1px solid var(--scm-line);
	border-radius: 999px;
	padding: 8px 16px;
	cursor: pointer;
	transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.scm-chip:hover {
	border-color: var(--scm-t2);
}

.scm-chip[aria-pressed="true"] {
	background: var(--scm-t2);
	border-color: var(--scm-t2);
	color: #fff;
}

.scm-chip:focus-visible {
	outline: 2px solid var(--scm-cta);
	outline-offset: 2px;
}

/* ---------- layout ---------- */
.scm-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
	gap: 34px;
	align-items: start;
}

/* ---------- map ---------- */
.scm-mapbox {
	position: relative;
}

.scm-usmap {
	width: 100%;
	height: auto;
	display: block;
	overflow: visible;
}

.scm-state {
	fill: var(--scm-t0);
	stroke: #fff;
	stroke-width: 1;
	stroke-linejoin: round;
	transition: fill 0.15s ease, transform 0.15s ease;
	transform-box: fill-box;
	transform-origin: center;
}

.scm-state.scm-l1 {
	fill: var(--scm-t1);
}

.scm-state.scm-l2 {
	fill: var(--scm-t2);
}

.scm-hatchbg {
	fill: var(--scm-t2);
}

.scm-state.scm-covered {
	cursor: pointer;
}

.scm-state.scm-dim {
	fill: var(--scm-t0);
	opacity: 0.85;
}

.scm-state.scm-covered:hover {
	transform: translateY(-3px) scale(1.012);
}

.scm-state:focus {
	outline: none;
}

.scm-state.scm-covered:focus-visible,
.scm-state.scm-selected {
	stroke: var(--scm-cta);
	stroke-width: 2.5;
}

.scm-slabel {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-anchor: middle;
	pointer-events: none;
}

.scm-slabel.scm-on2 {
	fill: #fff;
}

.scm-slabel.scm-on1 {
	fill: var(--scm-lbl1);
}

.scm-slabel.scm-off {
	opacity: 0;
}

.scm-nolabels .scm-labels {
	display: none;
}

/* ---------- tooltip ---------- */
.scm-tip {
	position: absolute;
	z-index: 5;
	pointer-events: none;
	transform: translate(-50%, -118%);
	background: #1d1d1d;
	color: #fff;
	padding: 8px 11px;
	border-radius: 6px;
	font-size: 0.8rem;
	line-height: 1.35;
	white-space: nowrap;
}

.scm-tip[hidden] {
	display: none;
}

.scm-tip b {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	margin-bottom: 2px;
}

/* ---------- legend ---------- */
.scm-legend {
	display: flex;
	flex-direction: column;
	gap: 9px;
	margin-top: 20px;
	font-size: 0.85rem;
	color: var(--scm-muted);
}

.scm-legend span {
	display: flex;
	align-items: center;
	gap: 9px;
}

.scm-sw {
	flex: none;
	width: 26px;
	height: 15px;
	border-radius: 3px;
	border: 1px solid rgba(0, 0, 0, 0.12);
}

.scm-sw2 {
	background: var(--scm-t2);
}

.scm-sw1 {
	background: var(--scm-t1);
}

.scm-sw0 {
	background: var(--scm-t0);
}

.scm-texture .scm-sw2 {
	background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.32) 0 2.6px, transparent 2.6px 8px);
}

/* ---------- detail panel ---------- */
.scm-panel {
	background: var(--scm-panel);
	border: 1px solid var(--scm-line);
	border-radius: 10px;
	padding: 24px;
}

.scm-eyebrow {
	font-size: 0.78rem;
	color: var(--scm-muted);
	margin-bottom: 6px;
}

.scm-panel-title {
	font-family: inherit;
	font-weight: var(--scm-heading-wt);
	font-size: 1.5rem;
	line-height: 1.12;
	letter-spacing: -0.015em;
	margin: 0 0 14px;
}

.scm-note {
	color: var(--scm-muted);
	font-size: 0.92rem;
	margin: 0;
}

.scm-count {
	font-size: 0.85rem;
	color: var(--scm-muted);
	margin: 14px 0 0;
}

.scm-plist {
	list-style: none;
	margin: 0 0 20px;
	padding: 0;
	border-top: 1px solid var(--scm-line);
}

.scm-plist li {
	border-bottom: 1px solid var(--scm-line);
	margin: 0;
}

.scm-plist a {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding: 11px 2px;
	color: var(--scm-ink);
	text-decoration: none;
	font-size: 0.95rem;
}

.scm-plist a:hover {
	color: var(--scm-t2);
}

.scm-plist .scm-go {
	font-size: 0.8rem;
	color: var(--scm-muted);
	opacity: 0.5;
	transition: opacity 0.15s, transform 0.15s;
}

.scm-plist a:hover .scm-go {
	opacity: 1;
	transform: translateX(2px);
}

.scm-cta {
	display: inline-block;
	background: var(--scm-cta);
	color: #fff;
	text-decoration: none;
	font-size: 0.92rem;
	font-weight: 700;
	line-height: 1.2;
	padding: 13px 24px;
	border-radius: 999px;
}

.scm-cta:hover,
.scm-cta:focus {
	color: #fff;
	filter: brightness(0.88);
}

.scm-cta.scm-ghost {
	background: transparent;
	color: var(--scm-ink);
	border: 1px solid var(--scm-line);
}

.scm-cta.scm-ghost:hover {
	color: var(--scm-ink);
	background: #fff;
	border-color: var(--scm-ink);
	filter: none;
}

.scm-cta-wrap {
	margin: 20px 0 0;
}

.scm-picker {
	display: none;
	width: 100%;
	font: inherit;
	padding: 11px 12px;
	margin-bottom: 18px;
	border: 1px solid var(--scm-line);
	border-radius: 6px;
	background: #fff;
	color: var(--scm-ink);
}

/* ---------- narrow screens ---------- */
@media (max-width: 820px) {
	.scm-layout {
		grid-template-columns: 1fr;
		gap: 24px;
	}

	.scm-picker {
		display: block;
	}
}

@container (max-width: 820px) {
	.scm-layout {
		grid-template-columns: 1fr;
		gap: 24px;
	}

	.scm-picker {
		display: block;
	}
}

@media (hover: none) {
	.scm-tip {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.scm-root * {
		transition: none !important;
	}
}
