/* ==========================================================================
   Lightweight YouTube Video Popup - Popup Styles
   ========================================================================== */

/* --- Overlay Backdrop --- */
.wpyt-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.85);
	-webkit-backdrop-filter: blur(5px);
	backdrop-filter: blur(5px);
	display: flex;
	justify-content: center;
	align-items: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
	/* Higher than most WP themes to ensure the overlay sits on top. */
	z-index: 999999;
}

.wpyt-overlay.wpyt-active {
	opacity: 1;
	pointer-events: auto;
}

/* --- Modal Container --- */
.wpyt-popup {
	position: relative;
	width: 90%;
	max-width: 1000px;
	background: #000;
	border-radius: 10px;
}

/* --- 16:9 Aspect Ratio Wrapper --- */
.wpyt-video-wrapper {
	position: relative;
	padding-bottom: 56.25%;
	height: 0;
}

.wpyt-video-wrapper iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: 8px;
}

/* --- Close Button --- */
.wpyt-close-btn {
	position: absolute;
	top: -45px;
	right: 0;
	background: none;
	border: none;
	color: #fff;
	font-size: 40px;
	cursor: pointer;
	line-height: 1;
}

.wpyt-close-btn:hover {
	/* Fallback to red if the theme primary color variable is not defined. */
	color: var(--wp--preset--color--primary, #cc0000);
}

/* ==========================================================================
   Thumbnail Figure Block — class: cjb-video-popup
   ========================================================================== */

/* 1. Reset default WordPress figure margins. */
figure.cjb-video-popup {
	margin: 0;
}

/* 2. Force the link to fill the image bounds and clip the zoom effect. */
figure.cjb-video-popup a {
	position: relative;
	display: block;
	cursor: pointer;
	overflow: hidden;
	border-radius: 10px;
}

/* 3. Smooth zoom transition on the image itself. */
figure.cjb-video-popup img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* 4. Play button — circle background. */
figure.cjb-video-popup a::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(1);
	width: 65px;
	height: 65px;
	background: rgba(0, 0, 0, 0.75);
	border: 3px solid #ffffff;
	border-radius: 50%;
	z-index: 10;
	transition: all 0.3s ease;
	pointer-events: none;
}

/* 5. Play button — triangle arrow. */
figure.cjb-video-popup a::after {
	content: '';
	position: absolute;
	top: 50%;
	/* Optical centering adjustment for the triangle shape. */
	left: 50.5%;
	transform: translate(-50%, -50%);
	width: 0;
	height: 0;
	border-top: 12px solid transparent;
	border-bottom: 12px solid transparent;
	border-left: 20px solid #ffffff;
	z-index: 11;
	transition: all 0.3s ease;
	pointer-events: none;
}

/* --- Hover States --- */

/* Highlight circle with theme primary color and scale it forward. */
figure.cjb-video-popup a:hover::before {
	/* Fallback to red if the theme primary color variable is not defined. */
	background: var(--wp--preset--color--primary, #cc0000);
	border-color: #ffffff;
	transform: translate(-50%, -50%) scale(1.1);
	box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

/* Keep the triangle white on hover. */
figure.cjb-video-popup a:hover::after {
	border-left-color: #ffffff;
}

/* Zoom image slightly, clipped by the link's overflow:hidden. */
figure.cjb-video-popup a:hover img {
	transform: scale(1.05);
}
