/*
 * MakeCommerce Testimonials.
 *
 * Colours come from the theme's variables (main.css) with the same values as fallbacks, so it also
 * looks right without them. Override any --mct-* variable on .mct to restyle one block.
 *
 * Space for everything the script adds (controls row, "Read more") is reserved in the CSS, so the
 * page doesn't move when the script runs.
 */

.mct {
	--mct-green: var(--green, #15A652);
	--mct-green-dark: var(--teal, #0F8546);
	--mct-ink: var(--secondary, #3A3A3B);
	--mct-muted: var(--gray-dark, #565b60);
	--mct-star: #F2C80F; /* brand yellow 4 (brandbook: yellows for illustrations, stars allowed by the owner) */
	--mct-border: #D8DBE0; /* brand grey 300 */
	--mct-line: #EAECF0; /* brand grey 200 */
	--mct-card-bg: #fff;
	--mct-radius: 12px;
	--mct-gap: 24px;
	--mct-lines: 7;
	/*
	 * Room below, as padding: a margin would collapse into the negative top margin the theme's
	 * next section uses to tuck its wave under (up to 76px), and the controls would end up under it.
	 */
	--mct-space-after: 56px;

	/*
	 * Card count follows the block's own width, not the screen's, so it also fits a narrow column.
	 * A size container can't take its width from its content, hence width: 100%.
	 */
	container-type: inline-size;
	position: relative;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding-bottom: var(--mct-space-after);
	color: var(--mct-ink);
}

.mct-editor-notice {
	margin: 1rem 0;
	padding: 1rem 1.25rem;
	border: 2px dashed #D8DBE0;
	border-radius: 12px;
	background: #fff;
	color: #3A3A3B;
	font-size: 1rem;
}

.mct-editor-notice a { color: #0F8546; } /* brand green 800, 4.7:1 */

/* Match the wide local frame and let an edge-to-edge slider escape the theme's scroll box. */
.editorContent:has(> .mct--bleed) {
	max-width: none;
	overflow: visible;
}

/* ---------- Track: a native scroll container that snaps to each card ---------- */

.mct__track {
	--mct-per: 1.08; /* Narrow: one card plus a peek at the next, so it reads as swipeable. */

	display: flex;
	gap: var(--mct-gap);
	margin: 0;
	padding: 0;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	position: relative; /* Card offsets are measured from the track. */
}

.mct__track::-webkit-scrollbar {
	display: none;
}

/* The scrollport clips vertically; leave room for the cards' bottom border and rounded corners. */
.mct--slider .mct__track {
	padding-bottom: 2px;
}

.mct__track:focus-visible {
	outline: 2px solid var(--mct-green-dark);
	outline-offset: 4px;
	border-radius: 4px;
}

/*
 * Edge to edge: the track reaches both sides of the screen while the first card lines up with the
 * page column. The script sets the exact distances; the fallback assumes a centred column. It uses
 * cqw (the column's width), not %, because % in scroll-padding means the track's own width, which
 * would make the browser snap one card too far. The live theme clips horizontal overflow on
 * <body>, so this never adds a sideways scrollbar.
 */
.mct--bleed .mct__track {
	--mct-bl: var(--mct-bleed-l, calc((100vw - 100cqw) / 2));
	--mct-br: var(--mct-bleed-r, calc((100vw - 100cqw) / 2));

	margin-left: calc(-1 * var(--mct-bl));
	margin-right: calc(-1 * var(--mct-br));
	padding-left: var(--mct-bl);
	padding-right: var(--mct-br);
	scroll-padding-left: var(--mct-bl);
	scroll-padding-right: var(--mct-br);
}

/* The track box includes both bleed paddings, so the opaque stops meet the column edges. */
.mct--slider.mct--bleed.mct--fade .mct__track {
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--mct-bl), #000 calc(100% - var(--mct-br)), transparent 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 var(--mct-bl), #000 calc(100% - var(--mct-br)), transparent 100%);
}

/* A focused track or card needs an unobstructed focus ring. The popup is outside the track. */
.mct--slider.mct--bleed.mct--fade .mct__track:focus-within {
	-webkit-mask-image: none;
	mask-image: none;
}

.mct--cols-1 .mct__track,
.mct--grid .mct__track {
	--mct-per: 1;
}

/* Grid: every card shown, in rows. */
.mct--grid .mct__track {
	display: grid;
	grid-template-columns: repeat(var(--mct-per), minmax(0, 1fr));
	overflow: visible;
	scroll-snap-type: none;
}

@container (max-width: 599px) {
	.mct__track {
		--mct-gap: 16px;
	}

	/* .mct in front: the base .mct__text rule comes later in this file and would win otherwise. */
	.mct .mct__text {
		--mct-l: var(--mct-lines-narrow, var(--mct-lines));
	}
}

/*
 * Cards side by side: as many as fit while each card stays at least 240px wide (gap 24px), up to
 * the chosen maximum. 2 need a 504px column, 3 need 768px, 4 need 1032px. So on the 1040px
 * homepage column the setting is what you get; a 750px article column shows 2; phones show 1.
 */
@container (min-width: 504px) {
	.mct__track,
	.mct--cols-1 .mct__track {
		--mct-per: 1;
	}

	.mct--cols-2 .mct__track,
	.mct--cols-3 .mct__track,
	.mct--cols-4 .mct__track {
		--mct-per: 2;
	}
}

@container (min-width: 768px) {
	.mct--cols-3 .mct__track,
	.mct--cols-4 .mct__track {
		--mct-per: 3;
	}
}

@container (min-width: 1032px) {
	.mct--cols-4 .mct__track {
		--mct-per: 4;
	}
}

/* Width from the block (100% of the track's content box), so edge-to-edge doesn't widen cards. */
.mct__slide {
	flex: 0 0 calc((100% - (var(--mct-per) - 1) * var(--mct-gap)) / var(--mct-per));
	min-width: 0;
	display: flex;
	scroll-snap-align: start;
}

/* ---------- Card ---------- */

.mct .mct__card {
	display: flex;
	flex-direction: column;
	width: 100%;
	margin: 0;
	padding: 32px 32px 28px;
	box-sizing: border-box;
	background: var(--mct-card-bg);
	border: 1px solid var(--mct-border);
	border-radius: var(--mct-radius);
	text-align: left;
}

.mct__top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 24px;
	margin-bottom: 20px;
}

.mct__mark {
	display: block;
	width: 30px;
	height: 23px;
	fill: var(--mct-green);
}

.mct__stars {
	display: inline-flex;
	gap: 3px;
}

.mct__stars svg {
	display: block;
	width: 18px;
	height: 18px;
	fill: var(--mct-star);
}

.mct__stars .mct__star-empty {
	fill: var(--mct-border);
}

/* Undo theme blockquote styling (borders, italics, quote marks, big type). */
.mct .mct__quote {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font-style: normal;
	font-size: inherit;
	quotes: none;
}

.mct .mct__quote::before,
.mct .mct__quote::after {
	content: none;
}

/*
 * Lines shown: the script's measurement (--mct-fit) once it has run, before that the server's guess
 * for this width (--mct-lines, or --mct-lines-narrow on a phone-width block).
 */
.mct__text {
	--mct-l: var(--mct-lines);

	max-height: calc(1.65em * var(--mct-fit, var(--mct-l)));
	overflow: hidden;
	font-size: 16px;
	line-height: 1.65;
	color: var(--mct-ink);
}

.mct__text.is-clamped {
	-webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 3.3em), transparent);
	mask-image: linear-gradient(to bottom, #000 calc(100% - 3.3em), transparent);
}

.mct--full .mct__text {
	max-height: none;
}

.mct .mct__text p {
	margin: 0 0 0.75em;
	font-size: inherit;
	line-height: inherit;
	color: inherit;
}

.mct .mct__text p:last-child {
	margin-bottom: 0;
}

/*
 * "Read more": quiet on purpose (small, grey, no underline) under the faded text, and the whole card
 * opens the full quote too. Always takes its line, shown only when the quote is cut off, so
 * nothing moves when the script decides.
 */
.mct .mct__more {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	align-self: flex-start;
	margin: 6px 0 0;
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--mct-muted);
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	text-decoration: none;
	cursor: pointer;
	visibility: hidden;
	transition: color 0.15s;
}

.mct .mct__more::after {
	content: "";
	width: 6px;
	height: 6px;
	border-top: 1.5px solid currentColor;
	border-right: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.15s;
}

.mct .mct__more.is-visible {
	visibility: visible;
}

.mct .mct__card.is-expandable {
	cursor: pointer;
	transition: border-color 0.15s;
}

.mct .mct__card.is-expandable:hover {
	border-color: #C7CBD1; /* brand grey 400 */
}

.mct .mct__card.is-expandable:hover .mct__more,
.mct .mct__more:hover {
	color: var(--mct-green-dark);
}

.mct .mct__card.is-expandable:hover .mct__more::after {
	transform: translateX(2px) rotate(45deg);
}

.mct__person {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-top: auto;
	padding-top: 24px;
}

.mct__photo {
	flex: none;
	display: block;
}

.mct .mct__photo img {
	display: block;
	width: 52px;
	height: 52px;
	max-width: none;
	margin: 0;
	border-radius: 50%;
	border: 1px solid var(--mct-line);
	object-fit: cover;
	background: #fff;
}

.mct .mct__photo--initials {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: #E7FCC0; /* brand green 100; text green 900, 7.2:1 */
	color: #075E35;
	font-size: 17px;
	font-weight: 600;
	letter-spacing: 0.02em;
}

.mct__who {
	min-width: 0;
	flex: 0 1 auto;
	line-height: 1.35;
}

.mct .mct__logo {
	display: block;
	flex: 0 1 auto;
	width: auto;
	height: 28px;
	max-width: 120px;
	min-width: 0;
	margin-left: auto;
	object-fit: contain;
}

.mct.mct--logos-grey .mct__logo:not(.mct__logo--original),
.mct .mct__logo--grey {
	filter: brightness(0);
	opacity: .77; /* black at 77% reads as #3A3A3B, MakeCommerce brand text grey */
}

@container (max-width: 503px) {
	.mct .mct__logo { max-width: 88px; }
	.mct .mct__name,
	.mct .mct__company { overflow-wrap: anywhere; }
}

.mct__name {
	display: block;
	font-size: 16px;
	font-weight: 600;
	color: var(--mct-ink);
}

.mct__company {
	display: block;
	margin-top: 3px;
	font-size: 14px;
	color: var(--mct-muted);
	overflow-wrap: anywhere;
}

/* :not(.button) matches the theme's own `.editorContent a:not(.button)` underline rule, and wins. */
.mct .mct__company a:not(.button) {
	color: var(--mct-green-dark);
	text-decoration: none;
}

.mct .mct__company a:not(.button):hover {
	text-decoration: underline;
}

/* ---------- Controls ---------- */

/* Laid out from the start (space reserved), revealed when the script is ready. */
.mct__controls {
	display: flex;
	align-items: center;
	gap: 16px;
	min-height: 48px;
	margin-top: 28px;
	visibility: hidden;
}

.mct.is-ready .mct__controls {
	visibility: visible;
}

.mct.is-static .mct__controls,
.mct--nav-none .mct__controls {
	display: none;
}

.mct--nav-arrows .mct__dots,
.mct--nav-dots .mct__arrows {
	display: none;
}

.mct .mct__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 2px solid var(--mct-ink);
	border-radius: 50%;
	background: transparent;
	color: var(--mct-ink);
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s, opacity 0.15s;
}

