/**
 * wp-login.php, wearing the same clothes as /login/.
 *
 * ⚠️ THIS FILE CANNOT REUSE THE THEME'S STYLESHEETS. wp-login.php is not a
 * template - it never calls get_header(), it enqueues nothing the theme
 * registers, and style.css and the-schoolmate.css are simply not there. That is
 * why the page looked like stock WordPress while /login/ two URLs away looked
 * like the product. Everything it needs has to be in here.
 *
 * Most people never see this page: a plain GET of wp-login.php is redirected to
 * /login/. What is left are the screens that have no themed equivalent - lost
 * password, the reset link out of the email, the "check your email" notice, and
 * the interim-login modal when a session expires inside wp-admin. Someone can
 * land on any of them, so they should not look like a different product.
 */

body.login {
    /* Relative to this file, which is in /css/. */
    background: #5b3fbf url(../img/login-bg.jpg) center / cover no-repeat;
    font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
}

#login {
    width: 350px;
    max-width: 100%;
    padding: 8% 0 0;
}

/* The brand mark, in place of the WordPress one. */
#login h1 a,
.login h1 a {
    background-image: url(../img/brand-logo.png);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    width: 170px;
    height: 67px;
    margin: 0 auto 22px;
    padding: 0;
}

.login form {
    margin-top: 0;
    padding: 24px;
    border: 0;
    border-radius: 4px;
    box-shadow: 0 5px 49px 0 rgba(0, 0, 0, 0.5);
}

.login form label,
.login label {
    color: #444444;
    font-size: 15px;
    font-weight: 500;
}

.login input[type="text"],
.login input[type="password"],
.login input[type="email"] {
    height: 50px;
    padding: 5px 20px;
    border: 1px solid #c2c2c2;
    border-radius: 4px;
    background: transparent;
    box-shadow: none;
    font-size: 14px;
}

.login input[type="text"]:focus,
.login input[type="password"]:focus,
.login input[type="email"]:focus {
    border-color: #0f3695;
    box-shadow: none;
}

/* The theme's own button, gradient and all. */
.login .button-primary,
.wp-core-ui .button-primary {
    float: none;
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 4px;
    background: linear-gradient(to top, #0f3695, #4496c8);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    text-shadow: none;
    box-shadow: none;
}

.login .button-primary:hover,
.wp-core-ui .button-primary:hover,
.login .button-primary:focus,
.wp-core-ui .button-primary:focus {
    background: linear-gradient(to top, #4496c8, #0f3695);
    color: #ffffff;
    box-shadow: none;
}

.login .submit {
    text-align: center;
}

/* Links sit on the wallpaper, not on the card. */
.login #backtoblog a,
.login #nav a {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.login #backtoblog a:hover,
.login #nav a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.login .message,
.login .notice,
.login #login_error {
    border-radius: 4px;
    border-left-width: 4px;
    font-size: 14px;
}

/* ---------------------------------------------------------------------------
   ON A PHONE - the same sheet /login/ uses.

   No card floating on a background: the form is already the size of the screen,
   so the panel would only take width away and draw a shadow onto a wall nobody
   can see.
   ------------------------------------------------------------------------ */

@media only screen and (max-width: 767.98px) {
    body.login {
        background: #ffffff;
        min-height: 100vh;
        min-height: 100dvh;
    }

    /*
     * ⚠️ border-box, OR THE PADDING IS ADDED TO THE WIDTH. #login is content-box
     * in WordPress's own login.min.css, so `width: 100%` plus 20px of padding on
     * each side came to 415px inside a 375px screen - the field and the button
     * ran 40px off the right-hand edge and the page scrolled sideways. The whole
     * point of this block is that nothing hangs off the side of a phone.
     */
    #login {
        box-sizing: border-box;
        width: 100%;
        padding:
            calc(36px + env(safe-area-inset-top)) 20px
            calc(24px + env(safe-area-inset-bottom));
    }

    #login h1 a,
    .login h1 a {
        width: 200px;
        height: 79px;
        margin-bottom: 28px;
    }

    .login form {
        padding: 0;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }

    .login input[type="text"],
    .login input[type="password"],
    .login input[type="email"] {
        height: 56px;
    }

    .login .button-primary,
    .wp-core-ui .button-primary {
        height: 56px;
        font-size: 17px;
    }

    /* The wallpaper is gone, so these have to be readable on white. */
    .login #backtoblog a,
    .login #nav a {
        color: #0f3695;
        text-shadow: none;
    }
}

/* ---------------------------------------------------------------------------
   ⚠️ AND THE SAME 16px, FOR THE SAME REASON AS /login/.

   iOS Safari zooms the whole page in when a field with a computed font-size
   below 16px takes focus. WordPress ships these at 20px on the login screen but
   drops them to 14px under 782px - exactly where it matters - so without this a
   reader resetting their password gets the zoom that /login/ no longer gives
   them. Said in both queries, because either one alone is a single point of
   failure for the thing most complained about.
   ------------------------------------------------------------------------ */

@media only screen and (max-width: 767.98px) {
    .login input[type="text"],
    .login input[type="password"],
    .login input[type="email"] {
        font-size: 16px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .login input[type="text"],
    .login input[type="password"],
    .login input[type="email"] {
        font-size: 16px;
    }

    /* WordPress's own show-password button, given a thumb-sized target. */
    .login .wp-hide-pw {
        min-width: 44px;
        min-height: 44px;
    }
}
