/*
 * The homepage's "Faces of the Trail" row and its player (F2, Design items 1 to 9). Loaded only where the section
 * renders (atotb_faces_render). Colours come from the theme's tokens: text on the cards sits on ink, never on the
 * poster; the Watch pill is ink on mint; no yellow (0044) and no white text on mint (0024). The only motion is the
 * visitor's own scrolling, and it isn't smooth under reduced motion.
 */

/* The section: heading and display line on the left, the row's buttons at the right of them (on a phone, beside the
   count under the row). The row runs off the right edge; its first card lines up with the page's 1200 px content. */
.atotb-faces.atotb-faces {
	/* The section is the container, so the gutter is measured from its width wherever it's used (a percentage would
	   be measured from each grid area instead). */
	--atotb-faces-gutter: max(var(--wp--style--root--padding-left, 1.25rem), calc((100cqw - 1200px) / 2));
	container-type: inline-size;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas: "heading controls" "line controls" "row row" "progress progress";
	align-items: end;
	column-gap: 2rem;
	padding-block: var(--wp--preset--spacing--80) var(--wp--preset--spacing--70);
}
.atotb-faces.atotb-faces > * {
	margin-block: 0;
}
/* What the script hides stays hidden: the row's buttons and count when the row fits, the player's person buttons when
   there's one card. The display rules below would otherwise win over the browser's own [hidden] rule. */
.atotb-faces [hidden],
.atotb-faces-player [hidden] {
	display: none !important;
}
.atotb-faces > .atotb-faces__heading {
	grid-area: heading;
	padding-inline-start: var(--atotb-faces-gutter);
}
.atotb-faces > .atotb-faces__line {
	grid-area: line;
	max-width: calc(var(--atotb-faces-gutter) + 47.5rem);
	margin-block-start: 0.75rem;
	padding-inline-start: var(--atotb-faces-gutter);
	font-size: clamp(2rem, 1.25rem + 2.4vw, 3rem);
	line-height: 1.1;
	font-weight: 700;
	letter-spacing: -0.01em;
}
.atotb-faces > .atotb-faces__row {
	grid-area: row;
	margin-block-start: 2.5rem;
	min-width: 0;
}
.atotb-faces > .atotb-faces__controls {
	grid-area: controls;
	display: flex;
	gap: 0.75rem;
	padding-inline-end: var(--atotb-faces-gutter);
}
.atotb-faces > .atotb-faces__progress {
	grid-area: progress;
	display: flex;
	align-items: center;
	gap: 1.25rem;
	margin-block-start: 2rem;
	padding-inline: var(--atotb-faces-gutter);
}

/* The row: a list that scrolls sideways inside its own box and snaps to each card. */
.atotb-faces__list {
	display: flex;
	gap: 1.5rem;
	margin: 0;
	padding: 0 var(--wp--style--root--padding-right, 1.25rem) 0.25rem var(--atotb-faces-gutter);
	list-style: none;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding-inline-start: var(--atotb-faces-gutter);
	scroll-behavior: smooth;
}
.atotb-faces.is-enhanced .atotb-faces__list {
	scrollbar-width: none;
}
.atotb-faces.is-enhanced .atotb-faces__list::-webkit-scrollbar {
	display: none;
}
/* Under reduced motion the theme's rule for every element makes scroll-behavior auto (theme.json), and the script
   moves the row without smoothing. */

/* A card: the poster fills the top 9:10 and fades into ink, where the text sits. */
.atotb-faces__card {
	position: relative;
	flex: 0 0 18rem;
	height: 30rem;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	overflow: hidden;
	border-radius: 12px;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--white);
	scroll-snap-align: start;
}
.atotb-faces__poster {
	position: absolute;
	inset: 0 0 auto;
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 9 / 10;
	object-fit: cover;
	object-position: top center;
}
.atotb-faces__text {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
	padding: 0 1.25rem 1.375rem;
	background: var(--wp--preset--color--ink);
}
.atotb-faces__text::before {
	content: "";
	position: absolute;
	inset: auto 0 100%;
	height: 7.5rem;
	background: linear-gradient(to bottom, transparent, var(--wp--preset--color--ink));
	pointer-events: none;
}
.atotb-faces__quote {
	order: -1;
	margin: 0 0 0.875rem;
	padding: 0;
	border: 0;
}
.atotb-faces__quote p {
	margin: 0;
	font-size: 1.1875rem;
	line-height: 1.32;
	font-weight: 600;
}
.atotb-faces__name,
.atotb-faces__role {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
}
.atotb-faces__name {
	font-weight: 700;
	letter-spacing: 0;
}
.atotb-faces__role {
	color: var(--wp--preset--color--mint);
}

