/**
 * ONC3D Testimonials grid.
 *
 * Monochrome, image-led, editorial — matches the ONC3D design system
 * (see Design.MD). Type sizes are a step up from the original mock so the
 * quote reads at the theme's "prominent body statement" scale (24px desktop).
 */

.onc3d-testimonials {
	--onc3d-testimonial-surface: #f4f4f4;
	--onc3d-testimonial-ink: #2f302f;
	--onc3d-testimonial-ink-muted: #6b6b6b;
	--onc3d-testimonial-tail-width: 44px;
	--onc3d-testimonial-tail-height: 16px;
	--onc3d-testimonial-row-gap: 64px;
	--onc3d-testimonial-column-gap: 40px;

	display: grid;
	align-items: stretch;
	column-gap: var(--onc3d-testimonial-column-gap);
	row-gap: var(--onc3d-testimonial-row-gap);
	margin: 0 0 1.5em;
	padding: 0;
}

.onc3d-testimonials--cols-1 { grid-template-columns: minmax(0, 1fr); }
.onc3d-testimonials--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.onc3d-testimonials--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.onc3d-testimonials--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

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

.onc3d-testimonial {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	text-align: center;
}

/* Grey quote panel with the downward tail from the reference design. */
.onc3d-testimonial__quote {
	position: relative;
	/*
	 * Never let the panel absorb leftover card height: it would drag the tail
	 * away from the text and misalign it against neighbouring cards.
	 */
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	padding: 52px 56px;
	background-color: var(--onc3d-testimonial-surface);
	border-radius: 2px;
}

.onc3d-testimonial__quote::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	width: 0;
	height: 0;
	transform: translateX(-50%);
	border-left: calc(var(--onc3d-testimonial-tail-width) / 2) solid transparent;
	border-right: calc(var(--onc3d-testimonial-tail-width) / 2) solid transparent;
	border-top: var(--onc3d-testimonial-tail-height) solid var(--onc3d-testimonial-surface);
}

/* Quote ------------------------------------------------------------------ */

.onc3d-testimonial__quote-text {
	margin: 0;
	padding: 0;
	border: 0;
	quotes: none;
	font-family: "Bodoni 72", "Miller", Georgia, "Times New Roman", serif;
	font-size: clamp(1.125rem, 0.95rem + 0.72vw, 1.5rem); /* 18px -> 24px */
	font-style: normal;
	font-weight: 400;
	line-height: 1.75;
	letter-spacing: 0.01em;
	color: var(--onc3d-testimonial-ink);
}

.onc3d-testimonial__quote-text > *:first-child { margin-top: 0; }
.onc3d-testimonial__quote-text > *:last-child { margin-bottom: 0; }

.onc3d-testimonial__quote-text p {
	margin: 0 0 0.9em;
	font-size: 0.8em;
}

/* Typographic quote marks, unless the shortcode is called with quotes="no". */
.onc3d-testimonials--quoted .onc3d-testimonial__quote-text > p:first-child::before {
	content: "\201C";
}

.onc3d-testimonials--quoted .onc3d-testimonial__quote-text > p:last-child::after {
	content: "\201D";
}

/* Attribution ------------------------------------------------------------ */

.onc3d-testimonial__meta {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	padding: calc(var(--onc3d-testimonial-tail-height) + 30px) 0 0;
	text-align: center;
}

.onc3d-testimonial__name {
	font-family: "Bodoni 72", "Miller", Georgia, "Times New Roman", serif;
	font-size: clamp(1.125rem, 1.02rem + 0.42vw, 1.375rem); /* 18px -> 22px */
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: 0.03em;
	color: var(--onc3d-testimonial-ink);
}

.onc3d-testimonial__role {
	margin-top: 10px;
	font-family: "Bodoni 72", "Miller", Georgia, "Times New Roman", serif;
	font-size: clamp(0.9375rem, 0.89rem + 0.19vw, 1rem); /* 15px -> 16px */
	font-weight: 400;
	line-height: 1.5;
	letter-spacing: 0.04em;
	/* Darker than the reference mock: the original light grey fails WCAG AA. */
	color: var(--onc3d-testimonial-ink-muted);
}

.onc3d-testimonial__logo {
	display: block;
	margin-top: 28px;
}

.onc3d-testimonial__logo-image {
	display: inline-block;
	width: auto;
	max-width: 100%;
	max-height: 88px;
	height: auto;
}

/*
 * Panel alignment (progressive enhancement).
 *
 * Without subgrid, cards keep correct tails but panels end at their natural
 * height. Where subgrid is supported, every panel in a row shares one track,
 * so the grey blocks and their tails align exactly. Row gap moves onto the
 * attribution because the parent gap would otherwise open up between a card's
 * own two tracks.
 */
@supports (grid-template-rows: subgrid) {
	.onc3d-testimonials {
		row-gap: 0;
		margin-bottom: 0;
	}

	.onc3d-testimonial {
		display: grid;
		grid-row: span 2;
		grid-template-rows: subgrid;
		row-gap: 0;
	}

	.onc3d-testimonial__quote {
		align-self: stretch;
	}

	.onc3d-testimonial__meta {
		align-self: start;
		padding-bottom: var(--onc3d-testimonial-row-gap);
	}
}

/* Editor-only notice ----------------------------------------------------- */

.onc3d-testimonials__empty {
	margin: 0 0 1.5em;
	font-style: italic;
	color: var(--onc3d-testimonial-ink-muted, #6b6b6b);
}

/* Responsive ------------------------------------------------------------- */

@media only screen and (max-width: 1024px) {
	.onc3d-testimonials {
		--onc3d-testimonial-row-gap: 56px;
		--onc3d-testimonial-column-gap: 32px;
	}

	.onc3d-testimonials--cols-3,
	.onc3d-testimonials--cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.onc3d-testimonial__quote {
		padding: 44px 36px;
	}
}

@media only screen and (max-width: 767px) {
	.onc3d-testimonials {
		--onc3d-testimonial-row-gap: 48px;
		--onc3d-testimonial-column-gap: 0px;
	}

	.onc3d-testimonials--cols-2,
	.onc3d-testimonials--cols-3,
	.onc3d-testimonials--cols-4 {
		grid-template-columns: minmax(0, 1fr);
	}

	.onc3d-testimonial__quote {
		padding: 36px 24px;
	}

	.onc3d-testimonial__meta {
		padding-top: calc(var(--onc3d-testimonial-tail-height) + 22px);
	}

	.onc3d-testimonial__logo-image {
		max-height: 88px;
	}
}
