/**
 * Testimonials page (page-templates/template-testimonials.php).
 *
 * Loaded only on that page, after theme.css, so it reuses the --tv-* tokens and
 * the shared .page-hero / .section-head / .eyebrow / .text-link rules. Nothing
 * here redefines a shared class except under a tm-* parent.
 *
 * Contents
 *   1. Hero
 *   2. Drag-to-compare photo (.ba)
 *   3. Results: case cards
 *   4. Customer videos
 *   5. Routine
 *   6. Share band
 *   7. Responsive
 *
 * Measurements are from Figma frame 28:395 (1440 wide).
 */

/* ============================================================ 1. HERO */

.tm-hero {
	padding: 64px 0 66px;
}

.tm-line {
	display: block;
}

.tm-hero__faces {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px 12px;
	margin: 34px 0 0;
	padding: 0;
	list-style: none;
}

.tm-hero__faces a {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 6px 18px 6px 6px;
	border-radius: 50px;
	background: var(--tv-mint);
	color: var(--tv-green);
	font-weight: 600;
	font-size: 14px;
	text-decoration: none;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.tm-hero__faces a:hover,
.tm-hero__faces a:focus-visible {
	background: var(--tv-lime-soft);
	transform: translateY(-1px);
}

.tm-hero__faces img {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
}

/* ============================================================ 2. COMPARE */

/*
 * Every pair sits in the Figma 338 x 493 portrait frame. That is exactly half
 * the 676 x 986 portrait crops, so on a 2x screen each CSS pixel has a real
 * photo pixel behind it. The landscape crown pair is cropped to the centre.
 *
 * The "after" photo is the base layer; the "before" photo sits over it and is
 * clipped from the right by --ba-pos, so the split line is wherever the range
 * input says. The range input covers the whole frame and is invisible, which
 * gives drag, tap-to-jump and arrow keys without any pointer maths in JS.
 */
.ba {
	--ba-pos: 50%;
	position: relative;
	overflow: hidden;
	width: 100%;
	max-width: 338px;
	margin-inline: auto;
	aspect-ratio: 676 / 986;
	border-radius: var(--tv-radius-photo);
	background: var(--tv-mint);
	isolation: isolate;
	user-select: none;
	-webkit-user-select: none;
	touch-action: pan-y;
}

.ba__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

.ba__before {
	position: absolute;
	inset: 0;
	clip-path: inset(0 calc(100% - var(--ba-pos)) 0 0);
}

.ba__tag {
	position: absolute;
	top: 14px;
	z-index: 2;
	padding: 6px 12px;
	border-radius: 50px;
	font-family: var(--tv-font-display);
	font-weight: 700;
	font-size: 12px;
	letter-spacing: 1.2px;
	text-transform: uppercase;
	line-height: 1.2;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.ba__tag--before {
	left: 14px;
	background: rgba(255, 255, 255, 0.92);
	color: var(--tv-green);
}

.ba__tag--after {
	right: 14px;
	background: var(--tv-green);
	color: var(--tv-white);
}

/* Fade a tag when the split line is about to run over it. */
.ba.is-left .ba__tag--before,
.ba.is-right .ba__tag--after {
	opacity: 0;
}

.ba__handle {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--ba-pos);
	z-index: 2;
	width: 2px;
	margin-left: -1px;
	background: var(--tv-white);
	box-shadow: 0 0 0 1px rgba(26, 42, 34, 0.12);
	pointer-events: none;
}

.ba__knob {
	position: absolute;
	top: 50%;
	left: 50%;
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: var(--tv-white);
	color: var(--tv-green);
	box-shadow: 0 6px 18px rgba(26, 42, 34, 0.25);
	transform: translate(-50%, -50%);
	transition: transform 0.2s ease, background-color 0.2s ease;
}

.ba:hover .ba__knob,
.ba.is-dragging .ba__knob {
	transform: translate(-50%, -50%) scale(1.08);
	background: var(--tv-lime-soft);
}

.ba__range {
	position: absolute;
	inset: 0;
	z-index: 3;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: ew-resize;
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
}

.ba__range::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 46px;
	height: 100%;
}

.ba__range::-moz-range-thumb {
	width: 46px;
	height: 100%;
	border: 0;
}

.ba:focus-within {
	outline: 3px solid var(--tv-lime);
	outline-offset: 3px;
}

/* ============================================================ 3. RESULTS */

.tm-results {
	padding: 72px 0 64px;
	background: var(--tv-mint);
}

.tm-cases {
	display: grid;
	gap: 50px;
	max-width: 1068px;
	margin: 0 auto;
}

/* Card 1068 x 579: 28px inset, 338px photo column, copy from x 428. */
.tm-case {
	display: grid;
	grid-template-columns: 338px minmax(0, 548px);
	gap: 62px;
	align-items: center;
	padding: 28px;
	border-radius: 22px;
	background: var(--tv-white);
	scroll-margin-top: calc(var(--tv-header-h) + 24px);
}

