/* Login and signup share one viewport: header, full-bleed photo, footer.
   The white card stays inside the photo. Long forms scroll inside the card. */

body.pagelayout-login {
    overflow: hidden !important;
}

body.pagelayout-login #page-wrapper.union-login-page {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    max-height: 100vh;
    max-height: 100dvh;
    display: flex !important;
    flex-direction: column;
    overflow: hidden !important;
}

body.pagelayout-login #page-wrapper.union-login-page > #page,
body.pagelayout-login #page,
body.pagelayout-login #page-content,
body.pagelayout-login #page-content.row,
body.pagelayout-login #region-main-box,
body.pagelayout-login #region-main {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
    width: 100% !important;
}

body.pagelayout-login .union-login-topbar,
body.pagelayout-login .union-login-footerband {
    flex: 0 0 auto;
}

body.pagelayout-login .union-login-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    background: transparent !important;
    padding: 0 !important;
    overflow: hidden;
}

body.pagelayout-login .union-login-image-stage {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto !important;
    width: 100%;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 24px 16px !important;
    box-sizing: border-box;
    overflow: hidden;
}

body.pagelayout-login .union-login-center {
    position: relative;
    width: min(500px, calc(100% - 24px));
    max-height: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 auto;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
    box-sizing: border-box;
}

body.pagelayout-login .union-login-center::before,
body.pagelayout-login .union-login-center::after {
    top: 0 !important;
    bottom: 0 !important;
    height: auto !important;
}

body.pagelayout-login .union-login-center-inner {
    width: 100%;
    min-height: 0 !important;
    max-height: 100% !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box;
}

body.pagelayout-login .union-login-title,
body.pagelayout-login .union-login-subtitle {
    flex: 0 0 auto;
}

body.pagelayout-login .union-login-form-wrap {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #005b97 transparent;
    padding-top: 18px;
    padding-right: 4px;
    padding-bottom: 8px;
    text-align: left;
}

body.pagelayout-login .union-login-form-wrap::-webkit-scrollbar {
    width: 6px;
}

body.pagelayout-login .union-login-form-wrap::-webkit-scrollbar-thumb {
    background: #005b97;
}

body.pagelayout-login .union-login-footerband {
    position: relative;
    z-index: 1;
    margin-top: 0;
}

/* Create account is wider. These selectors match the theme custom CSS,
   which pins the card and hides the overflow. */
body#page-login-signup .union-login-center {
    width: min(640px, calc(100% - 32px)) !important;
    max-width: 640px !important;
    min-height: 0 !important;
    max-height: 100% !important;
    height: auto !important;
    padding: 28px 40px 18px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    overflow: hidden !important;
}

body#page-login-signup .union-login-center-inner {
    max-width: none !important;
    width: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

body#page-login-signup .union-login-form-wrap {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

body#page-login-signup .signupform {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
    margin: 0 !important;
}

body#page-login-signup #fitem_id_email2 {
    display: none !important;
}

@media (max-width: 768px) {
    body.pagelayout-login .union-login-image-stage {
        min-height: 0 !important;
        padding: 16px 12px !important;
    }

    body.pagelayout-login .union-login-center,
    body#page-login-signup .union-login-center {
        width: calc(100% - 8px) !important;
        max-width: none !important;
        padding: 22px 16px 14px !important;
    }
}
