/**
 * Carousel Reviews Block Styles
 *
 * Only rules that cannot be achieved with utility classes.
 */

.carousel-reviews__track {
	--carousel-right-bleed: max(0px, calc((calc(100vw) - 100%) / 2));
	margin-right: calc(-1 * var(--carousel-right-bleed));
	padding-right: var(--carousel-right-bleed);
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: none;
	-ms-overflow-style: none;
	scroll-snap-type: x mandatory;
	scroll-padding-inline-start: 0;
}

/* lg: desktop (1024px) */
@media (min-width: 64rem) {
	.carousel-reviews__track {
		--carousel-right-bleed: max(0px, calc((calc(100vw - 15px) - 100%) / 2));
	}
	.carousel-reviews__stats {
		max-width: fit-content;
	}
}

.carousel-reviews__track::-webkit-scrollbar {
	display: none;
}

/* 3-line clamp on review text */
.carousel-reviews__review-text {
	overflow: hidden;
	display: -webkit-box;
	line-clamp: 3;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
}

.carousel-reviews__review-text.is-expanded {
	overflow: visible;
	display: block;
	line-clamp: unset;
	-webkit-line-clamp: unset;
	-webkit-box-orient: unset;
}

.carousel-reviews__review-toggle {
	background: transparent;
	border: 0;
	padding: 0;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

/* Fixed min-width ensures cards snap correctly inside the carousel */
.carousel-reviews__card {
	flex: 0 0 auto;
	min-width: 280px;
	width: 280px;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.carousel-reviews__review-body {
	min-height: 95px;
}

/* Title two-tone — bold portions render darker, mirrors video-steps /
 * grid-treatments convention. Default text inherits the lighter slate-40. */
.carousel-reviews__title strong {
	color: var(--wp--preset--color--slate-20);
	font-weight: var(--wp--custom--typography--heading--font-weight);
}
.carousel-reviews__title p {
	margin: 0;
}
.carousel-reviews__title p + p {
	margin-top: var(--wp--preset--spacing--4);
}

a.carousel-reviews__badge {
	transition: background-color 0.2s ease;
}
a.carousel-reviews__badge:hover {
	background-color: var(--wp--preset--color--slate-90);
}

/* lg: desktop (1024px) */
@media (min-width: 64rem) {
	.carousel-reviews__card {
		min-width: 363px;
		width: 363px;
	}
	.carousel-reviews__card--video {
		min-width: 308px;
		width: 308px;
	}
}

.carousel-reviews__nav-btn {
	width: 2.25rem;
	height: 2.25rem;
	font-size: 1.125rem;
	line-height: 1;
	transition: background-color 0.2s ease;
}

.carousel-reviews__nav-btn:not([disabled]):hover {
	background-color: var(--wp--preset--color--slate-90);
}

.carousel-reviews__nav-btn[disabled] {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Centered layout when cards don't overflow (≤ 3 items) — desktop only.
   On mobile 3 cards still overflow, so the carousel scrolls as normal. */
@media (min-width: 64rem) {
	.carousel-reviews__track--centered {
		--carousel-right-bleed: 0px;
		justify-content: center;
		overflow-x: visible;
	}
}

/* Video review card — the thumbnail stays in flow so its 3:4 ratio sets the
 * row height and text cards stretch to match. Scrim gradients are block-local:
 * functional legibility washes, not reusable brand surfaces. */
.carousel-reviews__video-thumb {
	aspect-ratio: 3 / 4;
	cursor: pointer;
}

.carousel-reviews__card--video {
	min-width: 238px;
	width: 238px;
}

.carousel-reviews__video-scrim {
	height: 45%;
	z-index: 1;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.carousel-reviews__video-scrim--top {
	top: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 100%);
}

.carousel-reviews__video-scrim--bottom {
	bottom: 0;
	background: linear-gradient(0deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0) 100%);
}

.carousel-reviews__video-stars,
.carousel-reviews__video-meta {
	left: 0;
	right: 0;
	z-index: 2;
	padding-left: var(--wp--preset--spacing--20);
	padding-right: var(--wp--preset--spacing--20);
	transition: opacity 0.25s ease;
	/* Decorative — let clicks fall through to the tile so the whole video toggles. */
	pointer-events: none;
}

.carousel-reviews__video-stars {
	top: 0;
	padding-top: var(--wp--preset--spacing--20);
}

/* star-filled ships a fixed dark fill; force the overlaid stars white. */
.carousel-reviews__video-stars svg {
	filter: brightness(0) invert(1);
}

.carousel-reviews__video-meta {
	bottom: 0;
	padding-bottom: var(--wp--preset--spacing--20);
}

/* Text-card insets match the video overlay insets so stars and name align. */
.carousel-reviews__card--text {
	padding-top: var(--wp--preset--spacing--20);
	padding-bottom: var(--wp--preset--spacing--20);
}

/* Playhead — centered white circle; play/pause icons swap on state, fades out
 * while playing and returns on hover. */
.felix-video__play-btn {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 52px;
	height: 52px;
	z-index: 2;
	border: none;
	border-radius: 9999px;
	background: rgba(255, 255, 255, 0.8);
	-webkit-backdrop-filter: blur(60px);
	backdrop-filter: blur(60px);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--wp--preset--color--slate-20);
	transition: opacity 0.25s ease;
}

.felix-video__pause-icon {
	display: none;
}

.carousel-reviews__video-thumb.is-playing .felix-video__play-icon {
	display: none;
}

.carousel-reviews__video-thumb.is-playing .felix-video__pause-icon {
	display: block;
}

.carousel-reviews__video-thumb.is-playing .felix-video__play-btn {
	opacity: 0;
}

.carousel-reviews__video-thumb.is-playing:hover .felix-video__play-btn,
.carousel-reviews__video-thumb.is-playing:focus-within .felix-video__play-btn {
	opacity: 1;
}

/* Just after click-to-play the cursor is already over the tile — keep the pause
 * control hidden until a later, deliberate hover (cursor leaves and returns). */
.carousel-reviews__video-thumb.is-playing.is-fresh-play:hover .felix-video__play-btn {
	opacity: 0;
}

.felix-video__media {
	z-index: 1;
}

.carousel-reviews__video-thumb video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Progress ring — bottom-right, revealed only while playing. */
.felix-video__progress {
	position: absolute;
	right: var(--wp--preset--spacing--12);
	bottom: var(--wp--preset--spacing--12);
	width: var(--wp--preset--spacing--20);
	height: var(--wp--preset--spacing--20);
	z-index: 3;
	pointer-events: none;
	opacity: 0;
	transform: rotate(-90deg);
	transition: opacity 0.25s ease;
}

.carousel-reviews__video-thumb.is-playing .felix-video__progress {
	opacity: 1;
}

/* When native controls are exposed for keyboard/AT users, the custom ring would
 * collide with the native control bar — let the native UI own progress. */
.carousel-reviews__video-thumb.is-native-controls .felix-video__progress {
	display: none;
}

.felix-video__progress-track {
	fill: none;
	stroke: color-mix(in srgb, var(--wp--preset--color--slate-20) 50%, transparent);
	stroke-width: 2;
}

.felix-video__progress-bar {
	fill: none;
	stroke: var(--wp--preset--color--white);
	stroke-width: 2;
	stroke-linecap: round;
	/* Bridge the gaps between throttled timeupdate events for smooth motion. */
	transition: stroke-dashoffset 0.3s linear;
}

/* Overlays clear while the video plays. The `is-video-playing` class (toggled in
 * JS) drives the same clear as a fallback for engines without :has(). */
.carousel-reviews__card--video:has(.carousel-reviews__video-thumb.is-playing) .carousel-reviews__video-scrim,
.carousel-reviews__card--video.is-video-playing .carousel-reviews__video-scrim,
.carousel-reviews__card--video:has(.carousel-reviews__video-thumb.is-playing) .carousel-reviews__video-stars,
.carousel-reviews__card--video.is-video-playing .carousel-reviews__video-stars,
.carousel-reviews__card--video:has(.carousel-reviews__video-thumb.is-playing) .carousel-reviews__video-meta,
.carousel-reviews__card--video.is-video-playing .carousel-reviews__video-meta {
	opacity: 0;
	pointer-events: none;
}

/* Honor reduced-motion: keep the state changes, drop the tweens (matches the
 * marquee-text / video-steps reduced-motion convention). */
@media (prefers-reduced-motion: reduce) {
	.carousel-reviews__video-scrim,
	.carousel-reviews__video-stars,
	.carousel-reviews__video-meta,
	.felix-video__play-btn,
	.felix-video__progress,
	.felix-video__progress-bar {
		transition: none;
	}
}