.mct .mct__btn:hover {
	background: var(--mct-ink);
	color: #fff;
}

.mct .mct__btn:disabled {
	opacity: 0.25;
	cursor: default;
	pointer-events: none;
}

.mct .mct__btn:focus-visible,
.mct .mct__dot:focus-visible,
.mct .mct__more:focus-visible,
.mct .mct__company a:focus-visible {
	outline: 2px solid var(--mct-green-dark);
	outline-offset: 2px;
}

.mct__btn svg {
	display: block;
	width: 22px;
	height: 22px;
}

.mct__dots {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	min-width: 0;
}

.mct .mct__dot {
	position: relative;
	width: 24px;
	height: 24px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: none;
	cursor: pointer;
}

.mct__dot::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 8px;
	border-radius: 4px;
	background: #93999E; /* brand grey 600 (owner pick: quieter than grey 700) */
	transform: translate(-50%, -50%);
	transition: width 0.25s, background-color 0.25s;
}

.mct__dot:hover::before {
	background: var(--mct-muted);
}

.mct__dot[aria-current="true"]::before {
	width: 24px;
	background: var(--mct-green);
}

/* Many positions: a slim progress bar instead of a row of dots. */
.mct__progress {
	position: relative;
	width: min(200px, 40vw);
	height: 4px;
	border-radius: 2px;
	background: #EAECF0; /* brand grey 200 */
	overflow: hidden;
}

