/* ==========================================================================
   Login — the Windows XP welcome screen, over WordPress's own wp-login.php
   (reached at /wp-admin/). See inc/login.php.

   Three bands: near-black top and bottom, the charcoal field between, a
   yellow rule above the bottom bar. XP's layout in Harry's palette - the
   Luna blues are gone, as they are from the taskbar. The account tile sits
   centred, the brand runs along the bottom. Loaded after tokens.css.
   ========================================================================== */

:root {
    --xp-band: #161616;
    --xp-band-edge: #2a2a2a;
    --xp-field: #2e2e2e;
    --xp-glow: #4a4a4a;
    --xp-rule: var(--harry-yellow);
    --xp-go: #edff00;
    --xp-go-dark: #cbdc00;

    --xp-band-h: 70px;
    --xp-foot-h: 60px;

    /* Every control on this screen is built from these three, so the field,
       the reveal toggle and the arrow button always agree. */
    --xp-control-h: 38px;
    --xp-control-r: 8px;
    --xp-border: 1px solid #6a6a6a;
}

body.login {
    min-height: 100vh;
    margin: 0;
    padding: var(--xp-band-h) 16px var(--xp-foot-h);
    display: flex;
    flex-direction: column;
    justify-content: center;

    background-color: var(--xp-field);
    /* The soft light patch the welcome screen has in its upper left. */
    background-image: radial-gradient(
        58% 62% at 14% 16%,
        var(--xp-glow) 0%,
        rgba(74, 74, 74, 0) 70%
    );
    font-family: var(--font-display);
}

/* --- the bands ----------------------------------------------------------- */

.hxp-xp__band {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 2;
    background: var(--xp-band);
}

.hxp-xp__band--top {
    top: 0;
    height: var(--xp-band-h);
}

/* The white line that separates the dark band from the field: brightest and
   thickest at the centre, tapering away to nothing at both ends. An ellipse
   wider than it is tall gives the taper - a masked flat strip would only fade,
   and would stay the same thickness all the way across. */
.hxp-xp__band--top::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 5px;
    background: radial-gradient(
        ellipse 54% 135% at 50% 50%,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(255, 255, 255, 0.78) 34%,
        rgba(255, 255, 255, 0.28) 62%,
        rgba(255, 255, 255, 0) 78%
    );
}

.hxp-xp__band--bottom {
    bottom: 0;
    height: var(--xp-foot-h);
    border-top: 2px solid var(--xp-rule);

    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
}

.hxp-xp__power:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
    border-radius: 3px;
}

/* The red power button, bottom right - here it takes you back to the site. */
.hxp-xp__power {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);

    display: grid;
    place-items: center;
    width: 30px;
    height: 24px;
    border-radius: 4px;
    background: linear-gradient(180deg, #e2564a 0%, #c62b1d 55%, #a81b0f 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        inset 0 -2px 4px rgba(0, 0, 0, 0.35),
        0 1px 2px rgba(0, 0, 0, 0.4);
}

.hxp-xp__power:hover {
    filter: brightness(1.12);
}

/* --- the account tile ---------------------------------------------------- */

body.login #login {
    position: relative;
    z-index: 1;
    width: 300px;
    max-width: calc(100vw - 32px);
    padding: 0;
    margin: 0 auto;
    text-align: center;
}

body.login h1 {
    margin: 0 0 14px;
    text-align: center;
}

/* The picture tile: a white frame round the mark, as XP framed the avatar. */
body.login h1 a {
    display: inline-grid;
    /* place-items centres each item inside its own cell; it does not centre the
       tracks. WordPress puts the site name in this anchor - invisible at
       font-size 0, but still a grid item - so the mark and the text became two
       rows packed to the top, sitting the mark high in the tile. */
    place-content: center;
    place-items: center;
    line-height: 0;
    width: 156px;
    height: 156px;
    padding: 0;
    background: var(--mono-black);
    background-image: none;
    border: 3px solid #fff;
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    text-indent: 0;
    font-size: 0;
    overflow: hidden;
}

/* The wordmark, white on the black tile - it ships white, so it needs no
   recolouring here, only room. */
body.login h1 a::before {
    content: "";
    width: 118px;
    height: 47px;
    background: url("../img/logo-wordmark.svg") center / contain no-repeat;
}

