/**
 * Macedon Directory — public stylesheet (v1.0.23, Google-Maps layout)
 *
 * CHA Brand: Sora; CHA Dark Blue #1d1d1f; CHA Light Blue #a3121a.
 *
 * Layout (matches Google Maps web + app):
 *   Desktop ≥ 769px — left panel (~420px): search + chips + state pills +
 *     radius + results list. Map fills the remaining space.
 *   Mobile ≤ 768px — full-viewport map. Floating top bar with search +
 *     category chips + "More filters". Bottom sheet with results,
 *     draggable (peek/half/full). Slide-in drawer from the right for
 *     state/radius/location.
 *
 * Modifier classes on .md-wrap:
 *   .is-full-width    break out of theme content container
 *   .is-full-takeover position:fixed inset:0 — covers the whole viewport
 */

/* ==================== ROOT WRAP ==================== */
.md-wrap {
	/* CHA brand palette */
	--md-dark-blue:   #a3121a;
	--md-light-blue:  #a3121a;
	--md-yellow:      #f6c21a;
	--md-green:       #92B943;
	--md-grey:        #A7A9AC;
	--md-light-grey:  #D3D4D5;

	/* Surface / text tokens */
	--md-bg:          var(--bg, #ffffff);
	--md-bg-soft:     var(--soft, #f6f3f0);
	--md-surface:     var(--bg, #ffffff);
	--md-ink:         var(--ink, #1d1d1f);
	--md-ink-soft:    var(--muted, #5f5955);
	--md-ink-mute:    #8f8782;
	--md-line:        var(--line, #ebe6e1);
	--md-line-soft:   var(--soft, #f6f3f0);

	--md-focus:       #f6c21a;
	--md-radius:      999px;
	--md-radius-lg:   18px;
	--md-shadow:      0 2px 6px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.08);
	--md-shadow-lg:   0 4px 10px rgba(0,0,0,.08), 0 16px 40px rgba(0,0,0,.12);
	--md-panel-w:     420px;

	font-family: var( --md-font, inherit, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif );
	color: var(--md-ink);
	background: var(--md-bg);
	border: 1px solid var(--md-line);
	border-radius: var(--md-radius-lg);
	overflow: hidden;
	position: relative;
	height: var(--md-height, 720px);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.md-wrap *,
.md-wrap *::before,
.md-wrap *::after { box-sizing: border-box; }

.md-wrap button { font-family: inherit; }

/* Full-width breakout (current-container edge-to-edge) */
.md-wrap.is-full-width {
	position: relative;
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	border-radius: 0;
	border-left: 0;
	border-right: 0;
}

/* Full takeover — overlays the entire viewport, including site header/footer.
   Admin bar (if logged in) is accounted for. */
.md-wrap.is-full-takeover {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	max-height: 100dvh;
	margin: 0;
	border: 0;
	border-radius: 0;
	z-index: 99998;
}
body.admin-bar .md-wrap.is-full-takeover {
	top: 32px;
	height: calc(100vh - 32px);
	height: calc(100dvh - 32px);
	max-height: calc(100dvh - 32px);
}
@media screen and ( max-width: 782px ) {
	body.admin-bar .md-wrap.is-full-takeover {
		top: 46px;
		height: calc(100vh - 46px);
		height: calc(100dvh - 46px);
		max-height: calc(100dvh - 46px);
	}
}

/* Prevent background scrolling when takeover is active (JS toggles this class) */
body.md-body-lock { overflow: hidden; }

/* Back-to-site button (takeover only) — floats over the map area.
   Uses history.back() via JS with home URL fallback. */
.md-back-link {
	position: absolute;
	top: 12px;
	left: calc( var(--md-panel-w) + 12px );
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	background: var(--md-surface);
	border: 1px solid var(--md-line);
	border-radius: 999px;
	color: var(--md-ink);
	font-size: 12px;
	font-weight: 700;
	font-family: inherit;
	text-decoration: none;
	cursor: pointer;
	box-shadow: var(--md-shadow);
	z-index: 600;
	transition: all .15s ease;
}
.md-back-link:hover { border-color: var(--md-light-blue); color: var(--md-light-blue); }
.md-back-link svg { flex-shrink: 0; }

/* ==================== LEFT PANEL (desktop) ==================== */
.md-panel {
	position: absolute;
	inset: 0 auto 0 0;
	width: var(--md-panel-w);
	background: var(--md-surface);
	border-right: 1px solid var(--md-line);
	display: flex;
	flex-direction: column;
	min-height: 0;
	z-index: 500;
}

.md-panel-top {
	padding: 16px 18px 4px;
	border-bottom: 1px solid var(--md-line-soft);
}

/* Search input — ONE single rounded pill with icon on the left inside it.
   Critical: the inner <input> must NEVER paint a border, background, outline,
   shadow, or focus ring. All of those visual states belong to the outer
   .md-search-wrap. The wrap is the visible pill; the input is just text. */
.md-search-wrap {
	position: relative;
	display: flex;
	align-items: center;
	background: var(--md-surface) !important;
	border: 1.5px solid var(--md-line);
	border-radius: 999px;
	padding: 0 16px 0 42px;
	margin-bottom: 12px;
	height: 44px;
	box-shadow: none;
	transition: border-color .15s ease, box-shadow .15s ease;
	overflow: hidden; /* Stop any descendant from poking outside the pill. */
}
.md-search-wrap:focus-within {
	border-color: var(--md-light-blue);
	box-shadow: 0 0 0 3px rgba(163,18,26,.15);
}
.md-search-wrap > svg.md-icon,
.md-search-wrap .md-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	width: 18px;
	height: 18px;
	color: var(--md-ink-soft);
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	box-shadow: none !important;
	pointer-events: none;
	flex-shrink: 0;
}
.md-search-wrap .md-search-input,
.md-search-wrap input.md-search-input,
.md-search-wrap input[type="search"].md-search-input {
	flex: 1;
	min-width: 0;
	width: 100%;
	height: 100%;
	padding: 0 !important;
	margin: 0 !important;
	font-size: 14px;
	line-height: 41px; /* matches wrap height (44) - border (2 * 1.5) ≈ 41 */
	font-family: inherit;
	color: var(--md-ink);
	background: transparent !important;
	background-color: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	-webkit-box-shadow: none !important;
	vertical-align: middle;
}
.md-search-wrap .md-search-input:focus,
.md-search-wrap .md-search-input:focus-visible,
.md-search-wrap .md-search-input:active,
.md-search-wrap .md-search-input:hover {
	outline: 0 !important;
	box-shadow: none !important;
	border: 0 !important;
	background: transparent !important;
	background-color: transparent !important;
}
.md-search-input::placeholder { color: var(--md-ink-mute); opacity: 1; }
.md-search-input::-webkit-search-decoration,
.md-search-input::-webkit-search-cancel-button,
.md-search-input::-webkit-search-results-button,
.md-search-input::-webkit-search-results-decoration { -webkit-appearance: none; display: none; }

.md-search-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid var(--md-line);
	border-top-color: var(--md-light-blue);
	border-radius: 50%;
	opacity: 0;
	flex-shrink: 0;
	transition: opacity .15s ease;
}
.md-search-wrap.is-loading .md-search-spinner {
	opacity: 1;
	animation: md-spin 0.7s linear infinite;
}
@keyframes md-spin { to { transform: rotate(360deg); } }

/* Category chips row */
.md-cat-toggles {
	display: flex;
	gap: 6px;
	margin-bottom: 14px;
	flex-wrap: wrap;
}
.md-cat-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 14px;
	font-size: 12.5px;
	font-weight: 700;
	color: var(--md-ink-soft);
	background: var(--md-surface);
	border: 1.5px solid var(--md-line);
	border-radius: 999px;
	cursor: pointer;
	transition: all .12s ease;
}
.md-cat-btn:hover { border-color: var(--md-light-blue); color: var(--md-ink); }
.md-cat-btn.is-active {
	background: var(--md-dark-blue);
	color: #fff;
	border-color: var(--md-dark-blue);
}
.md-cat-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	display: inline-block;
	flex-shrink: 0;
}

/* Panel filter groups (state pills + actions + radius) */
.md-panel-filters {
	padding: 12px 18px;
	border-bottom: 1px solid var(--md-line-soft);
}
.md-filter-group { margin-bottom: 14px; }
.md-filter-group:last-child { margin-bottom: 0; }
.md-filter-label {
	font-size: 10.5px;
	font-weight: 700;
	color: var(--md-ink-mute);
	text-transform: uppercase;
	letter-spacing: .08em;
	margin-bottom: 8px;
}

.md-state-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}
.md-state-pill {
	padding: 6px 12px;
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: .04em;
	color: var(--md-ink-soft);
	background: transparent;
	border: 1.5px solid var(--md-line);
	border-radius: var(--md-radius);
	cursor: pointer;
	transition: all .12s ease;
	text-transform: uppercase;
}
.md-state-pill:hover {
	background: var(--md-bg-soft);
	color: var(--md-dark-blue);
	border-color: var(--md-light-blue);
}
.md-state-pill.is-active {
	background: var(--md-light-blue);
	color: #fff;
	border-color: var(--md-light-blue);
}

/* Action row */
.md-action-row {
	display: flex;
	gap: 6px;
	align-items: center;
	flex-wrap: wrap;
}
.md-geo-btn,
.md-reset-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	font-size: 12px;
	font-weight: 700;
	color: var(--md-dark-blue);
	background: var(--md-surface);
	border: 1.5px solid var(--md-line);
	border-radius: var(--md-radius);
	cursor: pointer;
	transition: all .15s ease;
}
.md-geo-btn:hover,
.md-reset-btn:hover { border-color: var(--md-light-blue); color: var(--md-light-blue); }
.md-geo-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.md-geo-btn.md-geo-active {
	background: var(--md-light-blue);
	color: #fff;
	border-color: var(--md-light-blue);
}
.md-geo-btn.md-geo-active::after {
	content: '✕';
	margin-left: 4px;
	font-size: 11px;
	opacity: .85;
}
.md-reset-btn {
	color: var(--md-ink-soft);
	background: transparent;
	border-color: transparent;
	margin-left: auto;
}
.md-reset-btn:hover { color: var(--md-light-blue); background: var(--md-bg-soft); border-color: transparent; }
.md-reset-btn:disabled,
.md-reset-btn[disabled] { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* Radius slider */
.md-radius-row {
	margin-top: 10px;
	padding: 10px 12px;
	background: var(--md-bg-soft);
	border-radius: var(--md-radius);
}
.md-radius-row label {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 12px;
	font-weight: 700;
	color: var(--md-ink-soft);
}
.md-radius-slider { flex: 1; accent-color: var(--md-light-blue); }
.md-radius-value { font-weight: 700; color: var(--md-dark-blue); min-width: 3ch; text-align: right; }

/* Results header */
.md-results-header {
	padding: 14px 18px 10px;
	font-size: 11px;
	font-weight: 700;
	color: var(--md-ink-soft);
	text-transform: uppercase;
	letter-spacing: .1em;
	border-bottom: 1px solid var(--md-line-soft);
	flex-shrink: 0;
}

.md-results-list {
	flex: 1;
	overflow-y: auto;
	list-style: none;
	margin: 0;
	padding: 0;
	-webkit-overflow-scrolling: touch;
	min-height: 0;
}

.md-result {
	padding: 16px 18px;
	border-bottom: 1px solid var(--md-line-soft);
	cursor: pointer;
	transition: background-color .12s ease, padding-left .15s ease;
	position: relative;
}
.md-result:hover,
.md-result:focus-visible { background: var(--md-bg-soft); outline: none; }
.md-result.is-active { background: var(--md-bg-soft); padding-left: 22px; }
.md-result.is-active::before {
	content: '';
	position: absolute;
	left: 0; top: 0; bottom: 0;
	width: 4px;
	background: var(--md-light-blue);
}
.md-result h3 { margin: 0 0 4px; font-size: 14.5px; font-weight: 700; color: var(--md-dark-blue); line-height: 1.35; }
.md-result .md-org { font-size: 10px; color: var(--md-light-blue); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 5px; }
.md-result .md-addr { font-size: 12.5px; color: var(--md-ink-soft); line-height: 1.5; }
.md-result .md-meta-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--md-ink-soft); }
.md-pill {
	display: inline-block;
	padding: 3px 9px;
	background: var(--md-bg-soft);
	border: 1px solid var(--md-line);
	border-radius: 999px;
	font-size: 10px;
	font-weight: 700;
	color: var(--md-ink-soft);
}
.md-pill.is-aged-care { background: rgba(246,194,26,.14); border-color: rgba(212,160,0,.35); color: #7a5a00; }
.md-pill.is-hospital  { background: rgba(163,18,26,.07); border-color: rgba(163,18,26,.22); color: #a3121a; }
.md-distance { color: var(--md-light-blue); font-weight: 700; margin-left: auto; font-size: 12px; }

/* Empty state — centred vertically */
.md-empty {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 32px 24px;
	text-align: center;
	color: var(--md-ink-soft);
	font-size: 13.5px;
	line-height: 1.55;
	list-style: none;
}
.md-empty-icon { width: 44px; height: 44px; margin-bottom: 12px; color: var(--md-ink-mute); opacity: .7; }
.md-empty-title { margin: 0 0 6px; font-size: 14.5px; font-weight: 700; color: var(--md-dark-blue); }
.md-empty-msg { margin: 0 0 14px; max-width: 280px; }
.md-empty-actions { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.md-empty-actions .md-empty-btn {
	display: inline-block;
	padding: 9px 16px;
	font-size: 12.5px;
	font-weight: 700;
	color: #fff;
	background: var(--md-light-blue);
	border: 1.5px solid var(--md-light-blue);
	border-radius: var(--md-radius);
	cursor: pointer;
	text-decoration: none;
	transition: all .15s ease;
}
.md-empty-actions .md-empty-btn:hover,
.md-empty-actions .md-empty-btn:focus-visible {
	background: var(--md-dark-blue);
	border-color: var(--md-dark-blue);
}
.md-empty-actions .md-empty-btn.is-secondary {
	color: var(--md-dark-blue);
	background: transparent;
	border-color: var(--md-line);
}
.md-empty-actions .md-empty-btn.is-secondary:hover {
	border-color: var(--md-light-blue);
	color: var(--md-light-blue);
}

/* Skeleton loading rows */
.md-skeleton {
	padding: 16px 18px;
	border-bottom: 1px solid var(--md-line-soft);
	list-style: none;
}
.md-skeleton-line {
	height: 10px;
	border-radius: 3px;
	background: linear-gradient(90deg, var(--md-bg-soft) 0%, var(--line, #ebe6e1) 50%, var(--md-bg-soft) 100%);
	background-size: 200% 100%;
	animation: md-shimmer 1.2s ease-in-out infinite;
	margin-bottom: 8px;
}
.md-skeleton-line.is-short { width: 40%; }
.md-skeleton-line.is-mid   { width: 75%; height: 14px; }
.md-skeleton-line.is-wide  { width: 95%; }
@keyframes md-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* Mobile bottom-sheet drag handle (hidden on desktop) */
.md-sheet-handle {
	display: none;
	width: 100%;
	padding: 10px 18px 6px;
	background: var(--md-surface);
	border: none;
	cursor: grab;
	align-items: center;
	justify-content: center;
	touch-action: none;
}
.md-sheet-grip {
	width: 44px;
	height: 4px;
	border-radius: 2px;
	background: var(--md-line);
	display: inline-block;
}

/* ==================== MAP ==================== */
.md-map-wrap {
	position: absolute;
	inset: 0 0 0 var(--md-panel-w);
	background: #E4E8EF;
	min-height: 0;
}
.md-map { width: 100%; height: 100%; }

/* Leaflet overrides */
.md-wrap .leaflet-container { font-family: inherit; background: #E4E8EF; }
.md-wrap .leaflet-popup-content-wrapper {
	border-radius: var(--md-radius-lg);
	box-shadow: var(--md-shadow-lg);
	padding: 0;
	border: 1px solid var(--md-line);
}
.md-wrap .leaflet-popup-content {
	margin: 0;
	padding: 18px 20px;
	min-width: 240px;
	max-width: 320px;
	line-height: 1.5;
}
.md-wrap .leaflet-popup-tip { box-shadow: var(--md-shadow); }

.md-popup h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: var(--md-dark-blue); line-height: 1.3; }
.md-popup .md-org { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--md-light-blue); font-weight: 700; margin-bottom: 6px; }
.md-popup .md-addr { font-size: 13px; color: var(--md-ink-soft); margin-bottom: 10px; }
.md-popup .md-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.md-popup .md-actions a {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 8px 12px;
	font-size: 12px;
	font-weight: 700;
	border-radius: var(--md-radius);
	text-decoration: none;
	background: var(--md-bg-soft);
	border: 1.5px solid var(--md-line);
	color: var(--md-dark-blue);
	font-family: inherit;
	transition: all .15s ease;
}
.md-popup .md-actions a:hover { background: var(--md-dark-blue); color: #fff; border-color: var(--md-dark-blue); }
.md-popup .md-actions a.is-primary { background: var(--md-light-blue); color: #fff; border-color: var(--md-light-blue); }
.md-popup .md-actions a.is-primary:hover { background: var(--md-dark-blue); border-color: var(--md-dark-blue); }

/* Markers */
.md-marker {
	width: 30px;
	height: 38px;
	background: var(--md-aged-care, var(--md-light-blue));
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	border: 2.5px solid #fff;
	box-shadow: 0 3px 8px rgba(0,0,0,.3);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .15s ease;
}
.md-marker::after { content: ''; width: 10px; height: 10px; background: #fff; border-radius: 50%; }
.md-marker.is-hospital { background: var(--md-hospital, var(--md-dark-blue)); }

/* Soften the marker pop-in. When markers/clusters first appear, fade
   them in over 200ms instead of snapping to full opacity. NOTE: we
   animate ONLY opacity, never transform — Leaflet positions every
   marker via inline transform: translate3d(...) and overriding it
   would teleport markers to the wrong coordinates. */
.md-wrap .leaflet-marker-icon {
	animation: md-marker-in .25s ease-out backwards;
}
@keyframes md-marker-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.md-wrap .marker-cluster { background: transparent; }
.md-wrap .marker-cluster div {
	background: var(--md-dark-blue);
	color: #fff;
	font-weight: 700;
	font-size: 13px;
	font-family: inherit;
	border: 3px solid #fff;
	box-shadow: 0 3px 10px rgba(0,0,0,.3);
}

/* ==================== LEGEND (floating overlay on map) ==================== */
.md-legend {
	position: absolute;
	bottom: 12px;
	right: 12px;
	background: var(--md-surface);
	border: 1px solid var(--md-line);
	border-radius: var(--md-radius-lg);
	box-shadow: var(--md-shadow);
	z-index: 400;
	max-width: 240px;
}
.md-legend-toggle {
	display: none;
	height: 36px;
	padding: 0 14px;
	background: transparent;
	border: 0;
	cursor: pointer;
	color: var(--md-ink);
	font-family: inherit;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .1em;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
}
.md-legend-toggle:hover { color: var(--md-light-blue); }
.md-legend-body {
	display: flex;
	flex-direction: column;
	gap: 7px;
	padding: 10px 14px;
	font-size: 11.5px;
	font-weight: 500;
	color: var(--md-ink-soft);
}
.md-legend-item { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.md-legend-pin {
	width: 10px; height: 13px;
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	border: 1.5px solid #fff;
	box-shadow: 0 1px 2px rgba(0,0,0,.25);
	display: inline-block;
	flex-shrink: 0;
}
.md-legend-cluster {
	width: 18px; height: 18px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,.25);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	flex-shrink: 0;
}
.md-legend-you {
	width: 10px; height: 10px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,.25);
	display: inline-block;
	flex-shrink: 0;
}

/* ==================== FLOATING FILTERS PILL (mobile only) ==================== */
/* Hangs above the bottom sheet's top edge. Opens the filters drawer when
   tapped. Hidden on desktop — the panel already shows filters inline. */
.md-filter-pill {
	display: none;
	position: absolute;
	top: -52px;
	left: 50%;
	transform: translateX(-50%);
	padding: 9px 18px;
	font-size: 12.5px;
	font-weight: 700;
	font-family: inherit;
	color: var(--md-dark-blue);
	background: var(--md-surface);
	border: 1px solid var(--md-line);
	border-radius: 999px;
	box-shadow: 0 4px 14px rgba(0,0,0,.18);
	cursor: pointer;
	align-items: center;
	gap: 7px;
	white-space: nowrap;
	z-index: 555;
	transition: transform .2s ease, opacity .2s ease;
}
.md-filter-pill:hover { color: var(--md-light-blue); border-color: var(--md-light-blue); }
.md-filter-pill svg { flex-shrink: 0; }
.md-filter-pill-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	font-size: 11px;
	font-weight: 700;
	color: #fff;
	background: var(--md-light-blue);
	border-radius: 999px;
	margin-left: -2px;
}
.md-filter-pill-badge[hidden] { display: none; }

/* ==================== MOBILE DRAWER (slide in from right) ==================== */
.md-drawer-backdrop {
	display: none;
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,.45);
	z-index: 700;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s ease;
}
.md-drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

.md-drawer {
	display: none;
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(360px, 88%);
	background: var(--md-surface);
	box-shadow: -8px 0 24px rgba(0,0,0,.2);
	z-index: 800;
	transform: translateX(100%);
	pointer-events: none;
	transition: transform .25s ease;
	flex-direction: column;
}
.md-drawer.is-open { transform: translateX(0); pointer-events: auto; }

/* CRITICAL: the [hidden] attribute must always win over the mobile
   display:flex rule below — otherwise the invisible backdrop sits on top
   of the entire mobile UI at z-index 700 and swallows every tap. */
.md-drawer-backdrop[hidden],
.md-drawer[hidden] {
	display: none !important;
}
.md-drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid var(--md-line);
}
.md-drawer-head h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--md-dark-blue); }
.md-drawer-close {
	width: 36px;
	height: 36px;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	color: var(--md-ink-soft);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.md-drawer-close:hover { background: var(--md-bg-soft); color: var(--md-ink); }
.md-drawer-body {
	flex: 1;
	overflow-y: auto;
	padding: 12px 16px;
	-webkit-overflow-scrolling: touch;
	min-height: 0;
}
.md-drawer-foot { padding: 12px 16px; border-top: 1px solid var(--md-line); }
.md-drawer-apply {
	width: 100%;
	padding: 12px 16px;
	font-size: 13px;
	font-weight: 700;
	color: #fff;
	background: var(--md-light-blue);
	border: 0;
	border-radius: var(--md-radius);
	cursor: pointer;
	transition: background .15s ease;
}
.md-drawer-apply:hover { background: var(--md-dark-blue); }

/* ==================== LEAFLET ZOOM CONTROLS ==================== */
/* JS sets zoomControl:false and manually adds the control at top-right.
   On mobile it's hidden entirely — pinch-to-zoom is standard and the
   map area is at a premium. */
.md-wrap .leaflet-top.leaflet-right .leaflet-control-zoom {
	margin-top: 12px;
	margin-right: 12px;
	border: 1px solid var(--md-line);
	border-radius: var(--md-radius);
	box-shadow: var(--md-shadow);
}
.md-wrap .leaflet-control-zoom a {
	width: 32px;
	height: 32px;
	line-height: 32px;
	font-size: 18px;
	color: var(--md-dark-blue);
	border-radius: 0;
	background: var(--md-surface);
	font-weight: 700;
}
.md-wrap .leaflet-control-zoom a:hover {
	background: var(--md-bg-soft);
	color: var(--md-light-blue);
}

/* ==================== MOBILE LAYOUT (≤768px) ==================== */
@media (max-width: 768px) {

	.md-wrap {
		--md-panel-w: 0;
		height: var(--md-height, 92vh);
		border-radius: 0;
		border-left: 0;
		border-right: 0;
	}
	.md-wrap.is-full-takeover { height: 100dvh; max-height: 100dvh; }

	/* Map fills the entire viewport behind the sheet */
	.md-map-wrap { inset: 0; }

	/* =========== THREE-STATE BOTTOM SHEET =========== */
	/* Default: half the screen (good balance of map + results).
	   is-collapsed: peek — just the handle + search input visible.
	   is-expanded: near-fullscreen — full results list. */
	.md-panel {
		top: auto;
		inset: auto 0 0 0;
		width: 100%;
		height: 50%;
		min-height: 120px;
		max-height: 92%;
		border-right: 0;
		border-top: 1px solid var(--md-line);
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -8px 24px rgba(0,0,0,.12);
		z-index: 550;
		overflow: visible;           /* let filter pill hang above top edge */
		transition: height .25s cubic-bezier(.2,.8,.3,1);
	}

	/* Peek — drag handle + search input only, chips and results tucked away. */
	.md-panel.is-collapsed { height: 88px; }
	.md-panel.is-collapsed .md-cat-toggles,
	.md-panel.is-collapsed .md-results-header,
	.md-panel.is-collapsed .md-results-list { display: none; }
	/* Remove panel-top's bottom border when it's the only visible content */
	.md-panel.is-collapsed > .md-panel-top { border-bottom: 0; }

	/* Expanded — dominate the screen. */
	.md-panel.is-expanded { height: 88%; }

	/* Drag handle at the very top of the sheet */
	.md-sheet-handle {
		display: flex;
		order: -2;                   /* top of panel (above filter pill slot) */
		padding: 8px 14px 2px;
	}

	/* Search + chips visible on mobile (inside the sheet) */
	.md-panel > .md-panel-top {
		display: block;
		order: -1;                   /* immediately below drag handle */
		flex-shrink: 0;
		padding: 6px 16px 10px;
		border-bottom: 1px solid var(--md-line-soft);
	}

	/* Trim the chips a bit on mobile so they don't wrap too often */
	.md-panel > .md-panel-top .md-cat-btn {
		padding: 7px 12px;
		font-size: 11.5px;
	}

	/* Hide deep filters inline — they move to the drawer on mobile */
	.md-panel > .md-panel-filters { display: none; }

	/* Show the floating filter pill (always visible on mobile so users can
	   reach state/location filters from any sheet state) */
	.md-filter-pill { display: inline-flex; }

	/* Drawer + backdrop available */
	.md-drawer-backdrop,
	.md-drawer { display: flex; }

	/* Legend collapses to a "?" toggle, positioned above the bottom sheet */
	.md-legend {
		top: 12px;
		bottom: auto;
		right: 10px;
		max-width: unset;
	}
	.md-legend-toggle { display: inline-flex; }
	.md-legend .md-legend-body { display: none; padding: 8px 12px; }
	.md-legend.is-expanded .md-legend-body { display: flex; }
	.md-legend.is-expanded .md-legend-toggle {
		border-bottom: 1px solid var(--md-line);
		border-radius: var(--md-radius-lg) var(--md-radius-lg) 0 0;
	}

	/* Hide Leaflet zoom controls on mobile — pinch works, and the map area
	   is too small to afford them without crowding the other UI. */
	.md-wrap .leaflet-control-zoom { display: none; }

	/* Back link sits top-left, small */
	.md-back-link {
		top: 10px;
		left: 10px;
		font-size: 11px;
		padding: 6px 10px;
	}

	/* Popup tightens */
	.md-wrap .leaflet-popup-content { min-width: 200px; max-width: 260px; padding: 16px 18px; }

	/* Drawer interior — state pills + actions restyle for touch */
	.md-drawer-body .md-filter-group { margin-bottom: 20px; }
	.md-drawer-body .md-filter-group:last-child { margin-bottom: 0; }
	.md-drawer-body .md-state-pills { gap: 6px; }
	.md-drawer-body .md-state-pill { padding: 8px 14px; font-size: 12px; }
	.md-drawer-body .md-action-row { gap: 8px; }
	.md-drawer-body .md-geo-btn,
	.md-drawer-body .md-reset-btn { padding: 10px 14px; font-size: 13px; }
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
	.md-wrap *, .md-wrap *::before, .md-wrap *::after {
		transition: none !important;
		animation: none !important;
	}
	.md-drawer { transition: none !important; }
}

/* ==================== FOCUS VISIBILITY ==================== */
.md-wrap :focus-visible {
	outline: 2px solid var(--md-light-blue);
	outline-offset: 2px;
	border-radius: var(--md-radius);
}

/* ── Minimap (homepage teaser): map only + CTA to the full map ── */
.md-wrap.is-mini .md-panel{display:none!important}
.md-wrap.is-mini .md-map{width:100%!important;height:100%!important}
.md-wrap.is-mini{border-radius:16px;overflow:hidden;border:1px solid var(--line, #ebe6e1)}
.md-mini-cta{position:absolute;left:50%;bottom:18px;transform:translateX(-50%);z-index:1000;display:inline-flex;align-items:center;gap:8px;background:var(--md-accent,#a3121a);color:#fff;font-weight:600;font-size:14px;font-family:var(--md-font,inherit);padding:11px 22px;border-radius:100px;text-decoration:none;box-shadow:0 12px 28px -10px rgba(10,27,41,.65)}
.md-mini-cta:hover{transform:translateX(-50%) translateY(-2px);color:#fff}
.md-mini-cta svg{transition:transform .15s}
.md-mini-cta:hover svg{transform:translateX(3px)}

/* ── Members-only gate (shown in place of the map to non-members) ── */
.md-gate{display:flex;align-items:center;justify-content:center;min-height:320px;padding:2.5rem 1.5rem;border-radius:16px;background:linear-gradient(160deg,#12283b,#0a1b29);border:1px solid rgba(255,255,255,.10);color:#eaf4f8;font-family:var(--md-font,"Sora",system-ui,sans-serif);text-align:center}
.md-gate-inner{max-width:34ch}
.md-gate svg{color:#8fd3e8;margin-bottom:.6rem}
.md-gate h3{font-size:1.4rem;font-weight:700;margin:0 0 .5rem;color:#fff}
.md-gate p{font-size:.98rem;line-height:1.55;color:#cfe0e9;margin:0 0 1.4rem}
.md-gate-cta{display:flex;gap:.6rem;justify-content:center;flex-wrap:wrap}
.md-gate-btn{display:inline-block;padding:.7rem 1.5rem;border-radius:100px;font-weight:600;font-size:.95rem;text-decoration:none;border:1px solid rgba(255,255,255,.45);color:#fff;transition:transform .15s,background .2s}
.md-gate-btn:hover{transform:translateY(-2px);color:#fff}
.md-gate-btn.is-primary{background:#a3121a;border-color:#a3121a}
.md-gate-btn.is-primary:hover{background:#0E7A9B}

/* ── Member logo + brands in popups ── */
.md-popup .md-logo{max-width:130px;max-height:56px;object-fit:contain;display:block;margin:0 0 10px}
.md-popup .md-brands{font-size:12px;color:var(--muted, #5f5955);margin-top:8px;line-height:1.45}
.md-popup .md-brands::before{content:"Brands: ";font-weight:700;color:#1d1d1f}

/* Groups (third colour), descriptions and social links */
.md-marker.is-group { background: var(--md-group, #1d1d1f); }
.md-pill.is-group { background: var(--soft, #f6f3f0); border-color: var(--line, #ebe6e1); color: var(--ink, #1d1d1f); }
.md-desc { margin: 6px 0 4px; font-size: 13.5px; line-height: 1.45; color: var(--md-ink-soft); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.md-socials { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; font-size: 13px; font-weight: 600; }
.md-socials a { color: var(--md-dark-blue); text-decoration: underline; text-underline-offset: 3px; }
.md-region-group[hidden] { display: none !important; }
.md-region-pills { display: flex; flex-wrap: wrap; gap: 6px; }
/* Many countries: keep the pill rows on one line and let them scroll sideways */
.md-state-pills, .md-region-pills { flex-wrap: wrap !important; overflow: visible; }
.md-state-pills .md-state-pill, .md-region-pills .md-state-pill { flex: none; }

/* Wide pages: the map uses the full site width */
body.md-wide .k-page { max-width: var(--wrap, 1320px); }
body.md-wide .k-page-head, body.md-wide .k-prose > p { max-width: 820px; }
body.md-wide .k-prose { font-size: 17px; }
.md-wrap { max-width: 100%; }

/* Side panel: hide / show on desktop */
.md-collapse { display: none; }
@media (min-width: 769px) {
	.md-panel { transition: transform .35s cubic-bezier(.3,.9,.3,1); }
	.md-map-wrap { transition: left .35s cubic-bezier(.3,.9,.3,1), inset .35s cubic-bezier(.3,.9,.3,1); }
	.md-collapse { position: absolute; z-index: 600; top: 16px; left: calc( var(--md-panel-w) - 1px ); display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 10px; border: 1px solid var(--line, #ebe6e1); border-left: 0; border-radius: 0 999px 999px 0; background: var(--bg, #fff); color: var(--ink, #1d1d1f); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 4px 2px 14px rgba(0,0,0,.08); transition: left .35s cubic-bezier(.3,.9,.3,1), background .2s ease; }
	.md-collapse:hover { background: var(--soft, #f6f3f0); }
	.md-collapse:focus-visible { outline: 3px solid var(--k-sun, #f6c21a); outline-offset: 2px; }
	.md-collapse-label { display: none; }
	.md-collapse-ico { transition: transform .35s ease; }
	.md-wrap.is-collapsed .md-panel { transform: translateX(-100%); }
	.md-wrap.is-collapsed .md-map-wrap { inset: 0 !important; }
	.md-wrap.is-collapsed .md-collapse { left: 14px; border-left: 1px solid var(--line, #ebe6e1); border-radius: 999px; padding: 0 16px 0 12px; }
	.md-wrap.is-collapsed .md-collapse-label { display: inline; }
	.md-wrap.is-collapsed .md-collapse-ico { transform: rotate(180deg); }
	.md-wrap.is-collapsed .md-back-link { left: 130px; }
}
@media (prefers-reduced-motion: reduce) { .md-panel, .md-map-wrap, .md-collapse, .md-collapse-ico { transition: none !important; } }
/* Keep the map's layers below the site's sticky header */
.md-wrap { isolation: isolate; z-index: 0; }
