.gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.gallery__item {
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
}

.gallery__img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 4 / 3;
    transition: transform 0.3s ease;
}

.gallery__img:hover {
    transform: scale(1.05);
}

.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(153, 153, 153, 0.85) !important;
        /* gris medio */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.gallery-lightbox.hidden {
    display: none;
}

.gallery-lightbox__modal {
    max-width: 95%;
    max-height: 95%;
}

.gallery-lightbox__img-wrapper {
    position: relative;    /* referencia para ubicar la cruz */
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox__img {
    width: 100%;
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    margin: auto;
    border: 5px solid black;
    border-radius: 8px;
    pointer-events: none;    /* deja pasar clics a la cruz y flechas */
}

.gallery-lightbox__control {
    position: absolute;
    cursor: pointer;
    user-select: none;
    z-index: 2;
}

.icon-back,
.icon-next {
    color: white;
    font-size: 2rem;
    background: none;
    padding: 0;
    border: none;
    text-shadow: 0 0 4px black;
}

.icon-back {
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.icon-next {
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.icon-close {
    position: absolute;
    /* clave para ubicarla */
    top: 0.5rem;
    right: 0.5rem;
    width: 32px;
    height: 32px;
    background-color: black;
    color: white;
    border-radius: 50%;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    /* encima de la imagen */
}


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

@media (max-width: 480px) {
    .gallery {
        grid-template-columns: 1fr;
    }

    .gallery-lightbox__img {
        border: 5px solid white;
    }
}

.gallery-lightbox__img {
    pointer-events: none;
    /* deja pasar clics a flechas y cruz */
}

.gallery-lightbox__control {
    z-index: 1001;
    /* asegura que flechas y cruz estén arriba */
}

.gallery-title {
    font-family: Tahoma, sans-serif;
    font-size: 2rem;
    /* más grande */
    font-weight: bold;
    text-align: center;
    /* centrado */
    margin-bottom: 1.5rem;
    color: #5d4037;
    /* marrón institucional */
}

.sidenav {
    position: fixed;
    top: 0;
    left: -260px;
    width: 260px;
    height: 100%;
    background: #f5f5f5;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.3);
    transition: left 0.3s ease;
    z-index: 900;
    overflow-y: auto;
}

.sidenav.open {
    left: 0;
}

.sidenav-header {
    text-align: center;
    padding: 1rem;
    background: #333;
    color: #fff;
}

.sidenav-bg {
    width: 100%;
    height: 80px;
    object-fit: cover;
}

.sidenav-user {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-top: -40px;
    border: 3px solid #fff;
}

.sidenav-name {
    display: block;
    margin-top: 0.5rem;
    font-weight: bold;
}

.sidenav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidenav-links li {
    border-bottom: 1px solid #ddd;
}

.sidenav-links a {
    display: block;
    padding: 0.8rem 1rem;
    color: #333;
    text-decoration: none;
}

.sidenav-links a:hover {
    background: #e0e0e0;
}

.section-title {
    font-weight: bold;
    padding: 1rem;
    background: #ccc;
}

.sidenav-trigger {
    font-size: 1.2rem;
    color: #fff;
    margin-left: 1rem;
    cursor: pointer;
    text-decoration: none;
}