/* APD 266.0.0 — final mobile authentication surface. */

html.apd266-auth-open,
html.apd266-auth-open body,
body.apd266-auth-open {
    overflow:hidden !important;
    overscroll-behavior:none !important;
}

/* The nonfunctional arrow was removed from the template. This defensive rule
   also hides stale cached markup during rolling deployment. */
body #apd5-auth-modal #apd54-auth-back,
body #apd5-auth-modal .apd54-auth-back {
    display:none !important;
    visibility:hidden !important;
    pointer-events:none !important;
}

@media (max-width:767px) {
    html body #apd5-auth-modal.apd5-auth-modal {
        position:fixed !important;
        inset:auto 0 auto 0 !important;
        top:var(--apd-auth-visible-top,0px) !important;
        width:100vw !important;
        height:var(--apd-auth-visible-height,100dvh) !important;
        min-height:0 !important;
        max-height:none !important;
        z-index:2147483000 !important;
        isolation:isolate !important;
        overflow:hidden !important;
        overscroll-behavior:none !important;
    }

    html body #apd5-auth-modal[hidden] {
        display:none !important;
    }

    html body #apd5-auth-modal .apd5-auth-close {
        position:absolute !important;
        top:16px !important;
        right:18px !important;
        z-index:12 !important;
    }

    /* A focused auth field always receives an opaque viewport-sized surface.
       This deliberately does not depend on a fragile keyboard-height guess. */
    html body #apd5-auth-modal.is-keyboard-open,
    html body #apd5-auth-modal.apd266-auth-surface.is-keyboard-open {
        align-items:stretch !important;
        justify-content:stretch !important;
        padding:0 !important;
        background:#fff !important;
    }

    html body #apd5-auth-modal.is-keyboard-open::before {
        content:"";
        position:absolute;
        inset:0;
        z-index:0;
        background:#fff;
        pointer-events:none;
    }

    html body #apd5-auth-modal.is-keyboard-open .apd54-auth-dialog,
    html body #apd5-auth-modal.is-keyboard-open .apd5-auth-dialog,
    html body #apd5-auth-modal.is-keyboard-open.is-host-mode .apd5-auth-dialog {
        position:relative !important;
        z-index:2 !important;
        inset:auto !important;
        width:100% !important;
        min-width:0 !important;
        max-width:none !important;
        height:100% !important;
        min-height:100% !important;
        max-height:100% !important;
        margin:0 !important;
        padding:58px 24px calc(20px + env(safe-area-inset-bottom,0px)) !important;
        border:0 !important;
        border-radius:0 !important;
        background:#fff !important;
        box-shadow:none !important;
        overflow-x:hidden !important;
        overflow-y:auto !important;
        overscroll-behavior:contain !important;
        -webkit-overflow-scrolling:touch !important;
    }

    /* Preserve the complete APD login hierarchy while the keyboard is open.
       Older layers hid the logo/title and made the sheet appear broken. */
    html body #apd5-auth-modal.is-keyboard-open .apd54-auth-brand,
    html body #apd5-auth-modal.is-keyboard-open .apd5-auth-brand {
        display:flex !important;
        min-height:42px !important;
        margin:0 auto 12px !important;
    }

    html body #apd5-auth-modal.is-keyboard-open .apd54-auth-dialog > h2,
    html body #apd5-auth-modal.is-keyboard-open .apd5-auth-dialog > h2 {
        display:block !important;
        margin:0 auto 22px !important;
        font-size:clamp(27px,7.2vw,34px) !important;
        line-height:1.08 !important;
    }

    html body #apd5-auth-modal.is-keyboard-open #apd5-auth-identifier-form,
    html body #apd5-auth-modal.is-keyboard-open .apd5-auth-step:not(#apd5-auth-identifier-form) {
        margin-top:0 !important;
    }

    html body #apd5-auth-modal.is-keyboard-open .apd5-auth-divider {
        display:block !important;
    }

    html body #apd5-auth-modal.is-keyboard-open .apd5-auth-socials {
        display:grid !important;
    }

    html body #apd5-auth-modal.is-keyboard-open .apd5-auth-close {
        position:absolute !important;
        top:12px !important;
        right:16px !important;
    }
}
