/* woi.74p-herocap-mobile (29 Nov 2026): cap very tall ARTICLE FEATURE photos
   on phones only. Tablet (600px+) and desktop are unchanged from live
   (1.0.26-woi.74n2-seq). Image files are not resized. Full photo is shown
   (object-fit: contain), never cropped.
   Funeral notices articles (data-woi-funeral), in-body .kg-image-card
   images, homepage and category cards, ads and the funeral rotator are
   out of scope.
   Rollback: theme 1.0.26-woi.74n2-seq. */

/* Every rule is inside this query so 600px and up receive no styling
   from this file — no cap, no object-fit change, no portrait class. */
@media (max-width: 599px) {
    article:not([data-woi-funeral]) .post-main-image-wrapper-header .post-main-image,
    article:not([data-woi-funeral]) .post-main-image-wrapper-content .post-main-image {
        text-align: center;
        background: #eef2f8;
    }

    article:not([data-woi-funeral]) .post-main-image-wrapper-header .post-main-image figure,
    article:not([data-woi-funeral]) .post-main-image-wrapper-content .post-main-image figure {
        width: 100%;
        height: auto;
        overflow: hidden;
        display: block;
    }

    /* width 100% / height auto follows the source aspect unless the cap
       binds. contain is visually identical to cover when the box matches
       the image (landscapes under 480px), and letterboxes when a portrait
       is capped — full photo, smaller, centred, never cropped.
       480px ceiling: 70svh of an 844px screen is 591px, which would leave
       the current 579px Kiwibank hero almost uncapped. 480px is still
       taller than any landscape feature at this width (~293px for 4:3). */
    article:not([data-woi-funeral]) .post-main-image-wrapper-header .post-main-image img,
    article:not([data-woi-funeral]) .post-main-image-wrapper-content .post-main-image img {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
        margin-inline: auto;
        object-fit: contain;
        object-position: center center;
        max-height: 70vh;
        max-height: 480px;
        max-height: min(70svh, 70vh, 480px);
    }
}
