.hdm-widget {
	--hdm-navy: #0F1E2E;
	--hdm-navy-light: #16283C;
	--hdm-gold: #C6A23A;
	--hdm-cream: #FFFDF7;
	--hdm-ink: #1F2430;
	--hdm-muted: #7C8798;
	--hdm-map-height: 560px;

	display: grid;
	grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
	gap: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	color: var(--hdm-ink);
	box-sizing: border-box;
}
.hdm-widget *, .hdm-widget *::before, .hdm-widget *::after {
	box-sizing: border-box;
}

.hdm-empty-state {
	padding: 24px;
	border: 1px dashed #c9c2ac;
	border-radius: 10px;
	background: #FBF8F0;
	color: #6b6350;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Map pane */
.hdm-map-pane {
	position: relative;
	height: var(--hdm-map-height);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 6px 24px rgba(15, 30, 46, 0.18);
	border: 1px solid #d9dde3;
	/* Leaflet's internal panes/controls use z-index values up to 1000.
	   Without a contained stacking context here, those can render above
	   fixed/sticky page headers elsewhere on the site. isolate keeps all
	   of Leaflet's stacking scoped to this box, whatever its z-index is. */
	isolation: isolate;
	z-index: 0;
}
.hdm-map-el {
	position: absolute;
	inset: 0;
}

/* Sidebar */
.hdm-sidebar-pane {
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
}

.hdm-sidebar-heading {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--hdm-gold);
	padding: 0 2px;
}

.hdm-district-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.hdm-district-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border-radius: 10px;
	background: var(--hdm-navy);
	cursor: pointer;
	transition: background 0.15s ease, transform 0.1s ease;
	border: 2px solid transparent;
}
.hdm-district-item:hover {
	background: var(--hdm-navy-light);
}
.hdm-district-item.is-active {
	background: var(--district-color, var(--hdm-gold));
	border-color: rgba(0,0,0,0.15);
}
.hdm-district-item.is-active .hdm-district-name,
.hdm-district-item.is-active .hdm-district-area {
	color: #fff;
}

.hdm-district-num {
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--district-color, rgba(255,255,255,0.14));
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 13px;
}
.hdm-district-item.is-active .hdm-district-num {
	/* Same district color, darkened with a translucent black overlay so the
	   badge still reads as distinct from the now-solid-colored pill behind it. */
	background: linear-gradient(rgba(0,0,0,0.32), rgba(0,0,0,0.32)), var(--district-color, var(--hdm-gold));
}

.hdm-district-text {
	display: flex;
	flex-direction: column;
	line-height: 1.25;
	min-width: 0;
}
.hdm-district-name {
	color: #fff;
	font-weight: 700;
	font-size: 14.5px;
}
.hdm-district-area {
	color: #b7c0cc;
	font-size: 12.5px;
}

/* Info card */
.hdm-info-card {
	background: var(--hdm-cream);
	border: 1px solid var(--card-color, var(--hdm-gold));
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 4px 16px rgba(15, 30, 46, 0.1);
}

.hdm-info-eyebrow {
	background: var(--card-color, var(--hdm-gold));
	color: #1a1400;
	font-weight: 700;
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 7px 16px;
}

.hdm-info-title {
	padding: 14px 16px 10px 16px;
	font-size: 19px;
	font-weight: 800;
	color: var(--hdm-navy);
	border-bottom: 1px solid #ece6d6;
}

.hdm-info-body {
	padding: 12px 16px 16px 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.hdm-info-row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 14px;
}

.hdm-row-label {
	color: var(--hdm-muted);
	font-size: 11.5px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 2px;
}
.hdm-row-value {
	color: var(--hdm-ink);
	font-weight: 600;
}
.hdm-row-sub {
	color: var(--hdm-muted);
	font-size: 12.5px;
	margin-top: 1px;
}

.hdm-divider {
	border: none;
	border-top: 1px solid #ece6d6;
	margin: 2px 0;
}

.hdm-icon {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin-top: 1px;
	display: inline-block;
	background-color: var(--card-color, var(--hdm-gold));
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
}
.hdm-icon-shield {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2 4 5v6c0 5 3.4 9 8 11 4.6-2 8-6 8-11V5l-8-3Z'/></svg>");
	mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2 4 5v6c0 5 3.4 9 8 11 4.6-2 8-6 8-11V5l-8-3Z'/></svg>");
}
.hdm-icon-phone {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6.6 10.8c1.4 2.7 3.7 5 6.4 6.4l2.2-2.2c.3-.3.7-.4 1-.2 1.1.4 2.3.6 3.5.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1C10.6 21 3 13.4 3 4c0-.6.4-1 1-1h3.9c.6 0 1 .4 1 1 0 1.2.2 2.4.6 3.5.1.4 0 .8-.3 1L6.6 10.8Z'/></svg>");
	mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6.6 10.8c1.4 2.7 3.7 5 6.4 6.4l2.2-2.2c.3-.3.7-.4 1-.2 1.1.4 2.3.6 3.5.6.6 0 1 .4 1 1V20c0 .6-.4 1-1 1C10.6 21 3 13.4 3 4c0-.6.4-1 1-1h3.9c.6 0 1 .4 1 1 0 1.2.2 2.4.6 3.5.1.4 0 .8-.3 1L6.6 10.8Z'/></svg>");
}
.hdm-icon-mail {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M3 5h18v14H3zm0 0 9 7 9-7' fill='none' stroke='black' stroke-width='2'/></svg>");
	mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M3 5h18v14H3zm0 0 9 7 9-7' fill='none' stroke='black' stroke-width='2'/></svg>");
}
.hdm-icon-clock {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='9' fill='none' stroke='black' stroke-width='2'/><path d='M12 7v5l4 2' fill='none' stroke='black' stroke-width='2'/></svg>");
	mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='9' fill='none' stroke='black' stroke-width='2'/><path d='M12 7v5l4 2' fill='none' stroke='black' stroke-width='2'/></svg>");
}
.hdm-icon-pin {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 22s7-7.5 7-13a7 7 0 1 0-14 0c0 5.5 7 13 7 13Z'/><circle cx='12' cy='9' r='2.5' fill='white'/></svg>");
	mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 22s7-7.5 7-13a7 7 0 1 0-14 0c0 5.5 7 13 7 13Z'/><circle cx='12' cy='9' r='2.5' fill='white'/></svg>");
}

