/**
 * Pop-ups (ab 3.25): Pop-up (Mitte), Slide-in (Ecke), Hinweisleiste (oben/unten).
 * Verhalten in assets/js/popups.js; in Editoren (.is-inline) statisch an Ort und Stelle.
 * Design über das Schema (includes/popups/design-schema.php): --pu-width, --pu-offset, --pu-img-height, --pu-img-width.
 */
.itm-pu-wrapper {
	--pu-accent: #2b6cb0;
	--pu-width: 520px;
	--pu-offset: 20px;
	box-sizing: border-box;
	color: #1d2327;
	font-size: 16px;
	line-height: 1.5;
}

.itm-pu-wrapper *,
.itm-pu-wrapper *::before,
.itm-pu-wrapper *::after {
	box-sizing: border-box;
}

.itm-pu-wrapper[hidden] {
	display: none !important;
}

html.itm-pu-lock {
	overflow: hidden;
}

/* ---------- Fenster ---------- */

.itm-pu-box {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.itm-pu-media {
	overflow: hidden;
}

.itm-pu-media img {
	display: block;
	width: 100%;
	height: var(--pu-img-height, auto);
	max-height: 50vh;
	object-fit: cover;
}

.itm-pu-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
	padding: 24px 28px;
}

.itm-pu-title {
	margin: 0;
	padding-right: 28px;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.25;
}

.itm-pu-text p {
	margin: 0 0 0.6em;
}

.itm-pu-text p:last-child {
	margin-bottom: 0;
}

.itm-pu-embed {
	min-width: 0;
}