.mct__progress span {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	border-radius: 2px;
	background: var(--mct-green);
	transition: transform 0.2s linear;
}

.mct__arrows {
	display: flex;
	gap: 12px;
	margin-left: auto;
}

.mct.mct--nav-both.mct--arrows-together .mct__arrows {
	margin-left: 0;
	flex: none;
}

.mct.mct--nav-both.mct--arrows-together.mct--align-center .mct__controls {
	justify-content: center;
}

.mct.mct--nav-both.mct--arrows-together .mct__progress {
	max-width: 100%;
}

/* ---------- Card styles, alignment and photo shape ---------- */

.mct--style-soft .mct__card {
	--mct-green-dark: #075E35; /* brand green 900: teal is only 4.3:1 on grey 100, this is 7.2:1 */
	background: #F2F4F7; /* brand grey 100 */
	border-color: transparent;
}

.mct--style-soft .mct__photo img {
	border-color: #EAECF0; /* brand grey 200 */
}

.mct--style-white .mct__card {
	border-color: transparent;
}

.mct.mct--style-plain .mct__card {
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
}

.mct--align-center .mct__card {
	text-align: center;
}

.mct--align-center .mct__top {
	flex-direction: column;
	justify-content: center;
}

.mct.mct--align-center .mct__more {
	align-self: center;
}

