/* ==========================================================================
   ECE Video Banner — [ece_video_banner]

   Sizing, focal point and overlay colour arrive as CSS custom properties set
   on the banner element by the shortcode. Everything has a default here, so a
   banner with no attributes still renders correctly.
   ========================================================================== */

.ece-video-banner {
	position: relative;
	width: 100%;
	height: var(--ece-vb-h, 500px);
	overflow: hidden;
	background-color: #1a1a1a; /* shows before the poster paints */
}

/* Breakpoints match Divi's, so a banner sits on the same tablet and phone
   boundaries as the layout around it.

   The fallback chain matters: tablet falls back to the desktop height, and
   phone falls back to tablet and then desktop. Setting only "height" therefore
   applies everywhere, and setting only "height_phone" leaves the larger
   screens alone. */
@media (max-width: 980px) {
	.ece-video-banner {
		height: var(--ece-vb-h-tablet, var(--ece-vb-h, 500px));
	}
}

@media (max-width: 767px) {
	.ece-video-banner {
		height: var(--ece-vb-h-phone, var(--ece-vb-h-tablet, var(--ece-vb-h, 500px)));
	}
}

.ece-video-banner__video {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	/* The banner is a fixed height and the video fills it, so the frame is
	   cropped to cover. --ece-vb-pos chooses which part survives. */
	object-fit: cover;
	object-position: var(--ece-vb-pos, center center);
	display: block;
}

.ece-video-banner__overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
	background-color: var(--ece-vb-overlay, transparent);
	pointer-events: none;
}

/* --- Pause / play control ------------------------------------------------
   Sits bottom-right. Deliberately not hidden until hover: a control that only
   appears on hover is unreachable by touch and easy to miss by keyboard. */

.ece-video-banner__toggle {
	position: absolute;
	right: 16px;
	bottom: 16px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;   /* 44px is the minimum comfortable touch target */
	height: 44px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .7);
	border-radius: 50%;
	background-color: rgba(0, 0, 0, .55);
	color: #fff;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease;
}

.ece-video-banner__toggle:hover,
.ece-video-banner__toggle:focus-visible {
	background-color: #cc0000;
	border-color: #cc0000;
}

.ece-video-banner__toggle:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

/* Pause glyph: two bars, drawn in CSS so there is no icon-font dependency. */
.ece-video-banner__icon {
	display: block;
	width: 14px;
	height: 16px;
	border-left: 4px solid currentColor;
	border-right: 4px solid currentColor;
	box-sizing: border-box;
}

/* Play glyph: a triangle, swapped in when the video is paused. */
.ece-video-banner__toggle[data-state="paused"] .ece-video-banner__icon {
	width: 0;
	height: 0;
	border-left: 14px solid currentColor;
	border-right: 0;
	border-top: 9px solid transparent;
	border-bottom: 9px solid transparent;
	margin-left: 4px; /* optically centres the triangle in the circle */
}

/* --- Reduced motion ------------------------------------------------------
   The script also refuses to autoplay in this case; this is the visual half.
   Playback still works if the visitor presses play themselves. */

@media (prefers-reduced-motion: reduce) {
	.ece-video-banner__toggle {
		/* Make the affordance more prominent, since nothing is moving to
		   suggest there is a video at all. */
		background-color: rgba(0, 0, 0, .75);
	}
}
