.galeria {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 60px 140px;
    align-items: center;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto; 
}

.galeria a {
    overflow: hidden;
    display: block;
    position: relative;
}

.galeria a img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.galeria a:hover img {
    transform: scale(1.05);
}

.galeria a::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.galeria a::before {
    content: '\2315';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--blanco);
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.galeria a:hover::after,
.galeria a:hover::before {
    opacity: 1;
}

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.lightbox:target {
    display: flex;
}

.lightbox img {
    width: 85vw !important; 
    height: 85vh !important; 
    max-width: 1200px !important; 
    object-fit: contain !important; 
    display: block;
    margin: auto;
}

.lb-cerrar {
    position: fixed;
    top: 20px;
    right: 30px;
    color: #ffffff;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 10000;
    line-height: 1;
    text-decoration: none;
}

.lb-prev,
.lb-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 2rem;
    cursor: pointer;
    padding: 20px;
    z-index: 10000;
    text-decoration: none;
}

.lb-prev {
    left: 20px;
}

.lb-next {
    right: 20px;
}

.lb-contador {
    position: fixed;
    top: 20px;
    left: 30px;
    color: #ffffff;
    font-size: 1rem;
}

@media (max-width: 900px) {
    .galeria {
        grid-template-columns: repeat(2, 1fr);
        padding: 40px;
        gap: 8px;
    }

    .lightbox img {
        max-width: 90%;
    }
}

@media (max-width: 500px) {
    .galeria {
        grid-template-columns: 1fr;
        padding: 30px 20px;
    }

    .lb-prev,
    .lb-next {
        font-size: 1.5rem;
        padding: 10px;
    }
}