/**
 * Video sections — shared by every page that plays a film.
 *
 * Moved out of maestro.css so a page can show a video without loading all
 * 50KB of the Maestro page's styles: the dark overview band (Maestro,
 * Cornerstones Curriculum), the play button, and a video in a 50:50 split
 * (Curriculum and Assessment Review). The script that swaps the poster for
 * the player is assets/js/components/maestro-video.js ([data-inline-video]).
 */

/* ── Overview video ───────────────────────────────────────────────────────────
   Deep burgundy background. Full-width trigger panel.                         */

.ce-mae-overview {
	background: #253d47;
	padding: 5rem 0;
}

/* Title row — icon badge + heading centred, mirrors other sections */
.ce-mae-overview__title-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.65rem;
	margin-bottom: 0.875rem;
}

/* Override icon badge for dark background */
.ce-mae-overview .page-split__icon-badge {
	background: rgba(250, 240, 244, 0.9);
	border-color: #af4d76;
	color: #af4d76;
	--fa-primary-color: #af4d76;
	--fa-secondary-color: #af4d76;
	--fa-secondary-opacity: 0.4;
}

.ce-mae-overview__heading {
	font-family: var(--ci-font-primary);
	font-size: var(--ci-text-h2);
	font-weight: 700;
	color: #ffffff;
	margin: 0;
	line-height: 1.25;
}

.ce-mae-overview__sub {
	font-family: var(--ci-font-primary);
	font-size: var(--ci-text-body);
	color: rgba(255, 255, 255, 0.75);
	text-align: center;
	max-width: 780px;
	margin: 0 auto 3rem;
	line-height: 1.75;
	/* Even lines, so the last word never sits on its own. */
	text-wrap: balance;
}

/* Full-width video trigger */
.ce-mae-overview__trigger {
	width: 100%;
	position: relative;
	border-radius: 1.25rem;
	overflow: clip;
	box-shadow:
		0 24px 64px rgba(0, 0, 0, 0.45),
		0 0 0 1px rgba(255, 255, 255, 0.07);
	cursor: pointer;
	display: block;
}

.ce-mae-overview__trigger img {
	width: 100%;
	display: block;
	vertical-align: top;
}

.ce-mae-overview__placeholder {
	aspect-ratio: 16 / 9;
	background: #d0d4d8;
}

/* Playing in place. The panel keeps the shape the poster gave it so the page
   does not jump when the image is swapped for the player, and the cursor stops
   claiming there is anything left to click. */
.ce-mae-inline-video.is-playing {
	aspect-ratio: 16 / 9;
	background: #000;
	cursor: default;
}

.ce-mae-inline-video.is-playing iframe {
	width: 100%;
	height: 100%;
	display: block;
	border: 0;
}

/* Duration badge */
.ce-mae-overview__duration {
	position: absolute;
	bottom: 1.25rem;
	right: 1.25rem;
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	color: rgba(255, 255, 255, 0.8);
	font-family: var(--ci-font-primary);
	font-size: var(--ci-text-utility);
	font-weight: 700;
	padding: 0.3rem 0.65rem;
	border-radius: 9999px;
	z-index: 3;
	pointer-events: none;
}

/* No-video notice */
.ce-mae-overview__video-notice {
	position: absolute;
	bottom: 1.25rem;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 0.5rem;
	background: rgba(113, 148, 126, 0.25);
	border: 1px solid rgba(113, 148, 126, 0.4);
	border-radius: 9999px;
	padding: 0.4rem 1rem;
	font-family: var(--ci-font-primary);
	font-size: var(--ci-text-utility);
	color: rgba(255, 255, 255, 0.65);
	pointer-events: none;
	white-space: nowrap;
	z-index: 3;
}

.ce-mae-overview__video-notice i {
	color: #71947e;
	font-size: 0.875rem;
	--fa-primary-color: #71947e;
	--fa-secondary-color: rgba(113, 148, 126, 0.4);
}

/* A longer line under the heading, kept to two lines on desktop rather
   than three (the curriculum film). */
.ce-mae-overview--wide-sub .ce-mae-overview__sub {
	max-width: 960px;
}

@media (max-width: 600px) {
	.ce-mae-overview { padding: 3rem 0; }
}


/* ── Video trigger overlay (on page-split__image and overview trigger) ────────
   Play button centred on any panel. Matches the site's glass aesthetic.       */

.mae-video-panel {
	position: relative;
	cursor: pointer;
	overflow: clip;
}

.mae-video-panel::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.22);
	transition: background 0.25s ease;
	z-index: 1;
}

.mae-video-panel:hover::after {
	background: rgba(0, 0, 0, 0.36);
}

.mae-video-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	pointer-events: none;
}

