/*
 * Reviews carousel (0.2.16).
 * Native scroll-snap track; JS (msd-carousel.js) only adds arrows, dots and
 * optional autoplay. Without JS each review row is still a swipeable,
 * snapping row. Effects use transform/opacity only.
 */

/* ---------- No-JS fallback: the original rows become snap rows ---------- */
.msd-testimonials .msd-card-row {
	flex-wrap: nowrap !important;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	padding-block: 6px 32px;
	margin-bottom: -26px;
}

.msd-testimonials .msd-card-row::-webkit-scrollbar {
	display: none;
}

.msd-testimonials .msd-card-row > .wp-block-column {
	flex: 0 0 86% !important;
	scroll-snap-align: start;
}

@media (min-width: 600px) {
	.msd-testimonials .msd-card-row > .wp-block-column {
		flex-basis: calc(50% - 1rem) !important;
	}
}

@media (min-width: 1024px) {
	.msd-testimonials .msd-card-row > .wp-block-column {
		flex-basis: calc(33.333% - 1.4rem) !important;
	}
}

/* ---------- Carousel (built by JS) ---------- */
.msd-carousel {
	--msd-carousel-gap: var(--wp--preset--spacing--40, 1.5rem);
	--msd-carousel-per-view: 1;
	position: relative;
	width: 100%;
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin-inline: auto;
}

@media (min-width: 600px) {
	.msd-carousel {
		--msd-carousel-per-view: 2;
	}
}

@media (min-width: 1024px) {
	.msd-carousel {
		--msd-carousel-per-view: 3;
	}
}

.msd-carousel__track {
	display: flex;
	gap: var(--msd-carousel-gap);
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	/* Room for the card hover lift + shadow inside the scroller. */
	padding: 8px 24px 36px;
	margin: -8px -24px -36px;
	scroll-padding-inline: 24px;
	outline: none;
	-webkit-overflow-scrolling: touch;
}

.msd-carousel__track::-webkit-scrollbar {
	display: none;
}

@media (prefers-reduced-motion: no-preference) {
	.msd-carousel__track {
		scroll-behavior: smooth;
	}
}

.msd-carousel__track:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent, #C9A227);
	outline-offset: 4px;
	border-radius: 18px;
}

.msd-carousel__slide {
	flex: 0 0 calc((100% - (var(--msd-carousel-per-view) - 1) * var(--msd-carousel-gap)) / var(--msd-carousel-per-view));
	min-width: 0;
	display: flex;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.msd-carousel__slide > .msd-card {
	flex: 1 1 auto;
	width: 100%;
	height: auto;
	margin: 0 !important;
}

/* Controls */
.msd-carousel__controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	margin-top: var(--wp--preset--spacing--40, 1.5rem);
	position: relative;
}

.msd-carousel__controls[hidden] {
	display: none;
}

.msd-carousel__btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 2px solid var(--wp--preset--color--contrast, #021228);
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--contrast, #021228);
	cursor: pointer;
	isolation: isolate;
	overflow: hidden;
}

.msd-carousel__btn::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	background: var(--wp--preset--color--accent, #C9A227);
	opacity: 0;
	transform: scale(0.6);
}

.msd-carousel__btn svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.msd-carousel__btn:focus-visible,
.msd-carousel__dot:focus-visible {
	outline: 3px solid var(--wp--preset--color--accent, #C9A227);
	outline-offset: 3px;
}

.msd-carousel__dots {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* 44px tap target, small visible dot. */
.msd-carousel__dot {
	position: relative;
	width: 28px;
	height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.msd-carousel__dot::before,
.msd-carousel__dot::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	margin: -5px 0 0 -5px;
	border-radius: 999px;
}

.msd-carousel__dot::before {
	background: var(--wp--preset--color--contrast, #021228);
	opacity: 0.25;
}

.msd-carousel__dot::after {
	background: var(--wp--preset--color--accent, #C9A227);
	opacity: 0;
	transform: scale(0.5);
}

.msd-carousel__dot[aria-current="true"]::after {
	opacity: 1;
	transform: scale(1.35);
}

.msd-carousel__dot[aria-current="true"]::before {
	opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
	.msd-carousel__btn::before,
	.msd-carousel__btn svg,
	.msd-carousel__dot::before,
	.msd-carousel__dot::after {
		transition:
			opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1),
			transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
	}
}

@media (hover: hover) and (pointer: fine) {
	.msd-carousel__btn:hover::before {
		opacity: 1;
		transform: scale(1);
	}

	.msd-carousel__btn--prev:hover svg {
		transform: translate3d(-2px, 0, 0);
	}

	.msd-carousel__btn--next:hover svg {
		transform: translate3d(2px, 0, 0);
	}

	.msd-carousel__dot:hover::before {
		opacity: 0.5;
	}
}

.msd-carousel__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
