/* Guest testimonials — homepage, between the therapy bands and the showroom.
   Built only from the theme's tokens (site.css :root); no new colours or faces.
   The four seam hues are the therapy band glows (tbyb_glow()). */

.voices {
	--voices-stage: clamp(330px, 34vw, 520px);
	--voices-top: clamp(120px, 11vw, 170px); /* the open band the light rises through */
	--voices-r: 36px;     /* same radius as the therapy band frames */
	--voices-bezel: 8px;
	--voices-out: cubic-bezier(0.23, 1, 0.32, 1);
	position: relative;
	isolation: isolate;
	background:
		radial-gradient(34% 46% at 76% 56%, #d6b26d17, transparent 70%),
		var(--black);
	padding-block: var(--voices-top) clamp(96px, 10vw, 150px);
	scroll-margin-top: 0;
	overflow: clip;
}

/* ---- Seam: the therapy bands' light, rising back up out of this section.
        Each colour hangs from the line as a soft pool; a thin streak of it
        travels upward and disappears into the line, left to right, on a loop.
        Line stops sit at 20/40/60/80% of the line (6%..94% of the section),
        so the currents sit at 23.6/41.2/58.8/76.4%. -------------------------- */

.voices-seam {
	position: absolute;
	inset: 0 0 auto;
	height: calc(var(--voices-top) - 18px); /* stops above the heading: light never crosses text */
	pointer-events: none;
	z-index: -1;
}
.voices-seam-line {
	position: absolute;
	top: 0;
	left: 6%;
	right: 6%;
	height: 1px;
	background: linear-gradient(90deg, transparent, #ff2d55 20%, #b45cff 40%, #ff8a2a 60%, #36b4ff 80%, transparent);
	box-shadow: 0 0 18px 1px #ff8a2a40;
	transform-origin: 50% 50%;
	transition: transform 1.4s var(--voices-out), opacity 1.4s var(--voices-out);
}
.voices-current {
	--x: calc(6% + 88% * (.2 + var(--k) * .2));
	position: absolute;
	top: 1px;
	bottom: 0;
	left: var(--x);
	width: clamp(120px, 14vw, 220px);
	translate: -50% 0;
	overflow: hidden;
	transition: opacity 1.4s var(--voices-out) calc(.3s + var(--k) * .12s);
}
/* the pool of light hanging from the line */
.voices-current::before {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(50% 100% at 50% 0, color-mix(in srgb, var(--glow) 26%, transparent), transparent 85%);
	opacity: .6;
	animation: voices-pool 5.2s cubic-bezier(.4, 0, .6, 1) infinite;
	animation-delay: calc(var(--k) * 1.3s);
}
/* the streak: a full-height strip whose bright head is its top 30%,
   translated from below the pool up through the line */
.voices-current::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 2px;
	translate: -50% 0;
	border-radius: 2px;
	background: linear-gradient(to top, transparent 62%, color-mix(in srgb, var(--glow) 70%, transparent) 86%, var(--glow2) 97%, #fff6e6 100%);
	filter: drop-shadow(0 0 6px var(--glow));
	opacity: 0;
	animation: voices-rise 5.2s cubic-bezier(.4, 0, .6, 1) infinite;
	animation-delay: calc(var(--k) * 1.3s);
}
@keyframes voices-rise {
	0%   { transform: translateY(70%); opacity: 0; }
	12%  { opacity: 1; }
	52%  { transform: translateY(-100%); opacity: 1; }
	53%, 100% { transform: translateY(-100%); opacity: 0; }
}
/* the pool brightens as its streak reaches the line */
@keyframes voices-pool {
	0%, 34%   { opacity: .6; }
	50%       { opacity: 1; }
	72%, 100% { opacity: .6; }
}
/* nothing runs while the section is off screen */
.voices:not(.is-visible) .voices-current::before,
.voices:not(.is-visible) .voices-current::after { animation-play-state: paused; }

.voices-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--voices-stage);
	grid-template-areas:
		"head  stage"
		"words stage"
		"list  stage"
		"more  stage"
		".     note";
	/* the film spans the left column; any extra height it needs falls after the
	   transcript link, so the words and rows stay tight under the heading */
	grid-template-rows: auto auto auto 1fr auto;
	column-gap: clamp(56px, 8vw, 140px);
	align-items: start;
}

