.image-rotation-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: .5rem;
  padding: .5rem;
  border-bottom: 1px solid #dee2e6;
}
.image-rotation-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 50%;
  font-size: 1.125rem;
  color: #000;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.image-rotation-button:hover { background: #f0f3f6; }
.image-download-button {
  margin-left: auto;
  text-decoration: none;
  flex-shrink: 0;
}
.image-download-button:hover { color: #000; }
.image-rotation-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.image-rotation-stage {
  position: relative;
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
  overflow: hidden;
}

.image-rotation-rotor {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: center;
}
.image-rotation-rotor > img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain;
}
.image-rotation-tools[hidden], .image-rotation-stage[hidden] {
  display: none !important;
}

/* One consistent image viewer shared by every page. */
#globalImageViewerModal .modal-dialog {
  max-width: min(1140px, calc(100vw - 1rem));
}
#globalImageViewerModal .modal-content {
  overflow: hidden;
  border: 0;
  border-radius: .75rem;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, .28);
}
#globalImageViewerModal .modal-header {
  justify-content: flex-start;
  gap: 1rem;
  padding: .5rem 1rem;
}
#globalImageViewerModal .modal-header .btn-close {
  flex-shrink: 0;
  margin: 0;
}
#globalImageViewerModal .modal-body {
  min-height: 120px;
  overflow: hidden;
}
#globalImageViewerImage {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}
#globalImageViewerModal .image-rotation-stage.is-zoomed {
  touch-action: none;
  user-select: none;
}
#globalImageViewerModal .image-rotation-stage.is-panning,
#globalImageViewerModal .image-rotation-stage.is-panning img {
  cursor: grabbing;
}
#globalImageViewerModal .image-rotation-tools {
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
  padding: 0;
  border-bottom: 0;
}
#globalImageViewerModal .image-download-button {
  margin-left: auto;
}
#globalImageViewerCaption {
  width: 100%;
  max-width: 100%;
  padding: .75rem 1rem;
  font-size: 1.125rem;
  line-height: 1.6;
  color: #212529;
  background: #f8f9fa;
  border-radius: .375rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
  #globalImageViewerModal .modal-dialog {
    margin: .5rem;
  }
}