/* Watch: a mint pill at the card's top left, ink text, 44 px tall. Its focus ring is ink with a white edge, so it
   shows on any poster. */
.atotb-faces__watch {
	position: absolute;
	top: 1rem;
	left: 1rem;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 2.75rem;
	padding: 0 1rem 0 0.75rem;
	border-radius: 999px;
	background: var(--wp--preset--color--mint);
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
}
.atotb-faces__watch::before {
	content: "";
	width: 0.75rem;
	height: 0.875rem;
	background: currentColor;
	clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.atotb-faces__watch:hover {
	background: var(--wp--preset--color--pale-mint);
	color: var(--wp--preset--color--ink);
}
.atotb-faces__watch:focus-visible {
	outline: 3px solid var(--wp--preset--color--ink);
	outline-offset: 2px;
	box-shadow: 0 0 0 5px var(--wp--preset--color--white);
}
.atotb-faces__length {
	font-weight: 500;
}

/* Without the script, each card's transcript opens over the card, above its own button. With the script, the player
   shows it instead. */
.atotb-faces__transcript {
	padding: 0 1.25rem 0.5rem;
	background: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
}
.atotb-faces__transcript summary {
	display: flex;
	align-items: center;
	min-height: 2.75rem;
	color: var(--wp--preset--color--mint);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 0.18em;
	cursor: pointer;
}
.atotb-faces__transcript[open] .atotb-faces__transcript-body {
	position: absolute;
	inset: 0 0 3.25rem;
	z-index: 2;
	overflow-y: auto;
	padding: 1.25rem;
	background: var(--wp--preset--color--ink);
	line-height: 1.5;
}
.atotb-faces__transcript-body p {
	margin: 0 0 0.75rem;
}
.atotb-faces.is-enhanced .atotb-faces__transcript {
	display: none;
}

/* The previous and next buttons: round, 48 px, a 2 px mint edge (6.3:1 on deep teal). */
.atotb-faces__step {
	display: grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	padding: 0;
	border: 2px solid var(--wp--preset--color--mint);
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--white);
	cursor: pointer;
}
.atotb-faces__step::before {
	content: "";
	width: 0.625rem;
	height: 0.625rem;
	border: solid currentColor;
	border-width: 0 0 2.5px 2.5px;
	transform: translateX(0.125rem) rotate(45deg);
}
.atotb-faces__step--next::before {
	transform: translateX(-0.125rem) rotate(-135deg);
}
.atotb-faces__step:hover {
	background: var(--wp--preset--color--ink);
}
.atotb-faces__step[aria-disabled="true"] {
	border-color: color-mix(in srgb, var(--wp--preset--color--mint) 45%, transparent);
	color: color-mix(in srgb, var(--wp--preset--color--white) 45%, transparent);
	cursor: default;
}
.atotb-faces__step[aria-disabled="true"]:hover {
	background: transparent;
}

/* Under the row: a decorative bar, mint on 18% white, and the count, which is what screen readers hear. */
.atotb-faces__bar {
	position: relative;
	flex: 1;
	height: 4px;
	overflow: hidden;
	border-radius: 4px;
	background: rgb(255 255 255 / 18%);
}
.atotb-faces__fill {
	position: absolute;
	inset: 0 auto 0 0;
	border-radius: 4px;
	background: var(--wp--preset--color--mint);
}
.atotb-faces__count {
	margin: 0;
	color: var(--wp--preset--color--pale-mint);
	font-size: var(--wp--preset--font-size--small);
	white-space: nowrap;
}

