/**
 * Group Background Video - Frontend Styles
 * 
 * Styles for background video in Group blocks
 * 
 * @package WebtronDocs
 */

/* ==========================================================================
   Background Video Container
   ========================================================================== */

.wp-block-group.has-bg-video {
    position: relative;
    overflow: visible;
}

/* Clip overflow on the video container itself, not the parent */
.webtron-bg-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    overflow: hidden;
}

/* ==========================================================================
   Video Element
   ========================================================================== */

.webtron-bg-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

/* Handle different aspect ratios */
@media (min-aspect-ratio: 16/9) {
    .webtron-bg-video {
        width: 100%;
        height: auto;
    }
}

@media (max-aspect-ratio: 16/9) {
    .webtron-bg-video {
        width: auto;
        height: 100%;
    }
}

/* ==========================================================================
   Video Overlay
   ========================================================================== */

.webtron-bg-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ==========================================================================
   Content Layering
   ========================================================================== */

/* Ensure group content appears above video */
.wp-block-group.has-bg-video > *:not(.webtron-bg-video-container) {
    position: relative;
    z-index: 2;
}

/* Handle nested layout elements */
.wp-block-group.has-bg-video > .is-layout-constrained,
.wp-block-group.has-bg-video > .is-layout-flow,
.wp-block-group.has-bg-video > .is-layout-flex,
.wp-block-group.has-bg-video > .is-layout-grid {
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    .webtron-bg-video {
        /* Pause video by hiding it and showing first frame as poster */
        animation: none !important;
    }
    
    /* For reduced motion, we could also add JS to pause the video */
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .webtron-bg-video-container {
        display: none;
    }
}