.itm-pu-button {
	display: inline-block;
	align-self: flex-start;
	margin-top: 6px;
	padding: 10px 20px;
	border: 0;
	border-radius: 4px;
	background: var(--pu-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}

.itm-pu-button:hover,
.itm-pu-button:focus-visible {
	color: #fff;
	filter: brightness(0.9);
}

.itm-pu-close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: #1d2327;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.itm-pu-close:hover,
.itm-pu-close:focus-visible {
	background: #fff;
	outline: 2px solid var(--pu-accent);
}

/* Bild links (ab 600 px Breite des Fensters) */
@media (min-width: 600px) {
	.itm-pu-wrapper.img-left .itm-pu-box {
		flex-direction: row;
	}

	.itm-pu-wrapper.img-left .itm-pu-media {
		flex: 0 0 var(--pu-img-width, 40%);
	}

	.itm-pu-wrapper.img-left .itm-pu-media img {
		height: 100%;
		max-height: none;
	}
}

/* ---------- Auf der Website (nicht in Editoren) ---------- */

.itm-pu-wrapper:not(.is-inline) {
	position: fixed;
	z-index: 99990;
}

.itm-pu-wrapper.type-modal:not(.is-inline) {
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.itm-pu-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.itm-pu-wrapper.type-modal:not(.is-inline) .itm-pu-box {
	width: min(var(--pu-width), 100%);
	max-height: calc(100vh - 32px);
	overflow: auto;
}

.itm-pu-wrapper.type-slide:not(.is-inline) {
	width: min(var(--pu-width), calc(100vw - 2 * var(--pu-offset)));
	max-height: calc(100vh - 2 * var(--pu-offset));
}

.itm-pu-wrapper.type-slide:not(.is-inline) .itm-pu-box {
	max-height: calc(100vh - 2 * var(--pu-offset));
	overflow: auto;
}

.itm-pu-wrapper.type-slide.pos-br { right: var(--pu-offset); bottom: var(--pu-offset); }
.itm-pu-wrapper.type-slide.pos-bl { left: var(--pu-offset); bottom: var(--pu-offset); }
.itm-pu-wrapper.type-slide.pos-tr { right: var(--pu-offset); top: var(--pu-offset); }
.itm-pu-wrapper.type-slide.pos-tl { left: var(--pu-offset); top: var(--pu-offset); }

.itm-pu-wrapper.type-bar:not(.is-inline) {
	right: 0;
	left: 0;
}

.itm-pu-wrapper.type-bar.pos-top { top: 0; }
.itm-pu-wrapper.type-bar.pos-bottom { bottom: 0; }

/* Leiste: eine Zeile mit Titel, Text und Button; Bild ausgeblendet. */
.itm-pu-wrapper.type-bar .itm-pu-box {
	border-radius: 0;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.itm-pu-wrapper.type-bar .itm-pu-media {
	display: none;
}

.itm-pu-wrapper.type-bar .itm-pu-body {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px 20px;
	padding: 12px 56px 12px 20px;
	text-align: center;
}

.itm-pu-wrapper.type-bar .itm-pu-title {
	padding-right: 0;
	font-size: 17px;
}

.itm-pu-wrapper.type-bar .itm-pu-button {
	align-self: center;
	margin-top: 0;
	padding: 8px 16px;
}

.itm-pu-wrapper.type-bar .itm-pu-close {
	top: 50%;
	transform: translateY(-50%);
	background: transparent;
}

/* ---------- Animationen ---------- */

.itm-pu-wrapper:not(.is-inline) .itm-pu-box,
.itm-pu-wrapper:not(.is-inline) .itm-pu-backdrop {
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.itm-pu-wrapper:not(.is-inline):not(.is-visible) .itm-pu-box,
.itm-pu-wrapper:not(.is-inline):not(.is-visible) .itm-pu-backdrop {
	opacity: 0;
}

.itm-pu-wrapper.anim-slide.type-modal:not(.is-visible) .itm-pu-box { transform: translateY(24px); }
.itm-pu-wrapper.anim-slide.type-slide.pos-br:not(.is-visible) .itm-pu-box,
.itm-pu-wrapper.anim-slide.type-slide.pos-tr:not(.is-visible) .itm-pu-box { transform: translateX(40px); }
.itm-pu-wrapper.anim-slide.type-slide.pos-bl:not(.is-visible) .itm-pu-box,
.itm-pu-wrapper.anim-slide.type-slide.pos-tl:not(.is-visible) .itm-pu-box { transform: translateX(-40px); }
.itm-pu-wrapper.anim-slide.type-bar.pos-top:not(.is-visible) .itm-pu-box { transform: translateY(-100%); }
.itm-pu-wrapper.anim-slide.type-bar.pos-bottom:not(.is-visible) .itm-pu-box { transform: translateY(100%); }
.itm-pu-wrapper.anim-zoom:not(.is-visible) .itm-pu-box { transform: scale(0.9); }

.itm-pu-wrapper.anim-none .itm-pu-box,
.itm-pu-wrapper.anim-none .itm-pu-backdrop {
	transition: none;
}

@media (prefers-reduced-motion: reduce) {
	.itm-pu-wrapper .itm-pu-box,
	.itm-pu-wrapper .itm-pu-backdrop {
		transition: none !important;
		transform: none !important;
	}
}

/* ---------- In Editoren: statisch an Ort und Stelle ---------- */

.itm-pu-wrapper.is-inline {
	position: relative;
	margin: 12px 0;
	padding: 28px 16px 16px;
	border: 2px dashed #8c8f94;
	border-radius: 6px;
	background: repeating-linear-gradient(45deg, #f6f7f7, #f6f7f7 10px, #eef0f2 10px, #eef0f2 20px);
}

.itm-pu-wrapper.is-inline::before {
	content: "Pop-up";
	position: absolute;
	top: 6px;
	left: 10px;
	color: #50575e;
	font: 600 11px/1.4 sans-serif;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.itm-pu-wrapper.is-inline .itm-pu-backdrop {
	display: none;
}

.itm-pu-wrapper.is-inline.type-modal .itm-pu-box,
.itm-pu-wrapper.is-inline.type-slide .itm-pu-box {
	width: min(var(--pu-width), 100%);
	margin: 0 auto;
}

.itm-pu-wrapper.is-inline.type-slide.pos-br .itm-pu-box,
.itm-pu-wrapper.is-inline.type-slide.pos-tr .itm-pu-box {
	margin-right: 0;
}

.itm-pu-wrapper.is-inline.type-slide.pos-bl .itm-pu-box,
.itm-pu-wrapper.is-inline.type-slide.pos-tl .itm-pu-box {
	margin-left: 0;
}

@media (max-width: 767px) {
	.itm-pu-body {
		padding: 20px;
	}

	.itm-pu-wrapper.type-bar .itm-pu-body {
		padding: 12px 48px 12px 16px;
	}
}

/* ---------- Vorschau im Editor und im neuen Tab: geöffnet wie auf der Website ---------- */

html:has(.itm-pu-wrapper.is-demo) body {
	min-height: 620px;
	background: repeating-linear-gradient(180deg, #f6f7f7 0, #f6f7f7 22px, #eceef0 22px, #eceef0 24px);
}
