/**
 * Raadhuis OpenStreetMap kaart
 *
 * Kleuren via custom properties, zodat een thema ze kan overschrijven.
 */
.rh-osm-kaart {
	--rh-osm-primair: #004295;
	--rh-osm-actief: #c5301d;
	--rh-osm-licht: #dae0ec;
	--rh-osm-tekst: #1f1f1f;
	--rh-osm-subtiel: #4a4a4a;
	--rh-osm-hoogte: 520px;

	display: grid;
	gap: 20px;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas:
		"filter"
		"kaart"
		"lijst";
	margin: 30px 0 50px;
	color: var(--rh-osm-tekst);
}

@media (min-width: 64em) {
	/* Vaste hoogte, zodat de lijst naast de kaart scrolt in plaats van mee te groeien. */
	.rh-osm-kaart--overzicht {
		height: var(--rh-osm-hoogte);
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		grid-template-rows: auto minmax(0, 1fr);
		grid-template-areas:
			"filter kaart"
			"lijst kaart";
		column-gap: 2%;
	}
}

/* Filter */
.rh-osm-kaart__filter {
	grid-area: filter;
}

.rh-osm-kaart__filter label {
	display: block;
    margin-top: 0;
	margin-bottom: 6px;
	font-weight: bold;
	color: var(--rh-osm-primair);
}

/* Huisstijl: blauw vlak met witte chevron (zoals het oude regiofilter), i.p.v. het Foundation-driehoekje. */
.rh-osm-kaart__filter select {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	max-width: 100%;
	height: auto;
	margin: 0;
	padding: 15px 60px 15px 20px;
	border: 0;
	border-radius: 0;
	background: var(--rh-osm-primair) url("../chevron-down.svg") no-repeat right 20px center / 18px 11px;
	color: #fff;
	font-size: 18px;
	font-weight: bold;
	line-height: 1.4;
	text-transform: none;
	cursor: pointer;
	transition: background-color 0.3s ease;
}

.rh-osm-kaart__filter select:hover {
	background-color: #00336f;
}

/* Opties in de uitklaplijst leesbaar houden (sommige browsers nemen de selectkleuren over). */
.rh-osm-kaart__filter option {
	background: #fff;
	color: var(--rh-osm-tekst);
	font-weight: normal;
}

/* Kaart */
.rh-osm-kaart__kaart {
	grid-area: kaart;
	position: relative;
	width: 100%;
	height: var(--rh-osm-hoogte);
	background: var(--rh-osm-licht);
}

.rh-osm-kaart--enkel .rh-osm-kaart__kaart {
	--rh-osm-hoogte: 400px;
}

@media (max-width: 39.9375em) {
	.rh-osm-kaart__kaart {
		--rh-osm-hoogte: 360px;
	}
}

.rh-osm-kaart__kaart.is-mislukt::after {
	content: "De kaart kon niet geladen worden.";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	text-align: center;
}

/* Lijst */
.rh-osm-kaart__lijst {
	grid-area: lijst;
	position: relative; /* referentie voor offsetTop bij scrollen */
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
}

@media (max-width: 63.9375em) {
	.rh-osm-kaart__lijst {
		max-height: 420px;
	}
}

.rh-osm-kaart__regio + .rh-osm-kaart__regio {
	margin-top: 25px;
}

.rh-osm-kaart__regionaam {
	margin: 0 0 10px;
	font-size: 22px;
	font-weight: bold;
	text-transform: uppercase;
	color: var(--rh-osm-primair);
}

.rh-osm-kaart__items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.rh-osm-kaart__item {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 15px;
	margin: 0;
	padding: 0 15px 0 0;
	border-left: 4px solid transparent;
	transition: background-color 0.3s ease, border-color 0.3s ease;
}

.rh-osm-kaart__item::before {
	content: none !important;
}

.rh-osm-kaart__item + .rh-osm-kaart__item {
	border-top: 1px solid var(--rh-osm-licht);
}

.rh-osm-kaart__item:hover,
.rh-osm-kaart__item.is-actief {
	background-color: var(--rh-osm-licht);
}

