.gallery-page {
  position: relative;
  z-index: 2;
  width: min(100% - 32px, 1440px);
  margin: 0 auto;
  padding: 0 0 72px;
}

.gallery-body .hero-bg-canvas {
  position: absolute;
}

.gallery-page__header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px 24px;
  margin: 0 0 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}

.gallery-page__eyebrow {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--color-primary-accent);
  font-family: monospace;
  font-size: 0.78rem;
  font-weight: 700;
}

.gallery-page__header h2 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 1.8rem;
  line-height: 1.2;
}

.gallery-page__count {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.88rem;
}

.justified-gallery {
  display: grid;
  gap: 12px;
  width: 100%;
}

.justified-gallery__row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.justified-gallery__item {
  display: block;
  flex: 0 0 auto;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--color-card-surface);
  cursor: zoom-in;
}

.justified-gallery__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    transform 180ms ease,
    filter 180ms ease;
}

.justified-gallery__item:hover img,
.justified-gallery__item:focus-visible img {
  transform: scale(1.025);
  filter: saturate(1.08);
}

.justified-gallery__item:focus-visible {
  outline: 2px solid var(--color-primary-accent);
  outline-offset: 2px;
}

.gallery-page__message {
  min-height: 1.5em;
  margin: 26px 0 0;
  color: var(--color-text-secondary);
  text-align: center;
}

.gallery-page__more {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

.gallery-page__more[hidden] {
  display: none;
}

.gallery-page__more-button {
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--color-primary-accent);
  border-radius: 2px;
  background: transparent;
  color: var(--color-primary-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.gallery-page__more-button:hover,
.gallery-page__more-button:focus-visible {
  background: rgba(0, 255, 135, 0.12);
}

.gallery-page__more-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.gallery-viewer {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(96vw, 1200px);
  max-width: none;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 48px 16px 16px;
  border: 1px solid var(--color-border);
  border-radius: 2px;
  background: #0f1115;
  color: var(--color-text-primary);
}

.gallery-viewer::backdrop {
  background: rgba(0, 0, 0, 0.88);
}

.gallery-viewer img {
  display: block;
  max-width: 100%;
  max-height: 76vh;
  max-height: 76dvh;
  margin: 0 auto;
  object-fit: contain;
}

.gallery-viewer p {
  margin: 12px 0 0;
  color: var(--color-text-secondary);
  text-align: center;
}

.gallery-viewer__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-viewer__close:hover,
.gallery-viewer__close:focus-visible {
  border-color: var(--color-primary-accent);
  color: var(--color-primary-accent);
}

@media (max-width: 767px) {
  .gallery-page {
    width: min(100% - 24px, 1440px);
  }

  .gallery-page__header h2 {
    font-size: 1.5rem;
  }

  .justified-gallery,
  .justified-gallery__row {
    gap: 8px;
  }
}
