/* Shared fullscreen viewer for every [data-gallery] image set. */
.lb {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  opacity: 0;
  transition: opacity .22s ease;
  -webkit-tap-highlight-color: transparent;
}
.lb.is-open { display: block; }
.lb.is-visible { opacity: 1; }
.lb__backdrop { position: absolute; inset: 0; background: rgba(8, 12, 18, .94); }
.lb__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.lb__track { display: flex; height: 100%; width: 100%; will-change: transform; }
.lb__track.is-animating { transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.lb__slide {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 64px 110px;
  position: relative;
}
.lb__slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  transition: opacity .25s ease;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
  border-radius: 4px;
}
.lb__slide img.is-loaded { opacity: 1; }
.lb__slide .lb__spinner {
  position: absolute;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .18);
  border-top-color: rgba(255, 255, 255, .85);
  animation: lb-spin .9s linear infinite;
  opacity: 0;
  transition: opacity .2s ease;
}
.lb__slide.is-loading .lb__spinner { opacity: 1; }
@keyframes lb-spin { to { transform: rotate(360deg); } }

.lb__close,
.lb__nav {
  position: absolute;
  z-index: 3;
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(8px);
  touch-action: manipulation;
  transition: background .15s ease, transform .15s ease, opacity .2s ease;
}
.lb__close:hover,
.lb__nav:hover { background: rgba(255, 255, 255, .18); }
.lb__close:active,
.lb__nav:active { transform: scale(.94); }
.lb__close {
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
.lb__close svg { width: 18px; height: 18px; }
.lb__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
}
.lb__nav:active { transform: translateY(-50%) scale(.94); }
.lb__nav[disabled] { opacity: .25; cursor: default; pointer-events: none; }
.lb__prev { left: 22px; }
.lb__next { right: 22px; }
.lb__nav svg { width: 22px; height: 22px; }

.lb__counter {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .85);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  backdrop-filter: blur(8px);
  font-variant-numeric: tabular-nums;
}

.lb__thumbs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  z-index: 3;
  display: flex;
  justify-content: safe center;
  gap: 8px;
  padding: 6px 24px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
}
.lb__thumbs::-webkit-scrollbar { display: none; }
.lb__thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: #1a242f;
  opacity: .55;
  transition: opacity .18s ease, transform .18s ease, outline-color .18s ease;
  outline: 2px solid transparent;
  outline-offset: 2px;
}
.lb__thumb img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.lb__thumb:hover { opacity: .85; }
.lb__thumb.is-active { opacity: 1; outline-color: var(--brand); }

body.lb-open { overflow: hidden; }

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

@media (max-width: 1060px) {
  .lb__slide { padding: 56px 16px 56px; }
  .lb__nav { width: 44px; height: 44px; }
  .lb__prev { left: 10px; }
  .lb__next { right: 10px; }
  .lb__thumbs { display: none; }
}

@media (max-width: 640px) {
  .lb__close {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
  }
  .lb__counter {
    top: max(16px, env(safe-area-inset-top));
    font-size: 12px;
    padding: 6px 12px;
  }
}