.rh-osm-kaart__item.is-actief {
	border-left-color: var(--rh-osm-primair);
}

.rh-osm-kaart__knop {
	flex: 1 1 220px;
	display: block;
	margin: 0;
	padding: 15px 0 15px 41px;
	border: 0;
	background: transparent url("../pin.svg") no-repeat 11px 15px / 16px 25px;
	text-align: left;
	font: inherit;
	color: inherit;
	cursor: pointer;
}

.rh-osm-kaart__naam {
	display: block;
	font-size: 16px;
	font-weight: bold;
	color: var(--rh-osm-primair);
}

.rh-osm-kaart__adres {
	display: block;
	margin-top: 2px;
	font-size: 15px;
	line-height: 1.4;
	color: var(--rh-osm-subtiel);
}

.rh-osm-kaart__link {
	padding: 4px 0 15px 41px;
	font-size: 15px;
	color: var(--rh-osm-primair);
	text-decoration: underline;
}

@media (min-width: 40em) {
	.rh-osm-kaart__link {
		padding: 15px 0;
	}
}

.rh-osm-kaart__link:hover {
	text-decoration: none;
}

/* Focus duidelijk zichtbaar (WCAG 2.4.7) */
.rh-osm-kaart__knop:focus-visible,
.rh-osm-kaart__link:focus-visible,
.rh-osm-kaart__filter select:focus-visible,
.rh-osm-kaart .maplibregl-ctrl button:focus-visible,
.rh-osm-popup__link:focus-visible {
	outline: 3px solid var(--rh-osm-primair);
	outline-offset: 2px;
	box-shadow: 0 0 0 5px #fff;
}

/* Pins */
.rh-osm-marker {
	display: block;
	width: 24px;
	height: 38px;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--rh-osm-primair, #004295);
	cursor: pointer;
}

.rh-osm-marker[hidden] {
	display: none;
}

.rh-osm-marker svg {
	display: block;
	transform-origin: 50% 100%;
	transition: transform 0.2s ease;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.rh-osm-marker:hover svg,
.rh-osm-marker.is-actief svg {
	transform: scale(1.15);
}

.rh-osm-marker.is-actief {
	color: var(--rh-osm-actief, #c5301d);
	z-index: 1;
}

/* Pop-up */
.rh-osm-kaart .maplibregl-popup-content {
	padding: 0 0 15px;
	border-radius: 0;
	font: inherit;
	overflow: hidden;
}

.rh-osm-kaart .maplibregl-popup-close-button {
	width: 32px;
	height: 32px;
	font-size: 22px;
	line-height: 1;
	background: #fff;
	color: var(--rh-osm-primair);
}

/* Specifiek genoeg om de algemene p/address-stijlen van het thema te overschrijven. */
.rh-osm-kaart .rh-osm-popup__foto {
	display: block;
	width: 100%;
	height: 140px;
	margin: 0 0 12px;
	object-fit: cover;
}

.rh-osm-kaart .rh-osm-popup__naam,
.rh-osm-kaart .rh-osm-popup__adres,
.rh-osm-kaart .rh-osm-popup__link {
	margin: 0 15px;
	line-height: 1.4;
}

.rh-osm-kaart .rh-osm-popup__naam {
	padding-top: 15px;
	font-weight: bold;
	font-size: 16px;
	color: var(--rh-osm-primair);
    margin-bottom: 0.5rem !important;
}

.rh-osm-kaart .rh-osm-popup__foto + .rh-osm-popup__naam {
	padding-top: 0;
}

.rh-osm-kaart .rh-osm-popup__adres {
	margin-top: 4px;
	font-style: normal;
	font-size: 14px;
	line-height: 1.4;
}

.rh-osm-kaart .rh-osm-popup__link {
	display: inline-block;
	margin-top: 8px;
	font-size: 14px;
	color: var(--rh-osm-primair);
	text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
	.rh-osm-kaart__item,
	.rh-osm-marker svg {
		transition: none;
	}
}

.rh-osm-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
