/* ================================================================
   E2A Lightbox for Divi
   (c) Easy2Access  https://easy2access.co.za
   ================================================================ */

/* ── On-page: lightbox-enabled modules show only the overlay ───── */

/* Hide the actual video/iframe so only the placeholder is visible */
[data-e2a-lightbox="on"] .et_pb_video_box {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
}

/* Make the overlay visible and sized by its own background image */
[data-e2a-lightbox="on"] .et_pb_video_overlay {
	position: relative !important;
	display: block !important;
	width: 100%;
	padding-bottom: 56.25%; /* 16:9 fallback ratio */
	background-size: cover;
	background-position: center;
	cursor: pointer;
}

[data-e2a-lightbox="on"] .et_pb_video_overlay .et_pb_video_overlay_hover {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ── Lightbox overlay ──────────────────────────────────────────── */

.e2a-video-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	background: rgba(0, 0, 0, 0);
	transition: background 0.3s ease;
}

.e2a-video-lightbox.is-visible {
	display: flex;
}

.e2a-video-lightbox.is-open {
	background: rgba(0, 0, 0, 0.92);
}

/* Backdrop (click to close) */
.e2a-video-lightbox-backdrop {
	position: absolute;
	inset: 0;
	cursor: pointer;
}

/* Centered content wrapper — width & max-width set by JS from module settings */
.e2a-video-lightbox-wrap {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 90vw;
	max-width: 960px;
	max-height: calc(100vh - 24px);
	max-height: calc(100dvh - 24px);
	opacity: 0;
	transform: scale(0.95);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.e2a-video-lightbox.is-open .e2a-video-lightbox-wrap {
	opacity: 1;
	transform: scale(1);
}

/* Video container — dimensions set by JS to always fit viewport */
.e2a-video-lightbox-inner {
	position: relative;
	width: 100%;
	flex: 0 0 auto;
	background: #000;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
	border-radius: 6px;
	overflow: hidden;
}

.e2a-video-lightbox-inner iframe,
.e2a-video-lightbox-inner video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ── X button – top right ──────────────────────────────────────── */

.e2a-video-lightbox-close-x {
	position: absolute;
	top: -42px;
	right: 0;
	z-index: 3;
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	line-height: 1;
	color: #fff !important;
	background: rgba(255, 255, 255, 0.25);
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.e2a-video-lightbox-close-x:hover,
.e2a-video-lightbox-close-x:focus {
	background: rgba(255, 255, 255, 0.45);
	border-color: #fff;
	outline: none;
}

/* ── Close button – bottom (always visible) ────────────────────── */

.e2a-video-lightbox-close-btn {
	flex: 0 0 auto;
	margin-top: 14px;
	padding: 10px 36px;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: #fff;
	background: rgba(255, 255, 255, 0.15);
	border: 2px solid rgba(255, 255, 255, 0.45);
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.e2a-video-lightbox-close-btn:hover,
.e2a-video-lightbox-close-btn:focus {
	background: rgba(255, 255, 255, 0.28);
	border-color: #fff;
	outline: none;
}

/* ── Lock page scroll while open ───────────────────────────────── */

body.e2a-lightbox-open {
	overflow: hidden !important;
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 1024px) {
	.e2a-video-lightbox-close-x {
		top: -38px;
		width: 36px;
		height: 36px;
		font-size: 24px;
	}
}

@media (max-width: 767px) {
	.e2a-video-lightbox-close-x {
		top: -34px;
		width: 32px;
		height: 32px;
		font-size: 22px;
	}
	.e2a-video-lightbox-close-btn {
		margin-top: 10px;
		padding: 8px 28px;
		font-size: 14px;
	}
}

@media (max-height: 500px) {
	.e2a-video-lightbox-close-x {
		top: -30px;
		width: 28px;
		height: 28px;
		font-size: 18px;
	}
	.e2a-video-lightbox-close-btn {
		margin-top: 6px;
		padding: 6px 20px;
		font-size: 12px;
	}
}
