.galeria-pinterest {
    padding: 3rem 1.5rem;
    background: var(--blanco);
    position: relative;
    overflow: hidden;
}

.galeria-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.galeria-titulo {
    text-align: center;
    margin-bottom: 2rem;
}

.galeria-titulo h2 {
    font-size: 2.7rem;
    color: var(--azul-oscuro);
    font-weight: 800;
    line-height: 1.1;
}

.section-line {
    width: 90px;
    height: 5px;
    background: var(--rojo-principal);
    margin: 20px auto 60px;
}

.galeria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-rows: 5px;
    gap: 1rem;
}

.grid-item {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    cursor: pointer;
    grid-row-end: span var(--row-span, 15);
    border: 2px solid var(--blanco);
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

.grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.grid-item:hover img {
    transform: scale(1.03);
}

.grid-item::before {
    content: '\f00e';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: var(--azul-oscuro);
    background: var(--blanco);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: transform 0.2s ease;
    opacity: 0.9;
}

.grid-item:hover::before {
    transform: translate(-50%, -50%) scale(1);
}

.lightbox-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
}

.lightbox-modal.is-active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 80vh;
}

.lightbox-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.close-lightbox,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    color: var(--blanco);
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--blanco);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.close-lightbox {
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 24px;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 55px;
    height: 55px;
    font-size: 20px;
}

.close-lightbox:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: var(--blanco);
    color: var(--azul-oscuro);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--blanco);
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 15px;
    border-radius: 20px;
    border: 1px solid var(--blanco);
}

body.u-no-scroll {
    overflow: hidden !important;
}

#lightboxMainImg {
    transition: opacity 0.15s ease-in-out;
}

#lightboxMainImg.is-fading {
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    } to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid-item:nth-child(1) { animation-delay: 0.03s; }
.grid-item:nth-child(2) { animation-delay: 0.06s; }
.grid-item:nth-child(3) { animation-delay: 0.09s; }
.grid-item:nth-child(4) { animation-delay: 0.12s; }
.grid-item:nth-child(5) { animation-delay: 0.15s; }
.grid-item:nth-child(6) { animation-delay: 0.18s; }
.grid-item:nth-child(7) { animation-delay: 0.21s; }
.grid-item:nth-child(8) { animation-delay: 0.24s; }
.grid-item:nth-child(9) { animation-delay: 0.27s; }
.grid-item:nth-child(10) { animation-delay: 0.3s; }
.grid-item:nth-child(11) { animation-delay: 0.33s; }
.grid-item:nth-child(12) { animation-delay: 0.36s; }
.grid-item:nth-child(13) { animation-delay: 0.39s; }
.grid-item:nth-child(14) { animation-delay: 0.42s; }
.grid-item:nth-child(15) { animation-delay: 0.45s; }
.grid-item:nth-child(16) { animation-delay: 0.48s; }
.grid-item:nth-child(17) { animation-delay: 0.51s; }
.grid-item:nth-child(18) { animation-delay: 0.54s; }
.grid-item:nth-child(19) { animation-delay: 0.57s; }
.grid-item:nth-child(20) { animation-delay: 0.6s; }

@media (max-width: 992px) {
    .galeria-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.7rem;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 45px;
        height: 45px;
        top: auto;
        bottom: 20px;
        transform: none;
    }

    .lightbox-prev {
        left: 15%;
    }

    .lightbox-next {
        right: 15%;
    }

    .section-line {
        margin-bottom: 40px;
    }
}
