/*
 * Display real estate images without cropping.
 *
 * Notices embedded near an image edge must remain visible in property cards,
 * detail galleries, project pages, and the full-screen lightbox.
 */

/* Property cards used on the home, purchase, portfolio, and category pages. */
.wp-theme-immo .real-estates article figure {
    position: relative;
    width: 100%;
    max-height: none !important;
    /* Match the theme's 700x500 card format without cropping the source. */
    aspect-ratio: 7 / 5;
    overflow: hidden;
    background: #f0f0f0;
}

.wp-theme-immo .real-estates article figure > img,
.wp-theme-immo .real-estates article figure > picture,
.wp-theme-immo .real-estates article figure > picture > img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center center !important;
}

/* Image slider on real estate detail pages. */
.wp-theme-immo.single-im_real_estate .im-gallery #im-gallery > a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f0f0f0;
}

.wp-theme-immo.single-im_real_estate .im-gallery #im-gallery > a > img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain !important;
    object-position: center center !important;
}

/*
 * Keep SimpleLightbox within the visible viewport while preserving the
 * original aspect ratio. The !important declarations intentionally override
 * the dimensions written as inline styles by the lightbox script.
 */
.wp-theme-immo .sl-wrapper .sl-image {
    position: fixed !important;
    top: 2rem !important;
    left: 2.5rem !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: calc(100vw - 5rem) !important;
    height: calc(100vh - 4rem) !important;
    height: calc(100dvh - 4rem) !important;
    margin: 0 !important;
    transform: none !important;
}

.wp-theme-immo .sl-wrapper .sl-image > img {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
}

/* Project pages for Senne, Heepen, Amerkamp, and related page templates. */
.wp-theme-immo[class*="page-template-page-"] .img-responsive,
.wp-theme-immo[class*="page-template-page-"] .image_gallery img,
.wp-theme-immo[class*="page-template-page-"] .image_flex img,
.wp-theme-immo[class*="page-template-page-"] .planimage img {
    display: block;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center center !important;
}

/* Reserve additional space for the close control on narrow viewports. */
@media (max-width: 599px) {
    .wp-theme-immo .sl-wrapper .sl-image {
        top: 3rem !important;
        left: 1rem !important;
        width: calc(100vw - 2rem) !important;
        height: calc(100vh - 6rem) !important;
        height: calc(100dvh - 6rem) !important;
    }
}
