.gallery-viewer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(7, 22, 30, 0.94);
}

.gallery-viewer.is-open {
  display: flex;
}

.gallery-viewer-panel {
  position: relative;
  width: min(1200px, 100%);
  max-height: calc(100vh - 2.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.gallery-viewer-close {
  align-self: end;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(7, 22, 30, 0.72);
  color: #f4f7fb;
  font-size: 1.2rem;
  cursor: pointer;
}

.gallery-viewer-stage {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  gap: 1rem;
  align-items: center;
  min-height: 0;
}

.gallery-viewer-nav {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(7, 22, 30, 0.72);
  color: #f4f7fb;
  font-size: 1.4rem;
  cursor: pointer;
}

.gallery-viewer-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.gallery-viewer-image-wrap {
  position: relative;
}

.gallery-viewer-image {
  max-width: 100%;
  max-height: calc(100vh - 12rem);
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.gallery-viewer-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(7, 22, 30, 0.58);
  color: #e7eef5;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.gallery-viewer.is-loading .gallery-viewer-loading {
  display: flex;
}

.gallery-viewer-meta {
  text-align: center;
  color: #dbe7f2;
}

.gallery-viewer-counter {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}

.gallery-viewer-caption {
  color: #b7c7d6;
  font-size: 0.95rem;
}

.gallery-viewer-nav:disabled {
  opacity: 0.55;
  cursor: wait;
}

body.gallery-viewer-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .gallery-viewer {
    padding: 0.75rem;
  }

  .gallery-viewer-panel {
    max-height: calc(100vh - 1.5rem);
  }

  .gallery-viewer-stage {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 0.6rem;
  }

  .gallery-viewer-nav,
  .gallery-viewer-close {
    width: 44px;
    height: 44px;
  }

  .gallery-viewer-image {
    max-height: calc(100vh - 11.5rem);
  }
}
