/**
 * Shared content-media system.
 *
 * Use the utility classes in page templates instead of repeating image sizing,
 * padding and object-fit rules in every page stylesheet.
 *
 * .ahm-media-frame                Base image-only frame.
 * .ahm-media-frame--4x3           Stable 4:3 card/media area.
 * .ahm-media-frame--natural       Follow the source image's intrinsic ratio.
 * .ahm-media-frame--contain       Show the complete image without cropping.
 * .ahm-media-frame--cover         Fill the frame and allow controlled cropping.
 * .ahm-media-caption-card         Figure with a full-width image and caption.
 */


/* Match the WordPress Core safeguard for lazy images using sizes="auto". */
img:is([sizes="auto" i], [sizes^="auto," i]) {
    contain-intrinsic-size: 3000px 1500px;
}

.ahm-media-frame {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    line-height: 0;
}

.ahm-media-frame--4x3 {
    aspect-ratio: 4 / 3;
}

.ahm-media-frame--natural {
    height: auto;
    aspect-ratio: auto;
}

.ahm-media-frame > picture {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    line-height: 0;
}

.ahm-media-frame > img,
.ahm-media-frame > picture > img {
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    object-position: center;
    transform: none;
}

.ahm-media-frame--contain > img,
.ahm-media-frame--contain > picture > img {
    object-fit: contain;
}

.ahm-media-frame--cover > img,
.ahm-media-frame--cover > picture > img {
    object-fit: cover;
}

.ahm-media-frame--natural > picture {
    height: auto;
}

.ahm-media-frame--natural > img,
.ahm-media-frame--natural > picture > img {
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
}

.ahm-media-caption-card > img,
.ahm-media-caption-card > picture > img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    object-fit: cover;
    object-position: center;
    transform: none;
}


/* Homepage Quality and Packaging panels also inherit the older split-media
 * component. Keep these two photo panels full-bleed in this late-loaded file
 * so CSS combining/minification cannot restore the split component padding. */
.site-main .ahm-home-split-media.ahm-home-quality-media.ahm-media-frame,
.site-main .ahm-home-split-media.ahm-home-packaging-media.ahm-media-frame {
    display: block;
    min-height: 0;
    padding: 0;
    aspect-ratio: 4 / 3;
    line-height: 0;
}

.site-main .ahm-home-split-media.ahm-home-quality-media.ahm-media-frame > img,
.site-main .ahm-home-split-media.ahm-home-packaging-media.ahm-media-frame > img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    object-fit: cover;
    object-position: center;
    transform: none;
    filter: none;
}

/* The homepage solution cards use equal 4:3 media panels on both rows. */
.site-main .ahm-home-solution-media.ahm-media-frame {
    min-height: 0;
    padding: 0;
    aspect-ratio: 4 / 3;
}

.site-main .ahm-home-solution-media.ahm-media-frame > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    object-fit: cover;
}

/* Preserve intentional full-bleed photo galleries that are not contain frames. */
:is(
    .ahm-gummy-design-image-wrap,
    .ahm-gummy-stage-media,
    .ahm-powder-process-media,
    .ahm-production-gallery figure > div
) {
    position: relative;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

:is(
    .ahm-gummy-design-image-wrap,
    .ahm-gummy-stage-media,
    .ahm-powder-process-media,
    .ahm-production-gallery figure > div
) > img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    object-fit: cover;
    object-position: center;
}

:is(
    .ahm-capsule-operation-gallery figure > div,
    .ahm-tablet-operation-shot-media
) {
    position: relative;
    min-height: 0;
    overflow: hidden;
}

:is(
    .ahm-capsule-operation-gallery figure > div,
    .ahm-tablet-operation-shot-media
) > img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    object-fit: cover;
    object-position: center;
}

@media (max-width: 767px) {
    .ahm-media-frame,
    .ahm-media-frame > img,
    .ahm-media-frame > picture,
    .ahm-media-frame > picture > img,
    .ahm-media-caption-card > img,
    .ahm-media-caption-card > picture > img {
        min-height: 0;
    }
}

/* About Us media: all photo cards use the same full-bleed 4:3 system.
 * This block loads after the shared navigation Hero rules, so the About Hero
 * cannot fall back to a smaller contained image with exposed card background. */
.site-main .ahm-about-hero-media.ahm-media-frame,
.site-main .ahm-about-image-card.ahm-media-frame {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    aspect-ratio: 4 / 3;
    border-radius: 28px;
    background: #eaf1eb;
    box-shadow: 0 22px 52px rgba(11, 29, 58, .08);
    line-height: 0;
}

.site-main .ahm-about-hero-media.ahm-media-frame {
    border-radius: 32px;
    box-shadow: 0 28px 65px rgba(11, 29, 58, .13);
}

.site-main .ahm-about-hero-media.ahm-media-frame > img,
.site-main .ahm-about-image-card.ahm-media-frame > img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    object-fit: cover;
    object-position: center;
    box-shadow: none;
    filter: none;
    transform: none;
}

.site-main .ahm-about-hero-media.ahm-media-frame .ahm-about-hero-note {
    line-height: 1.45;
}
