/**
 * Woo YouTube Product Gallery — frontend styles.
 *
 * Scoped to .wypg- classes so themes such as Woostify and Elementor layouts are
 * left untouched.
 */

.wypg-slide {
	position: relative;
}

.wypg-slide__trigger {
	position: relative;
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: inherit;
	background: #000;
	color: inherit;
	font: inherit;
	line-height: 0;
	cursor: pointer;
	overflow: hidden;
	-webkit-appearance: none;
	appearance: none;
}

.wypg-slide__trigger:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 2px;
}

.wypg-slide__poster {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
	/* YouTube poster images are 4:3 with letterboxing; crop to a clean frame. */
	aspect-ratio: 4 / 3;
	object-fit: cover;
	transition: transform 0.35s ease, opacity 0.35s ease;
}

.wypg-slide__trigger:hover .wypg-slide__poster,
.wypg-slide__trigger:focus-visible .wypg-slide__poster {
	transform: scale( 1.03 );
	opacity: 0.85;
}

.wypg-slide__play {
	position: absolute;
	top: 50%;
	left: 50%;
	display: block;
	width: 68px;
	height: 48px;
	transform: translate( -50%, -50% );
	pointer-events: none;
	filter: drop-shadow( 0 2px 10px rgba( 0, 0, 0, 0.35 ) );
	transition: transform 0.25s ease;
}

.wypg-slide__trigger:hover .wypg-slide__play,
.wypg-slide__trigger:focus-visible .wypg-slide__play {
	transform: translate( -50%, -50% ) scale( 1.1 );
}

.wypg-icon-play {
	display: block;
	width: 100%;
	height: 100%;
}

.wypg-icon-play__body {
	fill: #212121;
	fill-opacity: 0.82;
	transition: fill 0.2s ease, fill-opacity 0.2s ease;
}

.wypg-slide__trigger:hover .wypg-icon-play__body,
.wypg-slide__trigger:focus-visible .wypg-icon-play__body {
	fill: #f00;
	fill-opacity: 1;
}

.wypg-icon-play__arrow {
	fill: #fff;
}

/* Thumbnail strip badge (Flexslider control nav). */
.woocommerce-product-gallery .flex-control-thumbs li.wypg-thumb-video,
.woocommerce-product-gallery .flex-control-nav li.wypg-thumb-video {
	position: relative;
}

.woocommerce-product-gallery .flex-control-thumbs li.wypg-thumb-video::after,
.woocommerce-product-gallery .flex-control-nav li.wypg-thumb-video::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 26px;
	height: 18px;
	transform: translate( -50%, -50% );
	border-radius: 5px;
	background-color: rgba( 33, 33, 33, 0.82 );
	background-image: url( 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23ffffff" d="M9 7.5v9l7.5-4.5z"/></svg>' );
	background-repeat: no-repeat;
	background-position: center;
	background-size: 16px 16px;
	pointer-events: none;
}

/* Lightbox. */
.wypg-lightbox[hidden] {
	display: none;
}

.wypg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 2147483000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp( 12px, 4vw, 48px );
	opacity: 0;
	transition: opacity 0.2s ease;
}

.wypg-lightbox.is-open {
	opacity: 1;
}

.wypg-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 8, 8, 8, 0.92 );
	cursor: pointer;
}

.wypg-lightbox__dialog {
	position: relative;
	width: min( 1100px, 100% );
	max-height: 100%;
	transform: translateY( 12px );
	transition: transform 0.25s ease;
}

.wypg-lightbox.is-open .wypg-lightbox__dialog {
	transform: none;
}

.wypg-lightbox__frame {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	max-height: 82vh;
	margin: 0 auto;
	border-radius: 8px;
	background: #000;
	overflow: hidden;
}

.wypg-lightbox__iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.wypg-lightbox__loading {
	position: absolute;
	top: 50%;
	left: 50%;
	margin: 0;
	transform: translate( -50%, -50% );
	color: #fff;
	font-size: 14px;
	letter-spacing: 0.02em;
}

.wypg-lightbox__close {
	position: absolute;
	top: -44px;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.12 );
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease;
}

.wypg-lightbox__close:hover,
.wypg-lightbox__close:focus-visible {
	background: rgba( 255, 255, 255, 0.28 );
}

.wypg-lightbox__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

@media ( max-width: 782px ) {
	.wypg-lightbox__close {
		top: -40px;
		right: 50%;
		transform: translateX( 50% );
	}
}

html.wypg-scroll-locked,
html.wypg-scroll-locked body {
	overflow: hidden;
	touch-action: none;
}

@media ( prefers-reduced-motion: reduce ) {
	.wypg-slide__poster,
	.wypg-slide__play,
	.wypg-lightbox,
	.wypg-lightbox__dialog,
	.wypg-icon-play__body {
		transition: none;
	}

	.wypg-slide__trigger:hover .wypg-slide__poster,
	.wypg-slide__trigger:hover .wypg-slide__play {
		transform: none;
	}
}
