html.media-viewer-open,
html.media-viewer-open body {
  overflow: hidden;
}

.media-viewer {
  --viewer-height: min(92dvh, 900px);
  width: min(92vw, 1200px);
  max-width: min(92vw, 1200px);
  max-height: var(--viewer-height);
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #f7f8f1;
  color: #29372b;
  overflow: auto;
}

.media-viewer[open] {
  animation: media-viewer-in .18s ease both;
}

.media-viewer::backdrop {
  background: rgb(20 27 21 / .72);
}

.media-viewer[open]::backdrop {
  animation: media-viewer-backdrop-in .18s ease both;
}

@keyframes media-viewer-in {
  from { opacity: 0; transform: scale(.97); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes media-viewer-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.media-viewer-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  max-height: var(--viewer-height);
  padding: 72px 24px 24px;
}

.media-viewer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #cdd2c5;
  border-radius: 4px;
  background: #f7f8f1;
  color: #29372b;
  font: inherit;
  cursor: pointer;
}

.media-viewer-close:hover {
  background: #e7ecdf;
}

.media-viewer-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  gap: 12px;
  max-width: 100%;

  margin: 0;
}

.media-viewer-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: max(80px, calc(var(--viewer-height) - 180px));
  object-fit: contain;
}

.media-viewer-caption {
  max-width: min(85vw, 900px);
  margin: 0;

  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.video-link[hidden] {
  display: none;
}

button.video-link {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .media-viewer[open],
  .media-viewer[open]::backdrop {
    animation: none;
  }
}

@media (max-width: 600px) {
  .media-viewer-panel {
    padding: 64px 16px 16px;
  }

}