.tm-hint {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 14px;
	font-size: 13px;
	font-weight: 500;
	color: var(--tv-green);
	opacity: 0.7;
}

.tm-case__kicker {
	display: inline-block;
	margin-bottom: 12px;
	padding: 5px 12px;
	border-radius: 50px;
	background: var(--tv-yellow);
	color: var(--tv-brown);
	font-family: var(--tv-font-display);
	font-weight: 700;
	font-size: 12px;
	letter-spacing: 1.5px;
	text-transform: uppercase;
}

.tm-case__name {
	font-weight: 700;
	font-size: clamp(30px, 3.2vw, 40px);
	line-height: 1.1;
	letter-spacing: -0.01em;
}

.tm-story {
	display: grid;
	gap: 30px;
	margin: 24px 0 0;
}

/* 42px badge, text column at +54px, as in the Figma card. */
.tm-story__row {
	display: grid;
	grid-template-columns: 42px minmax(0, 1fr);
	column-gap: 12px;
	align-items: start;
	font-size: 18px;
	line-height: 1.65;
	color: var(--tv-ink);
}

.tm-story__row::before {
	content: "";
	grid-row: 1 / span 2;
	width: 42px;
	height: 42px;
	margin-top: 7px;
	background: url("../assets/img/results/icon-concern.png") center / contain no-repeat;
}

.tm-story__row--changed::before {
	background-image: url("../assets/img/results/icon-changed.png");
}

.tm-story dt {
	font-weight: 700;
}

.tm-story dd {
	margin: 0;
}

.tm-case__routine {
	margin-top: 26px;
	padding: 6px 27px;
	border-radius: 9px;
	background: var(--tv-mint);
	font-size: 18px;
	line-height: 1.65;
	color: var(--tv-ink);
}

.tm-quote {
	position: relative;
	margin: 22px 0 0;
	padding: 18px 20px 18px 24px;
	border-left: 4px solid var(--tv-lime);
	border-radius: 0 12px 12px 0;
	background: var(--tv-wash);
}

.tm-quote p {
	font-family: var(--tv-font-display);
	font-weight: 600;
	font-size: 18px;
	line-height: 1.5;
	color: var(--tv-green);
}

.tm-quote cite {
	display: block;
	margin-top: 8px;
	font-style: normal;
	font-weight: 600;
	font-size: 14px;
	color: var(--tv-brown);
}

.tm-disclaimer {
	max-width: 620px;
	margin: 50px auto 0;
	text-align: center;
	font-size: 14px;
	line-height: 1.6;
	color: var(--tv-green);
	opacity: 0.75;
}

/* ============================================================ 4. VIDEOS */

/*
 * Two 9:16 reels framed like an Instagram post: handle bar, video, "View more
 * on Instagram" footer. Figma video 397 x 706, cards 16px apart.
 */
.tm-videos {
	padding: 57px 0 40px;
	background: var(--tv-white);
}

.tm-videos__title {
	margin-bottom: 54px;
	text-align: center;
	font-weight: 600;
	font-size: clamp(2.2rem, 4.2vw, 60px);
	line-height: 1.1;
	letter-spacing: -0.01em;
}

.tm-videos__title .tm-line {
	display: inline;
}