/* ---- Heading -------------------------------------------------------------- */

.voices-head { grid-area: head; max-width: 760px; }

.voices-head h2 {
	font-family: var(--font-serif);
	font-weight: 300;
	font-size: clamp(40px, 4.7vw, 78px);
	line-height: 1.02;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: var(--cream);
	/* the gold counter-phrase always starts its own line */
	display: flex;
	flex-wrap: wrap;
	column-gap: .26em;
}
.voices-head h2 .blur-accent { order: 2; }
.voices-head h2::after { content: ""; flex-basis: 100%; order: 1; }

/* provenance, captioned under the film: costs the left column no height */
/* Set in Geist, not Cormorant: at caption size Cormorant's small x-height and
   hairlines go thin and grey. The lead phrase carries the weight. */
.voices-note {
	grid-area: note;
	margin: 22px 0 0;
	padding-inline: calc(var(--voices-bezel) + 4px);
	font-family: var(--font-sans);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.6;
	letter-spacing: .01em;
	color: #f2e9d8b8;
	text-wrap: balance;
}
.voices-note span { color: var(--cream); font-weight: 500; }

/* ---- The words, set as they are spoken ------------------------------------ */

.voices-words {
	grid-area: words;
	position: relative;
	display: grid;
	margin-top: clamp(26px, 2.6vw, 40px);
	min-height: calc(2 * 1.14em); /* phrases are capped at two lines (voices.js) */
	align-items: start;
	font-family: var(--font-serif);
	font-weight: 300;
	font-size: clamp(32px, 3.2vw, 54px);
	line-height: 1.14;
	letter-spacing: .002em;
	color: var(--cream);
	text-wrap: pretty;
}

/* the two lines share one cell and cross-fade */
.voices-line {
	grid-area: 1 / 1;
	align-self: start;
	max-width: 19em;
	opacity: 0;
	filter: blur(6px);
	transform: translateY(12px);
	transition:
		opacity .28s var(--voices-out),
		filter .28s var(--voices-out),
		transform .28s var(--voices-out);
	pointer-events: none;
}
.voices-line.is-current {
	opacity: 1;
	filter: none;
	transform: none;
	transition-duration: .7s;
	transition-delay: .06s;
}
.voices-line.is-leaving { transform: translateY(-10px); }

/* opacity only: never move text someone is reading */
.voices-line .w { transition: opacity .3s var(--voices-out); opacity: .24; }
.voices-line .w.is-said { opacity: 1; }
.voices[data-state="idle"] .voices-line .w,
.voices[data-state="blocked"] .voices-line .w { opacity: 1; }

/* ---- Stage: a double bezel, glass in a tray -------------------------------- */

.voices-stage { margin: 0; display: contents; }

