/* RENA interactive map (shortcode [rena_map]) – front-end styles. */
.rena-map {
	--rena-model-a: #1d4ed8;
	--rena-model-b: #b45309;
	--rena-model-c: #047857;
	--rena-mixed: #374151;
	--rena-accent: var(--nv-secondary-accent, #f2a93b);
	--rena-ink: #111827;
	--rena-line: #d1d5db;
	--rena-map-height: 600px;
	/* Vertical margins only – horizontal ones stay with the theme (`.alignfull`). */
	margin-top: 0;
	margin-bottom: 1.5rem;
	font-size: 0.95rem;
	line-height: 1.45;
	color: var(--rena-ink);
}

.rena-map *,
.rena-map *::before,
.rena-map *::after {
	box-sizing: border-box;
}

.rena-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/*
 * Sections. part="map" is a normal content-width block whose map canvas breaks out to the full
 * viewport width; part="filters" is a full-width band (.alignfull, handled by the theme) whose
 * panel is kept to the content width. No extra wrappers, no theme overrides.
 */
.rena-map__heading {
	text-align: center;
	margin: 0 0 1.75rem;
}

.rena-map--map {
	margin-top: 2.5rem;
	margin-bottom: 0;
}

.rena-map--map .rena-map__canvas {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	border-left: 0;
	border-right: 0;
	border-radius: 0;
}

.rena-map--filters {
	background: #f3f4f6;
	padding: 3rem 15px;
	/* Only the vertical margins: the horizontal ones come from the theme's `.alignfull`. */
	margin-top: 2.5rem;
	margin-bottom: 0;
}

.rena-map--filters .rena-map__panel {
	max-width: calc(var(--container, 1170px) - 30px);
	margin-left: auto;
	margin-right: auto;
}

/* Head row above the map: status + jump link on the left, search on the right */
.rena-map__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 0.75rem 2rem;
	margin-bottom: 1.1rem;
}

.rena-map__head-main {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.rena-map__status {
	margin: 0;
	font-weight: 700;
	font-size: 1.15rem;
}

.rena-map__jump {
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: underline;
}

.rena-map__search {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	flex: 0 1 340px;
	min-width: 220px;
}

.rena-map__search label {
	font-weight: 600;
	font-size: 0.9rem;
}

.rena-map__search input {
	font: inherit;
	padding: 0.5rem 0.7rem;
	border: 1px solid #6b7280;
	border-radius: 6px;
	width: 100%;
	background: #fff;
}

.rena-map__search input:focus-visible {
	outline: 3px solid var(--rena-model-a);
	outline-offset: 1px;
}

/* Legend strip */
.rena-map__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.5rem;
	list-style: none;
	margin: 0 0 1.1rem;
	padding: 0;
	font-size: 0.9rem;
}

.rena-map__legend li {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.rena-legend__swatch,
.rena-popup__model,
.rena-chip__swatch {
	display: inline-block;
	min-width: 1.6em;
	padding: 0 0.3em;
	border-radius: 4px;
	color: #fff;
	font-size: 0.8em;
	font-weight: 700;
	text-align: center;
	line-height: 1.6;
}

.rena-legend__swatch.rena-marker--a,
.rena-popup__model.rena-marker--a { background: var(--rena-model-a); }
.rena-legend__swatch.rena-marker--b,
.rena-popup__model.rena-marker--b { background: var(--rena-model-b); }
.rena-legend__swatch.rena-marker--c,
.rena-popup__model.rena-marker--c { background: var(--rena-model-c); }
.rena-legend__swatch.rena-marker--mixed { background: var(--rena-mixed); }

/* Map canvas */
.rena-map__canvas {
	position: relative;
	height: var(--rena-map-height);
	min-height: 260px;
	width: 100%;
	border: 1px solid var(--rena-line);
	border-radius: 10px;
	background: #e9eef2;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
	z-index: 0;
}

.rena-map__canvas:focus-within {
	outline: 3px solid var(--rena-model-a);
	outline-offset: 2px;
}

.rena-map__noscript {
	padding: 1rem;
}

.rena-map__exports {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1rem;
	margin: 1rem 0 0;
	font-size: 0.9rem;
}

.rena-map--all .rena-map__exports {
	margin-bottom: 1.75rem;
}

/* Markers */
.rena-marker {
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
	color: #fff;
	font: 700 12px/1 Arial, Helvetica, sans-serif;
	background: var(--rena-mixed);
}

.rena-marker--a { background: var(--rena-model-a); }
.rena-marker--b { background: var(--rena-model-b); }
.rena-marker--c { background: var(--rena-model-c); }
.rena-marker--mixed { background: var(--rena-mixed); }

.rena-marker--mixed span {
	font-size: 10px;
	letter-spacing: 0.5px;
}

.leaflet-marker-icon:focus-visible,
.leaflet-container a:focus-visible,
.leaflet-control a:focus-visible {
	outline: 3px solid #111;
	outline-offset: 2px;
}

.rena-cluster {
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba(55, 65, 81, 0.92);
	border: 3px solid rgba(255, 255, 255, 0.85);
	color: #fff;
	font: 700 13px/1 Arial, Helvetica, sans-serif;
}

/* Popup */
.rena-popup__title {
	margin: 0 0 0.4rem;
	font-size: 1.05rem;
}

.rena-popup__table {
	border-collapse: collapse;
	font-size: 0.85rem;
	margin: 0;
}

.rena-popup__table th,
.rena-popup__table td {
	padding: 0.15rem 0.5rem 0.15rem 0;
	text-align: left;
	border-bottom: 1px solid #e5e7eb;
	vertical-align: top;
}

.rena-popup__num {
	text-align: right;
}

/* Filter panel + list (part="filters" or inside part="all") */
.rena-map__panel {
	display: grid;
	gap: 1.5rem;
}

.rena-map__form,
.rena-map__listing {
	background: #fff;
	border: 1px solid var(--rena-line);
	border-radius: 12px;
	padding: 1.4rem 1.6rem 1.6rem;
}

.rena-map__panel-title {
	margin: 0;
	font-size: 1.15rem;
	line-height: 1.3;
}

.rena-map__form-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1.5rem;
	margin-bottom: 1rem;
	padding-bottom: 0.8rem;
	border-bottom: 1px solid #e5e7eb;
}

