/**
 * Review Carousel — front-end styles.
 *
 * This renders as a MODULE, not a section: no background, no side padding and
 * no chrome unless the instance asks for it. Every tunable is a custom property
 * so the shortcode and the Beaver Builder module can override per instance.
 *
 * Selectors are deliberately over-specific. Themes and page builders ship rules
 * like `.fl-module ul li { display: list-item; width: auto; flex: 0 1 auto; }`
 * (specificity 0,1,2) which beat a lone `.rvcr__slide` and collapse every card
 * to its content width. Scoping through `.rvcr` keeps the layout intact.
 */

.rvcr {
	--rvcr-ink: #201e1d;
	--rvcr-muted: #605d5d;
	--rvcr-section-bg: transparent;
	--rvcr-card-bg: #f3f2f2;
	--rvcr-border-color: #201e1d;
	--rvcr-border-width: 2px;
	--rvcr-radius: 0px;
	--rvcr-star: #e0a800;
	--rvcr-accent: #ec3013;
	--rvcr-dot: #bab6b6;
	--rvcr-hover: #d7d3d3;
	--rvcr-gap: 20px;
	--rvcr-pad-x: 0px;
	--rvcr-card-max: none;

	/*
	 * Cards per view. The instance sets the three -desktop/-tablet/-mobile
	 * values inline; --rvcr-per is resolved HERE and never inline, because an
	 * inline custom property would outrank the media queries below and freeze
	 * the desktop count on every screen size.
	 */
	--rvcr-per-desktop: 3;
	--rvcr-per: var(--rvcr-per-desktop, 3);
	--rvcr-card-pad: clamp(20px, 3vw, 30px);
	--rvcr-quote-min: 17px;
	--rvcr-quote-max: 22px;
	--rvcr-quote-weight: 600;
	--rvcr-quote-ls: -0.015em;
	--rvcr-eyebrow-size: 12px;
	--rvcr-star-size: 15px;
	--rvcr-label-size: 11px;
	--rvcr-arrow-size: 44px;
	--rvcr-dot-w: 34px;
	--rvcr-dot-h: 6px;

	background: var(--rvcr-section-bg);
	color: var(--rvcr-ink);
	box-sizing: border-box;

	/*
	 * Side padding belongs HERE, not on the track, header and dots separately.
	 * On the track it is invisible anyway — mandatory scroll snapping pulls
	 * scrollLeft to the first slide's snap position, which equals the track's
	 * padding-left — so the cards sat flush while the arrows and progress bars
	 * stayed indented by it. One padded wrapper gives all three the same edges.
	 */
	padding: 0 var(--rvcr-pad-x);
}

.rvcr *,
.rvcr *::before,
.rvcr *::after {
	box-sizing: border-box;
}

/* ---------- Reset theme leakage ---------- */

.rvcr ul.rvcr__track,
.rvcr .rvcr__track > .rvcr__slide {
	margin: 0;
	padding: 0;
	list-style: none;
	text-indent: 0;
	background: none;
	border: 0;
}

.rvcr .rvcr__track > .rvcr__slide::before,
.rvcr .rvcr__track > .rvcr__slide::marker {
	content: none;
}

.rvcr .rvcr__card,
.rvcr .rvcr__card .rvcr__quote {
	float: none;
	text-align: left;
	text-transform: none;
	quotes: none;
}

.rvcr .rvcr__card .rvcr__quote {
	/* Themes style bare <blockquote> with a rule, indent and italics. */
	border: 0;
	border-left: 0;
	padding: 0;
	margin: 0;
	background: none;
	font-style: normal;
	text-indent: 0;
}

.rvcr .rvcr__card .rvcr__quote::before,
.rvcr .rvcr__card .rvcr__quote::after {
	content: none;
	display: none;
}

.rvcr .rvcr__arrow,
.rvcr .rvcr__dot {
	-webkit-appearance: none;
	appearance: none;
	text-transform: none;
	letter-spacing: normal;
	text-shadow: none;
	min-height: 0;
	min-width: 0;
	width: auto;
	height: auto;
	line-height: 1;
}

