/* One photo frame across the catalogue; source files and album order stay intact. */
body .product-card .product-image-wrapper {
    position: relative;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden;
    background: #fff;
}
body .product-card .product-image-wrapper > .card-gallery {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100% !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    background: inherit;
}
body .product-card .card-gallery-stage {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
body .product-card .product-image-wrapper > img,
body .product-card .card-gallery-stage > img,
body .product-card .card-gallery-stage > video {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    object-position: center !important;
    padding: 0 !important;
    transform: none !important;
}
body .product-card .product-image-wrapper > img {
    position: absolute;
    inset: 0;
}
/* The large photo keeps the same square geometry when changing gallery slides. */
body .product-modal-gallery,
body .product-modal-info {
    min-width: 0;
    max-width: 100%;
}
body .product-modal-gallery .product-modal-thumbs {
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
}
body .product-modal-gallery .product-modal-main {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none;
    aspect-ratio: 1 / 1;
    background: #fff;
    overflow: hidden;
}
body .product-modal-main > img,
body .product-modal-main > video {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain !important;
    object-position: center !important;
    padding: 0 !important;
    transform: none !important;
}
body .product-modal-main > [hidden] { display: none !important; }
body .product-modal-main > :is(img, video):not([hidden]) { display: block; }
body .product-modal-gallery .product-modal-thumb {
    box-sizing: border-box;
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    padding: 0 !important;
    background: #fff;
}
body .product-modal-thumb > img,
body .product-modal-thumb > video {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain !important;
    object-position: center !important;
    padding: 0 !important;
    transform: none !important;
}
/* Real used-device photos retain their original background and full frame. */
body .product-card-used .product-image-wrapper,
body .product-card-used .card-gallery,
body .product-card-used .product-modal-main,
body .product-card-used .product-modal-thumb { background: #212121; }
/* Compact product photos use the same uncropped square format. */
body .search-result-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    object-position: center;
}
body .cart-item-image { width: 100%; aspect-ratio: 1 / 1; }
body .cart-item-image img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    object-position: center;
}
/* Cover illustrations already have their own layout; never fill-crop them. */
body .catalog-card-media img,
body .series-image img { object-fit: contain; object-position: center; }
