/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: oklch(from var(--color-light) l c h / 0.9);
  display: none; /* Se activa con JS */
  justify-content: center;
  align-items: center;
  z-index: 2000; /* Asegurar que esté por encima de todo */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-image {
  max-width: 90%;
  max-height: 85vh;
  object-fit: contain;
  border: 5px solid var(--color-primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  border-radius: 8px;
}

/* --- Botón de Cerrar (X) --- */
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  background: none;
  border: none;
  color: var(--color-complementary);
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  z-index: 2010;
}

.lightbox-close:hover {
  opacity: 1;
}

/* --- Controles de Navegación (Flechas) --- */
.lightbox-nav {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  pointer-events: none; /* No bloquear clics en la imagen central */
}

.lightbox-prev,
.lightbox-next {
  color: var(--color-complementary);
  border: none;
  font-size: 30px;
  padding: 15px 20px;
  cursor: pointer;
  border-radius: 5px;
  pointer-events: auto; /* Reactivar clics para los botones */
  opacity: 0.5;
  transition: all 0.2s ease;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
}
.lightbox-prev,
.lightbox-next,
.lightbox-close {
  pointer-events: auto; /* Esto es OBLIGATORIO para que el clic funcione */
  cursor: pointer; /* Para que se vea la manita */
}

/* Gallery Grid */
.gallery-l {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  padding-block: var(--p-lg);
  text-align: center;
  flex-direction: column;
  gap: var(--p-xl);

  @media (min-width: 765px) {
    padding-block: var(--p-xl);
  }

  h2,
  p {
    margin: 0;
    margin-bottom: var(--m-md);
  }

  h2 {
    color: var(--color-primary);
  }

  .gallery-grid {
    display: grid;
    gap: var(--p-lg);
    width: 100%;
    grid-template-columns: repeat(2, 1fr);

    @media (min-width: 765px) {
      grid-template-columns: repeat(3, 1fr);
    }
    @media (min-width: 991px) {
      grid-template-columns: repeat(4, 1fr);
    }

    & .image {
      overflow: hidden;
      border-radius: 0.5rem;
      aspect-ratio: 1 / 1;

      & img {
        display: block;
        object-fit: cover;
        width: 100%;
        height: 100%;
        aspect-ratio: 1 / 1;
        transition: transform var(--transition-base-time)
          var(--transition-bounce-style);
      }

      &:hover img {
        transform: scale(1.1);
      }
    }
  }
}
