/**
 * WordPress integration layer for the KEB standort map.
 * Vendor styles live in assets/vendor/kath-akademie.scoped.min.css
 * (generated from kath-akademie.min.css via tools/scope-vendor-css.py).
 */

.skkb-standortkarte {
	/* Share of row width used for the SVG on desktop (list takes the rest). Default was 0.62. */
	--skkb-map-width-ratio: 0.6;
	/* Map theme tokens from KEB (UIkit), Bricks, and Core Framework naming conventions. */
	--skkb-font-body: var(
		--global-font-family,
		var(--base-body-font, var(--body-font-family, inherit))
	);
	--skkb-font-heading: var(
		--base-heading-font-family,
		var(--heading-font-family, var(--skkb-font-body))
	);
	--skkb-font-body-weight: var(--base-body-font-weight, var(--body-font-weight, inherit));
	--skkb-font-heading-weight: var(--base-heading-font-weight, var(--heading-font-weight, 700));
	position: relative;
	width: 100%;
	max-width: 100%;
	min-height: 0;
	min-width: 0;
	box-sizing: border-box;
	/* visible: active diocese scale() paints outside the coordinate box without resizing it */
	overflow: visible;
	isolation: isolate;
	font-family: var(--skkb-font-body);
}

/* Fills a vh / bounded parent: map column is contain-fitted, list scrolls beside it. */
.skkb-standortkarte.skkb-is-fill-height {
	box-sizing: border-box;
	align-self: stretch;
}

.skkb-standortkarte.skkb-is-fill-height .mod-map {
	height: 100% !important;
	min-height: 0;
	padding: 0;
	align-items: center;
}

.skkb-standortkarte.skkb-is-fill-height .m-map-content,
.skkb-standortkarte.skkb-is-fill-height .m-map-content.collapse {
	margin-bottom: 0;
	max-height: 100%;
	flex: 0 0 auto;
	overflow: visible;
}

.skkb-standortkarte.skkb-is-fill-height .m-map-list.show {
	/* Beside/below the map: cap height, scroll only when content is taller. */
	align-self: stretch;
	max-height: 100%;
	min-height: 0;
	overflow-x: clip;
	overflow-y: auto;
	padding-bottom: 0.75rem;
}

@media (max-width: 47.99em) {
	/* Stacked mobile: no fill-height stage — content defines height. */
	.skkb-standortkarte.skkb-is-fill-height {
		height: auto !important;
	}

	.skkb-standortkarte.skkb-is-fill-height .mod-map {
		height: auto !important;
		align-items: stretch;
	}

	.skkb-standortkarte.skkb-is-fill-height .m-map-content,
	.skkb-standortkarte.skkb-is-fill-height .m-map-content.collapse {
		max-height: none;
	}

	.skkb-standortkarte .m-map-list.show {
		width: 100% !important;
		max-width: none;
		flex: 0 0 auto;
		/* Height comes from JS (active panel), like keb-bayern.de — do not force auto. */
		max-height: none !important;
		overflow: hidden;
		scroll-margin-top: 5rem;
	}

	.skkb-standortkarte.skkb-is-fill-height .m-map-list.show {
		align-self: stretch;
		max-height: none !important;
		overflow: hidden;
		padding-bottom: 1.5rem;
	}

	/* Drill-down city/detail lists: keep the last row clear of the pane edge. */
	.skkb-standortkarte .m-map-list .m-flyout > ul.ds-list.skkb-map-list,
	.skkb-standortkarte .m-map-list .m-detail.subnavi-2 {
		padding-bottom: 1.25rem;
		box-sizing: border-box;
	}
}

/*
 * Drill-down panels are position:absolute with visibility:hidden while idle.
 * They still inflate scrollHeight (~1200px+) and make the short overview
 * feel endlessly scrollable on mobile. Collapse idle panels completely.
 */