.voices-shell {
	grid-area: stage;
	/* top level with the heading; bottom on or below the last guest row, never above */
	align-self: stretch;
	display: flex;
	flex-direction: column;
	min-height: calc((var(--voices-stage) - 2 * var(--voices-bezel)) * 16 / 9 * .9 + 2 * var(--voices-bezel));
	position: relative;
	padding: var(--voices-bezel);
	border-radius: var(--voices-r);
	background: linear-gradient(180deg, #f2e9d80f, #f2e9d805 60%, #d6b26d0d);
	border: 1px solid #d6b26d2e;
	box-shadow:
		inset 0 1px 0 #fff6e61a,
		0 60px 120px -60px #000,
		0 40px 90px -60px #d6b26d4d;
	transition:
		opacity 1s var(--voices-out),
		transform 1.1s var(--voices-out);
}
/* warm floor light under the film, the same light as the showroom; it stops at
   the frame's foot so it never sits behind the caption below */
.voices-shell::before {
	content: "";
	position: absolute;
	inset: auto -30% 0 -30%;
	height: 38%;
	background: radial-gradient(50% 50% at 50% 50%, #d6b26d2e, transparent 70%);
	z-index: -1;
	pointer-events: none;
}

.voices-frame {
	position: relative;
	flex: 1;
	width: 100%;
	border-radius: calc(var(--voices-r) - var(--voices-bezel));
	background: var(--char);
	overflow: hidden;
	isolation: isolate;
}
/* inner edge light, drawn above the film */
.voices-frame::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	box-shadow: inset 0 0 0 1px #fff6e614, inset 0 1px 0 #fff6e62e;
	pointer-events: none;
	z-index: 3;
}

.voices-video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: 50% 30%;
	background: var(--char);
	transition:
		opacity .7s var(--voices-out),
		filter .7s var(--voices-out),
		transform .9s var(--voices-out);
}
/* guest switch: the film dissolves out softly, the next one settles in */
.voices[data-swapping] .voices-video {
	opacity: 0;
	filter: blur(12px);
	transform: scale(1.04);
	transition-duration: .22s;
}

