/* Video Background Styles for Home Page */

.video-bg {
    position: relative;
    overflow: hidden;
}

.cover-bg-video {
    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;
}

/* Ensure video covers the entire slide */
.slide-item .video-bg .cover-bg-video {
    width: 100vw;
    height: 100vh;
    min-width: 100vw;
    min-height: 100vh;
}

/* Video overlay for better text readability */
.video-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

/* Ensure slide content is above video */
.slide-item .slide-content {
    position: relative;
    z-index: 10;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .cover-bg-video {
        /* On mobile, ensure video is optimized for performance */
        transform: translate(-50%, -50%) scale(1.1);
    }
    
    /* Increase overlay on mobile for better text visibility */
    .video-bg::before {
        background: rgba(0, 0, 0, 0.4);
    }
}

/* Video loading state */
.cover-bg-video:not([data-loaded]) {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.cover-bg-video[data-loaded] {
    opacity: 1;
}

/* Pause video when not active slide */
.swiper-slide:not(.swiper-slide-active) .cover-bg-video {
    opacity: 0.8;
}

.swiper-slide-active .cover-bg-video {
    opacity: 1;
}

/* Performance optimization */
.cover-bg-video {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Fallback for browsers that don't support video */
@supports not (object-fit: cover) {
    .cover-bg-video {
        display: none;
    }
    
    .video-bg {
        background-image: url('../img/Videos/Squirrel-1.gif');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
    .cover-bg-video {
        animation: none;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .video-bg::before {
        background: rgba(0, 0, 0, 0.6);
    }
}

/* Video controls for accessibility (hidden by default) */
.cover-bg-video::-webkit-media-controls {
    display: none !important;
}

.cover-bg-video::-webkit-media-controls-panel {
    display: none !important;
}

.cover-bg-video::-webkit-media-controls-play-button {
    display: none !important;
}

.cover-bg-video::-webkit-media-controls-start-playback-button {
    display: none !important;
}

/* Firefox video controls */
.cover-bg-video::-moz-media-controls {
    display: none !important;
}

/* Edge/IE video controls */
.cover-bg-video::-ms-media-controls {
    display: none !important;
}