/* ============================================================================
   lightbox.css  —  styling for the click-to-enlarge image overlay (lightbox.js)
   ============================================================================ */

/* Signal that gallery images are interactive. */
img[data-gallery-ref],
.campaign-gallery img {
  cursor: zoom-in;
}

/* Overlay. Uses visibility+opacity (not display) so it can fade and stays out
   of the a11y tree / pointer path when closed. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(26, 26, 26, 0.88);   /* --charcoal-ish, matches footer dark */
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

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

.lightbox-img {
  max-width: min(1100px, 92vw);
  max-height: 88vh;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  color: #fff;
}

/* Caption + "view full gallery" link, shown below the image for gallery tiles.
   Positioned at the bottom of the overlay so it reads as a caption strip. */
.lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
}

.lightbox-caption-text {
  margin: 0;
  max-width: min(700px, 90vw);
  font-size: 0.95rem;
  line-height: 1.4;
}

.lightbox-gallery-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  color: #fff;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.lightbox-gallery-link:hover,
.lightbox-gallery-link:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.7);
}

.lightbox-caption-text[hidden],
.lightbox-gallery-link[hidden] {
  display: none;
}

/* Previous / next arrows. Sit on the sides of the image and fade in on hover
   (or on keyboard focus); hidden entirely at the ends of a gallery. */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 26, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, color 0.2s ease;
}

.lightbox-nav-prev { left: 16px; }
.lightbox-nav-next { right: 16px; }

/* Reveal on hover of the open overlay, or when an arrow is focused. */
.lightbox.is-open:hover .lightbox-nav,
.lightbox-nav:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  background: rgba(26, 26, 26, 0.6);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

.lightbox-nav[hidden] {
  display: none;
}

/* Touch devices have no hover — keep the arrows visible there. */
@media (hover: none) {
  .lightbox-nav {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 600px) {
  .lightbox-nav { width: 44px; height: 44px; }
  .lightbox-nav-prev { left: 8px; }
  .lightbox-nav-next { right: 8px; }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox-nav {
    transition: none;
  }
}