.rena-map__status--panel {
	font-size: 0.95rem;
	font-weight: 600;
	color: #374151;
}

.rena-map__form-head .rena-map__reset {
	margin-left: auto;
}

.rena-map__badge {
	display: inline-block;
	min-width: 1.5em;
	padding: 0 0.45em;
	margin-left: 0.4em;
	border-radius: 999px;
	background: var(--rena-model-a);
	color: #fff;
	font-size: 0.75em;
	line-height: 1.6;
	text-align: center;
	vertical-align: middle;
}

.rena-map__reset {
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	padding: 0.45rem 1rem;
	border: 1px solid var(--rena-ink);
	border-radius: 6px;
	background: #fff;
	color: var(--rena-ink);
	cursor: pointer;
}

.rena-map__reset:hover {
	background: #f3f4f6;
}

.rena-map__reset:focus-visible {
	outline: 3px solid var(--rena-model-a);
	outline-offset: 2px;
}

.rena-map__form-grid {
	display: grid;
	grid-template-columns: minmax(180px, 220px) minmax(260px, 1fr);
	gap: 1.1rem 2rem;
}

.rena-map__fieldset {
	border: 0;
	padding: 0;
	margin: 0;
	min-width: 0;
}

.rena-map__fieldset--minority {
	grid-column: 1 / -1;
}

.rena-map__fieldset legend {
	display: block;
	font-weight: 700;
	font-size: 0.9rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #4b5563;
	padding: 0;
	margin: 0 0 0.5rem;
}

.rena-map__fieldset select {
	font: inherit;
	width: 100%;
	padding: 0.45rem 0.6rem;
	border: 1px solid #6b7280;
	border-radius: 6px;
	background: #fff;
}

.rena-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.rena-chip {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.4rem 0.85rem;
	border: 1px solid #9ca3af;
	border-radius: 999px;
	background: #fff;
	color: var(--rena-ink);
	font-size: 0.9rem;
	line-height: 1.25;
	cursor: pointer;
	user-select: none;
	transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.rena-chip input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

.rena-chip:hover {
	border-color: var(--rena-ink);
}

.rena-chip:focus-within {
	outline: 3px solid var(--rena-model-a);
	outline-offset: 2px;
}

.rena-chip.is-checked {
	background: var(--rena-ink);
	border-color: var(--rena-ink);
	color: #fff;
}

.rena-chip--model-a .rena-chip__swatch { background: var(--rena-model-a); }
.rena-chip--model-b .rena-chip__swatch { background: var(--rena-model-b); }
.rena-chip--model-c .rena-chip__swatch { background: var(--rena-model-c); }

.rena-chip--model-a.is-checked { background: var(--rena-model-a); border-color: var(--rena-model-a); }
.rena-chip--model-b.is-checked { background: var(--rena-model-b); border-color: var(--rena-model-b); }
.rena-chip--model-c.is-checked { background: var(--rena-model-c); border-color: var(--rena-model-c); }

.rena-chip.is-checked .rena-chip__swatch {
	background: #fff;
	color: var(--rena-ink);
}

.rena-chip.is-checked::before {
	content: "✓";
	font-weight: 700;
}

.rena-map__hint {
	margin: 0.3rem 0 0.8rem;
	font-size: 0.9rem;
	color: #4b5563;
}

.rena-map__items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 0.15rem 1.5rem;
	margin: 0;
	padding: 0 0.25rem 0 0;
	list-style: none;
	max-height: 440px;
	overflow: auto;
	scrollbar-gutter: stable;
}

.rena-map__items li {
	margin: 0;
	padding: 0.4rem 0.2rem;
	border-bottom: 1px solid #eef0f2;
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
}

.rena-map__item {
	font: inherit;
	font-weight: 700;
	text-align: left;
	background: none;
	border: 0;
	padding: 0;
	color: var(--rena-model-a);
	text-decoration: underline;
	cursor: pointer;
}

.rena-map__item:hover {
	color: var(--rena-ink);
}

.rena-map__item:focus-visible {
	outline: 3px solid var(--rena-model-a);
	outline-offset: 2px;
}

.rena-map__item-meta {
	font-size: 0.85rem;
	color: #4b5563;
}

/* Motion */
@media (prefers-reduced-motion: reduce) {
	.leaflet-zoom-anim .leaflet-zoom-animated,
	.leaflet-fade-anim .leaflet-tile,
	.leaflet-fade-anim .leaflet-popup,
	.marker-cluster,
	.leaflet-cluster-anim .leaflet-marker-icon,
	.leaflet-cluster-anim .leaflet-marker-shadow,
	.rena-chip {
		transition: none !important;
	}
}

@media (max-width: 720px) {
	.rena-map--filters {
		padding: 2rem 15px;
	}
	.rena-map__form,
	.rena-map__listing {
		padding: 1.1rem 1rem 1.2rem;
	}
	.rena-map__form-grid {
		grid-template-columns: 1fr;
	}
	.rena-map__form-head .rena-map__reset {
		margin-left: 0;
	}
	.rena-map__canvas {
		height: clamp(320px, 65vh, var(--rena-map-height));
	}
	.rena-map__search {
		flex-basis: 100%;
	}
	.rena-map__items {
		max-height: 360px;
	}
}
