/*
Login page: title sticker, then the access-code form (signed out) or the Sign out button (signed in).
Layout ranges: phone up to 600px, tablet 601-950px, desktop from 951px.
*/

/* 32px side margins, form at most 390px wide; title starts 64px below the 80px header (48px on phones) */
.account-page {
    box-sizing: border-box;
    width: min(calc(100% - 64px), 390px);
    margin: calc(5rem + 64px) auto 0;
    text-align: center;
}

.account-page h1 {
    display: inline-block;
    margin-bottom: 2.5rem;
    /* Padding, corners and shadow in em, like the sticker titles on the rules pages */
    padding: .33em .56em;
    background: white;
    color: black;
    border: 2px solid black;
    border-radius: .14em;
    box-shadow: .15em .15em 0 black;
    font-size: 1.75rem;
    font-weight: 800;
    transform: rotate(1.5deg);
}

.account-actions {
    display: grid;
}

.account-actions > #login-form, .account-actions > #signed-in {
    grid-area: 1 / 1;
}

#signed-in {
    align-self: center;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    text-align: left;
}

/* Keep the form's layout space so Sign out sits at its vertical midpoint. */
#login-form[hidden] {
    display: flex !important;
    visibility: hidden;
    pointer-events: none;
}

#signed-in[hidden] {
    display: none;
}

#site-password {
    box-sizing: border-box;
    width: 100%;
    padding: .9rem;
    border: 1px solid #ffffffa6;
    border-radius: .3rem;
    background: #0003;
    color: white;
    font: inherit;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#sign-in {
    display: block;
    padding: .75em 1.15em;
    border: 2px solid black;
    border-radius: .3em;
    background: white;
    color: black;
    /* Padding, corners and shadow in em: white buttons keep the same proportions at every text size */
    box-shadow: .22em .22em 0 black;
    font: inherit;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}

#sign-in {
    margin-top: .5rem;
}

#sign-out {
    box-sizing: content-box;
    padding: 0 1.6em;
    font-size: .875rem;
    height: 2.25rem;
    width: max-content;
    white-space: nowrap;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    font-family: "Trebuchet MS", Arial, sans-serif;
    letter-spacing: .1em;
    text-decoration: none;
    border: 2px solid white;
    border-radius: 1em;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    background-color: transparent;
    transition: background-color .2s, color .2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
    #sign-out:hover {
        background-color: white;
        color: black;
    }
}

.account-page :focus-visible {
    outline: 2px solid white;
    outline-offset: 4px;
}

.account-page button:disabled {
    opacity: .4;
    cursor: default;
}

[hidden] {
    display: none !important;
}

#login-status {
    font-size: .875rem;
    line-height: 1.5;
}

/* Phone */
@media (max-width: 600px) {
    .account-page {
        margin-top: calc(5rem + 48px);
    }

    .account-page h1 {
        margin-bottom: 2rem;
        font-size: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    #sign-out {
        transition: none;
    }
}
