/**
 * Estilos exclusivos para la sección de Galería con Carrusel y Lightbox - sportRCBike
 */

:root {
    --gallery-bg-dark: #141414;
    --font-gallery-impact: "Arial Black", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-gallery-sub: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --neon-green-accent: #76ff03; /* Heredado del concepto deportivo */
}

.gallery-section {
    background-color: #f7f5f2; 
    padding: 60px 20px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* --- Encabezado --- */
.gallery-header {
    text-align: center;
    margin-bottom: 40px;
}

.gallery-title {
    font-family: var(--font-gallery-impact);
    color: #000000;
    font-size: 2.5rem;
    font-weight: 900;
    font-style: italic;
    text-transform: uppercase;
    margin: 0 0 10px 0;
    letter-spacing: -1px;
}

.gallery-subtitle {
    font-family: var(--font-gallery-sub);
    color: #000000;
    font-size: 21px;
    font-weight: 300;
    margin: 0;
    opacity: 0.95;
}

/* --- Contenedor Global del Carrusel --- */
.gallery-carousel-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

/* El viewport de deslizamiento */
.gallery-slider {
    display: flex;
    flex-direction: row;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory; /* Bloqueo de scroll fluido nativo */
    scrollbar-width: none; /* Oculta barra en Firefox */
    width: 100%;
    padding: 10px 0;
}

.gallery-slider::-webkit-scrollbar {
    display: none; /* Oculta barra en Chrome/Safari */
}

/* Cada Item adaptado para comportamiento Slider */
.gallery-item {
    flex: 0 0 85%; /* En móviles se muestra casi todo el item y asoma el siguiente */
    scroll-snap-align: start;
    cursor: pointer;
    transform: translateY(35px); /* Mantener setup de animación original */
}

.gallery-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 68%; 
    overflow: hidden;
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.gallery-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; 
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Capa hover indicadora de Zoom */
.gallery-overlay-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.zoom-icon {
    font-size: 2rem;
    color: #fff;
    transform: scale(0.7);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gallery-item:hover .gallery-overlay-hover {
    opacity: 1;
}

.gallery-item:hover .zoom-icon {
    transform: scale(1);
}

.gallery-item:hover .gallery-img {
    transform: scale(1.06);
}

/* --- Flechas de Navegación del Carrusel --- */
.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--black-text-solid, #000000);
    color: #ffffff;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: background 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    opacity: 0; /* Ocultas por defecto en mobile (uso intuitivo de swipe) */
    pointer-events: none;
}

.prev-btn { left: -15px; }
.next-btn { right: -15px; }

.gallery-nav-btn:hover {
    background: #333;
    color: var(--neon-green-accent);
}

/* Mostramos flechas en hover sobre la sección si es desktop */
.gallery-carousel-wrapper:hover .gallery-nav-btn {
    opacity: 1;
    pointer-events: auto;
}


/* ==========================================================================
   DISEÑO PREMIUM DEL MODAL DE ZOOM (LIGHTBOX)
   ========================================================================== */
.gallery-lightbox {
    display: none; 
    position: fixed;
    z-index: 99999; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px); /* Sofisticado fondo desenfocado */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.gallery-lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content-wrapper {
    position: relative;
    max-width: 85%;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 6px;
    transform: scale(0.9);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); /* Zoom elástico suave */
}

.gallery-lightbox.active .lightbox-img {
    transform: scale(1);
}

.lightbox-caption {
    font-family: var(--font-gallery-sub);
    color: #fff;
    margin-top: 15px;
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 0.5px;
}

.lightbox-close {
    position: absolute;
    top: 25px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    user-select: none;
}

.lightbox-close:hover {
    color: var(--neon-green-accent);
    transform: scale(1.1);
}


/* ==========================================================================
   SISTEMA DE ANIMACIÓN ESCALONADA "STAGGERED WAVE"
   ========================================================================== */
.gallery-animate {
    opacity: 0;
    will-change: transform, opacity;
    transition: opacity 0.65s cubic-bezier(0.25, 1, 0.5, 1),
                transform 0.65s cubic-bezier(0.25, 1, 0.5, 1);
}

.fade-down { transform: translateY(-20px); }

.item-step-1 { transition-delay: 0.1s; }
.item-step-2 { transition-delay: 0.2s; }
.item-step-3 { transition-delay: 0.3s; }
.item-step-4 { transition-delay: 0.4s; }

.gallery-active .fade-down,
.gallery-active .gallery-carousel-wrapper {
    opacity: 1;
}

.gallery-active .gallery-item {
    opacity: 1;
    transform: translateY(0);
}


/* ==========================================================================
   MEDIA QUERIES (Transición y Escritorio Final)
   ========================================================================== */
@media (min-width: 576px) {
    .gallery-item {
        flex: 0 0 46%; /* 2 items por vista en tablets */
    }
    .prev-btn { left: 0px; }
    .next-btn { right: 0px; }
}

@media (min-width: 992px) {
    .gallery-section {
        padding: 57px 0;
    }

    .gallery-title {
        font-size: 3.6rem;
    }

    .gallery-subtitle {
        font-size: 1.4rem;
    }

    .gallery-slider {
        gap: 20px;
        overflow-x: hidden; /* Congelamos el scrollbar en Desktop para depender de las flechas */
    }

    .gallery-item {
        flex: 0 0 calc(25% - 15px); /* 4 Columnas exactas en una fila */
        scroll-snap-align: none; /* No lo requiere en layout fijo */
    }
    
    .gallery-image-wrapper {
        padding-top: 72%;
    }

    .gallery-nav-btn {
        display: flex; /* Se activan los botones físicos de control */
    }
}