/*
 * Optional mobile image support for Page Hero.
 * The modifier is only added when "Show Image on Mobile" is enabled.
 */

.page-hero__mobile-image-wrapper {
    display: none;
}

@media (max-width: 640px) {
    .page-hero._show-mobile-image {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        overflow: hidden;
        border-radius: var(--size-1, 1rem);
        background: var(--page-hero-mobile-background, transparent);
    }

    /*
     * The desktop background image remains disabled on mobile.
     */
    .page-hero._show-mobile-image .page-hero__background-wrapper {
        background: var(--page-hero-mobile-background, transparent) !important;
    }

    .page-hero._show-mobile-image .page-hero__background-image {
        display: none !important;
    }

    /*
     * Keep the text content first.
     */
    .page-hero._show-mobile-image .page-hero__main {
        position: relative;
        z-index: 2;
        order: 1;
        width: 100%;
        max-width: none;
        margin: 0;
    }

    .page-hero._show-mobile-image .page-hero__content {
        padding-top: 4.5rem;
        padding-bottom: 1.25rem;
        padding-left: 1em;
    }

    /*
     * Show the mobile image after the text content.
     */
    .page-hero._show-mobile-image .page-hero__mobile-image-wrapper {
        position: relative;
        z-index: 1;
        order: 2;
        display: flex;
        width: 100%;
        min-height: clamp(18rem, 92vw, 28rem);
        align-items: flex-end;
        justify-content: center;
        padding: 0;
        overflow: hidden;
        background: var(--page-hero-mobile-background, transparent);
    }

    .page-hero._show-mobile-image .page-hero__mobile-image {
        display: block;
        width: 100%;
        height: clamp(18rem, 92vw, 28rem);
        object-fit: contain;
        object-position: center bottom;
    }
}

@media (max-width: 380px) {
    .page-hero._show-mobile-image .page-hero__content {
        padding-top: 1.25rem;
        padding-bottom: 1rem;
    }

    .page-hero._show-mobile-image .page-hero__mobile-image-wrapper,
    .page-hero._show-mobile-image .page-hero__mobile-image {
        min-height: 17rem;
        height: 17rem;
    }
}