/**
 * Subpage section: Case study spotlight (template-parts/sections/subpage/section-case_spotlight.php).
 *
 * design/pages/case-study-spotlight/spotlight.png at 1:1 (1920 x 925): an orange mesh edge to edge (orange core
 * #f55601 left of centre, light blue at the end edge and the bottom start corner, peach elsewhere); the content
 * on the page container (the frame's 1472px container is not used: CLAUDE.md 4.5); a 36px heading and a 20px
 * intro; stats with a 3px #ffb38a start rule; an 804 x 536 black card with ~50px padding. Every value TODO:
 * verify in Figma. Contrast: white body text on the orange core is about 3:1 (the orange decision, CLAUDE.md
 * 4.11); the black card passes. Mobile (proposal, TODO): one column, the card full width after the facts.
 * Logical properties throughout; the arrow mirrors in RTL.
 *
 * @package cartrack
 */

.case-spotlight {
	--spot-bg:
		radial-gradient(38% 60% at 30% 58%, #f55601 0%, #f55601 45%, rgba(245, 86, 1, 0) 100%),
		radial-gradient(30% 55% at 100% 55%, #afd0f0 0%, rgba(175, 208, 240, 0) 100%),
		radial-gradient(28% 40% at 0% 100%, #b0cce9 0%, rgba(176, 204, 233, 0) 100%),
		radial-gradient(40% 50% at 70% 100%, #f5b694 0%, rgba(245, 182, 148, 0) 100%),
		#f47a3a;
	--spot-pad-y: 6.25rem;                         /* ~100px above the heading at 1920. */
	--spot-pad-y-mobile: var(--space-2xl);
	--spot-intro-max: 90rem;
	--spot-gap: 4.25rem;                           /* ~70px from the intro to the stats and card. */
	--spot-facts-max: 36.25rem;                    /* ~580px stats column. */
	--spot-card-max: 50.25rem;                     /* 804px card. */
	--spot-card-min: 33.5rem;                      /* 536px card. */
	--spot-card-bg: #000000;
	--spot-card-pad: 3.125rem;                     /* ~50px. */
	--spot-card-pad-mobile: var(--space-lg);
	--spot-rule: #ffb38a;                          /* Sampled. */
	--spot-rule-w: 3px;
	--spot-stat-gap: var(--space-lg);
	--spot-value-size: 1.25rem;                    /* ~20px "XX%". */
	--spot-logo-h: 4.75rem;                        /* ~76px logo. */
	--spot-quote-max: 31.25rem;                    /* ~500px quote column. */

	position: relative;
	overflow: hidden;
	padding-block: var(--spot-pad-y-mobile);
	background: var(--spot-bg);
	color: var(--color-text-inverse);
}

/* The section's own padding is the frame's; Section settings spacing would leave white strips at --bp-lg. */
.sp-section.case-spotlight {
	padding-block: var(--spot-pad-y-mobile);
}

.case-spotlight__inner {
	max-inline-size: calc(var(--container-max) + 2 * var(--container-gutter));
	margin-inline: auto;
	padding-inline: var(--container-gutter);
}

.case-spotlight__heading {
	color: inherit;
	overflow-wrap: anywhere;
}

.case-spotlight__intro {
	max-inline-size: var(--spot-intro-max);
	margin: var(--space-md) 0 0;
	font-family: var(--t-subtitle-family);
	font-size: var(--t-subtitle-size);
	line-height: var(--t-subtitle-line-height);
	letter-spacing: var(--t-subtitle-tracking);
	overflow-wrap: anywhere;
}

.case-spotlight__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space-xl);
	margin-block-start: var(--space-xl);
}

/* ---------- Facts: stats and the listing link ---------- */

.case-spotlight__facts {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-xl);
	min-inline-size: 0;
}

.case-spotlight__stats {
	display: flex;
	flex-direction: column;
	gap: var(--spot-stat-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* cartrack_stat() markup with a start rule instead of the gradient hairline. */
.case-spotlight .stat {
	gap: var(--space-xs);
	padding-block: 0;
	padding-inline-start: var(--space-md);
	border-inline-start: var(--spot-rule-w) solid var(--spot-rule);
}

.case-spotlight .stat::before {
	content: none;
}

.case-spotlight .stat__value {
	display: block;
	color: inherit;
	font-family: var(--font-heading);
	font-size: var(--spot-value-size);
	font-weight: 700;
	line-height: var(--line-height-snug);
	overflow-wrap: anywhere;
}

.case-spotlight .stat__label {
	display: block;
	color: inherit;
	font-size: var(--t-body-size);
	line-height: var(--t-body-line-height);
	overflow-wrap: anywhere;
}

.case-spotlight__all {
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
	color: inherit;
	font-size: var(--t-body-size);
	line-height: var(--t-body-line-height);
	text-decoration: none;
}

.case-spotlight__all-label {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.3em;
}

.case-spotlight__all .icon {
	flex: none;
	inline-size: 1.125rem;
	block-size: 1.125rem;
}

.case-spotlight__all:dir(rtl) .icon {
	transform: scaleX(-1);
}

/* ---------- The black card ---------- */

.case-spotlight__card {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
	gap: var(--space-lg);
	padding: var(--spot-card-pad-mobile);
	background-color: var(--spot-card-bg);
}

/*
 * The card image (2026-11-16, cartrack.id's spotlight card: a story photo under
 * linear-gradient(245deg, #0000 27%, #000c 100%)): only while there is no video. The gradient is darkest at the
 * start edge, where the text sits; it mirrors in RTL. TODO: verify in Figma (the frame shows a plain card).
 */
.case-spotlight__card--image {
	--spot-card-overlay: linear-gradient(245deg, rgba(0, 0, 0, 0) 27%, rgba(0, 0, 0, 0.8) 100%);

	position: relative;
	isolation: isolate;
	overflow: hidden;
}

.case-spotlight__card--image:dir(rtl) {
	--spot-card-overlay: linear-gradient(115deg, rgba(0, 0, 0, 0) 27%, rgba(0, 0, 0, 0.8) 100%);
}

.case-spotlight__card--image::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	/* A flat layer under the gradient keeps white text readable wherever the photo is light (TODO: check each photo). */
	background: var(--spot-card-overlay), var(--spot-card-overlay-base, rgba(0, 0, 0, 0.4));
}

.case-spotlight__card-image {
	position: absolute;
	inset: 0;
	z-index: -2;
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

.case-spotlight__logo {
	display: block;
	inline-size: auto;
	max-inline-size: 100%;
	block-size: var(--spot-logo-h);
	object-fit: contain;
	object-position: 0% 50%;
}

.case-spotlight__logo:dir(rtl) {
	object-position: 100% 50%;
}

.case-spotlight__quote {
	max-inline-size: var(--spot-quote-max);
	margin: 0;
}

.case-spotlight__quote-text {
	margin: 0;
	font-size: var(--t-body-size);
	line-height: var(--t-body-line-height);
	overflow-wrap: anywhere;
}

.case-spotlight__quote-text p {
	margin: 0;
}

.case-spotlight__cite {
	display: flex;
	flex-direction: column;
	gap: var(--space-2xs);
	margin-block-start: var(--space-lg);
	font-size: var(--t-body-size);
	line-height: var(--t-body-line-height);
	overflow-wrap: anywhere;
}

.case-spotlight__name {
	font-weight: var(--t-body-bold-weight);
}

.case-spotlight__role {
	font-style: italic;
}

.case-spotlight__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-md) var(--space-lg);
	margin-block-start: var(--space-sm);
}

.case-spotlight__story {
	max-inline-size: 100%;
	overflow-wrap: anywhere;
}

/* "Watch the video": a link without JS, a button that opens the dialog with it. */
.case-spotlight__video {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
	padding: 0;
	border: 0;
	background: none;
	color: var(--color-text-inverse);
	font: inherit;
	font-size: var(--t-body-size);
	line-height: var(--t-body-line-height);
	text-decoration: none;
	cursor: pointer;
}

.case-spotlight__video-label {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.3em;
}

.case-spotlight__video .icon {
	flex: none;
	inline-size: 1.25rem;
	block-size: 1.25rem;
}

/* White rings on the orange and on the black card (the dark default would not show on black). */
.case-spotlight a:focus-visible,
.case-spotlight button:focus-visible {
	outline: 2px solid var(--color-text-inverse);
	outline-offset: 3px;
}

@media (hover: hover) {
	.case-spotlight__all:hover .case-spotlight__all-label,
	.case-spotlight__video:hover .case-spotlight__video-label {
		text-decoration-thickness: 2px;
	}
}

@media (min-width: 64em) { /* --bp-lg */
	.sp-section.case-spotlight {
		padding-block: var(--spot-pad-y);
	}

	.case-spotlight__grid {
		grid-template-columns: minmax(0, var(--spot-facts-max)) minmax(0, var(--spot-card-max));
		justify-content: space-between;
		align-items: center;
		margin-block-start: var(--spot-gap);
	}

	.case-spotlight__card {
		min-block-size: var(--spot-card-min);
		padding: var(--spot-card-pad);
	}
}

/* ---------- The video dialog (js/video-dialog.js) ---------- */

.video-dialog {
	--video-dialog-max: 60rem;

	inline-size: min(var(--video-dialog-max), calc(100vw - 2 * var(--container-gutter)));
	max-inline-size: none;
	padding: 0;
	border: 0;
	background: #000000;
	color: var(--color-text-inverse);
	overflow: visible;
}

.video-dialog::backdrop {
	background-color: rgba(0, 0, 0, 0.8);
}

.video-dialog__frame {
	aspect-ratio: 16 / 9;
}

.video-dialog__player {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	border: 0;
	background: #000000;
}

.video-dialog__close {
	position: absolute;
	inset-block-end: 100%;
	inset-inline-end: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 2.75rem;
	block-size: 2.75rem;
	padding: 0;
	border: 0;
	background: none;
	color: var(--color-text-inverse);
	font-size: 2rem;
	line-height: 1;
	cursor: pointer;
}

.video-dialog__close:focus-visible {
	outline: 2px solid var(--color-text-inverse);
	outline-offset: 2px;
}
