/**
 * LIKA Product Video — front end.
 * Colours follow the theme tokens where they exist, with literal fallbacks so
 * the plugin still looks right if it is ever loaded outside the lika theme.
 */

/* --------------------------------------------------------- gallery slide -- */

.lpv-slide {
	position: relative;
}

.lpv-stage {
	position: relative;
	aspect-ratio: var(--lpv-ratio, 1 / 1);
	overflow: hidden;
	background: var(--lika-cream, #fbf7f4);
	border-radius: inherit;
}

.lpv-video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Controls -------------------------------------------------------------- */

.lpv-btn {
	position: absolute;
	display: grid;
	place-items: center;
	border: 0;
	cursor: pointer;
	color: #fff;
	background: rgba(20, 26, 25, 0.55);
	backdrop-filter: blur(4px);
	border-radius: 999px;
	padding: 0;
	transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.lpv-btn:hover,
.lpv-btn:focus-visible {
	background: var(--lika-brand, #0e6b63);
}

.lpv-btn:focus-visible {
	outline: 2px solid var(--lika-brand, #0e6b63);
	outline-offset: 2px;
}

.lpv-btn svg {
	width: 60%;
	height: 60%;
}

/* Sound sits in the inline-start bottom corner — RTL aware, so it never lands
   on top of WooCommerce's zoom/lightbox trigger in the opposite corner. */
.lpv-sound {
	inset-block-end: 12px;
	inset-inline-start: 12px;
	width: 38px;
	height: 38px;
}

.lpv-play {
	inset-block-end: 50%;
	inset-inline-start: 50%;
	transform: translate(50%, 50%);
	width: 62px;
	height: 62px;
}

.lpv-play:hover,
.lpv-play:focus-visible {
	transform: translate(50%, 50%) scale(1.06);
}

/* Only one of the two speaker icons shows at a time. */
.lpv-icon-loud,
.lpv-stage.is-loud .lpv-icon-muted {
	display: none;
}

.lpv-stage.is-loud .lpv-icon-loud {
	display: block;
}

/* ------------------------------------------ lika-quantity-pricing gallery -- */

/* The LQP stage is a single swapping <img>, so the video sits on top of it and
   is toggled rather than scrolled to. */
.lpv-stage--lqp {
	position: absolute;
	inset: 0;
	aspect-ratio: auto; /* fills the stage frame the image already sized */
	display: none;
	z-index: 2;
	background: var(--lika-cream, #fbf7f4);
}

.lpv-stage--lqp.is-showing {
	display: block;
}

.lqpd-stage-frame {
	position: relative;
}

/* Video thumb: same box as LQP's image thumbs, plus a play marker. */
.lpv-thumb {
	position: relative;
}

.lpv-thumb-badge {
	position: absolute;
	inset-block-end: 4px;
	inset-inline-end: 4px;
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
	border-radius: 999px;
	color: #fff;
	background: rgba(20, 26, 25, 0.6);
	pointer-events: none;
}

.lpv-thumb-badge svg {
	width: 10px;
	height: 10px;
	margin-inline-start: 1px;
}

/* ------------------------------------------------------------ card hover -- */

.p-card-media {
	position: relative;
}

.lpv-card-video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity 0.28s ease;
	pointer-events: none;
	z-index: 1;
}

.p-card-media.lpv-playing .lpv-card-video {
	opacity: 1;
}

/* Marker shown until the clip actually starts — it covers the gap between the
   card appearing and the video decoding its first frame. */
.lpv-card-badge {
	position: absolute;
	inset-block-start: 10px;
	inset-inline-start: 10px;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border-radius: 999px;
	color: #fff;
	background: rgba(20, 26, 25, 0.5);
	backdrop-filter: blur(3px);
	transition: opacity 0.2s ease;
}

.lpv-card-badge svg {
	width: 14px;
	height: 14px;
	margin-inline-start: 1px; /* optical centring of the triangle */
}

.p-card-media.lpv-playing .lpv-card-badge {
	opacity: 0;
}

/* --------------------------------------------------------- accessibility -- */

@media (prefers-reduced-motion: reduce) {
	.lpv-card-video {
		display: none;
	}

	.lpv-btn {
		transition: none;
	}
}
