/*
 * IndoorView: Stil für das, was das Skript des Plugins selbst baut
 * (Filterleiste, Kartenansicht, drehende Panorama-Fläche, Fenster für den Rundgang).
 *
 * Farben, Schrift und Rundungen kommen aus den Variablen des Design-Systems in
 * Elementor (--iv-…). Hinter jeder Variable steht derselbe Wert als Rückfall,
 * falls eine Variable einmal umbenannt wird.
 *
 * Eigene Klassen beginnen mit „ivp-“ (IndoorView-Plugin), damit sie sich nie mit
 * den Klassen aus Elementor („iv-“) überschneiden.
 */

/* ---------- Hilfen ---------- */

/* Nur für Screenreader sichtbar */
.ivp-vh {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Das Attribut hidden gewinnt immer, auch gegen display-Regeln von Elementor */
.ivp-aus,
.iv-filter [hidden],
.ivp-leer[hidden] {
	display: none !important;
}

/* Die ID des Rundgangs in der Karte ist nur für das Skript da */
.iv-card-id {
	display: none !important;
}

/* ---------- Filterleiste ---------- */

.iv-filter {
	font-family: var(--iv-font, "Hanken Grotesk"), "Segoe UI", system-ui, sans-serif;
	color: var(--iv-ink, #23201E);
}

.ivp-form {
	display: grid;
	gap: 24px;
	margin: 0;
}

.ivp-gruppe {
	border: 0;
	padding: 0;
	margin: 0;
	min-width: 0;
}

/* Branchen als Chips: echte Auswahlknöpfe (radio), nur anders gezeichnet */
.ivp-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.ivp-chip {
	position: relative;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}

.ivp-chip input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.ivp-chip span {
	display: block;
	padding: 13px 18px;
	border-radius: var(--iv-radius-pill, 999px);
	background: var(--iv-sand, #F5F3F0);
	transition: background-color .18s ease, color .18s ease;
}

.ivp-chip:hover span {
	background: var(--iv-line, #E4E0DB);
}

.ivp-chip input:checked + span {
	background: var(--iv-ink, #23201E);
	color: var(--iv-white, #FFFFFF);
	font-weight: 600;
}

.ivp-chip input:focus-visible + span {
	outline: 2px solid var(--iv-ink, #23201E);
	outline-offset: 3px;
}

/* Zahl hinter dem Namen der Branche */
.ivp-chip i {
	font-style: normal;
	font-weight: 400;
	margin-left: 8px;
	opacity: .7;
	font-variant-numeric: tabular-nums;
}

/* Ort, Name, Sortierung nebeneinander */
.ivp-felder {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr) minmax(0, 1.1fr);
	gap: 16px clamp(16px, 2.2vw, 32px);
	align-items: end;
}

.ivp-feld {
	display: grid;
	gap: 8px;
	min-width: 0;
}

.ivp-feld label {
	display: block;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
}

/* Mit „.iv-filter“ davor, damit diese Regeln stärker sind als die Grundregeln des Themes für Felder */
.iv-filter .ivp-feld input,
.iv-filter .ivp-feld select {
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 15px 16px;
	font: inherit;
	font-size: 17px;
	line-height: 1.3;
	color: var(--iv-ink, #23201E);
	background-color: var(--iv-white, #FFFFFF);
	border: 1.5px solid var(--iv-line, #E4E0DB);
	border-radius: var(--iv-radius-small, 10px);
	transition: border-color .18s ease, box-shadow .18s ease;
	appearance: none;
	-webkit-appearance: none;
}

/* Eigener Pfeil im Auswahlfeld (aus zwei Verläufen gezeichnet, kein Bild nötig) */
.iv-filter .ivp-feld select {
	padding-right: 44px;
	cursor: pointer;
	text-overflow: ellipsis;
	background-image:
		linear-gradient(45deg, transparent 50%, var(--iv-ink, #23201E) 50%),
		linear-gradient(135deg, var(--iv-ink, #23201E) 50%, transparent 50%);
	background-position: right 22px center, right 16px center;
	background-size: 6px 6px, 6px 6px;
	background-repeat: no-repeat;
}

.iv-filter .ivp-feld input:focus,
.iv-filter .ivp-feld select:focus {
	outline: 0;
	border-color: var(--iv-red-bright, #E04830);
	box-shadow: 0 0 0 3px rgba(224, 72, 48, .28);
}

/* Zeile mit der Trefferzahl */
.ivp-status {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px 24px;
	margin: 32px 0 24px;
}

.ivp-zahl {
	margin: 0;
	font-size: var(--iv-fs-text, 17px);
	line-height: 1.6;
	font-variant-numeric: tabular-nums;
}

.ivp-zahl b {
	font-weight: 600;
}

/*
 * Textknopf („Filter zurücksetzen“, „In neuem Tab öffnen“).
 * Mit „button“ und „a“ davor und mit eigenen Regeln für Maus und Fokus, damit
 * die Grundregeln des Themes für Knöpfe und Links (Rahmen, Farbfläche) nicht greifen.
 */
button.ivp-textknopf,
a.ivp-textknopf {
	display: inline;
	width: auto;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--iv-red, #C73E22);
	text-align: left;
	text-decoration: underline;
	text-decoration-thickness: 1.5px;
	text-underline-offset: 5px;
	white-space: normal;
	cursor: pointer;
	transition: color .18s ease;
}

button.ivp-textknopf:hover,
button.ivp-textknopf:focus,
a.ivp-textknopf:hover,
a.ivp-textknopf:focus {
	background: none;
	color: var(--iv-red-dark, #A93219);
	text-decoration: underline;
	text-decoration-thickness: 2.5px;
	text-underline-offset: 5px;
}

/* Leerer Zustand: kein Rundgang passt */
.ivp-leer {
	display: grid;
	gap: 16px;
	justify-items: start;
	padding: clamp(20px, 3vw, 40px);
	border-radius: var(--iv-radius-large, 20px);
	background: var(--iv-sand, #F5F3F0);
	font-family: var(--iv-font, "Hanken Grotesk"), "Segoe UI", system-ui, sans-serif;
	color: var(--iv-ink, #23201E);
}

.ivp-leer p {
	margin: 0;
	font-size: var(--iv-fs-text, 17px);
	line-height: 1.6;
}

/* Zweiter Knopf (Rand, rund), im leeren Zustand und im Fenster. Aufbau wie beim Textknopf. */
button.ivp-knopf,
a.ivp-knopf {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	padding: 13.5px 24.5px;
	border: 1.5px solid var(--iv-ink, #23201E);
	border-radius: var(--iv-radius-pill, 999px);
	background: transparent;
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	color: var(--iv-ink, #23201E);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .18s ease, color .18s ease;
}

button.ivp-knopf:hover,
button.ivp-knopf:focus,
a.ivp-knopf:hover,
a.ivp-knopf:focus {
	background: var(--iv-ink, #23201E);
	color: var(--iv-white, #FFFFFF);
	text-decoration: none;
}

/* Sichtbarer Rahmen bei Bedienung mit der Tastatur */
button.ivp-textknopf:focus-visible,
a.ivp-textknopf:focus-visible,
button.ivp-knopf:focus-visible,
a.ivp-knopf:focus-visible {
	outline: 2px solid var(--iv-ink, #23201E);
	outline-offset: 3px;
	box-shadow: none;
}

@media (max-width: 1024px) {
	.ivp-felder {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}
	/* Die Namenssuche steht dann allein in der ersten Zeile */
	.ivp-felder .ivp-feld:nth-child(2) {
		grid-column: 1 / -1;
		grid-row: 1;
	}
}

@media (max-width: 767px) {
	.ivp-form {
		gap: 16px;
	}
	.ivp-felder {
		grid-template-columns: minmax(0, 1fr);
	}
	.ivp-felder .ivp-feld:nth-child(2) {
		grid-row: auto;
	}
	.ivp-status {
		margin: 24px 0 16px;
	}
}

/* ---------- Kartenansicht (seit 1.2.0) ---------- */

/*
 * Die Karte ist normales Elementor (Klassen „iv-karte“, „iv-karte-bild“,
 * „iv-karte-orte“). In Elementor steht „iv-karte“ auf „nicht anzeigen“. Erst das
 * Skript blendet sie ein. Ohne Plugin oder ohne JavaScript bleibt sie unsichtbar,
 * und es gibt keinen leeren Rahmen.
 */
.iv-karte.ivp-an,
.elementor .iv-karte.ivp-an {
	display: block !important;
}

/* Umschalter „Raster / Karte“ rechts in der Zeile mit der Trefferzahl */
.ivp-status-mit-ansicht {
	align-items: center;
}

.ivp-ansicht {
	display: inline-flex;
	gap: 4px;
	margin-left: auto;
	padding: 4px;
	border-radius: var(--iv-radius-pill, 999px);
	background: var(--iv-sand, #F5F3F0);
	font-family: var(--iv-font, "Hanken Grotesk"), "Segoe UI", system-ui, sans-serif;
}

/* Mit „button“ davor und eigenen Regeln für Maus und Fokus, damit das Theme nicht greift */
button.ivp-ansicht-knopf,
button.ivp-ortknopf {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	margin: 0;
	border: 0;
	border-radius: var(--iv-radius-pill, 999px);
	background: transparent;
	font: inherit;
	font-size: var(--iv-fs-small, 15px);
	font-weight: 400;
	line-height: 1.2;
	color: var(--iv-ink, #23201E);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .18s ease, color .18s ease;
}

button.ivp-ansicht-knopf {
	min-height: 40px;
	padding: 10px 18px;
}

button.ivp-ansicht-knopf:hover,
button.ivp-ansicht-knopf:focus {
	background: var(--iv-line, #E4E0DB);
	color: var(--iv-ink, #23201E);
}

button.ivp-ansicht-knopf[aria-pressed="true"],
button.ivp-ansicht-knopf[aria-pressed="true"]:hover,
button.ivp-ansicht-knopf[aria-pressed="true"]:focus,
button.ivp-ortknopf[aria-pressed="true"],
button.ivp-ortknopf[aria-pressed="true"]:hover,
button.ivp-ortknopf[aria-pressed="true"]:focus {
	background: var(--iv-ink, #23201E);
	color: var(--iv-white, #FFFFFF);
	font-weight: 600;
}

button.ivp-ansicht-knopf:focus-visible,
button.ivp-ortknopf:focus-visible,
button.ivp-punkt:focus-visible {
	outline: 2px solid var(--iv-ink, #23201E);
	outline-offset: 3px;
	box-shadow: none;
}

/* Punkte über dem Kartenbild. Lage und Größe in Prozent, damit sie mit dem Bild wachsen. */
.iv-karte-bild {
	position: relative;
}

.iv-karte-bild img {
	display: block;
	width: 100%;
	height: auto;
}

.ivp-punkte,
.ivp-orte {
	margin: 0;
	padding: 0;
	list-style: none;
	font-family: var(--iv-font, "Hanken Grotesk"), "Segoe UI", system-ui, sans-serif;
}

.ivp-punkte {
	position: absolute;
	inset: 0;
}

.ivp-punkte li,
.ivp-orte li {
	margin: 0;
	padding: 0;
	list-style: none;
}

button.ivp-punkt {
	position: absolute;
	box-sizing: border-box;
	min-width: 12px;
	aspect-ratio: 1;
	margin: 0;
	padding: 0;
	border: 2px solid var(--iv-sand, #F5F3F0);
	border-radius: 50%;
	background: var(--iv-green, #00A868);
	color: var(--iv-white, #FFFFFF);
	cursor: pointer;
	transform: translate(-50%, -50%);
	transition: background-color .18s ease;
}

/* Größere Fläche zum Treffen, vor allem am Handy */
button.ivp-punkt::before {
	content: "";
	position: absolute;
	inset: -9px;
	border-radius: 50%;
}

button.ivp-punkt:hover,
button.ivp-punkt:focus {
	background: var(--iv-green-text, #007A4D);
}

button.ivp-punkt[aria-pressed="true"],
button.ivp-punkt[aria-pressed="true"]:hover,
button.ivp-punkt[aria-pressed="true"]:focus {
	background: var(--iv-red, #C73E22);
}

/* Der Punkt unter der Maus oder im Fokus liegt über allen anderen */
button.ivp-punkt:hover,
button.ivp-punkt:focus-visible {
	z-index: 30 !important;
}

/* Kleines Schild mit dem Namen, bei Maus und bei Tastatur-Fokus */
.ivp-punkt-name {
	position: absolute;
	left: 50%;
	bottom: calc(100% + 8px);
	padding: 5px 10px;
	border-radius: 6px;
	background: var(--iv-ink, #23201E);
	color: var(--iv-white, #FFFFFF);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	transform: translateX(-50%);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

button.ivp-punkt:hover .ivp-punkt-name,
button.ivp-punkt:focus-visible .ivp-punkt-name {
	opacity: 1;
	visibility: visible;
}

/* Ortsliste neben der Karte */
.ivp-orte {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

button.ivp-ortknopf {
	min-height: 40px;
	padding: 10px 14px;
	background: var(--iv-white, #FFFFFF);
}

button.ivp-ortknopf:hover,
button.ivp-ortknopf:focus {
	background: var(--iv-line, #E4E0DB);
	color: var(--iv-ink, #23201E);
}

button.ivp-ortknopf i {
	margin-left: 7px;
	font-style: normal;
	font-weight: 400;
	font-variant-numeric: tabular-nums;
	opacity: .6;
}

@media (max-width: 767px) {
	.ivp-ansicht {
		display: flex;
		width: 100%;
		margin-left: 0;
	}
	button.ivp-ansicht-knopf {
		flex: 1 1 0;
	}
}

/* ---------- Drehende Panorama-Fläche ---------- */

/* Der Streifen liegt über dem normalen Bild. Das Bild selbst bleibt stehen. */
.ivp-streifen {
	position: absolute;
	inset: 0;
	background-repeat: repeat-x;
	background-size: auto 100%;
	background-position: 0 50%;
	opacity: 0;
	transition: opacity .4s ease;
}

.ivp-streifen.ivp-da {
	opacity: 1;
}

/* Fläche, die sich drehen lässt: senkrecht scrollen bleibt möglich, waagerecht dreht */
.ivp-dreh {
	position: relative;
	overflow: hidden;
	touch-action: pan-y;
	cursor: grab;
	user-select: none;
	-webkit-user-select: none;
}

.ivp-dreh.ivp-zieht {
	cursor: grabbing;
}

/* ---------- Fenster für den Rundgang ---------- */

/* Solange das Fenster offen ist, scrollt die Seite dahinter nicht */
html.ivp-fenster-offen {
	overflow: hidden;
}

.ivp-fenster {
	box-sizing: border-box;
	width: min(1200px, calc(100vw - 32px));
	height: min(820px, calc(100vh - 32px));
	height: min(820px, calc(100dvh - 32px));
	max-width: none;
	max-height: none;
	padding: 0;
	border: 0;
	border-radius: var(--iv-radius-card, 16px);
	overflow: hidden;
	background: var(--iv-white, #FFFFFF);
	color: var(--iv-ink, #23201E);
	font-family: var(--iv-font, "Hanken Grotesk"), "Segoe UI", system-ui, sans-serif;
}

.ivp-fenster[open] {
	display: flex;
	flex-direction: column;
}

.ivp-fenster::backdrop {
	background: rgba(35, 32, 30, .72);
}

.ivp-fenster-kopf {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	padding: 12px 12px 12px 20px;
}

.ivp-fenster-titel {
	flex: 1 1 12ch;
	min-width: 0;
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.ivp-fenster-knoepfe {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
}

.ivp-fenster button.ivp-knopf {
	padding: 10px 18px;
	font-size: 15px;
}

.ivp-fenster-flaeche {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	background: var(--iv-sand, #F5F3F0);
}

.ivp-fenster-laedt {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	margin: 0;
	padding: 16px;
	text-align: center;
	font-size: 16px;
	color: var(--iv-muted, #5F5A56);
}

.ivp-fenster iframe {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

@media (max-width: 767px) {
	/* Am Handy füllt das Fenster den Bildschirm */
	.ivp-fenster {
		width: 100vw;
		height: 100vh;
		height: 100dvh;
		border-radius: 0;
	}
	.ivp-fenster-kopf {
		padding: 8px 8px 8px 16px;
	}
}

/* ---------- Einblenden beim Scrollen und Bild-Zoom (seit 1.3.0) ---------- */

/*
 * Einblenden: Die Klasse „iv-einblenden“ (in Elementor gesetzt) versteckt nichts.
 * Erst das Skript gibt Elementen unter dem Bildrand „ivp-wartet“ (blass, 22 px
 * tiefer) und nimmt es wieder weg, wenn sie ins Bild kommen. „ivp-kommt“ trägt
 * nur für diesen Moment den Übergang und wird danach wieder entfernt.
 * „translate“ statt „transform“: So bleibt ein eigenes transform des Elements
 * (z. B. zum Mittigsetzen) unberührt.
 */
.ivp-wartet {
	opacity: 0.3 !important;
	translate: 0 22px;
}

.ivp-kommt {
	transition: translate 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.6s ease !important;
	transition-delay: calc(var(--ivp-stufe, 0) * 80ms) !important;
}

/* Beim Drucken wartet nichts */
@media print {
	.ivp-wartet {
		opacity: 1 !important;
		translate: none;
	}
}

/*
 * Bild-Zoom: In einem Element mit der Klasse „iv-zoom“ wachsen die Bilder bei
 * Mauskontakt ganz leicht (3,5 %). Der Rahmen des Bildes braucht in Elementor
 * „Überlauf: versteckt“, sonst ragt das Bild über seine Ecken hinaus.
 * Nur für Geräte mit Maus, damit am Handy nichts nach dem Antippen hängen bleibt.
 */
.iv-zoom img,
.elementor .iv-zoom img {
	transition: scale 1.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (hover: hover) {
	.iv-zoom:hover img,
	.elementor .iv-zoom:hover img {
		scale: 1.035;
	}
}

/* ---------- Weniger Bewegung ---------- */

/*
 * Wer im Gerät „Bewegung reduzieren“ eingestellt hat, bekommt keine Übergänge.
 * Dazu gehört der Textlink des Design-Systems (iv-link): Elementor nimmt diese
 * Regel in einer Klasse nicht an, darum steht sie hier.
 */
@media (prefers-reduced-motion: reduce) {
	.iv-link,
	.iv-link::before,
	.iv-link::after,
	.elementor .iv-link,
	.elementor .iv-link::before,
	.elementor .iv-link::after,
	.ivp-chip span,
	.iv-filter .ivp-feld input,
	.iv-filter .ivp-feld select,
	button.ivp-knopf,
	a.ivp-knopf,
	button.ivp-textknopf,
	a.ivp-textknopf,
	button.ivp-ansicht-knopf,
	button.ivp-ortknopf,
	button.ivp-punkt,
	.ivp-streifen,
	.ivp-kommt,
	.iv-zoom img,
	.elementor .iv-zoom img {
		transition: none !important;
	}

	/* Kein Einblenden und kein Zoom (das Skript setzt „ivp-wartet“ dann gar nicht, das hier ist die zweite Sicherung) */
	.ivp-wartet {
		opacity: 1 !important;
		translate: none;
	}
	.iv-zoom:hover img,
	.elementor .iv-zoom:hover img {
		scale: none;
	}
}