.rvcr--font-archivo {
	font-family: Archivo, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.rvcr--bordered {
	border-top: var(--rvcr-border-width) solid var(--rvcr-border-color);
	border-bottom: var(--rvcr-border-width) solid var(--rvcr-border-color);
}

/* ---------- Header (opt-in) ---------- */

.rvcr .rvcr__head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 20px;
	padding: 0 0 16px;
}

/* Heading + rating travel together, so the arrows can never land between them. */
.rvcr .rvcr__headtext {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 12px;
	min-width: 0;
}

.rvcr .rvcr__title {
	margin: 0;
	padding: 0;
	font-size: var(--rvcr-eyebrow-size);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--rvcr-ink);
}

.rvcr .rvcr__meta {
	font-size: var(--rvcr-eyebrow-size);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--rvcr-muted);
}

.rvcr .rvcr__meta-star {
	color: var(--rvcr-star);
}

.rvcr .rvcr__nav {
	display: flex;
	gap: 8px;
	margin-left: auto;
}

/* Arrow alignment. Right is the default; the others release the auto margin. */
.rvcr.rvcr--arrows-left .rvcr__nav {
	margin-left: 0;
	margin-right: auto;
}

.rvcr.rvcr--arrows-center .rvcr__nav {
	margin-left: auto;
	margin-right: auto;
}

.rvcr.rvcr--arrows-right .rvcr__nav {
	margin-left: auto;
	margin-right: 0;
}

.rvcr .rvcr__arrow {
	width: var(--rvcr-arrow-size);
	height: var(--rvcr-arrow-size);
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
	border: var(--rvcr-border-width) solid var(--rvcr-border-color);
	border-radius: var(--rvcr-radius);
	background: transparent;
	color: var(--rvcr-ink);
	font-size: 18px;
	font-weight: 800;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: none;
	transition: background 120ms linear, opacity 120ms linear;
}

.rvcr .rvcr__arrow:hover,
.rvcr .rvcr__arrow:focus-visible {
	background: var(--rvcr-hover);
	color: var(--rvcr-ink);
}

.rvcr .rvcr__arrow[disabled] {
	opacity: 0.35;
	cursor: default;
}

.rvcr .rvcr__arrow[disabled]:hover {
	background: transparent;
}

/* ---------- Track ---------- */

.rvcr .rvcr__track {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	padding: 0;
	gap: var(--rvcr-gap);
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.rvcr .rvcr__track::-webkit-scrollbar {
	display: none;
}

/*
 * Set by the script for the length of one arrow/dot/autoplay move. Mandatory
 * snapping re-snaps the track mid-animation and the smooth behaviour would
 * animate each frame's scrollLeft write, so both stand down while the script
 * drives the scroll itself.
 */
.rvcr .rvcr__track.rvcr-glide {
	scroll-snap-type: none;
	scroll-behavior: auto;
}

.rvcr .rvcr__track:focus-visible {
	outline: 2px solid var(--rvcr-accent);
	outline-offset: -2px;
}

.rvcr .rvcr__track > .rvcr__slide {
	/* width, not flex-basis: a theme's `flex: 0 1 auto` on li cannot shrink it. */
	flex: 0 0 auto;
	/*
	 * Fallbacks live inside the calc() on purpose. An unresolved var() voids the
	 * whole declaration at computed-value time — no earlier `width` in the
	 * cascade can rescue it — and the card would drop to content width, one word
	 * per line. This keeps 3 columns even with no inline style at all.
	 */
	width: calc( ( 100% - ( var(--rvcr-per, 3) - 1 ) * var(--rvcr-gap, 20px) ) / var(--rvcr-per, 3) );
	max-width: var(--rvcr-card-max);
	display: flex;
	scroll-snap-align: start;
}

/* Tablet, then phone. Each falls back to the wider value when left unset. */
@media (max-width: 992px) {
	.rvcr {
		--rvcr-per: var(--rvcr-per-tablet, var(--rvcr-per-desktop, 3));
	}
}

@media (max-width: 768px) {
	.rvcr {
		--rvcr-per: var(--rvcr-per-mobile, var(--rvcr-per-tablet, var(--rvcr-per-desktop, 3)));
	}
}

.rvcr .rvcr__card {
	flex: 1 1 auto;
	width: 100%;
	margin: 0;
	border: var(--rvcr-border-width) solid var(--rvcr-border-color);
	border-radius: var(--rvcr-radius);
	background: var(--rvcr-card-bg);
	padding: var(--rvcr-card-pad);
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.rvcr .rvcr__stars {
	color: var(--rvcr-star);
	font-size: var(--rvcr-star-size);
	line-height: 1;
	letter-spacing: 0.18em;
	white-space: nowrap;
	/* Clip rather than spill past the card when the column is very narrow. */
	min-width: 0;
	overflow: hidden;
}

.rvcr .rvcr__stars-empty {
	color: var(--rvcr-dot);
}

.rvcr .rvcr__quote {
	font-size: clamp(var(--rvcr-quote-min), 2.4vw, var(--rvcr-quote-max));
	line-height: 1.4;
	font-weight: var(--rvcr-quote-weight);
	letter-spacing: var(--rvcr-quote-ls);
	color: var(--rvcr-ink);
	text-wrap: pretty;
}

.rvcr .rvcr__quote p {
	margin: 0 0 0.6em;
	font-size: inherit;
	line-height: inherit;
	font-weight: inherit;
	letter-spacing: inherit;
	color: inherit;
}

.rvcr .rvcr__quote p:last-child {
	margin-bottom: 0;
}

.rvcr .rvcr__card .rvcr__foot {
	float: none;
	text-align: left;
	margin: auto 0 0;
	padding: 0;
	font-size: var(--rvcr-label-size);
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--rvcr-muted);
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
}

.rvcr .rvcr__author {
	color: var(--rvcr-ink);
}

.rvcr .rvcr__card .rvcr__foot a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	box-shadow: none;
}

