/* Testimonial carousel (cairn/testimonial-carousel) */

.fc-testimonials {
	--fc-testimonials-per-view: 3;
	--fc-testimonials-gap: var(--wp--preset--spacing--50, 2.5rem);
	background-color: var(--wp--preset--color--custom-windmill-wings);
	padding: var(--wp--preset--spacing--60, 4rem) var(--wp--preset--spacing--50, 1.5rem);
}

.fc-testimonials__inner {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--50, 2.5rem);
	margin-inline: auto;
	max-width: var(--wp--style--global--wide-size, 1200px);
}

/* Same reason as .fc-testimonials-row below, for when the block sits in any flex or grid row. */
.fc-testimonials,
.fc-testimonials__inner,
.fc-testimonials__track {
	min-width: 0;
}

/* Nested for specificity: blocks/content.css adds a top margin to every h2. */
.fc-testimonials .fc-testimonials__heading {
	font-family: var(--wp--preset--font-family--eb-garamond);
	/*
	 * XL on desktop, as designed, but never bigger than the page's own XXL
	 * title, which scales down further on small screens than XL does.
	 */
	font-size: min(var(--wp--preset--font-size--x-large), var(--wp--preset--font-size--xx-large));
	font-weight: 400;
	line-height: 1.1;
	margin: 0;
	text-align: center;
}

/*
 * A native scroll-snap list: swipeable on touch and usable without
 * JavaScript. view.js only adds arrows and dots on top.
 */
.fc-testimonials__track {
	display: flex;
	gap: var(--fc-testimonials-gap);
	list-style: none;
	margin: 0;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	padding: 0;
	/* Makes the track the offsetParent view.js measures slides against. */
	position: relative;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.fc-testimonials__track::-webkit-scrollbar {
	display: none;
}

.fc-testimonials__track:focus-visible {
	outline: 2px solid var(--wp--preset--color--custom-mallorca-blue);
	outline-offset: 4px;
}

.fc-testimonials__slide {
	display: flex;
	flex: 0 0 calc((100% - (var(--fc-testimonials-per-view) - 1) * var(--fc-testimonials-gap)) / var(--fc-testimonials-per-view));
	margin: 0;
	scroll-snap-align: start;
}

/* Cards in a row share the tallest card's height, as in the design. */
.fc-testimonials__card {
	background: var(--wp--preset--color--custom-white);
	border-radius: var(--wp--preset--border-radius--large, 20px);
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20, 0.75rem);
	margin: 0;
	padding: var(--wp--preset--spacing--40, 2rem);
	width: 100%;
}

.fc-testimonials__logo {
	align-items: center;
	display: flex;
	height: 48px;
	margin-bottom: var(--wp--preset--spacing--20, 0.75rem);
}

.fc-testimonials__logo img {
	height: auto;
	max-height: 48px;
	max-width: 200px;
	object-fit: contain;
	object-position: left center;
	width: auto;
}

.fc-testimonials .fc-testimonials__company {
	color: var(--wp--preset--color--custom-mallorca-blue);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 400;
	line-height: 1.3;
	margin: 0;
}

/*
 * Nested for specificity: blocks/content.css gives every blockquote a grey
 * side bar, EB Garamond and padding, and `blockquote:not(.wp-block-quote)`
 * outranks a single class.
 */
.fc-testimonials .fc-testimonials__quote {
	border: 0;
	/* Same light weight and dark grey as the body copy on the story cards. */
	color: var(--wp--preset--color--custom-dark-grey);
	font-family: var(--wp--preset--font-family--roboto);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 300;
	line-height: 1.6;
	margin: 0;
	padding: 0;
}

.fc-testimonials .fc-testimonials__quote p {
	margin: 0 0 0.75em;
	/* stylelint-disable-next-line property-no-unknown */
	text-box: normal;
}

.fc-testimonials__quote p:last-child {
	margin-bottom: 0;
}

.fc-testimonials__attribution {
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
	line-height: 1.5;
	margin-top: var(--wp--preset--spacing--10, 0.5rem);
}

/* Arrows at either side, dots centred between them. */
.fc-testimonials__controls {
	align-items: center;
	display: flex;
	gap: var(--wp--preset--spacing--30, 1rem);
	justify-content: space-between;
}

.fc-testimonials__controls[hidden] {
	display: none;
}

.fc-testimonials__arrow {
	background: none;
	border: 0;
	border-radius: 50%;
	color: var(--wp--preset--color--custom-money-green);
	cursor: pointer;
	display: inline-flex;
	flex: none;
	padding: 0;
	transition: transform 0.2s ease-out;
}

.fc-testimonials__arrow:hover {
	transform: scale(1.06);
}

.fc-testimonials__arrow:focus-visible,
.fc-testimonials__dot:focus-visible {
	outline: 2px solid var(--wp--preset--color--custom-mallorca-blue);
	outline-offset: 3px;
}

.fc-testimonials__dots {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
}

.fc-testimonials__dot {
	background: var(--wp--preset--color--custom-money-green);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	height: 14px;
	opacity: 0.85;
	padding: 0;
	transition: transform 0.2s ease-out, opacity 0.2s ease-out;
	width: 14px;
}

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

.fc-testimonials__empty {
	font-size: var(--wp--preset--font-size--x-small);
	margin: 0;
	padding: var(--wp--preset--spacing--40, 2rem);
	text-align: center;
}

/*
 * Inside the Client Stories grid (see inc/testimonials.php). An explicit
 * second row spanning every column means auto-placed cards fill the first row
 * and carry on below, however many columns the screen allows.
 */
.wp-block-post-template.is-layout-grid > .fc-testimonials-row {
	grid-column: 1 / -1;
	grid-row: 2;
	list-style: none;
	margin: 0;
	/*
	 * Grid items won't shrink below their content by default, and the content
	 * here is every card laid side by side - which stretched the page sideways
	 * on mobile. Let it take the grid's width and scroll the track instead.
	 */
	min-width: 0;
}

/* Paint the beige band to the edges of the window without widening the page. */
.fc-testimonials-row .fc-testimonials {
	box-shadow: 0 0 0 100vmax var(--wp--preset--color--custom-windmill-wings);
	clip-path: inset(0 -100vmax);
	padding-inline: 0;
}

@media (max-width: 1100px) {
	.fc-testimonials {
		--fc-testimonials-per-view: 2;
		--fc-testimonials-gap: var(--wp--preset--spacing--40, 2rem);
	}
}

@media (max-width: 700px) {
	.fc-testimonials {
		--fc-testimonials-per-view: 1;
		--fc-testimonials-gap: var(--wp--preset--spacing--30, 1rem);
	}

	.fc-testimonials__arrow svg {
		height: 40px;
		width: 40px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fc-testimonials__arrow,
	.fc-testimonials__dot {
		transition: none;
	}
}
