/* Scroll-driven video background for Elementor sections */

.ebsv-scroll-track {
	position: relative;
	width: 100%;
	z-index: 1;
}

.ebsv-scroll-track + .ebsv-scroll-track,
.ebsv-scroll-track + .elementor-section:not(.ebsv-animated-section),
.ebsv-scroll-track + .ebsv-scroll-track ~ * {
	/* natural document flow — next section stays below track */
}

.ebsv-animated-section.ebsv-pinned {
	position: sticky;
	top: 0;
	left: 0;
	width: 100%;
	min-height: 100vh;
	height: 100vh;
	max-height: 100vh;
	overflow: hidden;
	z-index: 2;
	isolation: isolate;
	background: #000;
}

.ebsv-animated-section .elementor-background-video-container {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	min-height: 100% !important;
	max-height: none !important;
	pointer-events: none;
	z-index: 0;
	overflow: hidden;
}

.ebsv-animated-section .ebsv-video-canvas {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 100%;
	height: 100%;
	min-width: 100%;
	min-height: 100%;
	transform: translate(-50%, -50%);
	object-fit: cover;
	z-index: 1;
	pointer-events: none;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	background-color: transparent;
}

.ebsv-animated-section.ebsv-is-scrubbing .ebsv-video-canvas {
	/* keep last painted frame visible while seeking */
	will-change: contents;
}

/* Until first frame is ready: show paused video (no black canvas) */
.ebsv-animated-section.ebsv-loading .ebsv-video-canvas {
	opacity: 0 !important;
}

.ebsv-animated-section.ebsv-loading .elementor-background-video-hosted {
	opacity: 1 !important;
	visibility: visible !important;
}

.ebsv-animated-section.ebsv-use-canvas:not(.ebsv-loading) .elementor-background-video-hosted {
	opacity: 0 !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

.ebsv-animated-section.ebsv-priming .elementor-background-video-hosted {
	opacity: 0 !important;
	visibility: hidden !important;
}

.ebsv-animated-section .elementor-background-video-hosted,
.ebsv-animated-section .elementor-background-video-embed {
	position: absolute !important;
	top: 50% !important;
	left: 50% !important;
	width: 100% !important;
	height: 100% !important;
	min-width: 100% !important;
	min-height: 100% !important;
	max-width: none !important;
	transform: translate(-50%, -50%) !important;
	object-fit: cover !important;
}

.ebsv-animated-section .elementor-background-video-embed iframe {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 100%;
	height: 100%;
	min-height: 100%;
	min-width: 100%;
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.ebsv-animated-section > .elementor-container,
.ebsv-animated-section > .elementor-background-overlay {
	position: relative;
	z-index: 2;
	will-change: transform;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
}

.ebsv-scroll-track {
	-webkit-overflow-scrolling: touch;
}

.ebsv-animated-section.ebsv-is-scrubbing .elementor-background-video-hosted {
	/* paused via JS */
}

/* Hide default Elementor video play overlay interference */
.ebsv-animated-section .elementor-background-video-container::before,
.ebsv-animated-section .elementor-background-video-container::after {
	display: none !important;
}

/* Editor preview hint */
.elementor-editor-active .ebsv-animated-section {
	min-height: 50vh;
}

@media (max-width: 1024px) {
	.ebsv-animated-section .elementor-background-video-hosted,
	.ebsv-animated-section .elementor-background-video-embed iframe {
		width: 100% !important;
		height: 100% !important;
		min-height: 100% !important;
	}
}

@media (max-width: 767px) {
	.ebsv-animated-section.ebsv-pinned {
		min-height: 100vh;
		height: 100vh;
	}
}
