.gallery {
  max-width: 690px;
}

.gallery-figure {
  margin: 0;
}

.gallery-stage {
  display: grid;
  place-items: center;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  box-sizing: border-box;
  width: calc(100% - 10px);
  max-width: 680px;
  aspect-ratio: 680 / 308;
  margin: 0 5px;
  padding: 0;
  border: 0;
  background: #000;
  cursor: zoom-in;
}

.gallery-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-caption {
  min-height: 40px;
  margin: 7px 0 8px;
  line-height: 18px;
  white-space: pre-line;
}

.gallery-thumbs {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 3px 5px 7px;
  scrollbar-width: thin;
}

.gallery-thumb {
  flex: 0 0 50px;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
}

.gallery-thumb img {
  display: block;
  width: 50px;
  height: 50px;
  object-fit: cover;
}

.gallery-thumb[aria-current="true"] {
  outline: 1px solid #242424;
}

.gallery button:focus-visible {
  outline: 2px solid #496589;
  outline-offset: 2px;
}

.gallery-lightbox {
  box-sizing: border-box;
  width: max-content;
  max-width: 96vw;
  max-height: 96vh;
  padding: 12px;
  border: 0;
  background: #111;
  color: #fff;
}

.gallery-lightbox::backdrop {
  background: #000c;
}

.gallery-lightbox img {
  display: block;
  width: min(85vw, 1000px);
  height: min(76vh, 700px);
  object-fit: contain;
}

.gallery-lightbox-controls {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.gallery-lightbox-controls button {
  padding: 4px 8px;
  cursor: pointer;
}
