/* ================================================================
   09. GALLERY LIGHTBOX
   Full-screen image gallery opened from a project card.

   Files load in number order (01 → 12). Later files override
   earlier ones, so keep the order when moving rules around.
   ================================================================ */

/* ===== portfolio gallery lightbox ===== */
.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(12px,3vw,40px);
}

.lb[hidden] {
  display: none;
}

.lb-bg {
  position: absolute;
  inset: 0;
  background: rgba(8,15,20,.55);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  animation: lb-fade .3s ease;
}

.lb-box {
  position: relative;
  width: min(1100px,100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 32px;
  background: linear-gradient(160deg,rgba(255,255,255,.62),rgba(255,255,255,.4));
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  backdrop-filter: blur(26px) saturate(170%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7),0 40px 80px -30px rgba(8,15,20,.6);
  animation: lb-pop .45s cubic-bezier(.34,1.4,.5,1);
}

@keyframes lb-fade {
  from {
    opacity: 0;
  }
}

@keyframes lb-pop {
  from {
    opacity: 0;
    transform: scale(.94) translateY(12px);
  }
}

.lb-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 0 8px;
}

.lb-top h3 {
  font-size: clamp(18px,2vw,22px);
}

.lb-count {
  color: var(--mut);
}

.lb-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lb-open {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 14.5px;
}

.lb-open[hidden] {
  display: none;
}

.lb-x,
.lb-nav {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: rgba(255,255,255,.8);
  color: var(--ink);
  box-shadow: 0 8px 20px -12px rgba(11,26,92,.5);
  transition: background .2s,color .2s,opacity .2s;
}

.lb-x svg,
.lb-nav svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lb-x:hover,
.lb-nav:hover:not(:disabled) {
  background: var(--royal);
  color: #fff;
}

.lb-x:focus-visible,
.lb-nav:focus-visible,
.lb-open:focus-visible,
.lb-dots button:focus-visible {
  outline: 3px solid var(--royal);
  outline-offset: 3px;
}

.lb-nav:disabled {
  opacity: .3;
  cursor: default;
}

.lb-stage {
  position: relative;
}

.lb-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  border-radius: 22px;
  outline: none;
}

.lb-track::-webkit-scrollbar {
  display: none;
}

.lb-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  aspect-ratio: 16/10;
  max-height: calc(100dvh - 220px);
  display: grid;
  place-items: center;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  background: rgba(255,255,255,.4);
}

.lb-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.lb-slide .ph {
  background: rgba(255,255,255,.75);
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--mut);
}

.lb-nav {
  position: absolute;
  top: 50%;
  margin-top: -22px;
  z-index: 2;
}

.lb-prev {
  left: 12px;
}

.lb-next {
  right: 12px;
}

.lb-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding-bottom: 2px;
}

.lb-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(14,26,46,.25);
  cursor: pointer;
  transition: width .3s,background .3s;
}

.lb-dots button[aria-current="true"] {
  width: 24px;
  background: var(--royal);
}

@media (max-width:640px) {
  .lb {
    padding: 10px;
  }
  .lb-box {
    padding: 12px;
    border-radius: 26px;
  }
  .lb-nav {
    width: 38px;
    height: 38px;
    margin-top: -19px;
  }
  .lb-prev {
    left: 8px;
  }
  .lb-next {
    right: 8px;
  }
  .lb-open {
    height: 38px;
    padding: 0 12px;
    font-size: 13.5px;
  }
}

@media (prefers-reduced-motion:reduce) {
  .lb-bg,
  .lb-box {
    animation: none;
  }
  .lb-track {
    scroll-behavior: auto;
  }
}

.shot img {
  z-index: 0;
}

.shot .pill {
  z-index: 1;
}

/* gallery: one rounded frame, square slide edges so no notches between slides */
.lb-track {
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 22px;
  isolation: isolate;
  -webkit-mask-image: -webkit-radial-gradient(white,black);
}

.lb-slide,
.lb-slide.shot {
  border-radius: 0!important;
  border: 0!important;
  box-shadow: none!important;
}

.lb-slide::after,
.lb-slide.shot::after {
  display: none!important;
}

.lb-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
