/**
 * wn-map — functional + interaction styles only.
 *
 * This is NOT brand paint. It ships the minimum needed for the interactive map
 * to *work* (container sizing, tooltip, hover/focus affordance). All values are
 * CSS custom properties so the kadence-wolfesneck child theme owns the actual
 * look (fill colours, tooltip skin, etc.) without touching this file.
 */

.wn-map {
	--wn-map-bg: transparent;
	--wn-map-feature-hover-fill: #1f6f54;        /* neutral functional default */
	--wn-map-feature-hover-opacity: 1;
	--wn-map-feature-focus-outline: 2px solid #1f6f54;
	--wn-map-tooltip-bg: #1d2b27;
	--wn-map-tooltip-color: #fff;
	--wn-map-tooltip-radius: 4px;
	--wn-map-hotspot-hover-fill: rgba( 31, 111, 84, 0.28 );
	--wn-map-dot-hover-stroke: #fff;        /* ring on the dot on hover — reads on all 5 dot colours */
	--wn-map-dot-hover-stroke-width: 2;
	/* Map labels inherit the theme/page font by default (the SVG ships a
	   Skolar font-family that isn't loaded on the site). Child theme can pin a
	   brand token: --wn-map-label-font: var(--global-palette-…) / a font stack. */
	--wn-map-label-font: inherit;

	position: relative;
	width: 100%;
	background: var( --wn-map-bg );
}

/* Map labels derive their font from the theme (overrides the SVG's own
   font-family; selector specificity beats the SVG's .cls-* rules). Font SIZES
   stay as authored in the SVG — only the family is themed. */
.wn-map svg text,
.wn-map svg text tspan {
	font-family: var( --wn-map-label-font, inherit );
}

/* ===================================================================== *
 * Place/area labels — always-visible HTML labels (L.divIcon markers) lifted
 * out of the SVG by tools/extract-labels.py. Brand font, constant screen size
 * at any zoom, white halo for legibility over the varied map. Per-label colour
 * + per-line font-size + the centring/rotation transform are set inline by the
 * engine; this is the static skin. Non-interactive.
 * ===================================================================== */
.wn-map-label {
	pointer-events: none;
}
/* Invisible collision obstacles: one per interactive marker, so secondary names
   declutter around campsites/icons. Must keep a measurable box (size drives the
   collision), so hide with opacity, not display:none. */
.wn-map-obstacle {
	opacity: 0;
	pointer-events: none;
}
.wn-map-label__inner {
	position: absolute;
	left: 0;
	top: 0;
	/* centred on the marker point; rotated labels override transform inline */
	transform: translate( -50%, -50% );
	text-align: center;
	font-family: var( --wn-map-label-font, inherit );
	font-weight: 600; /* default; kinds below override */
	line-height: 1.05;
	white-space: nowrap;
}
.wn-map-label__line {
	display: block;
}

/* ---------------------------------------------------------------------
 * Label kinds — ONE definition each (colour · weight · size). The engine
 * tags every label with `wn-map-label__inner--<kind>` from data/labels.json;
 * nothing about colour or size is set inline anymore. Edit a value here and
 * every label of that kind moves together.
 * ------------------------------------------------------------------- */
