/**
 * Estland Cloudflare Stream for Enfold - frontend styles
 *
 * BEM: .estcfs-stream-embed, .estcfs-stream-embed__iframe, .estcfs-stream-embed__fallback
 * Enfold's .av-section-video-bg and avia_video_section JS handle sizing; these are fallbacks.
 *
 * At viewports < 1840px, the wrapper must fill the video slide via position:absolute
 * so the iframe cover sizing works correctly; otherwise black (Enfold's bg) shows.
 */

.estcfs-stream-embed {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.estcfs-stream-embed__fallback {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	z-index: 2; /* Above iframe while visible (placeholder state) */
}

/* When video has loaded, hide placeholder and put it behind iframe so video is always on top */
.estcfs-stream-embed--loaded .estcfs-stream-embed__fallback:not(.estcfs-stream-embed__fallback--visible) {
	visibility: hidden;
	pointer-events: none;
	z-index: 0;
}

/* Ensure iframe is above fallback when loaded (overrides stacking at all viewport widths) */
.estcfs-stream-embed--loaded .estcfs-stream-embed__iframe {
	z-index: 2;
}

/* Fallback state: Stream unavailable, iframe hidden via JS, fallback stays visible */
.estcfs-stream-embed__fallback.estcfs-stream-embed__fallback--visible {
	visibility: visible;
	z-index: 2;
}

#top .av-section-video-bg .estcfs-stream-embed__iframe {
	border: none;
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1; /* Below placeholder until video loads */
	/* width/height/left/top overridden by avia_video_section for cover */
}

.estcfs-stream-embed--section-bg {
	width: 100%;
	height: 100%;
}

/*
 * After visibility resume: keep poster above the iframe until playback actually progresses.
 * Avoids black frame when the Stream player is paused or has not rendered yet.
 */
.estcfs-stream-embed--stalled .estcfs-stream-embed__fallback {
	visibility: visible !important;
	z-index: 3;
}

.estcfs-stream-embed--stalled.estcfs-stream-embed--loaded .estcfs-stream-embed__iframe {
	z-index: 1;
}