.voices-scrim {
	position: absolute;
	inset: 0;
	background: linear-gradient(to bottom, #0b090799 0%, transparent 22%, transparent 72%, #0b090726 100%);
	pointer-events: none;
}

.voices-controls {
	position: absolute;
	inset: 14px 14px auto 14px;
	z-index: 2;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	opacity: 0;
	transition: opacity .4s var(--voices-out);
}
.js .voices-controls { opacity: 1; }
.voices[data-state="idle"] .voices-controls,
.voices[data-state="blocked"] .voices-controls { opacity: 0; pointer-events: none; }

.voices-sound,
.voices-toggle {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	color: var(--cream);
	background: #0b090773;
	border: 1px solid #f3dfa640;
	border-radius: 999px;
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	transition:
		border-color .3s ease,
		background-color .3s ease,
		color .3s ease,
		transform .16s var(--voices-out);
	cursor: pointer;
}
.voices-sound {
	padding: 0 18px 0 14px;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: .16em;
	text-transform: uppercase;
}
.voices-toggle { width: 44px; justify-content: center; padding: 0; }
.voices-sound:active,
.voices-toggle:active { transform: scale(.96); }
@media (hover: hover) and (pointer: fine) {
	.voices-sound:hover,
	.voices-toggle:hover { border-color: #f3dfa6a6; background: #0b0907a6; color: var(--gold-hi); }
}

.voices-icon { flex: none; }
.voices-sound .voices-icon-sound,
.voices-sound[aria-pressed="true"] .voices-icon-muted,
.voices-toggle .voices-icon-pause,
.voices[data-state="playing"] .voices-toggle .voices-icon-play { display: none; }
.voices-sound[aria-pressed="true"] .voices-icon-sound,
.voices[data-state="playing"] .voices-toggle .voices-icon-pause { display: block; }

/* Big start button: shown when autoplay is off (reduced motion, data saver) or refused */
.voices-start {
	position: absolute;
	left: 50%;
	bottom: 28px;
	z-index: 2;
	translate: -50% 0;
	display: none;
}
.voices-start .voices-icon { width: 18px; height: 18px; }
.js .voices[data-state="idle"] .voices-start,
.js .voices[data-state="blocked"] .voices-start { display: inline-flex; }

/* ---- Guest index ----------------------------------------------------------- */

.voices-list {
	grid-area: list;
	margin: clamp(28px, 3vw, 44px) 0 0;
	padding: 0;
	list-style: none;
	align-self: start;
}

.voices-item {
	position: relative;
	display: grid;
	grid-template-columns: 7em minmax(0, 1fr) auto;
	align-items: baseline;
	gap: 0 24px;
	padding: 18px 0 17px;
	color: var(--muted);
	transition: color .45s ease;
}
/* the whole row is the play button; tag links sit above it */
.voices-row {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: none;
	border: 0;
	border-radius: 4px;
	cursor: pointer;
}
.voices-row:focus-visible { outline-offset: 2px; }
.voices-item:has([aria-current="true"]) { color: var(--cream); }
@media (hover: hover) and (pointer: fine) {
	.voices-item:hover { color: var(--cream); }
	.voices-item:hover .voices-name { opacity: 1; }
}

/* the progress line runs under each guest */
.voices-rail {
	position: absolute;
	inset: auto 0 0;
	height: 1px;
	background: var(--line);
	overflow: hidden;
}
.voices-fill {
	position: absolute;
	inset: 0;
	background: var(--gold-grad);
	transform: scaleX(0);
	transform-origin: left;
}
.voices-item:has([aria-current="true"]) .voices-rail { background: #d6b26d4d; }

.voices-name {
	font-family: var(--font-serif);
	font-size: clamp(22px, 1.8vw, 28px);
	font-weight: 400;
	letter-spacing: .01em;
	line-height: 1.1;
	color: var(--cream);
	opacity: .7;
	transition: opacity .45s ease, color .45s ease;
}
.voices-item:has([aria-current="true"]) .voices-name { opacity: 1; color: var(--gold); font-style: italic; }

/* Still the spoken voice (Cormorant italic), but at 500 and a size up: the
   300/400 cuts are hairline-thin at this size on a dark ground. */
.voices-quote {
	min-width: 0;
	font-family: var(--font-serif);
	font-size: clamp(20px, 1.5vw, 23px);
	font-style: italic;
	font-weight: 500;
	line-height: 1.35;
	letter-spacing: .005em;
	text-wrap: pretty; /* no one-word last line ("gone.") */
	color: #f2e9d8c2;
	transition: color .45s ease;
}
.voices-item:has([aria-current="true"]) .voices-quote { color: var(--cream); }
@media (hover: hover) and (pointer: fine) {
	.voices-item:hover .voices-quote { color: var(--cream); }
}

.voices-time {
	font-size: 12px;
	font-weight: 500;
	letter-spacing: .14em;
	font-variant-numeric: tabular-nums;
	color: var(--gold);
	opacity: .8;
}

/* ---- Transcript ------------------------------------------------------------- */

.voices-transcript { grid-area: more; margin-top: 28px; }
.voices-transcript summary {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
	list-style: none;
	cursor: pointer;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--cream);
	background: linear-gradient(var(--gold), var(--gold)) 0 calc(100% - 8px) / 100% 1px no-repeat;
	transition: color .3s ease;
}
.voices-transcript summary::-webkit-details-marker { display: none; }
.voices-transcript summary:hover { color: var(--gold-hi); }
.voices-transcript summary svg { transition: transform .3s var(--voices-out); }
.voices-transcript[open] summary svg { transform: rotate(45deg); }

.voices-transcript-body {
	max-width: 68ch;
	padding-top: 20px;
	color: #f2e9d8c7;
	font-size: 16px;
	line-height: 1.75;
}
.voices-transcript-body h3 {
	margin: 26px 0 6px;
	font-family: var(--font-serif);
	font-size: 22px;
	font-weight: 400;
	color: var(--gold-hi);
}
.voices-transcript-body h3:first-child { margin-top: 0; }

/* ---- Intro link ("Hear it from our guests") ---------------------------------- */

.first-voices { margin-top: clamp(26px, 2.4vw, 36px); }
.first-voices .pill-icon { transition: transform .5s var(--voices-out, cubic-bezier(.23, 1, .32, 1)); }
.first-voices:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) {
	.first-voices:hover .pill-icon { transform: translateY(2px); }
}

/* ---- Entry: the seam draws out from the middle, then the film and the rows settle.
        Only with JS, so nothing is ever hidden for good. ------------------------------ */

.js .voices:not(.is-in) .voices-seam-line { transform: scaleX(0); opacity: 0; }
.js .voices:not(.is-in) .voices-current { opacity: 0; }
.js .voices:not(.is-in) .voices-shell { opacity: 0; transform: translateY(40px) scale(.97); }
.js .voices:not(.is-in) .voices-note,
.js .voices:not(.is-in) .voices-item,
.js .voices:not(.is-in) .voices-transcript { opacity: 0; transform: translateY(16px); }

.voices-note,
.voices-item,
.voices-transcript {
	transition:
		opacity .9s var(--voices-out),
		transform .9s var(--voices-out),
		color .45s ease;
}
.voices-shell { transition-delay: .15s; }
.voices-note { transition-delay: .5s; }
.voices-item { transition-delay: calc(.35s + var(--i) * 60ms), calc(.35s + var(--i) * 60ms), 0s; }
.voices-transcript { transition-delay: .8s; }
.voices.is-settled .voices-item { transition-delay: 0s; }

/* ---- Tablet / phone ------------------------------------------------------------ */

@media (max-width: 1000px) {
	.voices { --voices-r: 28px; --voices-bezel: 6px; }
	.voices-grid {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "head" "stage" "note" "list" "more";
		grid-template-rows: none;
	}
	.voices-shell {
		width: min(100%, 440px);
		margin: clamp(40px, 8vw, 64px) auto 0;
		justify-self: center;
		align-self: start;
		min-height: 0;
	}
	.voices-frame { flex: none; aspect-ratio: 9 / 16; }
	/* words ride on the film, like captions on any vertical clip */
	.voices-words {
		grid-area: stage;
		align-self: end;
		justify-self: center;
		z-index: 2;
		width: min(100%, 440px);
		margin: 0;
		padding: 0 30px 98px;
		min-height: 0;
		font-size: clamp(22px, 6vw, 28px);
		line-height: 1.2;
		text-shadow: 0 1px 18px #0b0907, 0 0 2px #0b0907b3;
		pointer-events: none;
	}
	.voices-line { max-width: none; }
	.voices-line .w { opacity: .42; }
	.voices-scrim { background: linear-gradient(to bottom, #0b090799 0%, transparent 20%, transparent 46%, #0b0907e6 100%); }
	.voices-start { bottom: 26px; }
	.voices[data-state="idle"] .voices-words,
	.voices[data-state="blocked"] .voices-words { padding-bottom: 104px; }
	.voices-list { margin-top: 36px; }
	.voices-note { width: min(100%, 440px); justify-self: center; margin-top: 18px; font-size: 14.5px; text-wrap: pretty; }
	.voices-note span { display: block; } /* the lead phrase gets its own line */
	.voices-item { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; }
	.voices-quote { grid-column: 1 / -1; grid-row: 2; }
	.voices-time { grid-column: 2; grid-row: 1; }
	.voices { --voices-top: clamp(96px, 22vw, 120px); }
	.voices-seam-line { left: 0; right: 0; }
	.voices-current { --x: calc(100% * (.2 + var(--k) * .2)); width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
	.voices-current::before { animation: none; }
	.voices-current::after { display: none; }
	.voices-line,
	.voices-line.is-current { transition: opacity .2s ease; filter: none; transform: none; }
	.voices[data-swapping] .voices-video { filter: none; transform: none; }
	.js .voices:not(.is-in) .voices-seam-line,
	.js .voices:not(.is-in) .voices-current,
	.js .voices:not(.is-in) .voices-shell,
	.js .voices:not(.is-in) .voices-note,
	.js .voices:not(.is-in) .voices-item,
	.js .voices:not(.is-in) .voices-transcript { transform: none; }
}

/* the section takes focus after the "Hear it from our guests" glide (for
   keyboard and screen-reader users); no ring on the whole section */
.voices:focus { outline: none; }
