/* CSS PARA VIDEO PRINCIPAL EN CABECERA */
/* Basado en mejores prácticas de BrowserStack para optimización de carga */

/* Video principal en el slider */
.revolution-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    z-index: 1;
    opacity: 0.9;
}

/* Contenedor del slider */
.slider-container {
    position: relative;
    height: 400px;
    overflow: hidden;
    background: linear-gradient(135deg, #2c3e50, #3498db);
}

.slider {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Captions sobre el video */
.tp-caption {
    position: relative !important;
    z-index: 10 !important;
    text-align: left !important;
}

/* Optimización para móviles */
@media (max-width: 768px) {
    .revolution-video {
        height: 300px !important;
    }
    
    .slider-container {
        height: 300px;
    }
    
    .tp-caption h2 {
        font-size: 22px !important;
    }
    
    .tp-caption p {
        font-size: 14px !important;
    }
    
    .btn-lg {
        padding: 8px 16px !important;
        font-size: 14px !important;
        margin: 5px !important;
    }
}

/* OPTIMIZACIONES DE CARGA PARA VELOCIDAD */

/* Lazy loading para imágenes */
img[loading="lazy"] {
    transition: opacity 0.3s;
}

img[loading="lazy"]:not([src]) {
    opacity: 0;
}

/* Reducir reflows y repaints */
.container {
    will-change: auto;
}

/* Optimización de fuentes */
@font-face {
    font-display: swap;
}

/* Cache de recursos */
.img-responsive {
    image-rendering: auto;
    image-rendering: crisp-edges;
    image-rendering: -webkit-optimize-contrast;
}

/* Reducir HTTP requests - sprites de iconos */
.fa {
    font-display: swap;
}

/* Optimización de video para carga rápida */
video {
    background: #000;
    background-image: url('IMG/2.jpg');
    background-size: cover;
    background-position: center;
}

/* Preload crítico */
.critical-content {
    font-display: swap;
    will-change: transform;
}

/* Optimización de botones */
.btn {
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.btn:hover {
    transform: translateY(-2px) translateZ(0);
    transition: transform 0.2s ease;
}

/* Loading spinner mientras carga el video */
.video-container {
    position: relative;
}

.video-container::before {
    content: "🎬 Cargando video...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 20px;
    border-radius: 8px;
    font-size: 16px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container video:not([data-loaded]) ~ .video-container::before {
    display: block;
}

/* Ocultar spinner cuando el video está cargado */
video[data-loaded] + .video-container::before,
video:not([preload="none"]) + .video-container::before {
    display: none;
}

/* Fallback si el video no carga */
.slider-container:not(:has(video)) {
    background-image: url('IMG/2.jpg');
    background-size: cover;
    background-position: center;
}

/* Optimización específica para Windows local */
@media screen {
    img, video {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: optimize-contrast;
        image-rendering: crisp-edges;
    }
} 