@media (max-width: 781px) {
	.atotb-faces.atotb-faces {
		grid-template-areas: "heading heading" "line line" "row row" "progress controls";
		column-gap: 1rem;
	}
	.atotb-faces > .atotb-faces__row {
		margin-block-start: 1.75rem;
	}
	.atotb-faces > .atotb-faces__progress {
		padding-inline-end: 0;
	}
	.atotb-faces > .atotb-faces__controls {
		margin-block-start: 2rem;
		padding-inline-end: var(--wp--style--root--padding-right, 1.25rem);
	}
	.atotb-faces__list {
		gap: 1rem;
	}
	.atotb-faces__card {
		flex-basis: 17.5rem;
		height: 29.25rem;
	}
	.atotb-faces__quote p {
		font-size: 1.125rem;
	}
}

/* The player: a modal dialog with the 9:16 video at full height beside the person's words; on a phone it fills the
   screen. A light surface: ink text, green eyebrow (5.9:1), slate role (7.5:1). */
.atotb-faces-player {
	width: min(65rem, calc(100vw - 3rem));
	max-width: none;
	max-height: calc(100dvh - 3rem);
	padding: 0;
	overflow: auto;
	border: 0;
	border-radius: 16px;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink);
}
.atotb-faces-player::backdrop {
	background: rgb(18 35 29 / 92%);
}
.atotb-faces-player__inner {
	position: relative;
	display: flex;
	gap: 3rem;
	padding: 2rem;
}
.atotb-faces-player__video {
	flex: 0 0 auto;
	height: min(45rem, calc(100dvh - 7rem));
	aspect-ratio: 9 / 16;
	overflow: hidden;
	border-radius: 10px;
	background: #000;
}
.atotb-faces-player__video iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}
.atotb-faces-player__panel {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 1rem;
	min-width: 0;
	padding-top: 0.5rem;
	padding-inline-end: 2.5rem;
}
.atotb-faces-player__panel > * {
	margin: 0;
}
.atotb-faces-player__eyebrow {
	color: var(--wp--preset--color--green);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
}
.atotb-faces-player__name {
	font-size: var(--wp--preset--font-size--x-large);
	line-height: 1.15;
}
.atotb-faces-player__role,
.atotb-faces-player__note {
	color: var(--wp--preset--color--slate);
}
.atotb-faces-player__quote {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 1.375rem;
	line-height: 1.4;
	font-weight: 600;
}
.atotb-faces-player__note {
	font-size: var(--wp--preset--font-size--small);
}
.atotb-faces-player__transcript {
	border-top: 1px solid var(--wp--preset--color--sage);
	padding-top: 0.5rem;
}
.atotb-faces-player__transcript summary {
	display: flex;
	align-items: center;
	min-height: 2.75rem;
	font-weight: 700;
	cursor: pointer;
}
.atotb-faces-player__transcript-body {
	max-height: 16rem;
	overflow-y: auto;
	padding-inline-end: 0.5rem;
	font-size: 0.9375rem;
	line-height: 1.6;
}
.atotb-faces-player__transcript-body p {
	margin: 0 0 0.5rem;
}
.atotb-faces-player__nav {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: auto;
	padding-top: 0.5rem;
}
.atotb-faces-player__nav button,
.atotb-faces-player__close {
	min-height: 2.75rem;
	border: 2px solid var(--wp--preset--color--sage);
	border-radius: 999px;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	cursor: pointer;
}
.atotb-faces-player__nav button {
	padding: 0 1.125rem;
}
.atotb-faces-player__nav button:hover,
.atotb-faces-player__close:hover {
	background: var(--wp--preset--color--pale-mint);
}
.atotb-faces-player__close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	z-index: 1;
	display: grid;
	place-items: center;
	width: 2.75rem;
	padding: 0;
	font-size: 1.5rem;
	line-height: 1;
}
@media (max-width: 781px) {
	.atotb-faces-player {
		width: 100vw;
		height: 100dvh;
		max-height: none;
		margin: 0;
		border-radius: 0;
	}
	.atotb-faces-player__inner {
		flex-direction: column;
		gap: 1.5rem;
		padding: 4rem 1rem 1.5rem;
	}
	.atotb-faces-player__video {
		width: min(100%, calc((100dvh - 6rem) * 9 / 16));
		height: auto;
		margin-inline: auto;
	}
	.atotb-faces-player__panel {
		padding-inline-end: 0;
	}
	/* The player scrolls on a phone; the way out stays on screen. */
	.atotb-faces-player__close {
		position: fixed;
	}
}
