/*
 * ADVC Homepage Mobile Polish v1.2.1
 * All rules are restricted to the homepage at widths up to 767px.
 * Desktop styling is not changed.
 */

@media screen and (max-width: 767px) {
    /*
     * The mobile hero is now replaced in place. The plugin no longer appends a
     * second image to the desktop visual column, which was what squeezed the
     * hero copy into a narrow strip in v1.1.0.
     */
    body.advc-mobile-polish-enabled .advc-mobile-hero-replaced-host {
        position: relative !important;
        inset: auto !important;
        float: none !important;
        clear: both !important;
        display: block !important;
        grid-column: 1 / -1 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        min-height: 0 !important;
        height: auto !important;
        margin: 0 auto !important;
        padding: 0 !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        background: transparent !important;
        transform: none !important;
    }

    body.advc-mobile-polish-enabled picture.advc-mobile-hero-replaced-host {
        display: block !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-hero-image-replaced {
        position: relative !important;
        inset: auto !important;
        display: block !important;
        float: none !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 auto !important;
        padding: 0 !important;
        object-fit: contain !important;
        object-position: center top !important;
        border: 0 !important;
        box-shadow: none !important;
        transform: none !important;
    }

    /* Fallback only when the original hero is a CSS background rather than an img. */
    body.advc-mobile-polish-enabled .advc-mobile-hero-background-replaced {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        background-position: center top !important;
        background-size: contain !important;
        background-repeat: no-repeat !important;
        transform: none !important;
    }

    /* Defensive cleanup for markup inserted by the superseded v1.1.0 script. */
    body.advc-mobile-polish-enabled .advc-mobile-hero-replacement {
        display: none !important;
    }

    /* Compact cards identified by the script. */
    body.advc-mobile-polish-enabled .advc-mobile-polished-card {
        min-height: 0 !important;
        height: auto !important;
        padding: 20px 20px 22px !important;
        box-sizing: border-box !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-card-head {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto !important;
        align-items: center !important;
        column-gap: 12px !important;
        row-gap: 0 !important;
        width: 100% !important;
        margin: 0 0 12px !important;
        padding: 0 !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-card-head--number-only,
    body.advc-mobile-polish-enabled .advc-mobile-card-head--icon-only {
        grid-template-columns: auto minmax(0, 1fr) !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-card-head--title-only {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-card-icon {
        grid-column: 1 !important;
        grid-row: 1 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        min-height: 52px !important;
        margin: 0 !important;
        padding: 0 !important;
        align-self: center !important;
        transform: none !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-card-icon svg,
    body.advc-mobile-polish-enabled .advc-mobile-card-icon img {
        display: block !important;
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 100% !important;
        margin: 0 !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-card-title {
        grid-column: 2 !important;
        grid-row: 1 !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: clamp(21px, 5.8vw, 27px) !important;
        line-height: 1.16 !important;
        text-wrap: balance;
    }

    body.advc-mobile-polish-enabled .advc-mobile-card-head--title-only .advc-mobile-card-title {
        grid-column: 1 !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-card-number {
        grid-column: 3 !important;
        grid-row: 1 !important;
        align-self: center !important;
        justify-self: end !important;
        margin: 0 !important;
        flex: 0 0 auto !important;
        transform: none !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-card-head--number-only .advc-mobile-card-number {
        grid-column: 1 !important;
        justify-self: start !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-card-head--number-only .advc-mobile-card-title,
    body.advc-mobile-polish-enabled .advc-mobile-card-head--icon-only .advc-mobile-card-title {
        grid-column: 2 !important;
    }

    /* Keep all How coaching works cards visually consistent: no numbered circles. */
    body.advc-mobile-polish-enabled .advc-mobile-process-number-hidden {
        display: none !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-polished-card p {
        margin-top: 0 !important;
        margin-bottom: 14px !important;
        font-size: clamp(17px, 4.4vw, 20px) !important;
        line-height: 1.48 !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-polished-card p:last-of-type {
        margin-bottom: 10px !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-polished-card a,
    body.advc-mobile-polish-enabled .advc-mobile-polished-card [class*="link"],
    body.advc-mobile-polish-enabled .advc-mobile-polished-card [class*="Link"] {
        margin-top: 6px !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-empty-wrapper {
        display: none !important;
    }

    /* About credentials, rebuilt by the script as an even 2 x 2 grid. */
    body.advc-mobile-polish-enabled .advc-mobile-about-tags-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        width: 100% !important;
        margin: 22px 0 0 !important;
        padding: 0 !important;
        align-items: stretch !important;
        box-sizing: border-box !important;
    }

    body.advc-mobile-polish-enabled .advc-mobile-about-tags-grid > * {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 48px !important;
        margin: 0 !important;
        padding: 10px 12px !important;
        text-align: center !important;
        line-height: 1.2 !important;
        white-space: normal !important;
        box-sizing: border-box !important;
    }
}
