/* Authentication presentation only; WordPress retains all form behavior. */
/* Hover/focus blends green from left to right across the solid blue button. */
@property --cem-login-green-edge { syntax: "<percentage>"; inherits: false; initial-value: 0%; }

body.login {
    /* Center the visible stack, not a banner-sized offset. Hidden/blocked ads
       drop out of the grid; tall forms grow the page and remain scrollable. */
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
    justify-items: center;
    align-content: center;
    gap: 24px;
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 24px 0;
    /* Match the new sidebar's slate surface. */
    background: #202b3d;
    isolation: isolate;
    color: #10112b;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Static fallback also serves touch, reduced-motion and script-free browsers. */
body.login::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: radial-gradient(circle, rgb(52 211 153 / 20%) 1px, transparent 1.5px);
    background-size: 36px 36px;
}

body.login.cem-auth-dots-ready::before {
    display: none;
}

body.login .cem-auth-dots {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Core's standalone wp_die document has its own inline card styles. Reset
   that outer body so the shared #login card supplies the same auth layout. */
body.login.cem-error-page#error-page {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 24px 0;
    border: 0;
    background: #202b3d;
    box-shadow: none;
}

body.cem-error-page #login {
    overflow-wrap: anywhere;
}

body.cem-error-page #login :is(h1, h2) {
    margin: 0 0 16px;
    padding: 0;
    border: 0;
    color: #10112b;
    font-size: 22px;
    line-height: 1.3;
}

body.cem-error-page#error-page #login :is(p, .wp-die-message) {
    margin: 0 0 16px;
    color: #46536d;
    font-size: 14px;
    line-height: 1.6;
}

body.cem-error-page #login > :last-child {
    margin-bottom: 0 !important;
}

body.cem-error-page #login :is(pre, table) {
    display: block;
    max-width: 100%;
    overflow: auto;
}

@keyframes cem-login-enter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

body.login #login {
    box-sizing: border-box;
    position: relative;
    isolation: isolate;
    width: min(420px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px;
    border: 1px solid #e2e8f2;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 64px -24px rgb(24 46 90 / 20%), 0 2px 8px rgb(24 46 90 / 3%);
    animation: cem-login-enter .55s ease-out both;
}

body.login #login h1 a {
    width: 240px;
    max-width: 100%;
    background-position: center;
    margin: 0 auto 20px;
}

body.login .ad {
    box-sizing: border-box;
    width: min(560px, calc(100% - 32px)) !important;
    max-width: 560px !important;
    max-height: none;
    margin: 0 auto;
    border: 1px solid #e2e8f2;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

body.login .ad a {
    display: block;
    overflow: hidden;
}

body.login .ad a:focus-visible {
    outline: 2px solid #112ea3 !important;
    outline-offset: -3px;
}

body.login .ad img {
    display: block;
    /* The source artwork includes a square gray border; crop only that edge. */
    width: calc(100% + 4px);
    max-width: none;
    height: auto;
    margin: -2px;
}

.login #login form {
    /* Contain the floated submit controls without clipping external focus rings. */
    display: flow-root;
    overflow: visible;
    margin-top: 20px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.login #login label {
    color: #26364f;
    font-size: 13px;
    line-height: 1.6;
}

.login #login input:is([type="text"], [type="email"], [type="password"]) {
    box-sizing: border-box;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid #d4deef;
    border-radius: 9px;
    background: #fff;
    color: #10112b;
    font-size: 16px;
    line-height: 24px;
    box-shadow: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.login #login .wp-pwd input {
    padding-right: 44px;
}

/* Browser autofill otherwise paints these fields pale blue. Keep the focus outline. */
.login #login input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    box-shadow: 0 0 0 1000px #fff inset !important;
    -webkit-text-fill-color: #10112b;
    caret-color: #10112b;
}

.login #login input:autofill {
    box-shadow: 0 0 0 1000px #fff inset !important;
}

.login #login .wp-hide-pw {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 7px;
    color: #112ea3;
}

.login #login input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin: 0 6px 0 0;
    vertical-align: middle;
    border: 2px solid #d4deef;
    border-radius: 5px;
    background: #fff;
    box-shadow: none;
}

.login #login input[type="checkbox"]:checked {
    background: #112ea3;
    border-color: #112ea3;
}

.login #login input[type="checkbox"]:checked::before {
    content: "";
    display: block;
    box-sizing: border-box;
    width: 6px;
    height: 10px;
    margin: 1px 0 0 5px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.login #login .button:not(.wp-hide-pw) {
    min-height: 38px;
    padding: 8px 16px;
    border: 1px solid #d4deef;
    border-radius: 7px;
    background: #fff;
    color: #112ea3;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    text-shadow: none;
    box-shadow: none;
    white-space: normal;
}

.login #login .button.button-primary {
    border-color: transparent;
    /* A broad, soft transition travels from left to right. */
    background:
        linear-gradient(to right,
            #00a86b calc(var(--cem-login-green-edge) - 80%),
            rgb(0 168 107 / 0%) var(--cem-login-green-edge)),
        #112ea3;
    color: #fff;
    /* Large, bold lettering retains contrast against the brighter brand green. */
    font-size: 19px;
    font-weight: 700;
    line-height: 24px;
    min-height: 44px;
    border-radius: 9px;
    transition: --cem-login-green-edge .4s ease-in-out,
        transform .18s ease, box-shadow .18s ease;
}

