/* The picture viewer (owner, 2026-10-18 - "do the small fixes"): the overlay
   public/lightbox.js builds once and shows for any inline picture wrapped in
   <a data-lightbox="<item>" href="<url>"> (feed items and posts, comments
   under posts and missions, message bubbles, the bird page's updates, the
   admin's queue). Included once from views/partials/head.ejs. Dark backdrop,
   the picture fitted to the screen, Close (44px) top right, arrows for the
   pictures of the SAME item, a "2 of 4" caption; body scroll is locked
   while it is open (.lb-open). Nothing here is rendered on the server. */

html.lb-open, body.lb-open { overflow: hidden; }

.lb {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 14, 0.94);
  color: #FFFFFF;
  -webkit-tap-highlight-color: transparent;
}
.lb[hidden] { display: none; }

.lb-stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  touch-action: pan-y; /* the horizontal swipe is ours; vertical scrolling stays the browser's */
}

.lb-img {
  display: block;
  max-width: 100vw;
  max-height: calc(100vh - 6.5rem);
  max-height: calc(100dvh - 6.5rem);
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.15s ease;
}
.lb-img.is-loading { opacity: 0.35; }

.lb-btn {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  font: inherit;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.28); }
.lb-btn:focus-visible { outline: 3px solid #F5C400; outline-offset: 2px; box-shadow: none; }
.lb-btn[hidden] { display: none; }

.lb-close { top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); width: 44px; height: 44px; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); width: 44px; height: 64px; }
.lb-prev { left: max(4px, env(safe-area-inset-left)); }
.lb-next { right: max(4px, env(safe-area-inset-right)); }

.lb-caption {
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
  padding: 0.75rem 4rem max(0.75rem, env(safe-area-inset-bottom));
  text-align: center;
  font-weight: 700;
  color: #FFFFFF;
}

@media (prefers-reduced-motion: reduce) {
  .lb-img { transition: none; }
}
