/* Lightbox — image-focused viewer with heavy backdrop blur + side nav */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(28px) saturate(0.6) brightness(0.5);
  -webkit-backdrop-filter: blur(28px) saturate(0.6) brightness(0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lightbox__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 92vw;
  position: relative;
  z-index: 1;
}

.lightbox__img {
  display: block;
  max-width: 92vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transition: opacity 0.2s ease-out;
}

.lightbox.is-changing .lightbox__img {
  opacity: 0.25;
}

.lightbox__caption {
  font-size: 0.92rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
  text-align: center;
  max-width: 56ch;
  margin: 0;
  padding: 0 0.5rem;
  letter-spacing: 0.01em;
}

/* --- Buttons (close + nav) shared base --- */
.lightbox__close,
.lightbox__nav {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.20);
  color: var(--blanco-glaciar, #F0FAFA);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
  z-index: 2;
  font-family: inherit;
}

.lightbox__close:hover,
.lightbox__close:focus-visible,
.lightbox__nav:hover,
.lightbox__nav:focus-visible {
  background-color: rgba(255, 255, 255, 0.16);
  border-color: rgba(91, 184, 196, 0.55);
  outline: none;
}

.lightbox__close {
  top: 1.5rem;
  right: 1.5rem;
  width: 46px;
  height: 46px;
  padding: 0;
}

.lightbox__close-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
  height: 54px;
  padding: 0;
}

.lightbox__nav-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.lightbox__nav:hover,
.lightbox__nav:focus-visible {
  transform: translateY(-50%) scale(1.06);
}

.lightbox__nav--prev { left: 1.5rem; }
.lightbox__nav--next { right: 1.5rem; }

/* --- Counter pill --- */
.lightbox__counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.78);
  background-color: rgba(0, 0, 0, 0.40);
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  margin: 0;
  z-index: 2;
}

/* --- Backdrop click area (the outer area of .lightbox not covered by figure/buttons) --- */
.lightbox__backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
  z-index: 0;
}

/* --- Mobile --- */
@media (max-width: 640px) {
  .lightbox {
    padding: 0.75rem;
  }
  .lightbox__close {
    top: 0.85rem;
    right: 0.85rem;
    width: 42px;
    height: 42px;
  }
  .lightbox__close-icon {
    width: 18px;
    height: 18px;
  }
  .lightbox__nav {
    width: 46px;
    height: 46px;
  }
  .lightbox__nav-icon {
    width: 20px;
    height: 20px;
  }
  .lightbox__nav--prev { left: 0.6rem; }
  .lightbox__nav--next { right: 0.6rem; }
  .lightbox__counter {
    bottom: 0.85rem;
    font-size: 0.7rem;
    padding: 0.35rem 0.8rem;
  }
  .lightbox__img {
    max-height: 72vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox__img,
  .lightbox__close,
  .lightbox__nav {
    transition: none;
  }
}
