/* Preserve the complete photo in upload, history and review thumbnails. */
.preview-tile img,
.review-thumb img,
.record-image-stack img,
.detail-gallery img {
  object-fit: contain;
  object-position: center;
  background: var(--surface-3, #edf2f7);
}

/* A bounded flex layout reserves space for the title, zoom and close controls. */
.modal-card.image-lightbox-modal {
  box-sizing: border-box;
  width: min(920px, 100%);
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  max-height: 880px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.image-lightbox-modal > .modal-head,
.image-lightbox-modal > .modal-actions {
  flex: 0 0 auto;
  padding: 10px 14px;
}
.image-lightbox-modal .modal-head h2 { margin: 3px 0 0; font-size: 18px; }
.image-lightbox-modal > .modal-body {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px 0;
  overflow: hidden;
}
.image-lightbox-modal .image-lightbox-viewer {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  background: #07101d;
  border-radius: 10px;
}
.image-lightbox-modal img.image-lightbox {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  flex: 0 0 auto;
  object-fit: contain;
}
.image-lightbox-modal .image-lightbox-zoom-controls {
  position: static;
  flex: 0 0 auto;
  align-self: center;
}
.image-lightbox-modal .image-lightbox-hint {
  flex: 0 0 auto;
  margin: 0;
  line-height: 1.3;
}
@media (max-height: 480px) {
  .image-lightbox-modal .modal-head .section-eyebrow,
  .image-lightbox-modal .image-lightbox-hint { display: none; }
  .image-lightbox-modal > .modal-head,
  .image-lightbox-modal > .modal-actions { padding-top: 5px; padding-bottom: 5px; }
}
