/*
 * Dazzolite Promotional Video Popup
 * All selectors are namespaced with .dz-promo-popup to avoid theme/plugin conflicts.
 */

.dz-promo-popup[hidden] {
	display: none !important;
}

.dz-promo-popup {
	--dz-overlay-opacity: 0.75;
	--dz-max-width: 1600px;

	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	overscroll-behavior: contain;
	touch-action: none;
	-webkit-tap-highlight-color: transparent;
}

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

/* Dark overlay: fades in */
.dz-promo-popup .dz-promo-popup__overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
	background: rgba(0, 0, 0, var(--dz-overlay-opacity));
	opacity: 0;
	transition: opacity 0.35s ease;
	cursor: pointer;
}

.dz-promo-popup.is-open .dz-promo-popup__overlay {
	opacity: 1;
}

/* Dialog: subtle fade + scale. Size = fit inside 90vw / max width / 85vh while keeping the video ratio. */
.dz-promo-popup .dz-promo-popup__dialog {
	--dz-ratio: 1.9124; /* 1920 x 1004, replaced with the real ratio once video metadata loads */

	position: relative;
	z-index: 2;
	width: min(90vw, var(--dz-max-width), calc(85vh * var(--dz-ratio)));
	height: auto;
	max-height: 85vh;
	aspect-ratio: var(--dz-ratio);
	margin: 0;
	padding: 0;
	opacity: 0;
	transform: translateY(10px) scale(0.965);
	transition: opacity 0.4s ease 0.05s, transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) 0.05s;
	will-change: opacity, transform;
}

@supports (height: 1dvh) {
	.dz-promo-popup .dz-promo-popup__dialog {
		width: min(90vw, var(--dz-max-width), calc(85dvh * var(--dz-ratio)));
		max-height: 85dvh;
	}
}

.dz-promo-popup.is-open .dz-promo-popup__dialog {
	opacity: 1;
	transform: none;
}

/* Media wrapper clips the video corners; the close button sits outside it. */
.dz-promo-popup .dz-promo-popup__media {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 10px;
	background: #000;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

/* Video: no pointer interaction, so taps/clicks never reveal native controls. */
.dz-promo-popup .dz-promo-popup__video {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #000;
	object-fit: contain;
	pointer-events: none;
	outline: 0;
}

/* Suppress native playback UI wherever the browser supports it (each rule separate on purpose). */
.dz-promo-popup .dz-promo-popup__video::-webkit-media-controls {
	display: none !important;
}
.dz-promo-popup .dz-promo-popup__video::-webkit-media-controls-enclosure {
	display: none !important;
}
.dz-promo-popup .dz-promo-popup__video::-webkit-media-controls-panel {
	display: none !important;
}
.dz-promo-popup .dz-promo-popup__video::-webkit-media-controls-overlay-play-button {
	display: none !important;
}
.dz-promo-popup .dz-promo-popup__video::-webkit-media-controls-start-playback-button {
	display: none !important;
	-webkit-appearance: none;
}
.dz-promo-popup .dz-promo-popup__video::-moz-media-controls {
	display: none !important;
}

/* Close button (desktop): white circle, black X, 42px, just outside the top-right corner. */
.dz-promo-popup .dz-promo-popup__close {
	position: absolute;
	top: -18px;
	right: -18px;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.14) !important;
	border-radius: 50% !important;
	background: #fff !important;
	color: #000 !important;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.38);
	line-height: 1;
	text-decoration: none;
	text-transform: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dz-promo-popup .dz-promo-popup__close:hover,
.dz-promo-popup .dz-promo-popup__close:active,
.dz-promo-popup .dz-promo-popup__close:focus {
	border: 1px solid rgba(0, 0, 0, 0.14) !important;
	background: #fff !important;
	color: #000 !important;
}

.dz-promo-popup .dz-promo-popup__close:hover {
	transform: scale(1.07);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.dz-promo-popup .dz-promo-popup__close:focus {
	outline: none;
}

.dz-promo-popup .dz-promo-popup__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
	box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.65), 0 4px 16px rgba(0, 0, 0, 0.38);
}

.dz-promo-popup .dz-promo-popup__close svg {
	display: block;
	width: 16px;
	height: 16px;
	pointer-events: none;
}

/* Scroll lock while the popup is open (no layout shift: scrollbar width is compensated). */
html.dz-promo-popup-lock {
	overflow: hidden !important;
	padding-right: var(--dz-sbw, 0px);
}

html.dz-promo-popup-lock body {
	overflow: hidden !important;
	overscroll-behavior: none;
}

/* ---------- Mobile: 767px and below ---------- */
@media (max-width: 767px) {
	.dz-promo-popup {
		padding-top: env(safe-area-inset-top, 0px);
		padding-right: env(safe-area-inset-right, 0px);
		padding-bottom: env(safe-area-inset-bottom, 0px);
		padding-left: env(safe-area-inset-left, 0px);
	}

	.dz-promo-popup .dz-promo-popup__dialog {
		--dz-ratio: 0.8; /* 1080 x 1350 */

		width: min(94vw, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 12px), calc(82vh * var(--dz-ratio)));
		max-height: 82vh;
	}

	@supports (height: 1dvh) {
		.dz-promo-popup .dz-promo-popup__dialog {
			width: min(94vw, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 12px), calc(82dvh * var(--dz-ratio)));
			max-height: 82dvh;
		}
	}

	.dz-promo-popup .dz-promo-popup__media {
		border-radius: 8px;
	}

	/* Portrait: button sits fully above the upper-right corner so it can never be clipped at the screen edge. */
	.dz-promo-popup .dz-promo-popup__close {
		top: -46px;
		right: 0;
		width: 38px;
		height: 38px;
	}

	.dz-promo-popup .dz-promo-popup__close svg {
		width: 14px;
		height: 14px;
	}
}

/* Mobile landscape / very short screens: the dialog is narrow, so the button can sit on the corner. */
@media (max-width: 767px) and (orientation: landscape), (max-width: 767px) and (max-height: 520px) {
	.dz-promo-popup .dz-promo-popup__close {
		top: -16px;
		right: -16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dz-promo-popup .dz-promo-popup__overlay,
	.dz-promo-popup .dz-promo-popup__dialog,
	.dz-promo-popup .dz-promo-popup__close {
		transition: none !important;
	}

	.dz-promo-popup .dz-promo-popup__dialog {
		transform: none !important;
		will-change: auto;
	}
}