.login #login .button.button-primary:not(:disabled):is(:hover, :focus-visible) {
    --cem-login-green-edge: 180%;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgb(0 168 107 / 20%);
}

.login #login .button:disabled {
    opacity: .55;
    cursor: default;
}

.login #login :is(input, button, a):focus-visible {
    outline: 2px solid #112ea3;
    outline-offset: 2px;
    box-shadow: none;
}

.login #login :is(.message, .notice, #login_error) {
    padding: 16px;
    border: 1px solid #d4deef;
    border-left: 4px solid #112ea3;
    border-radius: 10px;
    background: #fff;
    color: #46536d;
    box-shadow: none;
}

.login #login :is(#login_error, .notice-error) {
    border-color: #f0cdd2;
    border-left-color: #c73645;
    background: #fff7f8;
}

.login #login .notice-success {
    border-left-color: #00a86b;
}

.login #login :is(#nav, #backtoblog) {
    padding: 0;
    margin: 16px 0 0;
    font-size: 12px;
    text-align: center;
    line-height: 1.6;
}

.login #login a {
    color: #112ea3;
    overflow-wrap: anywhere;
}

.login #login a:not(.button):not(.btn):not([role="button"]):hover {
    color: #0d2584;
    text-decoration: underline;
}

/* Anchor-based SSO/logout actions should behave like buttons, not text links. */
.login #login :is(.button, .btn, [role="button"]),
.login #login :is(.button, .btn, [role="button"]):is(:hover, :focus, :active) {
    text-decoration: none;
}

/* Give the embedded session-renewal form room without changing its behavior. */
body.login.interim-login {
    gap: 8px;
    padding: 4px 0;
}

body.login.interim-login #login {
    width: min(640px, calc(100% - 32px));
    padding: 20px;
}

body.login.interim-login .ad {
    width: min(420px, calc(100% - 32px)) !important;
}

body.login.interim-login #login h1 a {
    /* Site branding sets a 100px minimum; compact only the iframe. */
    min-height: 0;
    height: 56px;
    background-size: contain;
    margin-bottom: 10px;
}

body.login.interim-login #login :is(.message, .notice, #login_error) {
    padding: 12px;
    margin-bottom: 12px;
}

body.login.interim-login #login form {
    margin-top: 12px;
}

body.login.interim-login #login input:is([type="text"], [type="email"], [type="password"]) {
    margin-bottom: 10px;
}

body.login.interim-login #login .forgetmenot {
    margin-top: 6px;
    margin-bottom: 8px;
}

.login #login :is(.description, .indicator-hint) {
    color: #46536d;
    line-height: 1.6;
}

.login #login #pass-strength-result {
    box-sizing: border-box;
    border-radius: 7px;
}

.login #login .forgetmenot {
    margin: 8px 12px 12px 0;
}

.login #loginform .submit {
    clear: both;
    padding-top: 8px;
    position: relative;
}

.login #loginform .submit .button-primary {
    float: none;
    width: 100%;
}

.login #loginform .submit .button-primary.cem-login-submitting {
    cursor: wait;
    opacity: 1 !important;
    border-color: #008d5a !important;
    background: #00a86b !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    text-shadow: none !important;
}

.login #loginform input.cem-login-locked {
    cursor: wait;
    opacity: 1 !important;
    border-color: #a7aaad !important;
    background: #dcdcde !important;
    color: #50575e !important;
    -webkit-text-fill-color: #50575e !important;
    box-shadow: none !important;
}

.login #login #backtoblog a {
    color: #69758a;
}

.login #login .cem-logout-confirmation h2 {
    margin: 24px 0 12px;
    color: #10112b;
    font-size: 22px;
    line-height: 1.3;
    text-align: center;
}

.login #login .cem-logout-confirmation p {
    margin: 0 0 24px;
    color: #46536d;
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
    overflow-wrap: anywhere;
}

.login #login .cem-logout-confirm {
    display: block;
    float: none;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
}

@media (max-width: 480px) {
    body.login #login {
        margin: 0 auto;
        padding: 24px 20px;
    }

    .login #login form {
        padding: 0;
    }
}

body.login > :is(.privacy-policy-page-link, .language-switcher) {
    color: #edf1f7;
}

body.login > .privacy-policy-page-link a {
    color: #edf1f7;
}

@media (prefers-reduced-motion: reduce) {
    body.login #login,
    .login #login .button.button-primary {
        animation: none;
    }

    .login #login :is(input, .button) {
        transition: none;
    }

    .login #login .button.button-primary:not(:disabled):is(:hover, :focus-visible) {
        transform: none;
    }
}

@media (forced-colors: active) {
    body.login::before,
    body.login .cem-auth-dots {
        display: none;
    }

    body.login #login {
        background: Canvas;
        border-color: CanvasText;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .login #login input[type="checkbox"] {
        appearance: auto;
    }

    .login #login input[type="checkbox"]::before {
        display: none;
    }
}
