/* Shared by the crop editor and public Memories views. Keep the image out of
   grid track sizing: its intrinsic height must never enlarge a square frame. */
.gallery-photo-fit-surface {
  position: relative;
  overflow: hidden;
  background: #000;
}

.gallery-photo-fit-surface > img[data-gallery-crop-zoom] {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: var(--crop-x, 50%) var(--crop-y, 50%);
  transform: scale(var(--crop-render-scale, var(--crop-zoom, 1)));
  transform-origin: var(--crop-x, 50%) var(--crop-y, 50%);
}

.gallery-photo-fit-surface > img[hidden] {
  display: none;
}
