/* ============================================================
   LIGHTBOX — shared fullscreen image viewer markup/behavior.
   Used by templates/tracking/index.html, templates/tracking/incoming.html
   and templates/problem/home.html, driven by static/js/lightbox.js.
   Page-specific tweaks (extra header clearance, hidden-until-open nav,
   etc.) live in each page's own stylesheet and load after this file.
   ============================================================ */
.lightbox {
  /* Above the site's sticky header (.naviheader, z-index: 999) so the close/nav
     buttons are never hidden behind it, regardless of the header's rendered height. */
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(5,8,16,0.92);
  backdrop-filter: blur(12px);
  display: none; align-items: center; justify-content: center; padding: 40px;
  overflow: hidden;
}
.lightbox.visible { display: flex; }
html.lightbox-open, html.lightbox-open body, body.lightbox-open { overflow: hidden !important; height: 100% !important; }
html.lightbox-open { scrollbar-gutter: auto !important; }
.lightbox img { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; box-shadow: 0 20px 80px rgba(0,0,0,0.6); transition: filter 0.15s ease; will-change: filter; transform: translateZ(0); }
.lightbox img.is-loading { filter: blur(14px); }
.lightbox-close {
  position: absolute; top: 24px; right: 24px; z-index: 2;
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  background: rgba(20,20,20,0.55) !important; color: white; border: 1px solid rgba(255,255,255,0.25); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.lightbox-nav {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%) translateZ(0);
  width: 48px; height: 48px; padding: 0; border-radius: 50%;
  background: rgba(20,20,20,0.55) !important; color: white; border: 1px solid rgba(255,255,255,0.25); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background 0.2s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  /* Own compositor layer: isolates these from the backdrop-filter repaint
     that .lightbox's blur triggers whenever the <img> swaps src/filter on
     every navigation, which otherwise visibly flashes these buttons too.
     z-index pins them above the img, which got its own stacking context
     below for the same reason and would otherwise paint on top (DOM order). */
  will-change: transform;
}
.lightbox-nav:hover { background: #222; }
.lightbox-nav svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.lightbox-close svg { pointer-events: none; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-nav.is-single { display: none; }
.lightbox-counter {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: none;
}
.lightbox-counter.is-single { display: none; }

@media (max-width: 600px) {
  .lightbox {
    padding: 64px 16px 20px;
  }
  .lightbox-close {
    top: 12px !important;
    right: 12px !important;
    width: 38px !important;
    height: 38px !important;
  }
  .lightbox-nav {
    width: 34px;
    height: 34px;
  }
  .lightbox-nav svg {
    width: 18px;
    height: 18px;
  }
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
  .lightbox-counter {
    bottom: 14px;
    font-size: 12px;
    padding: 5px 13px;
  }
}
