/* Waipuna Rise — advanced image lightbox (shared, sitewide)
   Zoom/pan, fullscreen, thumbnail strip, slideshow, swipe. */

.lightbox-trigger { cursor: zoom-in; }

#lightboxOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 8, .95);
  z-index: 1500;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#lightboxOverlay.open { display: flex; }
#lightboxOverlay:fullscreen,
#lightboxOverlay:-webkit-full-screen { background: #000; padding: 30px; }

#lightboxTopBar {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 20;
}
.lightbox-icon-btn {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.lightbox-icon-btn:hover,
.lightbox-icon-btn.active {
  background: var(--secondary-color, #DEB878);
  color: #1a1a1a;
  border-color: var(--secondary-color, #DEB878);
}

#lightboxStage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
}

#lightboxImageWrap {
  overflow: hidden;
  max-width: 92vw;
  max-height: 68vh;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
#lightboxImage {
  max-width: 92vw;
  max-height: 68vh;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
  user-select: none;
  -webkit-user-drag: none;
  transition: transform .15s ease-out;
  will-change: transform;
  cursor: zoom-in;
}
#lightboxImage.zoomed { cursor: grab; }
#lightboxImage.dragging { cursor: grabbing; transition: none; }

#lightboxCaption { color: #fff; text-align: center; margin-top: 14px; font-size: .9rem; opacity: .85; }

#lightboxMeta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
}
#lightboxDownload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 20px;
  padding: 7px 18px;
  font-size: .82rem;
  text-decoration: none;
  transition: background-color .2s ease;
}
#lightboxDownload:hover { background: rgba(255, 255, 255, .25); color: #fff; }
#lightboxCounter { color: #fff; opacity: .7; font-size: .8rem; letter-spacing: .03em; }

.lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s ease;
  z-index: 15;
}
.lightbox-btn:hover { background: rgba(255, 255, 255, .25); }
#lightboxPrev { left: 16px; }
#lightboxNext { right: 16px; }

#lightboxThumbs {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  max-width: 92vw;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: thin;
}
#lightboxThumbs::-webkit-scrollbar { height: 6px; }
#lightboxThumbs::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); border-radius: 3px; }
.lightbox-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  opacity: .55;
  border: 2px solid transparent;
  transition: opacity .2s ease, border-color .2s ease;
}
.lightbox-thumb:hover { opacity: .85; }
.lightbox-thumb.active { opacity: 1; border-color: var(--secondary-color, #DEB878); }

@media (max-width: 576px) {
  .lightbox-btn { width: 40px; height: 40px; font-size: 1.1rem; }
  .lightbox-icon-btn { width: 36px; height: 36px; font-size: .95rem; }
  #lightboxImageWrap, #lightboxImage { max-height: 58vh; }
  .lightbox-thumb { width: 44px; height: 34px; }
}