.hxp-xp__name {
    margin: 0 0 16px;
    font-size: 19px;
    font-weight: 400;
    line-height: 1.2;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* --- the form ------------------------------------------------------------ */

body.login form {
    /* Grid so the submit can sit beside the password, the way the welcome
       screen puts its green arrow. WordPress renders it after the field, and
       grid honours `order`. */
    display: grid;
    grid-template-columns: 1fr calc(var(--xp-control-h) + 8px);
    gap: 10px 8px;
    align-items: end;

    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;

    /* WordPress sets overflow:hidden on #loginform. The fields are exactly the
       form's width, so that clipped the focus ring's left and right edges
       while leaving the top and bottom visible. */
    overflow: visible;
}

body.login form > p:first-of-type {
    order: 0;
    grid-column: 1 / -1;
    margin: 0;
}

body.login .user-pass-wrap {
    order: 1;
    grid-column: 1;
    margin: 0;
}

body.login .submit {
    order: 2;
    grid-column: 2;
    margin: 0;
}

body.login .forgetmenot {
    order: 3;
    grid-column: 1 / -1;
}

/* Labels stay - the welcome screen showed none, but a field with no label is
   no use to a screen reader. They are small and quiet instead. */
body.login form > p > label,
body.login .user-pass-wrap > label {
    display: block;
    margin: 0 0 5px;
    font-size: 10px;
    line-height: 1.2;
    text-align: left;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

/* XP text fields: white, thin sunken border, small. */
body.login input[type="text"],
body.login input[type="password"],
body.login input[type="email"] {
    box-sizing: border-box;
    width: 100%;
    height: var(--xp-control-h);
    margin: 0;
    padding: 0 13px;
    background: #fff;
    border: var(--xp-border);
    border-radius: var(--xp-control-r);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    color: #101010;
    font-family: Tahoma, var(--font-display), sans-serif;
    font-size: 14px;
    line-height: normal;
    min-height: 0;
}

body.login input[type="text"]:focus,
body.login input[type="password"]:focus,
body.login input[type="email"]:focus {
    border-color: var(--mono-black);
    outline: 2px solid var(--harry-yellow);
    outline-offset: 2px;
}

body.login .wp-pwd {
    position: relative;
}

body.login .wp-pwd input {
    padding-right: calc(var(--xp-control-h) + 2px);
}

body.login .wp-hide-pw {
    display: grid;
    place-items: center;
    top: 0;
    right: 0;
    width: var(--xp-control-h);
    height: var(--xp-control-h);
    padding: 0;
    color: #55606d;
}

body.login .wp-hide-pw .dashicons {
    width: 19px;
    height: 19px;
    font-size: 19px;
    line-height: 1;
}

/* --- the go arrow -------------------------------------------------------- */

/* XP's green arrow, in the brand yellow the Start button uses - so the arrow
   turns black to read off it. */

/* Addressed by id: WordPress's own `.wp-core-ui .button` rules outrank a class
   selector here, and were re-imposing their padding and box-sizing - which left
   the arrow two pixels taller than the field beside it. */
body.login #wp-submit.button-primary {
    box-sizing: border-box;
    display: grid;
    place-items: center;
    width: 100%;
    height: var(--xp-control-h);
    /* WordPress sets min-height: 40px on its buttons, which beat the height
       above and left the arrow standing two pixels proud of the field. */
    min-height: var(--xp-control-h);
    padding: 0;

    /* The arrow is a background image, not a pseudo-element: an <input> is a
       replaced element and cannot have ::before or ::after, so the button
       rendered as a bare green block. */
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='11' viewBox='0 0 15 11'%3E%3Cpath fill='%23202020' d='M0 3.7h8.4V0.9L15 5.5l-6.6 4.6V7.3H0z'/%3E%3C/svg%3E") center / 15px 11px no-repeat,
        linear-gradient(180deg, #f6ff5c 0%, var(--xp-go) 48%, var(--xp-go-dark) 100%);
    border: 1px solid #8f9c00;
    border-radius: var(--xp-control-r);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        0 1px 2px rgba(0, 0, 0, 0.3);
    color: transparent;
    font-size: 0;
    text-shadow: none;
    transition: filter 0.12s var(--ease);
}

body.login #wp-submit.button-primary:hover,
body.login #wp-submit.button-primary:focus {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='11' viewBox='0 0 15 11'%3E%3Cpath fill='%23202020' d='M0 3.7h8.4V0.9L15 5.5l-6.6 4.6V7.3H0z'/%3E%3C/svg%3E") center / 15px 11px no-repeat,
        linear-gradient(180deg, #faff8a 0%, #f3ff3d 48%, #d7e800 100%);
    filter: brightness(1.04);
}

body.login #wp-submit.button-primary:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* --- remember me --------------------------------------------------------- */

/* WordPress renders the checkbox as a *sibling* of its label, not a parent,
   so the row has to be the flex container. */
body.login .forgetmenot {
    display: flex;
    align-items: center;
    gap: 8px;
    float: none;
    margin: 2px 0 0;
    font-size: 11px;
    line-height: 1;
}

body.login .forgetmenot label {
    margin: 0;
    font-size: 11px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

body.login input[type="checkbox"] {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    min-width: 17px;
    margin: 0;
    background: #fff;
    border: var(--xp-border);
    border-radius: 4px;
}

body.login input[type="checkbox"]:checked {
    background: #fff;
}

body.login input[type="checkbox"]:checked::before {
    content: "";
    width: 17px;
    height: 17px;
    margin: -1px 0 0 -1px;
    background: var(--mono-black);
    clip-path: polygon(16% 52%, 38% 74%, 84% 26%, 92% 34%, 38% 88%, 8% 58%);
}

/* --- links and the Switch User button ------------------------------------ */

body.login #nav {
    position: relative;
    margin: 16px 0 0;
    padding: 0;
    text-align: center;
    font-size: 11px;
}

body.login #nav a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

body.login #nav a:hover {
    color: #fff;
    text-decoration: underline;
}

body.login #nav a:focus-visible,
.hxp-login__back a:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    border-radius: 2px;
}

