.gallery figure > a {
  display: block;
  height: 100%;
  cursor: zoom-in;
}

.gallery figure > a::after {
  content: "⤢";
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #172c25;
  color: #fff;
  font: 20px/1 system-ui, sans-serif;
  pointer-events: none;
}

.gallery figure > a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -5px;
}

body:has(.gallery-viewer[open]) {
  overflow: hidden;
}

.gallery-viewer {
  width: min(94vw, 1100px);
  height: min(90dvh, 850px);
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #172c25;
  color: #fff;
}

.gallery-viewer::backdrop {
  background: rgb(9 18 14 / 85%);
}

.gallery-viewer[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.gallery-viewer-bar,
.gallery-viewer-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
}

.gallery-viewer-bar {
  justify-content: space-between;
}

.gallery-viewer-title {
  margin: 0;
  color: inherit;
  font: 600 14px/1.4 Montserrat, Arial, sans-serif;
}

.gallery-viewer-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: pan-y pinch-zoom;
}

.gallery-viewer-controls {
  justify-content: center;
}

.gallery-viewer-controls p {
  min-width: 0;
  margin: 0;
  color: inherit;
  text-align: center;
  line-height: 1.35;
}

.gallery-viewer-counter {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #dadfd8;
  font-variant-numeric: tabular-nums;
}

.gallery-viewer button {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #aab6ac;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font: 25px/1 system-ui, sans-serif;
  cursor: pointer;
}

.gallery-viewer button:hover,
.gallery-viewer button:focus-visible {
  background: #f8f6f1;
  color: #172c25;
}

@media (max-width: 600px) {
  .gallery-viewer-bar,
  .gallery-viewer-controls {
    padding-inline: 10px;
  }
}
