/* Simple Product Video for WooCommerce - frontend styles */

/* Player wrapper: the aspect ratio is passed as a CSS variable from PHP. */
.spv-video {
	--spv-aspect-ratio: 16 / 9;
	position: relative;
	display: block;
	box-sizing: border-box;
	width: 100%;
	margin: 0 auto;
}

.spv-video__frame {
	position: relative;
	width: 100%;
	aspect-ratio: var(--spv-aspect-ratio);
	overflow: hidden;
	background: #000;
}

.spv-video__frame > iframe,
.spv-video__frame > video,
.spv-video__frame > .spv-video__media {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Click-to-load thumbnail shown until the visitor presses play. */
.spv-video__frame > .spv-video__facade {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #000;
	cursor: pointer;
	display: block;
	overflow: hidden;
}

.spv-video__facade .spv-video__poster {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.spv-video__play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 68px;
	height: 48px;
	margin: -24px 0 0 -34px;
	border-radius: 12px;
	background: rgba(0, 0, 0, 0.65) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M8 5v14l11-7z'/%3E%3C/svg%3E") center / 28px 28px no-repeat;
	transition: background-color 0.2s ease;
}

.spv-video__facade:hover .spv-video__play,
.spv-video__facade:focus-visible .spv-video__play {
	background-color: rgba(0, 0, 0, 0.9);
}

.spv-video__facade:focus-visible {
	outline: 3px solid #fff;
	outline-offset: -3px;
}

/* Fallback for browsers without aspect-ratio support. */
@supports not (aspect-ratio: 16 / 9) {
	.spv-video__frame {
		height: 0;
		padding-bottom: 56.25%;
	}
}

/* Shortcode placement inside the product description. */
.spv-video--shortcode {
	margin: 1.5em auto;
}

/* Gallery slide. */
.woocommerce-product-gallery__image.spv-gallery-video {
	background: #000;
}

.woocommerce-product-gallery__image.spv-gallery-video .spv-video {
	margin: 0;
}

/* Play badge on the FlexSlider thumbnail of a video slide. */
.flex-control-thumbs li.spv-thumb-video {
	position: relative;
}

.flex-control-thumbs li.spv-thumb-video::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 32px;
	height: 32px;
	margin: -16px 0 0 -16px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M8 5v14l11-7z'/%3E%3C/svg%3E") center / 14px 14px no-repeat;
	pointer-events: none;
}

/* Video slide inside the WooCommerce PhotoSwipe lightbox. */
.pswp .spv-pswp-video {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 44px 16px;
}

.pswp .spv-pswp-video .spv-video {
	width: 100%;
	max-width: calc((100vh - 88px) * var(--spv-aspect-ratio));
	margin: 0;
}