.skkb-standortkarte .m-map-list .m-flyout:not(.subnavi-1),
.skkb-standortkarte .m-map-list .m-detail:not(.subnavi-2) {
	height: 0 !important;
	max-height: 0 !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	margin: 0 !important;
	overflow: hidden !important;
	border: 0 !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

/*
 * Vendor CSS (kath-akademie.scoped.min.css) hardcodes Open Sans on map UI text.
 * Re-map to theme typography tokens so drill-down navigation matches the site.
 */
.skkb-standortkarte .m-map-list :is(.m-headline, h4, h5),
.skkb-standortkarte .mod-map-text-detail > .m-headline {
	font-family: var(--skkb-font-heading) !important;
	font-weight: var(--skkb-font-heading-weight) !important;
}

.skkb-standortkarte .m-map-list,
.skkb-standortkarte .m-map-list :is(.m-navi-container, .m-copy, .m-list-content, .m-flyout, .m-detail, .mod-map-text-detail, .m-back, .m-city-list),
.skkb-standortkarte .m-map-list :is(p, a, span, li),
.skkb-standortkarte .mod-map-text-detail :is(a, span, p) {
	font-family: var(--skkb-font-body) !important;
}

/*
 * Active region — match keb-bayern.de exactly:
 * Desktop: scale + solid white + hide diocese title + show city markers.
 * Mobile: no scale, keep diocese title, hide city markers (vendor default).
 */
.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active .m-bg {
	fill: #fff;
}

@media (min-width: 48em) {
	.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active {
		-webkit-transform-origin: 50% 50%;
		transform-origin: 50% 50%;
		-webkit-transform: scale(1.2);
		transform: scale(1.2);
		z-index: 100;
	}

	.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active .m-diocese {
		opacity: 0;
	}

	.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active > .m-marker-wrapper > g {
		pointer-events: all;
	}

	.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active > .m-marker-wrapper > g > .m-marker,
	.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active > .m-marker-wrapper > g > .m-city {
		opacity: 1 !important;
		visibility: visible !important;
		-webkit-transition-delay: 0s, 0s;
		transition-delay: 0s, 0s;
	}

	.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active > .m-marker-wrapper > g > .m-marker {
		fill: #069 !important;
	}
}

@media (max-width: 47.99em) {
	.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active {
		-webkit-transform: none;
		transform: none;
	}

	/* Region title stays visible on mobile (keb-bayern.de). */
	.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active .m-diocese {
		opacity: 1 !important;
		visibility: visible !important;
	}

	.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active > .m-marker-wrapper > g > .m-marker,
	.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active > .m-marker-wrapper > g > .m-city,
	.skkb-standortkarte .mod-map > .m-map-content > .svg-map.active .m-city-highlight {
		opacity: 0 !important;
		visibility: hidden !important;
		display: none !important;
		pointer-events: none !important;
	}
}

/* Original homepage map is absolutely positioned; keep it in document flow inside pages. */
.skkb-standortkarte .mod-map {
	position: relative !important;
	top: auto !important;
	right: auto !important;
	height: auto !important;
	min-height: 0;
	min-width: 0;
	max-width: 100%;
	padding: 2rem 0 0;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: center;
	gap: 1.5rem;
	overflow: visible;
	box-sizing: border-box;
}

.skkb-standortkarte .m-map-content,
.skkb-standortkarte .m-map-content.collapse {
	/* Full 725×801 coordinate box (sized in px by standortkarte.js). Do not change aspect ratio. */
	position: relative;
	max-width: 100%;
	min-width: 0;
	margin-bottom: 0;
	margin-left: auto !important;
	margin-right: auto !important;
	flex: 0 1 auto;
	overflow: visible;
	box-sizing: border-box;
}

/* Mobile: stage ≤ 100% of page column; oversized canvas clipped — no page blowout. */
@media (max-width: 47.99em) {
	.skkb-standortkarte {
		/* inline-size containment: children cannot widen this box / the page. */
		contain: inline-size;
		overflow-x: hidden !important;
		max-width: 100% !important;
		min-width: 0 !important;
		width: 100% !important;
		box-sizing: border-box;
	}

	.skkb-standortkarte .mod-map {
		contain: inline-size;
		justify-content: flex-start;
		overflow: hidden !important;
		max-width: 100% !important;
		min-width: 0 !important;
		width: 100% !important;
		box-sizing: border-box;
	}

	.skkb-standortkarte .m-map-content,
	.skkb-standortkarte .m-map-content.collapse {
		/* Inner canvas may exceed the stage; parent clips. */
		max-width: none;
		min-width: 0;
		flex: 0 0 auto;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}
}

@media (min-width: 48em) {
	/* Homepage hero offset; breaks border-to-border alignment in embedded flex layout. */
	.skkb-standortkarte .mod-map > .m-map-content {
		transform: none;
	}
}

/*
 * From kath-akademie.min.css — each diocese SVG is absolutely positioned with %-based
 * width/height/left/top inside .m-map-content (reference size ~725×801).
 */
.skkb-standortkarte .mod-map > .m-map-content > .svg-map {
	position: absolute;
	max-width: none;
}

.skkb-standortkarte .mod-map > .m-map-content > .svg-map-wuerzburg {
	width: 33.10345%;
	height: 28.68966%;
	left: 0;
	top: 0;
}

.skkb-standortkarte .mod-map > .m-map-content > .svg-map-bamberg {
	width: 35.31034%;
	height: 35.58621%;
	left: 19%;
	top: 0.3%;
}

.skkb-standortkarte .mod-map > .m-map-content > .svg-map-eichstaett {
	width: 25.7931%;
	height: 25.24138%;
	left: 23.1%;
	top: 22%;
}

.skkb-standortkarte .mod-map > .m-map-content > .svg-map-regensburg {
	width: 31.58621%;
	height: 50.06897%;
	left: 42.5%;
	top: 6.5%;
}

.skkb-standortkarte .mod-map > .m-map-content > .svg-map-passau {
	width: 22.2069%;
	height: 29.65517%;
	left: 63.5%;
	top: 34.3%;
}

.skkb-standortkarte .mod-map > .m-map-content > .svg-map-augsburg {
	width: 35.31034%;
	height: 53.24138%;
	left: 10%;
	top: 31%;
}

.skkb-standortkarte .mod-map > .m-map-content > .svg-map-muenchen-freising {
	width: 40.82759%;
	height: 32.27586%;
	left: 32.7%;
	top: 47.5%;
}

.skkb-standortkarte .m-map-content::before,
.skkb-standortkarte .m-map-content.collapse::before {
	content: none !important;
	display: none !important;
}

.skkb-standortkarte .m-map-list.show {
	position: relative !important;
	top: auto !important;
	right: auto !important;
	width: 100% !important;
	max-width: 22rem;
	min-width: 0;
	/* No !important: JS sets explicit panel height (esp. mobile drill-down). */
	height: auto;
	min-height: 0;
	flex: 0 1 22rem;
	opacity: 1 !important;
	visibility: visible !important;
	box-sizing: border-box;
	overflow-x: clip;
	overflow-y: clip;
}

@media (min-width: 48em) {
	.skkb-standortkarte .mod-map {
		flex-wrap: nowrap;
	}
}

/*
 * Scoped list reset: theme bullets stay outside .m-map-list.
 * ul.ds-list excludes lists from .ds-article-text ul:not(..., .ds-list, ...) rules.
 */
@scope (.skkb-standortkarte .m-map-list) {
	:where(ul, ol) {
		list-style: none;
		margin: 0;
		padding: 0;
		padding-inline-start: 0;
	}

	:where(li.js-city-list-items) {
		list-style: none;
		padding-inline-start: 0;
		margin-inline-start: 0;
	}

	:where(li.js-city-list-items)::marker {
		all: unset;
		content: none;
	}

	:where(li.js-city-list-items)::before,
	:where(li.js-city-list-items)::after,
	:where(li.js-city-list-items > .m-city-list)::before,
	:where(li.js-city-list-items > .m-city-list)::after {
		all: unset;
		content: none;
		display: none;
	}
}

/* Fallback when @scope is unsupported (older browsers) */
@supports not (top: 1rlh) {
	.skkb-standortkarte .m-map-list :where(li.js-city-list-items)::before,
	.skkb-standortkarte .m-map-list :where(li.js-city-list-items)::after,
	.skkb-standortkarte .m-map-list :where(li.js-city-list-items > .m-city-list)::before,
	.skkb-standortkarte .m-map-list :where(li.js-city-list-items > .m-city-list)::after {
		all: unset;
		content: none;
		display: none;
	}
}

.skkb-standortkarte .mod-map-text-detail a {
	word-break: break-word;
}

/* Inactive cities: hidden in list only; map markers stay visible. */
.skkb-standortkarte .m-map-list li.skkb-city-inactive {
	display: none !important;
}

/* Builder / admin placeholder (no vendor CSS loaded). */
.skkb-map-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 280px;
	padding: 2rem;
	background: #069;
	color: #fff;
	font-family: var(--skkb-font-body);
	border-radius: 4px;
	box-sizing: border-box;
}

.skkb-map-placeholder__inner {
	max-width: 36rem;
	text-align: center;
}

.skkb-map-placeholder__title {
	margin: 0 0 0.75rem;
	font-size: 1.25rem;
	font-weight: 600;
}

.skkb-map-placeholder__text {
	margin: 0 0 1rem;
	font-size: 0.95rem;
	line-height: 1.5;
	opacity: 0.95;
}

.skkb-map-placeholder__code {
	display: inline-block;
	padding: 0.35rem 0.65rem;
	background: rgba(0, 0, 0, 0.2);
	border-radius: 3px;
	font-size: 0.85rem;
}