.hdm-icon-flag {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M5 3v18M5 4h13l-3 4 3 4H5' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/></svg>");
	mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M5 3v18M5 4h13l-3 4 3 4H5' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/></svg>");
}

.hdm-meeting-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 2px;
}
.hdm-meeting-entry {
	font-weight: 600;
	color: var(--hdm-ink);
	font-size: 13.5px;
	line-height: 1.35;
}
.hdm-meeting-entry .hdm-meeting-time {
	font-weight: 400;
	color: var(--hdm-muted);
}
.hdm-meeting-empty {
	color: var(--hdm-muted);
	font-size: 13px;
	font-style: italic;
}

.hdm-watch-sentence {
	font-weight: 600;
	color: var(--hdm-ink);
}
.hdm-watch-sentence a {
	font-weight: 600;
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 0.15s ease;
}
.hdm-watch-sentence a:hover {
	border-bottom-color: currentColor;
}
.hdm-icon-broadcast {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 16a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z'/><path d='M8.5 11.5a5 5 0 0 1 7 0M5.6 8.6a9 9 0 0 1 12.8 0' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/></svg>");
	mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 16a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z'/><path d='M8.5 11.5a5 5 0 0 1 7 0M5.6 8.6a9 9 0 0 1 12.8 0' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/></svg>");
}

.hdm-val-location-name {
	font-weight: 700;
	color: var(--hdm-navy);
}

/* Leaflet popup tweaks to match the widget's tone */
.hdm-widget .leaflet-popup-content-wrapper {
	border-radius: 8px;
}
.hdm-widget .leaflet-container {
	font-family: inherit;
}

@media (max-width: 860px) {
	.hdm-widget {
		grid-template-columns: 1fr;
	}
	.hdm-map-pane {
		height: min(var(--hdm-map-height), 420px);
	}

	/* Tablet: condense the tall vertical list into a grid so the info card
	   below is visible (or close to it) without much scrolling. */
	.hdm-district-list {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 8px;
	}
	.hdm-district-item {
		flex-direction: column;
		justify-content: center;
		text-align: center;
		padding: 12px 8px;
		gap: 6px;
	}
	.hdm-district-text {
		align-items: center;
	}
}

/* Accordion panel: closed by default everywhere. Only opened/shown on
   phones — on tablet/desktop it's simply never used (info card stays in
   its normal spot below the list instead). */
.hdm-accordion-panel {
	display: none;
}
.hdm-district-chevron {
	display: none;
}

@media (max-width: 600px) {
	/* Phones: drop back to a single column so each row can expand into an
	   accordion showing that district's info right underneath it, instead
	   of relying on a separate info card further down the page. */
	.hdm-district-list {
		display: flex;
		flex-direction: column;
		gap: 8px;
	}
	.hdm-district-wrap {
		display: flex;
		flex-direction: column;
	}
	.hdm-district-item {
		flex-direction: row;
		text-align: left;
		padding: 12px 14px;
		gap: 12px;
	}
	.hdm-district-text {
		align-items: flex-start;
	}
	.hdm-district-chevron {
		display: block;
		width: 12px;
		height: 12px;
		margin-left: auto;
		flex: 0 0 auto;
		background-color: #fff;
		transition: transform 0.2s ease;
		-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
		mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
	}
	.hdm-district-item.is-active .hdm-district-chevron {
		transform: rotate(180deg);
	}
	.hdm-accordion-panel {
		display: block;
		max-height: 0;
		overflow: hidden;
		margin-top: 0;
		transition: max-height 0.32s ease, margin-top 0.32s ease;
	}
	.hdm-accordion-panel.is-open {
		margin-top: 8px;
	}
	.hdm-accordion-panel .hdm-info-card {
		margin: 0;
	}
	/* Hides the info card only when it's sitting in its default spot below
	   the list (nothing selected yet) — once selectDistrict() moves it
	   inside a panel, this selector no longer matches, since its parent is
	   then .hdm-accordion-panel instead of .hdm-sidebar-pane. */
	.hdm-sidebar-pane > .hdm-info-card {
		display: none;
	}
}
