.gallery {
  max-width: 1200px;
  margin: 80px auto 40px;
  padding: 0 var(--page-gutter);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.gallery-thumbnail {
  appearance: none;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.gallery-viewer {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--viewer-surface);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  overscroll-behavior: contain;
}

.gallery img,
.gallery-viewer-media {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.gallery-viewer-close {
  padding: 0;
  border: 0;
  background: none;
  position: fixed;
  top: 20px;
  right: 30px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
  color: var(--viewer-ink);
  cursor: pointer;
  z-index: 1002;
  opacity: 0.62;
  transition: opacity 0.18s ease;
}

.gallery-viewer-close:hover,
.gallery-viewer-close:focus-visible {
  opacity: 1;
}

@media (max-width: 900px) {
  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 80px;
  }
}
