.slideshow-thumbnail {
  display: block;
  position: relative;
}

.slideshow-thumbnail > img {
  display: block;
  width: 100%;
  height: auto;
  box-sizing: border-box;
}

.slideshow + .slideshow > .slideshow-thumbnail {
  margin-top: 1.5rem;
}

.slideshow-icon {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0.4rem;
  border-radius: 6px;
  color: #0c408e;
  background: #fff;
  box-shadow: 0 1px 5px #0003;
  pointer-events: none;
}

.slideshow-thumbnail:is(:hover, :focus-visible) .slideshow-icon {
  color: #fff;
  background: #0c408e;
}

.media-dialog {
  width: min(960px, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  box-sizing: border-box;
  padding: 1rem;
  border: 0;
  border-radius: 8px;
  color: #333;
  background: #fff;
  box-shadow: 0 1rem 4rem #0005;
}

.media-dialog::backdrop {
  background: #0009;
}

.media-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.media-dialog-header h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
}

.media-dialog-header form {
  flex-shrink: 0;
}

.slideshow-viewer {
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.slideshow-viewer > img {
  width: 100%;
  height: auto;
  max-height: calc(100dvh - 13rem);
  object-fit: contain;
}

.slideshow-viewer > img:not([hidden]) {
  display: block;
}

.slideshow-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem;
  border-top: 1px solid #ddd;
}

.slideshow-controls button {
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fafafa;
  color: #0c408e;
  font: inherit;
  cursor: pointer;
}

.media-dialog-header button {
  border: 0;
  background: none;
  padding: 0.5rem;
  font: inherit;
  cursor: pointer;
}

.slideshow-controls button:disabled {
  color: #777;
  cursor: default;
}

.photo-thumbnail {
  display: block;
  cursor: zoom-in;
}

.photo-dialog > :is(img, video):not([hidden]) {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 9rem);
  margin: 0 auto;
}
