/*
 * Video player
 *
 * The static build (site/video.html) ships video cards with no player at all —
 * the anchors #v1..#v6 go nowhere. These rules dress the lightbox added in
 * template-parts/video-lightbox.php.
 *
 * The overlay itself reuses .modal / .modal__panel from main.css so the
 * dialog behaves and animates exactly like the enquiry modal. Only the video
 * specific pieces are declared here; main.css and pages.css are kept
 * byte-identical to the static build.
 */

/* --- panel ------------------------------------------------------------- */

.modal--video .modal__panel--video {
	width: min(1040px, 100%);
	max-width: 1040px;
	padding: 16px;
	background: #0c0e0f;
	color: #fff;
}

.modal--video .modal__title {
	display: none;
}

.modal--video .modal__close {
	color: #fff;
	border-color: rgba(255, 255, 255, 0.28);
}

.modal--video .modal__close:hover,
.modal--video .modal__close:focus-visible {
	background: rgba(255, 255, 255, 0.12);
}

/* --- player ------------------------------------------------------------ */

.video-player {
	position: relative;
}

/*
 * A 16:9 box that matches the 520x300 card art closely enough that opening the
 * dialog feels like the thumbnail grew into a player.
 */
.video-player__media {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	background: #000;
	object-fit: contain;
}

.video-player__caption {
	margin: 12px 4px 0;
	font-size: 15px;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.86);
}

.video-player__caption:empty {
	display: none;
}

.video-player__status {
	margin: 6px 4px 0;
	font-size: 13px;
	color: rgba(255, 255, 255, 0.6);
}

.video-player__status:empty {
	display: none;
}

/* --- play badge on the card -------------------------------------------- */

/*
 * The badge is absolutely positioned at 50%/50%, so it needs the figure as its
 * containing block. main.css's .card__media only sets overflow:hidden (no
 * position), so without this the badge resolves against the nearest positioned
 * ancestor further up - which is DIV.site-frame - and lands halfway down the
 * whole page, straddling the gap between two cards instead of sitting on the
 * thumbnail. pages.css sets the aspect ratio; position stays here.
 */
.video-card__media {
	position: relative;
}

/*
 * The static card has no affordance saying "this plays"; add a centred play
 * glyph on hover (and always on touch, where there is no hover).
 */
.video-card__play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 56px;
	height: 56px;
	margin: -28px 0 0 -28px;
	border-radius: 50%;
	background: rgba(12, 14, 15, 0.62);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s var(--tr-ease, ease);
}

.video-card__play::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -9px 0 0 -7px;
	border-style: solid;
	border-width: 9px 0 9px 15px;
	border-color: transparent transparent transparent #fff;
}

.video-card:hover .video-card__play,
.video-card:focus-within .video-card__play {
	opacity: 1;
}

@media (hover: none) {
	.video-card__play {
		opacity: 1;
	}
}

/* --- cards without media ------------------------------------------------ */

/*
 * Entries carried over from the static build that have no file yet. They stay in
 * the grid so the layout keeps its original six-card shape, but they must not
 * look clickable.
 */
.video-card--pending {
	cursor: default;
}

.video-card--pending .video-card__media img {
	opacity: 0.45;
	filter: grayscale(1);
}

.video-card--pending .card__body {
	opacity: 0.7;
}

.video-card__soon {
	margin: 4px 0 0;
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #8a8f94;
}

/* --- filter bar / AJAX state ------------------------------------------- */

/* Result count and error messages sit inside the bar, right of the select. */
.filter-bar__status {
	margin: 0;
	font-size: var(--fs-micro, 12px);
	color: var(--c-ink-3, #6b7276);
}

/* While a request is in flight, dim the grid so the swap is legible.
 * opacity only - the cards must keep their layout to avoid a jump. */
[data-video-grid].is-loading {
	opacity: 0.45;
	transition: opacity 0.15s ease;
}

[data-video-grid] {
	transition: opacity 0.15s ease;
}

/* --- small screens ------------------------------------------------------ */

@media (max-width: 640px) {
	.modal--video .modal__panel--video {
		padding: 10px;
	}

	.video-card__play {
		width: 44px;
		height: 44px;
		margin: -22px 0 0 -22px;
	}
}