.supplied-gallery .gallery-thumbnail {
  position: relative;
  cursor: zoom-in;
}

.gallery-enlarge {
  position: absolute;
  right: .6rem;
  bottom: .6rem;
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid #ffffff60;
  border-radius: 50%;
  background: #0b2e40eb;
  color: white;
  font-size: 1.25rem;
  line-height: 1;
  pointer-events: none;
}

.supplied-gallery figcaption a:hover,
.supplied-gallery figcaption a:focus-visible {
  text-decoration: underline;
  text-underline-offset: .2em;
}

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

.gallery-viewer {
  inset: 0;
  width: min(calc(100% - 2rem), 72rem);
  height: min(calc(100vh - 2rem), 54rem);
  height: min(calc(100dvh - 2rem), 54rem);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #ffffff28;
  border-radius: .85rem;
  background: #0b202d;
  color: white;
}

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

.gallery-viewer::backdrop {
  background: #071823e8;
}

.gallery-viewer-top,
.gallery-viewer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .5rem 1rem;
}

.gallery-viewer-top {
  border-bottom: 1px solid #ffffff28;
  font-weight: 650;
}

.gallery-viewer button {
  min-width: 44px;
  min-height: 44px;
  padding: .45rem .85rem;
  border: 1px solid #ffffff45;
  border-radius: .35rem;
  background: #183747;
  color: white;
  font-size: .875rem;
  font-weight: 650;
}

.gallery-viewer button:hover {
  background: #244859;
}

.gallery-viewer button:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.gallery-viewer .gallery-viewer-close {
  padding: 0;
  font-size: 1.55rem;
  line-height: 1;
}

.gallery-viewer-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  margin: 0;
  padding: .75rem .75rem 0;
}

.gallery-viewer-media {
  min-height: 0;
  min-width: 0;
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

.gallery-viewer-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-viewer-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .15rem .75rem;
  padding: .55rem .25rem;
  font-size: .875rem;
  font-weight: 600;
}

.gallery-viewer-count {
  color: #c4d6de;
  white-space: nowrap;
}

.gallery-viewer-controls {
  border-top: 1px solid #ffffff28;
}

@media (max-width: 640px) {
  .gallery-viewer {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .gallery-viewer-top {
    padding-top: max(.5rem, env(safe-area-inset-top));
  }

  .gallery-viewer-controls {
    padding-bottom: max(.65rem, env(safe-area-inset-bottom));
  }
}
