/*
 * Von Hebel Popup Manager – Frontend-Styles
 *
 * Alle Selektoren sind strikt auf .vhe-popup gekapselt.
 * Farben/Rundungen kommen über CSS-Variablen:
 *  1. Divi-Akzentfarbe / Plugin-Einstellung (per Inline-Style gesetzt)
 *  2. Laufzeit-Übernahme vom sichtbaren Divi-Button (JS, optional)
 *  3. Neutrale Fallback-Werte unten (greifen nur ohne Divi)
 */

.vhe-popup {
	/* Fallback-Tokens – werden i. d. R. durch Divi-Werte überschrieben. */
	--vhe-popup-accent: #22303e;
	--vhe-popup-accent-contrast: #ffffff;
	--vhe-popup-text: #333333;
	--vhe-popup-heading: #222222;
	--vhe-popup-muted: #6b7076;
	--vhe-popup-background: #ffffff;
	--vhe-popup-overlay: rgba(17, 24, 32, 0.62);
	--vhe-popup-radius: 8px;
	--vhe-popup-radius-btn: 3px;
	--vhe-popup-shadow: 0 18px 50px rgba(10, 16, 24, 0.28);

	position: fixed;
	inset: 0;
	z-index: 999990; /* unterhalb der WP-Adminbar-Menüs auf Mobil nicht relevant, oberhalb Divi-Header. */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	box-sizing: border-box;

	/* Schrift bewusst von der Webseite erben – kein eigener Font-Import. */
	font-family: inherit;
	line-height: 1.6;
}

.vhe-popup *,
.vhe-popup *::before,
.vhe-popup *::after {
	box-sizing: border-box;
}

/* Solange "hidden" gesetzt ist, existiert das Popup weder sichtbar noch für Screenreader. */
.vhe-popup[hidden] {
	display: none;
}

.vhe-popup__overlay {
	position: absolute;
	inset: 0;
	background: var(--vhe-popup-overlay);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.vhe-popup__dialog {
	position: relative;
	width: 100%;
	max-width: 540px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: var(--vhe-popup-background);
	color: var(--vhe-popup-text);
	border-radius: var(--vhe-popup-radius);
	box-shadow: var(--vhe-popup-shadow);
	opacity: 0;
	transform: translateY(18px) scale(0.98);
	transition: opacity 0.28s ease, transform 0.28s ease;
	overscroll-behavior: contain;
}

/* Sichtbarer Zustand (Klasse wird per JS nach dem Einfügen gesetzt). */
.vhe-popup.vhe-popup--visible .vhe-popup__overlay {
	opacity: 1;
}

.vhe-popup.vhe-popup--visible .vhe-popup__dialog {
	opacity: 1;
	transform: none;
}

/* Bewegungsreduzierung respektieren. */
@media (prefers-reduced-motion: reduce) {
	.vhe-popup__overlay,
	.vhe-popup__dialog {
		transition: none;
		transform: none;
	}
}

.vhe-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: var(--vhe-popup-heading);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
	appearance: none;
	-webkit-appearance: none;
	line-height: 1;
}

.vhe-popup__close:hover {
	background: rgba(0, 0, 0, 0.08);
}

.vhe-popup__close:focus-visible {
	outline: 2px solid var(--vhe-popup-accent);
	outline-offset: 2px;
}

.vhe-popup__close-icon {
	display: block;
}

.vhe-popup__media {
	line-height: 0;
	border-radius: var(--vhe-popup-radius) var(--vhe-popup-radius) 0 0;
	overflow: hidden;
}

.vhe-popup__media .vhe-popup__image {
	display: block;
	width: 100%;
	height: auto;
	max-height: 260px;
	object-fit: cover;
}

.vhe-popup__content {
	padding: 30px 34px 34px;
}

.vhe-popup__kicker {
	margin: 0 0 8px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--vhe-popup-accent);
}

.vhe-popup__title {
	margin: 0 0 14px;
	padding: 0;
	font-size: 26px;
	font-weight: 700;
	line-height: 1.25;
	color: var(--vhe-popup-heading);
}

.vhe-popup__text {
	margin: 0 0 22px;
	font-size: 16px;
	color: var(--vhe-popup-text);
}

.vhe-popup__text p {
	margin: 0 0 12px;
}

.vhe-popup__text p:last-child {
	margin-bottom: 0;
}

.vhe-popup__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px 20px;
}

.vhe-popup__button {
	display: inline-block;
	padding: 13px 26px;
	border: 2px solid var(--vhe-popup-accent);
	border-radius: var(--vhe-popup-radius-btn);
	background: var(--vhe-popup-accent);
	color: var(--vhe-popup-accent-contrast);
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.15s ease;
}

.vhe-popup__button:hover {
	filter: brightness(1.08);
	transform: translateY(-1px);
	color: var(--vhe-popup-accent-contrast);
	text-decoration: none;
}

.vhe-popup__button:focus-visible,
.vhe-popup__link:focus-visible {
	outline: 2px solid var(--vhe-popup-accent);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.vhe-popup__button:hover {
		transform: none;
	}
}

.vhe-popup__link {
	color: var(--vhe-popup-accent);
	font-size: 15px;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.vhe-popup__link:hover {
	text-decoration: none;
}

/* Hintergrund-Scrollen sperren, solange ein Popup offen ist. */
html.vhe-popup-lock,
html.vhe-popup-lock body {
	overflow: hidden !important;
}

/* Smartphone */
@media (max-width: 600px) {
	.vhe-popup {
		padding: 12px;
	}

	.vhe-popup__dialog {
		max-height: calc(100vh - 24px);
		max-height: calc(100dvh - 24px);
	}

	.vhe-popup__content {
		padding: 24px 20px 26px;
	}

	.vhe-popup__title {
		font-size: 22px;
	}

	.vhe-popup__text {
		font-size: 15px;
	}

	.vhe-popup__button {
		display: block;
		width: 100%;
	}

	.vhe-popup__media .vhe-popup__image {
		max-height: 180px;
	}
}
