/* Queensirikit.Web Phase 04.5 - Detail cover and CMS list-image hotfix.
   Rules target public CMS pages only, leaving Designer CSS, home and gallery alone.
   Detail: never upscale an image, cap at 900 CSS px, preserve natural aspect ratio.
   List: fixed-ratio box, center crop (NO image stretching). */

/* Shared detail for news-highlight, news-central, announcement, crematory,
   royal-procession, journey, infographic and vocabulary.
   The Designer previously forces image width: 100%, which upscaled tiny covers. */
.content .body .info-body .main-image {
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
.content .body .info-body .main-image > img {
    display: block;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    margin-left: auto;
    margin-right: auto;
    object-fit: contain;
}

/* Calendar event detail uses figure.qs-cal-cover rather than .main-image.
   Override its existing max-height: 720px (otherwise portrait covers shrink). */
.content .body .qs-calendar.qs-cal-detail figure.qs-cal-cover {
    width: 100%;
    max-width: 900px;
    margin: 0 auto 22px;
    text-align: center;
}
.content .body .qs-calendar.qs-cal-detail figure.qs-cal-cover > img {
    display: block;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    margin-left: auto;
    margin-right: auto;
    object-fit: contain;
}

/* CMS list-card thumbnails only, not galleries, detail body pictures or Home.
   Restrict to the direct cards of PublicCmsContentList's main .info-body > .row. */
.content .body .info-body > .row > [class*="col-"] > a > .image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #f2f4f4;
}
.content .body .info-body > .row > [class*="col-"] > a > .image > img.equal-height {
    display: block;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center;
}
.content .body .info-body > .row > [class*="col-"] > a > .image > .qs-cms-no-image,
.content .body .info-body > .row > [class*="col-"] > a > .image > .qs-video-card-tiktok-preview {
    width: 100%;
    height: 100%;
    min-height: 0;
    aspect-ratio: auto;
}

/* Print with native dimensions; never crop cover images. */
@media print {
    .content .body .info-body .main-image > img,
    .content .body .qs-calendar.qs-cal-detail figure.qs-cal-cover > img {
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }
}
