/* ============================================================
   GALERÍA – Grilla, carrusel mobile y lightbox
   ============================================================ */

/* ── Grilla (desktop) ── */
.gallery-section {
    margin-bottom: 3.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, 200px);
    gap: 6px;
    justify-content: center;
}

.gallery-section>h2,
.gallery-section>p.section-intro,
.gallery-section>.gallery-carousel,
.gallery-section>script {
    grid-column: 1 / -1;
}

.gallery-grid {
    display: contents;
}

.gallery-thumb {
    width: 200px;
    height: 110px;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity var(--transition);
    background-color: #222;
    display: block;
}

.gallery-thumb:hover {
    opacity: 1;
}

/* ── Carrusel mobile ── */
.gallery-carousel {
    display: none;
    position: relative;
    overflow: hidden;
}

.gallery-carousel-track {
    display: flex;
    transition: transform 0.35s ease;
}

.gallery-carousel-track img {
    width: 100%;
    flex-shrink: 0;
    object-fit: contain;
    background-color: #000;
    height: auto;
}

.carousel-counter {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text);
    padding: 0.4rem 0;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    z-index: 5;
    border-radius: 3px;
}

.carousel-btn.prev {
    left: 0;
}

.carousel-btn.next {
    right: 0;
}

/* ============================================================
   LIGHTBOX / MODAL OVERLAY
   ============================================================ */
#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

#lightbox.is-open {
    display: flex;
}

#lightbox-inner {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    display: block;
    background-color: #111;
}

#lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    z-index: 1001;
    opacity: 0.8;
    transition: opacity var(--transition);
}

#lightbox-close:hover {
    opacity: 1;
}

#lightbox-counter {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: #ccc;
    font-size: 0.875rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background var(--transition);
    z-index: 1001;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

#lightbox-prev {
    left: 1rem;
}

#lightbox-next {
    right: 1rem;
}

/* ============================================================
   RESPONSIVE – Galería
   ============================================================ */
@media (max-width: 768px) {
    .gallery-grid {
        display: none;
    }

    .gallery-carousel {
        display: block;
    }

    .gallery-section {
        display: block;
        margin-left: 0;
        margin-right: 0;
        margin-bottom: 2rem;
        padding: 0 10px;
    }

    .gallery-section>h2 {
        font-size: 1.1rem;
    }

    .gallery-carousel-track img {
        aspect-ratio: 1/1;
        object-fit: cover;
        object-position: center center;
    }
}