body.login #backtoblog {
    display: none;
}

/* XP's "Switch User" button, sitting under the tile. */
.hxp-login__back {
    position: relative;
    z-index: 1;
    margin: 22px 0 0;
    text-align: center;
}

.hxp-login__back a {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(180deg, #5a5a5a 0%, #3a3a3a 52%, #2a2a2a 100%);
    border: 1px solid #111;
    border-radius: var(--xp-control-r);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.45),
        0 1px 2px rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 12px;
    text-decoration: none;
}

.hxp-login__back a:hover {
    filter: brightness(1.1);
    color: #fff;
}

/* --- messages ------------------------------------------------------------ */

body.login .message,
body.login .notice,
body.login #login_error {
    margin: 0 0 14px;
    padding: 9px 12px;
    background: rgba(22, 22, 22, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-left: 3px solid var(--xp-rule);
    border-radius: 3px;
    color: #fff;
    font-size: 12px;
    line-height: 1.45;
    text-align: left;
    text-shadow: none;
    box-shadow: none;
}

body.login #login_error {
    border-left-color: #ff6b5e;
}

body.login .message a,
body.login #login_error a {
    color: var(--harry-yellow);
}

body.login .privacy-policy-page-link {
    margin-top: 16px;
}

body.login .privacy-policy-page-link a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

body.login .language-switcher {
    display: none;
}

/* --- the decoy (templates/log-on.php) ----------------------------------- */

/* The form is display:grid, which would otherwise beat [hidden] and keep the
   fields on screen under the Welcome. */
body.hxp-decoy [hidden] {
    display: none !important;
}

/* No password on the decoy: the arrow sits beside the name instead. */
body.hxp-decoy form > p:first-of-type {
    grid-column: 1;
}

body.hxp-decoy .submit {
    order: 1;
}

/* XP's "welcome" moment, in place of the fields. */
.hxp-decoy__welcome {
    padding: 6px 0 4px;
    animation: hxp-decoy-in 0.4s ease both;
}

.hxp-decoy__hello {
    margin: 0 0 10px;
    color: #fff;
    font-size: 40px;
    font-style: italic;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.hxp-decoy__loading {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

.hxp-decoy__loading::after {
    content: "";
    display: block;
    width: 140px;
    height: 4px;
    margin: 12px auto 0;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--xp-rule), transparent) 0 0 / 60% 100% no-repeat, rgba(255, 255, 255, 0.15);
    animation: hxp-decoy-bar 1.1s linear infinite;
}

@keyframes hxp-decoy-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

@keyframes hxp-decoy-bar {
    from { background-position: -100% 0, 0 0; }
    to { background-position: 250% 0, 0 0; }
}

/* --- short screens -------------------------------------------------------- */

@media (max-height: 560px) {
    :root {
        --xp-band-h: 41px;
        --xp-foot-h: 48px;
    }

    body.login h1 a {
        width: 114px;
        height: 114px;
    }

    body.login h1 a::before {
        width: 66px;
        height: 66px;
        background-size: 37px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.login * {
        transition: none !important;
        animation: none !important;
    }
}
