/* css/foto.css */

.foto-gallery-container {
    width: 100%;
    /* Altura del contenedor de scroll. Dejamos márgenes arriba y abajo */
    height: 70vh;
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    grid-auto-flow: column;
    /* Cada columna ocupa aprox el 25% del espacio visible para que haya 4 fotos en el ancho */
    grid-auto-columns: calc((100vw - 4rem - 20px - 60px) / 4);
    overflow-x: auto;
    overflow-y: hidden;
    gap: 20px;
    padding: 0 4rem 0 20px;
    align-items: center;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
    margin-top: 70px;

}

/* Ocultar barra de scroll o hacerla fina en Webkit */
.foto-gallery-container::-webkit-scrollbar {
    height: 11px;
}

.foto-gallery-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.foto-gallery-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 10px;
}

.foto-gallery-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.7);
}

/* Elementos individuales */
.foto-item {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #111;
    /* Sombra suave */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Aspect ratio de cada foto */
.foto-hor {
    aspect-ratio: 4 / 3;
}

.foto-ver {
    aspect-ratio: 3 / 4;
}

/* Imágenes */
.foto-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, filter 0.4s ease;
    cursor: url('../media/cursor16.png'), zoom-in !important;
}

.foto-item:hover img {
    transform: scale(1.03);
    filter: brightness(1.1);
}

/* Videos de Vimeo */
.foto-video {
    cursor: url('../media/cursor16.png'), pointer !important;
}

.foto-video iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: auto;
}

/* FOTO LIGHTBOX */
.foto-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.foto-lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Imagen al 50% */
.foto-lightbox img {
    max-width: 50vw;
    max-height: 50vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
}

.foto-lightbox.active img {
    transform: scale(1);
}

/* Botón de cerrar */
.foto-lightbox-close {
    position: absolute;
    top: 2rem;
    right: 3rem;
    color: white;
    font-size: 2.5rem;
    background: none;
    border: none;
    line-height: 1;
    z-index: 1001;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.foto-lightbox-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Navegación lateral */
.foto-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.021);
    backdrop-filter: blur(4px);
    color: white;
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: background 0.2s ease, transform 0.2s ease;
}

.foto-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.05);
}

.foto-lightbox-prev {
    left: 3rem;
}

.foto-lightbox-next {
    right: 3rem;
}

/* Contador (Ej: 3 / 28) */
.foto-lightbox-counter {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 2px;
}

/* ==========================================================================
   FOTOGRAFÍA RESPONSIVE
   ========================================================================== */

/* TABLETS (max 1024px) */
@media screen and (max-width: 1024px) {
    .foto-gallery-container {
        /* Reducimos a 2 filas, con 3 fotos a lo ancho aprox */
        grid-template-rows: repeat(2, 1fr);
        grid-auto-columns: calc((100vw - 4rem - 20px - 40px) / 3);
        height: 55vh;
    }
}

/* MÓVILES (max 768px) */
@media screen and (max-width: 768px) {
    .foto-gallery-container {
        /* Pasamos a 1 sola fila para que la foto se vea bien grande */
        grid-template-rows: 1fr;
        /* Cada foto ocupa casi toda la pantalla (dejando un pedacito de la siguiente) */
        grid-auto-columns: calc(100vw - 4rem - 20px - 20px);
        height: 45vh;
        padding: 0 1rem 0 20px;
        /* Reducimos el padding derecho en móvil */
    }

    /* En móvil, el modal puede y debe ocupar más porcentaje para verse bien */
    .foto-lightbox img {
        max-width: 90vw;
        max-height: 80vh;
    }

    /* Reducimos el tamaño de los botones del modal en móvil */
    .foto-lightbox-nav {
        width: 44px;
        height: 44px;
    }

    .foto-lightbox-prev {
        left: 1rem;
    }

    .foto-lightbox-next {
        right: 1rem;
    }

    .foto-lightbox-close {
        top: 1rem;
        right: 1.5rem;
        font-size: 2rem;
    }

    /* Optimización de rendimiento: quitamos blur en móvil */
    .foto-lightbox {
        backdrop-filter: none;
        background: rgba(0, 0, 0, 0.98);
    }

    .foto-lightbox-nav {
        backdrop-filter: none;
        background: rgba(255, 255, 255, 0.15);
    }
}