.pp-icon {
	display: inline-block;
	line-height: 1;
	text-align: center;
	transition: all 0.3s;
}

.pp-icon i,
.pp-icon svg {
	width: 1em;
	height: 1em;
	position: relative;
	display: block;
}

.pp-modal-popup-link {
	cursor: pointer;
}

.pp-modal-popup-button {
	cursor: pointer;
}

.pp-modal-popup-wrap {
	display: inline-block;
}

// Full-viewport backdrop layer; replaces Magnific's mfp-bg + mfp-wrap.
.pp-modal-popup-overlay {
	position: fixed;
	inset: 0;
	z-index: 1042;
	display: none;
	overflow: auto;
	background: rgba(11, 11, 11, 0.8);
	outline: none;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;

	&:focus,
	&:focus-visible {
		outline: none;
	}

	&.pp-modal-popup-active {
		display: block;
	}

	&.pp-no-overlay {
		background: transparent;
	}
}

// Centering layer inside the overlay.
.pp-modal-popup-container {
	box-sizing: border-box;
	width: 100%;
	min-height: 100%;
	padding: 40px 8px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pp-modal-popup-window {
	background: #fff;
	box-sizing: border-box;
	max-width: 100%;
	margin: 0 auto;
	padding: 20px;
	position: relative;
	width: 100%;

	p:last-child {
		margin-bottom: 0;
	}

	img.pp-modal-popup-img {
		padding: 0;
		max-width: 100%;
		height: auto;
		display: block;
	}
}

// Iframe placeholder — kept hidden until window is sized; aspect-ratio handles 16:9.
.pp-modal-popup-iframe-scaler {
	width: 100%;
	overflow: hidden;
	aspect-ratio: 16 / 9;

	iframe {
		display: block;
		width: 100%;
		height: 100%;
		border: 0;
		background: #000;
	}
}

.pp-popup-content {
	overflow: hidden;
}

// Close button — replaces .mfp-close.
.pp-modal-popup-close {
	position: absolute;
	top: 0;
	inset-inline-end: 0;
	background: transparent;
	border: 0;
	cursor: pointer;
	box-sizing: content-box;
	padding: 0;
	width: auto;
	height: auto;
	line-height: 1;
	color: #333;
	font-size: 28px;
	font-style: normal;
	font-family: Arial, Baskerville, monospace;
	opacity: 0.65;
	text-align: center;
	text-decoration: none;
	transition: all 0.5s;
	z-index: 1046;
	-webkit-appearance: none;
	appearance: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	user-select: none;
	touch-action: manipulation;

	&:hover,
	&:focus {
		opacity: 1;
	}
}

// Layouts.
.pp-modal-popup-fullscreen {

	.pp-modal-popup-container {
		padding: 0;
		align-items: stretch;
	}

	.pp-modal-popup-window {
		max-width: 100%;
		width: 100%;
		min-height: 100vh;
	}
}

// Close button position variants.
// Box-* — close button rendered inside `.pp-modal-popup-window`; absolute
// positioning is relative to the window box.
// Win-* — close button rendered as a direct child of `.pp-modal-popup-overlay`;
// the overlay is `position: fixed` so absolute positioning resolves against
// the viewport, placing the button visually outside the popup window.

.box-top-left .pp-modal-popup-window > .pp-modal-popup-close {
	top: 0;
	inset-inline-start: 0;
	inset-inline-end: auto;
}

.pp-modal-popup-overlay.win-top-right > .pp-modal-popup-close,
.pp-modal-popup-overlay.win-top-left > .pp-modal-popup-close {
	top: 50px;
}

.pp-modal-popup-overlay.win-top-right > .pp-modal-popup-close {
	inset-inline-end: 50px;
}

.pp-modal-popup-overlay.win-top-left > .pp-modal-popup-close {
	inset-inline-start: 50px;
	inset-inline-end: auto;
}

// Lock body scroll while a popup is active (added by JS handler).
html.pp-modal-popup-prevent-scroll,
html.pp-modal-popup-prevent-scroll body {
	overflow: hidden;
}

// Entrance animations — applied to the overlay alongside state classes.
// Class names retain legacy `mfp-` prefix for backward compatibility with saved
// widget settings (the value stored in `popup_animation_in`). These are no
// longer tied to Magnific Popup — keyframes are defined here, not externally.
// State machine on overlay:
//   .pp-modal-popup-active                                   — visible, start.
//   .pp-modal-popup-active.pp-modal-popup-ready              — animate in.
//   .pp-modal-popup-active.pp-modal-popup-removing           — animate out.

.mfp-zoom-in {

	&.pp-modal-popup-active {
		opacity: 0;
		transition: opacity 0.3s ease-out;

		.pp-modal-popup-window {
			opacity: 0;
			transform: scale(0.8);
			transition: all 0.2s ease-in-out;
		}

		&.pp-modal-popup-ready {
			opacity: 1;

			.pp-modal-popup-window {
				opacity: 1;
				transform: scale(1);
			}
		}

		&.pp-modal-popup-removing {
			opacity: 0;

			&:not([class*="pp-anim-out-"]) .pp-modal-popup-window {
				transform: scale(0.8);
				opacity: 0;
			}
		}
	}
}

.mfp-zoom-out {

	&.pp-modal-popup-active {
		opacity: 0;
		transition: opacity 0.3s ease-out;

		.pp-modal-popup-window {
			opacity: 0;
			transform: scale(1.3);
			transition: all 0.3s ease-in-out;
		}

		&.pp-modal-popup-ready {
			opacity: 1;

			.pp-modal-popup-window {
				opacity: 1;
				transform: scale(1);
			}
		}

		&.pp-modal-popup-removing {
			opacity: 0;

			&:not([class*="pp-anim-out-"]) .pp-modal-popup-window {
				transform: scale(1.3);
				opacity: 0;
			}
		}
	}
}

.mfp-move-from-top {

	&.pp-modal-popup-active {
		opacity: 0;
		transition: opacity 0.2s;

		.pp-modal-popup-window {
			opacity: 0;
			transform: translateY(-80%);
			transition: all 0.2s;
		}

		&.pp-modal-popup-ready {
			opacity: 1;

			.pp-modal-popup-window {
				opacity: 1;
				transform: translateY(0);
			}
		}

		&.pp-modal-popup-removing {
			opacity: 0;

			&:not([class*="pp-anim-out-"]) .pp-modal-popup-window {
				transform: translateY(-80%);
				opacity: 0;
			}
		}
	}
}

.mfp-3d-unfold {

	&.pp-modal-popup-active {
		opacity: 0;
		transition: opacity 0.5s;

		.pp-modal-popup-container {
			perspective: 2000px;
		}

		.pp-modal-popup-window {
			opacity: 0;
			transform-style: preserve-3d;
			transform: rotateY(-60deg);
			transition: all 0.3s ease-in-out;
		}

		&.pp-modal-popup-ready {
			opacity: 1;

			.pp-modal-popup-window {
				opacity: 1;
				transform: rotateY(0deg);
			}
		}

		&.pp-modal-popup-removing {
			opacity: 0;

			&:not([class*="pp-anim-out-"]) .pp-modal-popup-window {
				transform: rotateY(60deg);
				opacity: 0;
			}
		}
	}
}

.mfp-move-right {

	&.pp-modal-popup-active {
		opacity: 0;
		transition: opacity 0.3s;

		.pp-modal-popup-window {
			opacity: 0;
			transform: translateX(-100px);
			transition: all 0.3s;
		}

		&.pp-modal-popup-ready {
			opacity: 1;

			.pp-modal-popup-window {
				opacity: 1;
				transform: translateX(0);
			}
		}

		&.pp-modal-popup-removing {
			opacity: 0;

			&:not([class*="pp-anim-out-"]) .pp-modal-popup-window {
				transform: translateX(100px);
				opacity: 0;
			}
		}
	}
}

.mfp-move-left {

	&.pp-modal-popup-active {
		opacity: 0;
		transition: opacity 0.3s;

		.pp-modal-popup-window {
			opacity: 0;
			transform: translateX(100px);
			transition: all 0.3s;
		}

		&.pp-modal-popup-ready {
			opacity: 1;

			.pp-modal-popup-window {
				opacity: 1;
				transform: translateX(0);
			}
		}

		&.pp-modal-popup-removing {
			opacity: 0;

			&:not([class*="pp-anim-out-"]) .pp-modal-popup-window {
				transform: translateX(-100px);
				opacity: 0;
			}
		}
	}
}

.mfp-newspaper {

	&.pp-modal-popup-active {
		opacity: 0;
		transition: opacity 0.5s;

		.pp-modal-popup-window {
			opacity: 0;
			transform: scale(0) rotate(500deg);
			transition: all 0.5s;
		}

		&.pp-modal-popup-ready {
			opacity: 1;

			.pp-modal-popup-window {
				opacity: 1;
				transform: scale(1) rotate(0deg);
			}
		}

		&.pp-modal-popup-removing {
			opacity: 0;

			&:not([class*="pp-anim-out-"]) .pp-modal-popup-window {
				transform: scale(0) rotate(500deg);
				opacity: 0;
			}
		}
	}
}

// Exit animations — applied to overlay when `popup_animation_out` is set.
// Each definition only describes the exit (removing) state.

.pp-modal-popup-overlay[class*="pp-anim-out-"] {

	&.pp-modal-popup-removing {

		.pp-modal-popup-window {
			transition: all 0.3s ease-in-out;
		}
	}
}

.pp-anim-out-zoom-in.pp-modal-popup-removing .pp-modal-popup-window {
	opacity: 0;
	transform: scale(0.8);
}

.pp-anim-out-zoom-out.pp-modal-popup-removing .pp-modal-popup-window {
	opacity: 0;
	transform: scale(1.3);
}

.pp-anim-out-move-from-top.pp-modal-popup-removing .pp-modal-popup-window {
	opacity: 0;
	transform: translateY(-80%);
}

.pp-anim-out-3d-unfold.pp-modal-popup-removing .pp-modal-popup-window {
	opacity: 0;
	transform: rotateY(60deg);
	transform-style: preserve-3d;
}

.pp-anim-out-move-right.pp-modal-popup-removing .pp-modal-popup-window {
	opacity: 0;
	transform: translateX(100px);
}

.pp-anim-out-move-left.pp-modal-popup-removing .pp-modal-popup-window {
	opacity: 0;
	transform: translateX(-100px);
}

.pp-anim-out-newspaper.pp-modal-popup-removing .pp-modal-popup-window {
	opacity: 0;
	transform: scale(0) rotate(500deg);
}
