.pub-photo-gallery {
  display: grid;
  gap: 1rem;
}

.pub-photo-stage-wrap {
  position: relative;
  background: #0d1f1c;
  border-radius: 18px;
  overflow: hidden;
  min-height: 540px;
}

.pub-photo-stage-list {
  position: relative;
  min-height: 540px;
}

.pub-photo-stage {
  display: none;
  margin: 0;
  min-height: 540px;
  height: 100%;
}

.pub-photo-stage.is-active {
  display: block;
}

.pub-photo-stage img {
  width: 100%;
  height: 540px;
  object-fit: contain;
  display: block;
  background: #0d1f1c;
  transition: opacity .2s ease;
}

.pub-photo-stage img[data-photo-src] {
  opacity: .01;
}

.pub-photo-stage img.is-ready {
  opacity: 1;
}

.pub-photo-caption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: grid;
  gap: .35rem;
  padding: 1rem 1.1rem;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, .18), transparent);
}

.pub-photo-caption strong,
.pub-photo-caption span,
.pub-photo-caption small {
  display: block;
}

.pub-photo-nav,
.pub-photo-expand,
.pub-photo-lightbox-close,
.pub-photo-lightbox-nav {
  appearance: none;
  border: 0;
  cursor: pointer;
}

.pub-photo-nav,
.pub-photo-expand {
  position: absolute;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: #0d1f1c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  box-shadow: 0 10px 26px rgba(0,0,0,.16);
}

.pub-photo-nav.prev { left: 14px; top: 50%; transform: translateY(-50%); }
.pub-photo-nav.next { right: 14px; top: 50%; transform: translateY(-50%); }
.pub-photo-expand { top: 14px; right: 14px; font-size: 1.15rem; }
html[dir="rtl"] .pub-photo-expand { right: auto; left: 14px; }
html[dir="rtl"] .pub-photo-nav.prev { left: auto; right: 14px; }
html[dir="rtl"] .pub-photo-nav.next { right: auto; left: 14px; }

.pub-photo-counter {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 3;
  display: inline-flex;
  gap: .35rem;
  align-items: center;
  padding: .45rem .7rem;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: #0d1f1c;
  font-size: .9rem;
  font-weight: 700;
}
html[dir="rtl"] .pub-photo-counter { left: auto; right: 14px; }

.pub-photo-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: .75rem;
}

.pub-photo-thumb {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.pub-photo-thumb:hover,
.pub-photo-thumb.is-active {
  border-color: #1a7346;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(13,31,28,.12);
}

.pub-photo-thumb img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
}

.pub-photo-lightbox[hidden] {
  display: none !important;
}

.pub-photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(7, 12, 12, .92);
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  padding: 2rem;
}

.pub-photo-lightbox-stage {
  min-width: 0;
}

.pub-photo-lightbox-stage .pub-photo-stage {
  display: block;
  min-height: auto;
}

.pub-photo-lightbox-stage .pub-photo-stage img {
  max-height: 82vh;
  height: auto;
  width: 100%;
  object-fit: contain;
  background: transparent;
}

.pub-photo-lightbox-stage .pub-photo-caption {
  position: static;
  max-width: 900px;
  margin: 0 auto;
  background: transparent;
  padding: 1rem 0 0;
}

.pub-photo-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
}
html[dir="rtl"] .pub-photo-lightbox-close { right: auto; left: 16px; }

.pub-photo-lightbox-nav {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 1.8rem;
  justify-self: center;
}

@media (max-width: 900px) {
  .pub-photo-stage-wrap,
  .pub-photo-stage-list,
  .pub-photo-stage,
  .pub-photo-stage img {
    min-height: 420px;
    height: 420px;
  }

  .pub-photo-thumbs {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  }

  .pub-photo-thumb img {
    height: 76px;
  }

  .pub-photo-lightbox {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    padding: 1rem;
  }
}

@media (max-width: 640px) {
  .pub-photo-stage-wrap,
  .pub-photo-stage-list,
  .pub-photo-stage,
  .pub-photo-stage img {
    min-height: 300px;
    height: 300px;
  }

  .pub-photo-nav,
  .pub-photo-expand {
    width: 38px;
    height: 38px;
  }

  .pub-photo-counter {
    font-size: .82rem;
    padding: .35rem .6rem;
  }

  .pub-photo-thumbs {
    display: flex;
    gap: .65rem;
    overflow-x: auto;
    padding-bottom: .25rem;
    scroll-snap-type: x proximity;
  }

  .pub-photo-thumb {
    min-width: 84px;
    scroll-snap-align: start;
  }
}