.tm-videos__row {
	display: flex;
	justify-content: center;
	gap: 50px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tm-reel {
	flex: 0 1 399px;
	overflow: hidden;
	border: 1.5px solid #8a9a92;
	border-radius: 14px;
	background: var(--tv-white);
	box-shadow: 0 4px 18px rgba(26, 42, 34, 0.08);
}

.tm-reel__head {
	display: flex;
	align-items: center;
	gap: 18px;
	height: 64px;
	padding: 0 20px;
	font-size: 15px;
	font-weight: 500;
	color: var(--tv-ink);
}

.tm-reel__avatar {
	display: grid;
	place-items: center;
	flex: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 1px solid var(--tv-line);
	background: var(--tv-white);
}

.tm-reel__avatar img {
	width: 24px;
	height: auto;
}

.tm-reel__media {
	position: relative;
	aspect-ratio: 9 / 16;
	background: var(--tv-ink);
}

.tm-reel__video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tm-reel__play {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	width: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.tm-reel__play[hidden] {
	display: none;
}

.tm-reel__play img {
	width: 64px;
	height: 64px;
	transition: transform 0.2s ease;
}

.tm-reel__play:hover img,
.tm-reel__play:focus-visible img {
	transform: scale(1.08);
}

.tm-reel__play:focus-visible {
	outline: 3px solid var(--tv-lime);
	outline-offset: -3px;
}

.tm-reel__link {
	display: block;
	padding: 16px 18px 18px;
	font-size: 15px;
	font-weight: 500;
	color: var(--tv-ink);
	text-decoration: none;
}

.tm-reel__link:hover,
.tm-reel__link:focus-visible {
	color: var(--tv-green);
	text-decoration: underline;
}

/* ============================================================ 5. ROUTINE */

.tm-routine {
	padding: 50px 0;
	background: var(--tv-wash);
}

.tm-routine__inner {
	display: grid;
	grid-template-columns: minmax(0, 318px) minmax(0, 1fr);
	gap: 20px;
	align-items: center;
	max-width: 1276px;
}

.tm-routine__title {
	margin-bottom: 22px;
	font-weight: 600;
	font-size: clamp(1.8rem, 3vw, 36px);
	line-height: 1.1;
	letter-spacing: -0.01em;
}

.tm-steps {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* The home page step card, on white and narrower: photo band 269 x 180. */
.tm-steps .step-card {
	min-height: 302px;
	padding: 0 20px 22px;
	background: var(--tv-white);
}

.tm-steps .step-card__art {
	position: static;
	margin: 0 -20px;
	aspect-ratio: 269 / 180;
}

.tm-steps .step-card__num {
	margin: -22px auto 12px;
}

.tm-steps .step-card__title {
	margin-bottom: 6px;
}

.tm-steps .step-card__copy {
	line-height: 1.4;
}

/* ============================================================ 6. SHARE */

.tm-share {
	padding: 72px 0;
	background: var(--tv-white);
}

.tm-share__inner {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	gap: 28px;
	align-items: center;
	max-width: 1040px;
	padding: 34px 40px;
	border-radius: 22px;
	border: 1px solid var(--tv-green);
	background: var(--tv-white);
}

.tm-share__mark {
	color: var(--tv-green);
}

.tm-share__title {
	margin-bottom: 6px;
	font-weight: 700;
	font-size: 26px;
}

.tm-share__copy p {
	max-width: 58ch;
	font-size: 16px;
	line-height: 1.65;
	color: var(--tv-ink);
}

.tm-share__btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 26px;
	border-radius: 999px;
	background: var(--tv-green);
	color: var(--tv-white);
	font-weight: 600;
	font-size: 15px;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease;
}

.tm-share__btn:hover,
.tm-share__btn:focus-visible {
	background: var(--tv-ink);
}

/* ============================================================ 7. RESPONSIVE */

@media (max-width: 1080px) {
	.tm-routine__inner {
		grid-template-columns: minmax(0, 1fr);
		gap: 32px;
	}

	.tm-routine__head {
		text-align: center;
	}
}

@media (max-width: 900px) {
	/* Photo stacks above the copy, as in the 390 mobile frame. */
	.tm-case {
		grid-template-columns: minmax(0, 1fr);
		gap: 24px;
		max-width: 520px;
		margin-inline: auto;
		padding: 16px;
		border-radius: 26px;
	}

	.tm-case__copy {
		padding: 0 6px 10px;
	}

	.tm-story__row,
	.tm-case__routine {
		font-size: 16px;
	}

	.tm-story__row {
		grid-template-columns: 36px minmax(0, 1fr);
	}

	.tm-story__row::before {
		width: 36px;
		height: 36px;
		margin-top: 5px;
	}

	.tm-case__routine {
		padding-inline: 18px;
	}

	/* Reels become a swipe row with the next card peeking in. */
	.tm-videos__row {
		justify-content: flex-start;
		gap: 16px;
		margin-inline: calc(var(--tv-gutter) * -1);
		padding: 4px var(--tv-gutter) 20px;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scroll-padding-inline: var(--tv-gutter);
		-webkit-overflow-scrolling: touch;
	}

	.tm-reel {
		flex: 0 0 min(78vw, 340px);
		scroll-snap-align: start;
	}

	.tm-steps {
		grid-template-columns: minmax(0, 1fr);
		max-width: 340px;
		margin-inline: auto;
		gap: 16px;
	}

	.tm-share__inner {
		grid-template-columns: minmax(0, 1fr);
		justify-items: start;
		gap: 18px;
		width: auto;
		margin-inline: var(--tv-gutter);
		padding: 28px 24px;
	}
}

@media (max-width: 600px) {
	/* Mobile frame sets the headline on two lines at 358px wide. */
	.tm-hero .page-hero__title {
		font-size: min(36px, 9.4vw);
	}

	.tm-results {
		padding: 44px 0 56px;
	}

	.tm-cases {
		gap: 28px;
	}

	.tm-videos {
		padding: 48px 0 32px;
	}

	.tm-videos__title {
		margin-bottom: 32px;
		font-size: 36px;
	}

	.tm-videos__title .tm-line {
		display: block;
	}

	.tm-routine,
	.tm-share {
		padding: 48px 0;
	}

	.tm-hero__faces a {
		font-size: 13px;
		padding-right: 14px;
	}

	.tm-share__btn {
		width: 100%;
		justify-content: center;
	}
}
