/* Image lightbox — dark glass overlay, smooth zoom/fade, fully responsive.
   Always dark regardless of site theme; loads guarded /uploads URLs only. */

.lb-root { overflow: hidden; }

.lb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 32px);
  background: rgba(10, 9, 8, 0.9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  opacity: 0;
  transition: opacity 0.28s ease;
}
/* Author-level display rule above beats the UA [hidden] style, so restate
   it explicitly or the closed overlay keeps covering the page invisibly. */
.lb-backdrop[hidden] { display: none; }
.lb-backdrop.is-open { opacity: 1; }

.lb-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  transform: scale(0.92) translateY(14px);
  opacity: 0;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.26s ease;
  will-change: transform, opacity;
}
.lb-backdrop.is-open .lb-stage { transform: none; opacity: 1; }

/* Drag-to-dismiss follow state */
.lb-stage.is-drag { transition: none; }
.lb-backdrop.is-closing { opacity: 0; transition: opacity 0.24s ease; }
.lb-backdrop.is-closing .lb-stage { transform: scale(0.94); opacity: 0; transition: transform 0.24s ease, opacity 0.24s ease; }

.lb-img {
  display: block;
  max-width: min(1100px, 94vw);
  max-height: 78vh;
  width: auto;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 4px 18px rgba(0, 0, 0, 0.4);
  background: rgba(255, 255, 255, 0.04);
}

/* Crossfade between gallery images */
.lb-img.is-swapping { opacity: 0; transform: scale(0.985); }
.lb-img { transition: opacity 0.16s ease, transform 0.16s ease; }

.lb-cap {
  margin-top: 14px;
  max-width: min(720px, 90vw);
  text-align: center;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.9rem;
  line-height: 1.5;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
.lb-cap:empty { display: none; }

.lb-counter {
  position: absolute;
  left: 50%;
  bottom: calc(-30px - env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}
.lb-counter[hidden] { display: none; }

/* Circular glass controls */
.lb-btn {
  position: fixed;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .lb-btn:hover { background: rgba(255, 255, 255, 0.18); transform: scale(1.06); }
}
.lb-btn:active { transform: scale(0.96); }
.lb-btn:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.8); outline-offset: 2px; }
.lb-btn[hidden] { display: none; }

.lb-close { top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); }
.lb-prev { left: calc(12px + env(safe-area-inset-left, 0px)); top: 50%; transform: translateY(-50%); }
.lb-next { right: calc(12px + env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); }
.lb-prev:active, .lb-next:active { transform: translateY(-50%) scale(0.96); }

/* Thumbnails keep an inviting cursor */
img[data-lightbox] { cursor: zoom-in; }

@media (max-width: 640px) {
  .lb-prev, .lb-next { top: auto; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: none; }
  .lb-prev:active, .lb-next:active { transform: scale(0.96); }
  .lb-img { max-height: 70vh; border-radius: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .lb-backdrop, .lb-stage, .lb-img, .lb-btn { transition: none !important; }
}