/* ---------- Progress bars (opt-in) ---------- */

.rvcr .rvcr__dots {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 14px 0 0;
	justify-content: flex-start;
}

.rvcr.rvcr--dots-center .rvcr__dots {
	justify-content: center;
}

.rvcr.rvcr--dots-right .rvcr__dots {
	justify-content: flex-end;
}

.rvcr .rvcr__dot {
	width: var(--rvcr-dot-w);
	height: var(--rvcr-dot-h);
	flex: 0 0 auto;
	border: 0;
	padding: 0;
	margin: 0;
	cursor: pointer;
	background: var(--rvcr-dot);
	box-shadow: none;
	border-radius: 0;
	transition: background 120ms linear;
}

.rvcr .rvcr__dot[hidden] {
	display: none;
}

.rvcr .rvcr__dot[aria-current="true"] {
	background: var(--rvcr-accent);
}

.rvcr .rvcr__dot:focus-visible {
	outline: 2px solid var(--rvcr-ink);
	outline-offset: 2px;
}

/* ---------- States ---------- */

/*
 * Added by the script when the cards all fit: no scrolling to control, so the
 * controls go away. The header row goes too, unless it carries a heading.
 */
.rvcr.rvcr--static .rvcr__nav,
.rvcr.rvcr--static .rvcr__dots {
	display: none;
}

.rvcr.rvcr--static:not(.rvcr--head-text) .rvcr__head {
	display: none;
}

.rvcr .rvcr__empty {
	padding: 0;
	font-size: 14px;
	color: var(--rvcr-muted);
}

/*
 * Phones and small tablets: text keeps the left of the row, arrows keep the
 * right. The heading and rating stack under each other rather than pushing the
 * arrows onto a line of their own.
 */
@media (max-width: 768px) {
	.rvcr .rvcr__head {
		flex-wrap: nowrap;
		align-items: center;
		gap: 12px;
	}

	.rvcr .rvcr__headtext {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
		flex: 1 1 auto;
	}

	.rvcr .rvcr__nav,
	.rvcr.rvcr--arrows-left .rvcr__nav,
	.rvcr.rvcr--arrows-center .rvcr__nav,
	.rvcr.rvcr--arrows-right .rvcr__nav {
		flex: 0 0 auto;
		width: auto;
		margin-left: auto;
		margin-right: 0;
	}

	/* Progress bars sit centred on phones, whatever the instance alignment. */
	.rvcr .rvcr__dots,
	.rvcr.rvcr--dots-left .rvcr__dots,
	.rvcr.rvcr--dots-center .rvcr__dots,
	.rvcr.rvcr--dots-right .rvcr__dots {
		justify-content: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rvcr .rvcr__track {
		scroll-behavior: auto;
	}
}
