/**
 * PageSpeed video styles (front page only).
 *
 * Enqueued from functions.php (aot_psv_enqueue_assets). Only styles the new
 * elements; the existing theme styles and design are untouched.
 */

/* === PAGESPEED VIDEO — START: banner. The fallback image fills the banner exactly like the video did; the JS-injected video sits on top with object-fit: cover and fades in once it is actually playing, so there is no flash === */
.main-banner-wrapper .video-holder > .psv-banner-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.main-banner-wrapper .video-holder > video.psv-banner-video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity 0.4s ease;
}

.main-banner-wrapper .video-holder > video.psv-banner-video.psv-is-ready {
	opacity: 1;
}
/* === PAGESPEED VIDEO — END === */

/* === PAGESPEED VIDEO — START: YouTube facade. Thumbnail + play button; the iframe is added on click and fills the same box === */
.psv-yt {
	cursor: pointer;
}

/* Standalone facade (video section): 16:9 box. Not applied in the overland slider, where Bootstrap's .ratio already positions the wrapper. */
.psv-yt.psv-yt--box {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	max-height: 650px; /* Same limit as .owner-video-section video */
	overflow: hidden;
	border-radius: 8px;
	background: #000;
	line-height: 0;
}

.psv-yt.psv-yt--box .psv-yt__thumb {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.psv-yt__btn {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 72px;
	height: 72px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.psv-yt__btn:hover {
	background: rgba(0, 0, 0, 0.8);
}

/* CSS triangle play icon (no extra image request). */
.psv-yt__icon {
	display: block;
	width: 0;
	height: 0;
	margin-left: 5px; /* Optical centring of the triangle */
	border-style: solid;
	border-width: 14px 0 14px 24px;
	border-color: transparent transparent transparent #fff;
}

.psv-yt__frame {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Once the player is loaded, hide the thumbnail and button underneath it. */
.psv-yt.psv-yt--active > .psv-yt__thumb,
.psv-yt.psv-yt--active > .psv-yt__btn {
	visibility: hidden;
}
/* === PAGESPEED VIDEO — END === */

/* === PAGESPEED VIDEO — START: pause/play toggle for autoplaying videos (consultants carousel and banner). Required because they play for longer than 5 seconds === */
.psv-toggle {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 3; /* Above the consultant's .stretched-link overlay */
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.psv-toggle:hover {
	background: rgba(0, 0, 0, 0.8);
}

/* Default (paused): play triangle. */
.psv-toggle__icon {
	display: block;
	width: 0;
	height: 0;
	margin-left: 3px;
	border-style: solid;
	border-width: 8px 0 8px 13px;
	border-color: transparent transparent transparent #fff;
}

/* Playing: two pause bars. */
.psv-toggle.is-playing .psv-toggle__icon {
	width: 12px;
	height: 14px;
	margin-left: 0;
	border: 0;
	border-left: 4px solid #fff;
	border-right: 4px solid #fff;
}

/* Banner toggle: bottom right, above the banner content layer (z-index 10). */
.main-banner-wrapper > .psv-toggle--banner {
	top: auto;
	bottom: 16px;
	right: 16px;
	z-index: 10;
}

/* Keyboard focus for all new buttons. */
.psv-yt__btn:focus-visible,
.psv-toggle:focus-visible,
.video-control[data-psv-play]:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
	box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.6);
}
/* === PAGESPEED VIDEO — END === */

/* === PAGESPEED VIDEO — START: custom facade thumbnails (Section Image / Video Poster Image) and the video-content-section facade. A custom image can have any shape, so it fills the facade box and is cropped (object-fit: cover) like YouTube's own thumbnail was === */
.psv-yt > .psv-yt__thumb--custom {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* video-content-section: the facade is the direct child of Bootstrap's .ratio-16x9, which already sizes and positions it. */
.psv-yt.psv-yt--fill {
	overflow: hidden;
	background: #000;
}

.psv-yt.psv-yt--fill > .psv-yt__thumb {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover; /* Also crops YouTube's 4:3 fallback thumbnail to 16:9. */
}
/* === PAGESPEED VIDEO — END === */
