/**
 * CWE Popups – native Divi-5 Popup-Engine (Bridge)
 * Ersetzt die Front-End-Funktion von popups-for-divi für Sections mit Klasse .cwe-popup.
 * Die Popup-Section behält ihr eigenes Divi-Styling (Hintergrund, Schatten, Breite);
 * diese Datei liefert nur Overlay/Backdrop, Zentrierung, Scroll-Lock und Close-Button.
 */

/* Popup-Section im normalen Fluss (z. B. im Footer) ausblenden – aber NUR auf dem
   echten Front-End. Im Divi Visual Builder (html.et-vb-app-ancestor) bleiben die
   Popups sichtbar und damit editierbar. */
html:not(.et-vb-app-ancestor) .cwe-popup {
	display: none !important;
}

/* Vollflächiges Overlay, an <body> gehängt. */
.cwe-popup-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 100000;
	box-sizing: border-box;
	padding: 4vh 16px;
	background: rgba(0, 0, 0, 0.6);
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}

.cwe-popup-overlay.is-open {
	display: flex;
	align-items: flex-start;
	justify-content: center;
}

/* Host nimmt die ein=geschobene Section auf und zentriert sie. */
.cwe-popup-host {
	position: relative;
	margin: auto;
	width: 100%;
	max-width: none;
	display: flex;
	justify-content: center;
}

/* Die Section wird im offenen Overlay wieder sichtbar gemacht. */
.cwe-popup-overlay.is-open .cwe-popup {
	display: block !important;
	margin: 0 !important;
	max-width: 100%;
	max-height: 92vh;
	overflow: auto;
}

/* Close-Button oben rechts. */
.cwe-popup-close {
	position: fixed;
	top: 16px;
	right: 20px;
	z-index: 100001;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: #ffffff;
	color: #17468d;
	font-size: 28px;
	line-height: 44px;
	text-align: center;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.cwe-popup-close:hover {
	background: #17468d;
	color: #ffffff;
}

/* Scroll-Lock des Hintergrunds, solange ein Popup offen ist. */
body.cwe-popup-locked {
	overflow: hidden;
}