.wn-map-label__inner--area          { color: #005670; font-weight: 700; }
.wn-map-label__inner--area .wn-map-label__line       { font-size: 26px; }
.wn-map-label__inner--area .wn-map-label__line--sub  { font-size: 11px; font-weight: 600; }

.wn-map-label__inner--water         { color: #4298b5; font-weight: 400; }
.wn-map-label__inner--water .wn-map-label__line      { font-size: 21px; }

.wn-map-label__inner--building      { color: #131e29; font-weight: 600; }
.wn-map-label__inner--building .wn-map-label__line   { font-size: 16px; }

.wn-map-label__inner--field         { color: #4a773c; font-weight: 600; }
.wn-map-label__inner--field .wn-map-label__line      { font-size: 16px; }

.wn-map-label__inner--cabin         { color: #131e29; font-weight: 600; }
.wn-map-label__inner--cabin .wn-map-label__line      { font-size: 12px; }

.wn-map-label__inner--trail         { color: #4a773c; font-weight: 600; }
.wn-map-label__inner--trail .wn-map-label__line      { font-size: 13px; }

.wn-map-label__inner--road          { color: #131e29; font-weight: 600; }
.wn-map-label__inner--road .wn-map-label__line       { font-size: 13px; }

/* Site numbers are centred on the group origin (= the dot centre) centrally
   here — one rule, not per-element attributes. build-site-groups.py positions
   the number's PARENT group; the number itself carries no coordinates. */
.wn-map svg .wn-site-number {
	text-anchor: middle;
	dominant-baseline: central;
}
/* Legibility gate (engine toggles .wn-hide-numbers on the map when a number would
   render below ~8px): hide via visibility so the sample keeps its measurable box. */
.wn-map.wn-hide-numbers svg .wn-site-number {
	visibility: hidden;
}

/* Retired-but-kept markers: hidden from view AND from hit-testing (display:none
   drops pointer events + tab order), without deleting them from the SVG — flip
   the class off to restore. Set via a wn-hidden class / data-wn-hidden on the group. */
.wn-map svg .wn-hidden,
.wn-map svg [data-wn-hidden="1"] {
	display: none;
}

/* Leaflet marks the whole SVG overlay `.leaflet-interactive`, and its own CSS gives
   that the pointer cursor — so the pointing hand covered the entire map and looked
   identical to hovering a real hotspot. The overlay is the pannable surface, so it
   gets the open hand (and the closed one while dragging); markers keep pointer via
   their own rules below, which win on themselves. */
.wn-map svg.leaflet-interactive {
	cursor: grab;
}
.wn-map.leaflet-dragging svg.leaflet-interactive {
	cursor: grabbing;
}

/* A site/cabin is a <g> group (dot + hotspot + number) with a single transform.
   The engine adds .wn-map__feature + is-hover to the GROUP; hover paints the
   hotspot child so the dot and number stay crisp. */
.wn-map svg [id^="site-"] {
	cursor: pointer;
}
.wn-map svg [id^="site-"]:focus,
.wn-map svg [id^="site-"]:focus-visible {
	outline: none;
}

/* Hover affordance for a normal site is PURE CSS on its dot (already a real
   shape) — a ring, no extra hotspot element. The dot's own fill is the hit area. */
.wn-map svg .wn-site-dot,
.wn-map svg .wn-site-badge {
	transition: stroke-width 0.1s ease;
}
.wn-map svg [id^="site-"].is-hover .wn-site-dot,
.wn-map svg [id^="site-"]:focus .wn-site-dot,
.wn-map svg [id^="site-"].is-hover .wn-site-badge,
.wn-map svg [id^="site-"]:focus .wn-site-badge {
	stroke: var( --wn-map-dot-hover-stroke );
	stroke-width: var( --wn-map-dot-hover-stroke-width );
}

/* Hotspot = transparent hit + hover target, only for groups with NO dot
   (cabins + walk-in sites). A circle at the group origin. */
.wn-map svg .wn-hotspot {
	fill: transparent;
	pointer-events: all;
	transition: fill 0.12s ease;
}
.wn-map svg [id^="site-"].is-hover .wn-hotspot,
.wn-map svg [id^="site-"]:focus .wn-hotspot {
	fill: var( --wn-map-hotspot-hover-fill );
}

/* Facilities + named buildings are now iconized: the marker <g class="wn-facility">
   / ".wn-building" holds a <use> of an external icon, NOT a transparent hotspot —
   so only cursor/focus apply (the old `.is-hover .wn-hotspot` ring rules were dead
   after iconization and were removed). Hover affordance is the tooltip. */
.wn-map svg .wn-facility,
.wn-map svg .wn-building {
	cursor: pointer;
}
.wn-map svg .wn-facility:focus,
.wn-map svg .wn-facility:focus-visible,
.wn-map svg .wn-building:focus,
.wn-map svg .wn-building:focus-visible {
	outline: none;
}

/* Fallback for non-grouped features — a portable map whose selector matches
   shapes directly (not groups): paint the shape itself on hover. */
.wn-map__feature:not( [id^="site-"] ).is-hover {
	fill: var( --wn-map-feature-hover-fill );
	opacity: var( --wn-map-feature-hover-opacity );
	cursor: pointer;
}

/* Flat markers = title-only (no image/text/link): tooltip on hover, but NOT
   clickable — override the pointer cursor from the site/facility/building rules.
   The `.is-hover` variant is needed to outrank the (0,3,0) hover-pointer rule
   `.wn-map__feature:not([id^="site-"]).is-hover` while the marker is hovered. */
.wn-map svg .wn-map__feature--flat,
.wn-map svg .wn-map__feature--flat.is-hover {
	cursor: default;
}

/* Carbon FootPath trail stops (draft overlay from tools/add-carbon-stops.py).
   The whole layer is hidden by default; the [wn-map stops="1"] attribute adds
   .wn-has-stops to the container to reveal it. */
.wn-map svg .wn-carbon-layer {
	display: none;
}
.wn-map.wn-has-stops svg .wn-carbon-layer {
	display: inline;
}

/* Distinct pin so they read as trail stops, not campsites. */
.wn-map svg .wn-carbon-pin {
	fill: var( --wn-map-carbon-pin, #b00020 );
	stroke: #fff;
	stroke-width: 3;
}
.wn-map svg .wn-carbon-num {
	text-anchor: middle;
	dominant-baseline: central;
	fill: #fff;
	font-weight: 700;
	font-size: 16px;
}

/* Hover tooltip — a compact light bubble (kicker + title). The full card lives
   in the click popup. Custom div + edge-aware JS placement (flips near the
   container edges) because Leaflet tooltips bind to layers, not SVG sub-elements. */
.wn-map__tooltip {
	position: absolute;
	z-index: 1000;
	pointer-events: none;
	max-width: 220px;
	padding: 5px 9px;
	background: #fff;
	color: var( --wn-map-card-color, #1d2b27 );
	border-radius: 6px;
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.22 );
}
.wn-map__tip-kicker {
	display: block;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --wn-map-card-kicker, #1f6f54 );
}
.wn-map__tip-title {
	font-size: 13px;
	font-weight: 700;
	line-height: 1.25;
}

.wn-map__tooltip[hidden] {
	display: none;
}

/* Click card — a self-positioning popover (flips above/below the marker, clamps
   to the container edges; positioned by JS in makeCard). */
.wn-map__card-pop {
	position: absolute;
	/* topmost overlay — above the legend (1100), nav (1002), toggle/compass/logo
	   (1001). Otherwise those sit over the centred mobile card (and over its close
	   button → close stops working). */
	z-index: 1200;
	width: var( --wn-map-card-width, 240px );
	/* never wider than the viewport minus a side gap (so it always fits on phones,
	   whatever the configured width). Gap hardcoded to 30px for now. */
	max-width: calc( 100vw - 2 * var( --wn-map-card-gap, 30px ) );
	/* drop-shadow (not box-shadow) so the tail triangle is shadowed too */
	filter: drop-shadow( 0 3px 14px rgba( 0, 0, 0, 0.3 ) );
}
.wn-map__card-pop[hidden] {
	display: none;
}
.wn-map__card-pop-body {
	overflow: hidden auto;
	/* generous safety cap (small screens only) — the image stays FULL; long copy
	   scrolls inside the excerpt below, not the photo. */
	max-height: var( --wn-map-card-maxh, 92vh );
	background: #fff;
	border-radius: 8px;
	overscroll-behavior: contain;
}
.wn-map__card-pop-close {
	position: absolute;
	top: 7px;
	right: 7px;
	z-index: 2;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.5 );
	color: #fff;
	font-size: 19px;
	line-height: 26px;
	text-align: center;
	cursor: pointer;
}
.wn-map__card-pop-close:hover {
	background: rgba( 0, 0, 0, 0.72 );
}
.wn-map__card-pop-tail {
	position: absolute;
	width: 0;
	height: 0;
	border: 7px solid transparent;
}
.wn-is-above .wn-map__card-pop-tail {
	top: 100%;
	border-bottom-width: 0;
	border-top-color: #fff;
}
.wn-is-below .wn-map__card-pop-tail {
	bottom: 100%;
	border-top-width: 0;
	border-bottom-color: #fff;
}
.wn-is-left .wn-map__card-pop-tail {
	left: 100%;
	border-right-width: 0;
	border-left-color: #fff;
}
.wn-is-right .wn-map__card-pop-tail {
	right: 100%;
	border-left-width: 0;
	border-right-color: #fff;
}
.wn-map__card-img {
	display: block;
	width: 100%;
	aspect-ratio: var( --wn-map-card-img-ratio, 16 / 9 );
	/* default contain = show the whole photo (letterbox on the muted backdrop);
	   set --wn-map-card-img-fit:cover to crop-fill instead */
	object-fit: var( --wn-map-card-img-fit, contain );
	background: var( --wn-map-card-img-bg, #eceae3 );
}
/* The fallback graphic is built to fill any ratio — always cover. Text-only
   sites (no real photo) keep it SMALL so it doesn't dominate; real photos are
   uncapped (full height). */
.wn-map__card-img.is-placeholder {
	object-fit: cover;
	max-height: var( --wn-map-card-ph-maxh, 120px );
}
.wn-map__card-body {
	padding: 10px 12px 12px;
}
.wn-map__card-kicker {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --wn-map-card-kicker, #1f6f54 );
}
.wn-map__card-title {
	margin-top: 2px;
	font-size: var( --wn-map-card-title-size, 16px );
	font-weight: 700;
	line-height: 1.2;
	color: var( --wn-map-card-title-color, inherit );
}
.wn-map__card-excerpt {
	margin: 6px 0 0;
	/* limit the COPY height (not the photo) — long descriptions scroll here */
	max-height: var( --wn-map-card-excerpt-maxh, 12em );
	overflow-y: auto;
	overscroll-behavior: contain;
	font-size: var( --wn-map-card-text-size, 13px );
	line-height: 1.4;
	color: var( --wn-map-card-text-color, inherit );
}
/* Global rental note — appended to every rentable object's popup card. */
.wn-map__card-rental {
	margin: 10px 0 0;
	padding: 8px 10px;
	border-radius: 6px;
	background: var( --wn-map-card-rental-bg, rgba( 0, 0, 0, 0.05 ) );
	font-size: var( --wn-map-card-rental-size, 12px );
	line-height: 1.4;
	color: var( --wn-map-card-rental-color, inherit );
}
.wn-map__card-meta {
	margin: 8px 0 0;
	padding: 8px 0 0;
	border-top: 1px solid var( --wn-map-card-rule, rgba( 0, 0, 0, 0.08 ) );
	list-style: none;
	font-size: 12px;
	line-height: 1.35;
	color: var( --wn-map-card-meta, var( --wn-map-card-text-color, #555 ) );
}
.wn-map__card-meta li {
	position: relative;
	margin: 0;
	padding: 2px 0 2px 16px;
}
.wn-map__card-meta li::before {
	content: "";
	position: absolute;
	left: 2px;
	top: 0.6em;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var( --wn-map-card-kicker, #1f6f54 );
}
/* `.wn-map a.…` (specificity 0,2,1) so Leaflet's `.leaflet-container a`
   (0,1,1 — colours every link blue) can't repaint our CTA button. */
.wn-map a.wn-map__card-cta {
	display: inline-block;
	margin-top: 10px;
	padding: 7px 14px;
	border-radius: 4px;
	background: var( --wn-map-card-cta-bg, #1f6f54 );
	color: var( --wn-map-card-cta-color, #fff );
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}

/* Keep Leaflet's own controls above the SVG overlay. */
.wn-map .leaflet-control-container {
	z-index: 800;
}

/* Area shortcut buttons — a stack under the zoom control. Each frames its area. */
.wn-map__groupnav {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-top: 8px;
}
.wn-map__groupbtn {
	display: block;
	position: relative;
	padding: 5px 12px;
	border: 0;
	border-radius: 4px;
	background: var( --wn-map-nav-bg, #fff );
	color: var( --wn-map-nav-color, #1d2b27 );
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.25 );
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	text-align: left;
	cursor: pointer;
}
.wn-map__groupbtn:hover {
	background: var( --wn-map-nav-bg-hover, #1f6f54 );
	color: var( --wn-map-nav-color-hover, #fff );
}
.wn-map__groupbtn--all {
	margin-top: 4px;
	background: var( --wn-map-nav-all-bg, #eceae3 );
	font-weight: 500;
}

/* ===================================================================== *
 * Legend — responsive off-canvas flyout (side drawer wide / bottom sheet
 * narrow). Toggle button sits over the map; the engine wires open/close.
 * ===================================================================== */
.wn-map-frame {
	position: relative;
}
/* Compass rose + brand logo — non-interactive overlays anchored to the bottom
   corners. width/max-width forced (!important) because some host themes apply a
   global `img { width: 100% }` to content images, which otherwise blows these
   SVG <img>s up to full map width (seen on staging). The <img>s also carry
   width/height attributes so they stay sane even if this stylesheet is stale. */
.wn-map__compass,
.wn-map__logo {
	position: absolute;
	bottom: 30px;
	z-index: 1001;
	height: auto !important;
	pointer-events: none;
	transition: opacity 0.25s ease;
}
/* Decorative chrome (logo + compass) fades out once zoomed past the overview, so
   it never sits over campsites/labels; the engine toggles .wn-hide-chrome. */
.wn-map-frame.wn-hide-chrome .wn-map__compass,
.wn-map-frame.wn-hide-chrome .wn-map__logo {
	opacity: 0;
}
.wn-map__compass {
	right: 30px;
	width: 128px !important;
	max-width: 128px !important;
	opacity: 0.9;
	filter: drop-shadow( 0 1px 3px rgba( 0, 0, 0, 0.35 ) );
}
.wn-map__logo {
	left: 30px;
	width: 190px !important;
	max-width: 190px !important;
	filter: drop-shadow( 0 1px 4px rgba( 255, 255, 255, 0.6 ) );
}
/* ---------------------------------------------------------------------
 * Phone layout (≤640px): smaller place labels, no compass/logo, and the
 * area-nav collapses to single initials with the full name on hover.
 * ------------------------------------------------------------------- */
@media ( max-width: 640px ) {
	/* 1 — shrink the prominent place/area/building labels */
	.wn-map-label__inner--area .wn-map-label__line       { font-size: 20px; }
	.wn-map-label__inner--area .wn-map-label__line--sub  { font-size: 10px; }
	.wn-map-label__inner--water .wn-map-label__line      { font-size: 18px; }
	.wn-map-label__inner--field .wn-map-label__line      { font-size: 14px; }
	.wn-map-label__inner--building .wn-map-label__line   { font-size: 14px; }
	.wn-map-label__inner--cabin .wn-map-label__line,
	.wn-map-label__inner--trail .wn-map-label__line,
	.wn-map-label__inner--road .wn-map-label__line       { font-size: 11px; }

	/* 2 — hide the decorative compass + logo (they crowd a phone canvas) */
	.wn-map__compass,
	.wn-map__logo { display: none !important; }

	/* 3 — area-nav buttons → just the initial (compact on a phone); full name on
	   hover/focus. Tapping the initial still frames the area (incl. West Bay). */
	.wn-map__groupbtn {
		padding: 7px 0;
		width: 30px;
		font-size: 0;
		text-align: center;
	}
	.wn-map__groupbtn::before {
		content: attr( data-letter );
		font-size: 14px;
		font-weight: 600;
	}
	.wn-map__groupbtn::after {
		content: attr( title );
		position: absolute;
		left: 100%;
		top: 50%;
		transform: translateY( -50% );
		margin-left: 6px;
		padding: 3px 8px;
		border-radius: 4px;
		background: var( --wn-map-nav-bg, #fff );
		color: var( --wn-map-nav-color, #1d2b27 );
		box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.3 );
		font-size: 12px;
		font-weight: 600;
		white-space: nowrap;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.1s ease;
		z-index: 1002;
	}
	.wn-map__groupbtn:hover::after,
	.wn-map__groupbtn:focus::after { opacity: 1; }

	/* 4 — popup card: forget marker-anchored positioning; centre it in the map with
	   a 30px gutter all round (overrides the JS inline left/top + drops the tail). */
	.wn-map__card-pop {
		left: 30px !important;
		right: 30px !important;
		top: 50% !important;
		bottom: auto !important;
		transform: translateY( -50% ) !important;
		width: auto !important;
		max-width: none !important;
		max-height: calc( 100% - 60px ) !important;
		display: flex !important;
		flex-direction: column !important;
	}
	/* keep the closed card hidden — the display:flex above is !important, so the
	   base `[hidden]{display:none}` (no !important) would lose without this. */
	.wn-map__card-pop[hidden] {
		display: none !important;
	}
	.wn-map__card-pop-body {
		max-height: none !important;
		flex: 0 1 auto !important; /* size to content; shrink+scroll only past the cap */
		min-height: 0 !important;
	}
	.wn-map__card-pop-tail {
		display: none !important;
	}
}
.wn-legend-toggle {
	position: absolute;
	right: 10px;
	top: 10px;
	z-index: 1001;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 13px;
	border: 0;
	border-radius: 6px;
	background: var( --wn-legend-toggle-bg, #fff );
	color: var( --wn-legend-toggle-color, #1d2b27 );
	box-shadow: 0 1px 5px rgba( 0, 0, 0, 0.3 );
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
.wn-legend-toggle::before {
	content: "";
	width: 14px;
	height: 14px;
	border-radius: 3px;
	background:
		linear-gradient( var( --wn-legend-toggle-color, #1d2b27 ) 0 0 ) 0 2px / 4px 2px no-repeat,
		linear-gradient( var( --wn-legend-toggle-color, #1d2b27 ) 0 0 ) 0 6px / 4px 2px no-repeat,
		linear-gradient( var( --wn-legend-toggle-color, #1d2b27 ) 0 0 ) 0 10px / 4px 2px no-repeat,
		linear-gradient( currentColor 0 0 ) 7px 2px / 7px 2px no-repeat,
		linear-gradient( currentColor 0 0 ) 7px 6px / 7px 2px no-repeat,
		linear-gradient( currentColor 0 0 ) 7px 10px / 7px 2px no-repeat;
	opacity: 0.85;
}
.wn-legend-toggle:hover {
	background: var( --wn-legend-toggle-bg-hover, #1f6f54 );
	color: var( --wn-legend-toggle-color-hover, #fff );
}

/* No backdrop — the legend never covers/dims the map and the map stays fully
   interactive. The container ignores pointer events; only the panel catches them. */
.wn-legend {
	position: absolute;
	inset: 0;
	z-index: 1100;
	pointer-events: none;
	/* The hidden panel parks off-canvas via translateX/Y(100%); clip it to the
	   map so it can't push page-level horizontal (or vertical) scroll. Themes that
	   set overflow-x:hidden on <body> mask this — staging doesn't, so clip here. */
	overflow: hidden;
}
.wn-legend__panel {
	position: absolute;
	pointer-events: auto;
	background: var( --wn-legend-bg, #fff );
	color: var( --wn-legend-color, #1d2b27 );
	box-shadow: 0 0 24px rgba( 0, 0, 0, 0.3 );
	overflow-y: auto;
	overscroll-behavior: contain;
	transition: transform 0.28s cubic-bezier( 0.2, 0.7, 0.2, 1 );
	-webkit-overflow-scrolling: touch;
}

/* wide → side drawer from the right */
.wn-legend__panel {
	top: 0;
	right: 0;
	width: var( --wn-legend-width, 300px );
	max-width: 86%;
	height: 100%;
	transform: translateX( 100% );
}
.wn-legend.is-open .wn-legend__panel {
	transform: translateX( 0 );
}
/* narrow → bottom sheet */
@media ( max-width: 640px ) {
	.wn-legend__panel {
		top: auto;
		bottom: 0;
		right: 0;
		left: 0;
		width: 100%;
		max-width: none;
		height: auto;
		max-height: 78%;
		border-radius: 14px 14px 0 0;
		transform: translateY( 100% );
	}
	.wn-legend.is-open .wn-legend__panel {
		transform: translateY( 0 );
	}
}

.wn-legend__head {
	position: sticky;
	top: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: inherit;
	border-bottom: 1px solid var( --wn-legend-rule, rgba( 0, 0, 0, 0.08 ) );
}
.wn-legend__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.wn-legend__close {
	border: 0;
	background: none;
	font-size: 26px;
	line-height: 1;
	color: inherit;
	cursor: pointer;
	opacity: 0.6;
}
.wn-legend__close:hover {
	opacity: 1;
}
.wn-legend__groups {
	padding: 12px 16px 20px;
	column-gap: 24px;
}
.wn-legend__group {
	break-inside: avoid;
	margin-bottom: 14px;
}
.wn-legend__gtitle {
	margin: 6px 0 7px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var( --wn-legend-gtitle, #1f6f54 );
}
.wn-legend__list {
	margin: 0;
	padding: 0;
	list-style: none;
}
.wn-legend__item {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 3px 0;
	font-size: 13.5px;
	line-height: 1.3;
}
.wn-legend__swatch {
	flex: 0 0 22px;
	width: 22px;
	height: 22px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.wn-legend__icon {
	width: 22px;
	height: 22px;
	display: block;
}
.wn-legend__dot {
	width: 15px;
	height: 15px;
	border-radius: 50%;
}
.wn-legend__line {
	width: 22px;
	height: 0;
	border-top: 3px solid var( --wn-line-color, #000 );
}
.wn-legend__line--dashed {
	border-top-style: dashed;
}
/* two columns on a wider side drawer */
@media ( min-width: 641px ) {
	.wn-legend__panel {
		--wn-legend-width: 340px;
	}
}

/* ===================================================================== *
 * DEBUG group overlay — add ?wngroups to the URL to outline every marker
 * by its data-wn-group. Colour key: West=red · Middle=blue · East=green ·
 * Quiet Cove=orange · Facilities=purple · Other/rest=black. Temporary aid.
 * ===================================================================== */
.wn-debug-groups svg [data-wn-group="west-bay"]   { --wn-dbg: #e6194b; }
.wn-debug-groups svg [data-wn-group="middle-bay"] { --wn-dbg: #4363d8; }
.wn-debug-groups svg [data-wn-group="east-bay"]   { --wn-dbg: #3cb44b; }
.wn-debug-groups svg [data-wn-group="quiet-cove"] { --wn-dbg: #f58231; }
.wn-debug-groups svg [data-wn-group="facilities"] { --wn-dbg: #911eb4; }
.wn-debug-groups svg [data-wn-group="rest"]       { --wn-dbg: #111111; }
.wn-debug-groups svg [data-wn-group] .wn-hotspot {
	stroke: var( --wn-dbg, #e6194b );
	stroke-width: 3px;
	fill: var( --wn-dbg, #e6194b );
	fill-opacity: 0.3;
}
.wn-debug-groups svg [data-wn-group] .wn-site-dot,
.wn-debug-groups svg [data-wn-group] polygon {
	stroke: var( --wn-dbg, #e6194b );
	stroke-width: 4px;
}
/* iconized facility / building markers have no hotspot — outline their icon BOX
 * (cls-77 brown box / cls-25 red office box; the cls-1 white symbol is left clean) */
.wn-debug-groups svg [data-wn-group] .cls-77,
.wn-debug-groups svg [data-wn-group] .cls-25 {
	stroke: var( --wn-dbg, #e6194b );
	stroke-width: 4px;
}
/* de-duplicated icons render via <use> of a <symbol>; descendant selectors can't
 * reach into the use shadow, but stroke set on the <use> is inherited by the
 * referenced shapes (they declare fill only), so this outlines the whole icon. */
.wn-debug-groups svg [data-wn-group] use {
	stroke: var( --wn-dbg, #e6194b );
	stroke-width: 2px;
}

/* ===================================================================== *
 * Legend → map highlight — hovering a legend type dims the map and pops
 * every marker of that data-wn-type (wired in wireLegend).
 * ===================================================================== */
.wn-legend__item[data-wn-type] {
	cursor: pointer;
	border-radius: 4px;
}
.wn-legend__item[data-wn-type]:hover {
	background: var( --wn-legend-item-hover, rgba( 0, 0, 0, 0.05 ) );
}
/* Single effect: every marker fades back; only the matched type stays. Targets
   [data-wn-GROUP] (not -type) so it ALSO fades the typeless named buildings
   (Farm Store / Café have no data-wn-type) — they dim like everything else. */
.wn-legend-hl .wn-map svg [data-wn-group] {
	opacity: 0.12;
	transition: opacity 0.12s ease;
}
.wn-legend-hl .wn-map svg [data-wn-group].wn-type-hl {
	opacity: 1;
}
/* Trails & Roads rows join the same effect. Roads/trails carry data-wn-type but
   NO data-wn-group (markers have a group), so target that — covers <path> AND
   <polyline>/<polygon>, anywhere (the old `#Trails_v2_ path` missed polylines). */
.wn-legend-hl .wn-map svg [data-wn-type]:not([data-wn-group]) {
	opacity: 0.12;
	transition: opacity 0.12s ease;
}
.wn-legend-hl .wn-map svg [data-wn-type]:not([data-wn-group]).wn-type-hl {
	opacity: 1;
}
/* Building/facility NAME labels are decluttered divIcon labels (.wn-map-label
   --marker), sharing the collision layer with the geographic names so nothing
   overlaps. They carry their icon's wn-type--/wn-group-- tag so the legend
   highlight can dim/pop the NAME together with its icon. Only these tagged
   labels join the highlight — the geographic names (West Bay, Little River…)
   stay untouched. */
.wn-legend-hl .wn-map-label--marker {
	opacity: 0.12;
	transition: opacity 0.12s ease;
}
.wn-legend-hl .wn-map-label--marker.wn-type-hl {
	opacity: 1;
}

/* Marker-name PLACER: each name is anchored to one EDGE of its icon (JS picks the
   side, class wn-ml-<dir>) and offset a constant PIXEL gap to that side, so the gap
   never changes and the name never jumps as you zoom. Visibility declutter fades
   names in/out (wn-ml-off) — positions stay fixed. */
.wn-map-label--marker { transition: opacity 0.18s ease; }
.wn-map-label--marker.wn-ml-off { opacity: 0 !important; }

/* The engine prunes Key rows whose type has no visible marker by setting `hidden`.
   The UA rule `[hidden] { display: none }` is only (0,0,0), so the item's own
   `display` (flex) beat it and pruned rows kept showing — e.g. Wedding Field, which
   is retired on the map. Restate it at the item's own specificity. */
.wn-legend__item[hidden] { display: none; }
/* Optional subtle white glow (block/shortcode "Label glow", OFF by default) so
   building/cabin names stay legible over busy map art. */
.wn-has-label-glow .wn-map-label--marker .wn-map-label__inner {
	text-shadow: 0 0 2px #fff, 0 0 4px rgba( 255, 255, 255, 0.55 );
}

/* Google-Maps-style scroll hint: a full-map dim overlay with a centred message,
   flashed when a plain wheel / one-finger gesture would otherwise be trapped. */
.wn-map-gesture-hint {
	position: absolute;
	inset: 0;
	z-index: 1200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba( 0, 0, 0, 0.5 );
	color: #fff;
	font-size: 18px;
	font-weight: 600;
	text-align: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}
.wn-map-gesture-hint.is-visible { opacity: 1; }
.wn-ml-above .wn-map-label__inner { transform: translate( -50%, calc( -100% - 10px ) ); }
.wn-ml-below .wn-map-label__inner { transform: translate( -50%, 10px ); }
.wn-ml-right .wn-map-label__inner { transform: translate( 10px, -50% ); }
.wn-ml-left  .wn-map-label__inner { transform: translate( calc( -100% - 10px ), -50% ); }

/* Card loading state — shown only when a marker's data takes longer than the
   engine's threshold, so a slow click is never silent. */
.wn-map__card-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 96px;
	padding: 24px;
}
.wn-map__spinner {
	width: 26px;
	height: 26px;
	border: 3px solid var( --wn-map-card-spinner-track, rgba( 0, 0, 0, .12 ) );
	border-top-color: var( --wn-map-card-spinner, currentColor );
	border-radius: 50%;
	animation: wn-map-spin .7s linear infinite;
}
@keyframes wn-map-spin {
	to { transform: rotate( 360deg ); }
}
@media ( prefers-reduced-motion: reduce ) {
	.wn-map__spinner { animation-duration: 2.4s; }
}
