/* ============================================
   LIGHTBOX
   ============================================ */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0, 0, 0, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

/* Stage fills the overlay, clips slides */
.lb-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Each slide is absolutely centred in the stage */
.lb-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Fixed bounding box — same for every image/video */
.lb-img,
.lb-video {
  display: block;
  width: 92vw;
  height: 92vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: all;
  outline: none;
  transform-origin: center center;
  will-change: transform;
}

/* Zoom cursor states */
.lb-img { cursor: zoom-in; }
#lightbox.lb-zoomed .lb-img { cursor: grab; }
#lightbox.lb-zoomed .lb-img:active { cursor: grabbing; }

/* ---- Before / After label ---- */
.lb-ba-label {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.65);
  color: rgba(255, 255, 255, 0.6);
  padding: 0.25rem 0.65rem;
  pointer-events: none;
  z-index: 1;
}

.lb-ba-label.proposed {
  color: var(--accent, #5ee7b7);
}

/* ---- Close button ---- */
.lb-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 20001;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 2rem;
  line-height: 1;
  cursor: none;
  padding: 0.5rem;
  transition: color 0.2s;
}

.lb-close:hover { color: #fff; }

/* ---- Counter ---- */
.lb-counter {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20001;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
  white-space: nowrap;
}

/* ---- Image controls (zoom button) ---- */
.lb-img-controls {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 20001;
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.lb-img-controls.visible {
  display: flex;
}

/* Zoom icon states */
.lb-zoom .lb-icon-zoomout { display: none; }
.lb-zoom.active .lb-icon-zoomin  { display: none; }
.lb-zoom.active .lb-icon-zoomout { display: inline; }

/* ---- Video controls ---- */
.lb-video-controls {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 20001;
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.lb-video-controls.visible {
  display: flex;
}

.lb-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.55);
  cursor: none;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.lb-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.lb-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* Muted state: show muted icon, hide sound icon */
.lb-mute .lb-icon-sound { display: none; }
.lb-mute .lb-icon-muted { display: inline; }

/* Unmuted state: show sound icon, hide muted icon */
.lb-mute.unmuted .lb-icon-muted { display: none; }
.lb-mute.unmuted .lb-icon-sound { display: inline; }

/* Fullscreen active state */
.lb-fullscreen .lb-icon-exit { display: none; }
.lb-fullscreen.active .lb-icon-enter { display: none; }
.lb-fullscreen.active .lb-icon-exit  { display: inline; }

/* ---- Mobile ---- */
@media (max-width: 600px) {
  .lb-img,
  .lb-video {
    width: 100vw;
    height: 88vh;
  }

  .lb-close {
    top: 0.75rem;
    right: 1rem;
    font-size: 1.75rem;
  }

  .lb-video-controls {
    bottom: 1rem;
    right: 1rem;
    gap: 0.4rem;
  }

  .lb-btn {
    width: 2.2rem;
    height: 2.2rem;
  }
}
