/* Gallery lightbox — flat, full image, minimal chrome */

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}

.gallery-lightbox.is-open {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  opacity: 1;
}

.gallery-lightbox-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1400px;
  height: 100%;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(12px, 2vw, 20px);
  box-sizing: border-box;
}

.gallery-lightbox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.gallery-lightbox-counter {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.gallery-lightbox-close {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.gallery-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.gallery-lightbox-close:focus-visible {
  outline: 2px solid var(--blue-light, #7eb8e8);
  outline-offset: 2px;
}

.gallery-lightbox-figure {
  margin: 0;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: 1fr auto;
  gap: 12px;
  align-items: center;
}

.gallery-lightbox-media {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.gallery-lightbox-img {
  width: 100%;
  height: 100%;
  max-height: min(72vh, 900px);
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: #000;
  border-radius: 0;
}

.gallery-lightbox-caption {
  grid-column: 1 / -1;
  grid-row: 2;
  padding: 8px 0 0;
  text-align: center;
  flex-shrink: 0;
}

.gallery-lightbox-title {
  margin: 0 auto;
  font-size: clamp(15px, 2vw, 20px);
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  max-width: 800px;
}

.gallery-lightbox-desc {
  margin: 6px auto 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
  max-width: 720px;
}

.gallery-lightbox-nav {
  position: static;
  transform: none;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 5;
  flex-shrink: 0;
}

.gallery-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.12);
}

.gallery-lightbox-nav:focus-visible {
  outline: 2px solid var(--blue-light, #7eb8e8);
  outline-offset: 2px;
}

.gallery-lightbox-prev {
  grid-column: 1;
  grid-row: 1;
}

.gallery-lightbox-next {
  grid-column: 3;
  grid-row: 1;
}

.gallery-lightbox-thumbs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.gallery-lightbox-thumbs::-webkit-scrollbar {
  height: 4px;
}

.gallery-lightbox-thumbs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
}

.gallery-lightbox-thumb {
  flex: 0 0 auto;
  width: 72px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 0;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.5;
  scroll-snap-align: center;
}

.gallery-lightbox-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-lightbox-thumb:hover {
  opacity: 0.8;
}

.gallery-lightbox-thumb.is-active {
  opacity: 1;
  border-color: var(--blue-light, #7eb8e8);
}

body.lightbox-open {
  overflow: hidden;
}

@media (max-width: 760px) {
  .gallery-lightbox-shell {
    padding: 10px;
  }

  .gallery-lightbox-figure {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
    gap: 8px;
  }

  .gallery-lightbox-media {
    grid-column: 1;
    grid-row: 1;
  }

  .gallery-lightbox-prev {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  .gallery-lightbox-next {
    grid-column: 1;
    grid-row: 2;
    justify-self: end;
  }

  .gallery-lightbox-caption {
    grid-row: 3;
  }

  .gallery-lightbox-img {
    max-height: min(58vh, 640px);
  }

  .gallery-lightbox-thumb {
    width: 60px;
    height: 42px;
  }
}
