/*
 * Uncropped photo presentation.
 * Real archive photos keep their natural aspect ratio everywhere.
 * Avatar/profile circles are intentionally NOT targeted here.
 */

.gallery-card-visual,
.media-library-thumb,
.linked-photo-thumb,
.profile-gallery-thumb {
    aspect-ratio: auto !important;
    height: auto !important;
    min-height: 0 !important;
}

.gallery-card-visual img,
.media-library-thumb img,
.linked-photo-thumb img,
.profile-gallery-thumb img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center !important;
}

.media-import-preview {
    min-height: 0 !important;
    height: auto !important;
    display: grid !important;
    place-items: center !important;
}

.media-import-preview img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center !important;
}

/* The identification preview is a workspace panel, so keep its frame,
   but force the actual photo to fit fully inside it. */
.identify-preview img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
}

/* Gallery lightbox: use the exact available stage size and fit inside it. */
.gallery-lightbox-stage,
.gallery-lightbox-visual {
    min-width: 0 !important;
    min-height: 0 !important;
}

.gallery-lightbox-visual {
    overflow: hidden !important;
}

.gallery-lightbox-visual img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
}

/* Main-page profile lightbox: same rule as the gallery lightbox.
   The old natural-size image could exceed the middle grid row and be clipped
   by the footer. Constrain both the stage and image wrapper, then let contain
   fit the whole photo into the available rectangle. */
.photo-lightbox-stage,
.photo-lightbox-image-wrap {
    min-width: 0 !important;
    min-height: 0 !important;
}

.photo-lightbox-image-wrap {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}

.photo-lightbox-image-wrap img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
}
