/* Product video (Vimeo) — see lib/product-video.php */

/* Card: the video covers the card image, which stays underneath as the poster.
   inline-block (not block) so the link stays the image's width, like other cards. */
.product-item .productImg.has-video {
	position: relative;
	display: inline-block;
}

.matat-video--card {
	position: absolute;
	inset: 0;
	overflow: hidden;
	container-type: size;
	pointer-events: none;
	z-index: 0;
}

/* Crop the player to the card / slide shape (like object-fit: cover), using the video ratio --vr. */
.matat-video--card iframe,
.matat-video--gallery iframe {
	position: absolute;
	top: 50%;
	left: 50%;
	width: max(100cqw, 100cqh * var(--vr, 1.7778));
	height: max(100cqh, 100cqw / var(--vr, 1.7778));
	transform: translate(-50%, -50%);
	border: 0;
	opacity: 0;
	transition: opacity .4s ease;
}

.matat-video.is-loaded iframe {
	opacity: 1;
}

/* Product page gallery slide: same shape as the main image, video cropped to fill. */
.matat-video--gallery {
	position: relative;
	width: 100%;
	overflow: hidden;
	container-type: size;
	background: #fff;
	box-shadow: 1px 0 10px 4px rgba(0, 0, 0, .04);
}

/* Same height cap as the gallery images (style.css, .single-product-slider .slick-slide img). */
@media (min-width: 768px) {
	.matat-video--gallery {
		max-height: 564px;
	}
}

.single-product-slider .matat-video--gallery .matat-video__poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Sits over the player so swipes still move the slider and a tap plays / pauses. */
.matat-video__tap {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

/* Play icon on the poster and on the video's thumbnail. */
.matat-video--gallery:not(.is-loaded) .matat-video__tap::after,
.matat-video-thumb::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 3rem;
	height: 3rem;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: rgba(0, 0, 0, .45) url("data:image/svg+xml,%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 / 55% no-repeat;
	pointer-events: none;
}

.matat-video-thumb {
	position: relative;
}

.matat-video-thumb::after {
	width: 1.75rem;
	height: 1.75rem;
}