.mct--align-center .mct__person {
	text-align: left;
}

.mct--shape-square .mct__photo img,
.mct.mct--shape-square .mct__photo--initials {
	border-radius: 12px;
}

/* ---------- "Read more" popup ---------- */

.mct .mct__dialog {
	width: min(640px, calc(100vw - 32px));
	max-height: calc(100dvh - 48px);
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: var(--mct-radius);
	background: var(--mct-card-bg);
	color: var(--mct-ink);
	box-shadow: 0 24px 64px rgba(16, 24, 40, 0.24);
	overflow: auto;
}

.mct__dialog::backdrop {
	background: rgba(16, 24, 40, 0.55);
}

.mct .mct__dialog .mct__card {
	border: 0;
	border-radius: 0;
	padding: 40px 40px 32px;
	background: var(--mct-card-bg);
	text-align: left;
}

.mct .mct__dialog .mct__top {
	flex-direction: row;
	justify-content: flex-start;
	padding-right: 56px;
}

.mct .mct__dialog .mct__person {
	flex-direction: row;
}

.mct .mct__dialog .mct__text {
	max-height: none;
	-webkit-mask-image: none;
	mask-image: none;
	font-size: 17px;
}

.mct .mct__close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 1;
	width: 44px;
	height: 44px;
}

@media (max-width: 480px) {
	.mct .mct__card {
		padding: 24px 22px 22px;
	}

	.mct .mct__dialog .mct__card {
		padding: 28px 24px 24px;
	}

	.mct .mct__btn {
		width: 44px;
		height: 44px;
	}
}

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

	.mct__dot::before,
	.mct__progress span,
	.mct .mct__btn {
		transition: none;
	}
}
