/* Estilos base para la galería */
.galeria {
    padding: 60px 20px;
    background-color: var(--color-blanco, #ffffff);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-image: url(../assets/img/fondo.png);
}

.galeria h2 {
    font-family: 'Breathing', sans-serif;
    text-align: center;
    font-size: 4rem;
    margin: 0;
    color: #456344;
    border-bottom: 2px solid #456344;
    padding-bottom: 0.5rem;
    font-weight: normal;
    margin-top: -7rem;
}

.grid-fotos {
    display: grid;
    grid-template-columns: repeat(3, 400px);
    grid-template-rows: repeat(2, 400px);
    gap: 20px;
    margin-top: 30px;
}

.grid-fotos img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid #456344;
    border-radius: 12px;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.grid-fotos img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    width: 80vw;
    height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.imagen-lightbox {
    max-width: 100%;
    max-height: calc(80vh - 50px);
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Estilos para los botones de navegación */
.anterior, .siguiente {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 3rem;
    cursor: pointer;
    z-index: 1001;
    background: rgba(69, 99, 68, 0.7);
    width: 50px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    transition: background-color 0.3s;
}

.anterior:hover, .siguiente:hover {
    background: rgba(69, 99, 68, 0.95);
}

.anterior { left: 10vw; }
.siguiente { right: 10vw; }

.cerrar {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 2;
    background-color: rgba(69, 99, 68, 0.7);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    transition: background-color 0.3s;
}

.cerrar:hover {
    background-color: rgba(69, 99, 68, 0.95);
}

/* Contador debajo de la imagen */
.contador {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2em;
    margin-top: 10px;
    padding: 5px 15px;
    border-radius: 20px;
    font-family: 'Arial', sans-serif;
    color: #456344;
    background-color: white;
    border: 1px solid #456344;
    z-index: 1001;
}

/* Responsive */
@media (max-width: 1270px) {
    .grid-fotos {
        grid-template-columns: repeat(2, 1fr);
    }

    .imagen-lightbox {
        max-height: 70vh;
    }

    .anterior, .siguiente {
        font-size: 40px;
        padding: 15px;
    }

    .cerrar {
        font-size: 30px;
        top: 10px;
        right: 20px;
    }

    .galeria h2 {
        font-size: 7rem;
    }
}

@media (max-width: 768px) {
    .grid-fotos {
        grid-template-columns: repeat(2, 1fr);
    }

    .imagen-lightbox {
        max-height: 60vh;
    }

    .anterior, .siguiente {
        font-size: 30px;
        padding: 10px;
    }

    .cerrar {
        font-size: 25px;
        top: 10px;
        right: 15px;
    }

    .galeria h2 {
        font-size: 3rem;
    }

    .anterior { 
        left: 10vw; 
        top: 90vh;
    }
    
    .siguiente { 
        right: 10vw;
        top: 90vh;
    }
}

@media (max-width: 480px) {
    .grid-fotos {
        grid-template-columns: 1fr;
        grid-auto-rows: 300px;
    }

    .galeria h2 {
        font-size: 2rem;
    }

    .anterior { 
        left: 10vw; 
        top: 90vh;
    }
    
    .siguiente { 
        right: 10vw;
        top: 90vh;
    }
}

/* Animación de carga */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