.mae-video-play__circle {
	width: 5rem;
	height: 5rem;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.5rem;
	color: #1e2d3d;
	padding-left: 0.2em;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 6px rgba(255, 255, 255, 0.2);
	transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.mae-video-panel:hover .mae-video-play__circle {
	transform: scale(1.08);
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45), 0 0 0 8px rgba(255, 255, 255, 0.22);
}

.mae-video-play__label {
	font-family: var(--ci-font-primary);
	font-size: var(--ci-text-utility);
	font-weight: 700;
	color: #fff;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
	/* Sentence case, like the rest of the site. The wide tracking stays — it
	   was doing the work of holding the letters apart over a photograph, and
	   that job did not go away with the capitals. */
	letter-spacing: 0.04em;
}

/* Larger play button for the overview section */
.mae-video-play--large .mae-video-play__circle {
	width: 6.5rem;
	height: 6.5rem;
	font-size: 2rem;
}


/* ── A film in a 50:50 split ──────────────────────────────────────────────────
   The panel is square and a film is 16:9, so the film sits as a card in the
   middle of the panel rather than filling it. See ce_page_split_section().   */

.page-split__image--video {
	display: flex;
	align-items: center;
	justify-content: center;
	/* The panel takes the row's height from the text beside it instead of
	   forcing a square, which would leave a tall empty frame round the film. */
	aspect-ratio: auto;
	padding: clamp(1.5rem, 4vw, 4rem);
	overflow: visible;
	/* The overview band's navy, so the panel still reads as one solid block
	   beside the text, the way the photo it replaces did. */
	background: #253d47;
}

.page-split__video {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: 1.25rem;
	overflow: clip;
	background: #253d47;
	box-shadow:
		0 24px 64px rgba(0, 0, 0, 0.45),
		0 0 0 1px rgba(255, 255, 255, 0.07);
}

.page-split__video img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.page-split__video.is-playing {
	background: #000;
	cursor: default;
}

/* The darkening layer from .mae-video-panel would sit over the player.
   Not while it fades: it goes with the poster, not ahead of it. */
.page-split__video.is-playing:not(.is-revealing)::after {
	display: none;
}

.page-split__video.is-playing iframe {
	width: 100%;
	height: 100%;
	display: block;
	border: 0;
}

@media (max-width: 1024px) {
	/* Undo the square-panel rules the photo panels use at this width. */
	.page-split__image.page-split__image--video {
		aspect-ratio: auto;
		min-height: 0;
		max-height: none;
		padding: 2rem var(--ci-container-padding);
		/* After the text, not above it as the photos go: the film needs the
		   section's heading to say what it is before anyone presses play. */
		order: 0;
	}
}

/* On a phone the card is only ~340px wide: the label would run into the
   running-time badge, so the button alone does the asking. */
@media (max-width: 600px) {
	.page-split__video .mae-video-play__label,
	.ce-mae-overview__trigger .mae-video-play__label {
		display: none;
	}

	.page-split__video .mae-video-play__circle,
	.ce-mae-overview__trigger .mae-video-play--large .mae-video-play__circle {
		width: 4rem;
		height: 4rem;
		font-size: 1.35rem;
	}

	.page-split__video .ce-mae-overview__duration,
	.ce-mae-overview__trigger .ce-mae-overview__duration {
		bottom: 0.75rem;
		right: 0.75rem;
	}
}


/* ── Loading: the player starts under the poster ──────────────────────────────
   maestro-video.js puts the iframe in behind the poster on the first press
   and only fades the poster away once the film is moving, so nobody sees
   the black box the player shows while it starts. See play() there.        */

[data-inline-video] > iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	z-index: 0;
}

/* Poster above the loading player; the play button and badge already sit
   higher (2 and 3), as does the darkening layer on split panels (1). */
[data-inline-video] > img {
	position: relative;
	z-index: 1;
}

[data-inline-video].is-loading {
	cursor: progress;
}

/* The play triangle becomes a turning ring. */
/* > * not i: Font Awesome swaps the <i> for an <svg> once it runs. */
[data-inline-video].is-loading .mae-video-play__circle > * {
	opacity: 0;
}

[data-inline-video].is-loading .mae-video-play__circle::after {
	content: '';
	position: absolute;
	width: 40%;
	height: 40%;
	border-radius: 50%;
	border: 3px solid rgba(30, 45, 61, 0.2);
	border-top-color: #1e2d3d;
	animation: ce-video-spin 0.8s linear infinite;
}

.mae-video-play__circle {
	position: relative;
}

@keyframes ce-video-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	[data-inline-video].is-loading .mae-video-play__circle::after {
		animation-duration: 2.4s;
	}
}

/* Then the poster, button, badge and darkening fade off the moving film. */
[data-inline-video].is-revealing > :not(iframe),
[data-inline-video].is-revealing::after {
	opacity: 0;
	transition: opacity 0.4s ease;
	pointer-events: none;
}
