/*
    Flex Hub auth spotlight shell.

    One responsive view per auth route, the same structural breakpoint at 900px as the app shell.
    Below it the screen is the 390px phone spotlight, above it the 1200px desktop spotlight. Both
    are in the markup at once and the breakpoint decides which sizes apply. The app shell uses the
    same arrangement for the sidebar and the app bar.

    Mobile first. The min-width block at the bottom is the desktop side.

    Token-table values come through custom properties from tokens.css.
*/

/* ---- Spotlight frame ---- */

/*
    The frame clips the spotlight, which is wider and taller than the screen. It grows
    with its content, so nothing real is ever clipped by this.
*/
.hub-auth {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    /* Mobile browsers count the address bar in 100vh, which pushes the logo off the screen. */
    min-height: 100dvh;
    box-sizing: border-box;
    background: var(--surface-login);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 56px 20px 134px;
}

/*
    On the phone the company logo is pinned to the bottom of the frame and the bottom padding
    above reserves its room. At 900px and above the logo is in flow after the card and the padding
    is only the floor gap.
*/
.hub-auth__spotlight {
    position: absolute;
    left: 50%;
    top: -150px;
    transform: translateX(-50%);
    width: 620px;
    height: 520px;
    background: var(--login-spotlight);
    pointer-events: none;
}

.hub-auth__content {
    position: relative;
    width: 100%;
    text-align: center;
}

/* Which of the two sets of marks applies. Both are in the markup. */
.hub-auth__desktop-only {
    display: none;
}

/*
    ---- Brand lockup ----

    Enlarge the mobile lockup for readability. Desktop sizes are unchanged.

    The phone takes the 52px mark with a 30px wordmark and a 10px subtitle, the gap opens up to
    carry the larger mark, and the company logo at the foot of the screen is 96px tall.
*/

.hub-auth__lockup {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.hub-auth__lockup-inner {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-right: 5px;
}

/* The text block shrinks to the wordmark, so the subtitle centres under the wordmark itself. */
.hub-auth__lockup-text {
    line-height: 1.05;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.hub-auth__wordmark {
    font: var(--font-nav-wordmark-login-mobile);
    font-size: 30px;
    letter-spacing: var(--tracking-wordmark);
    color: var(--text-login-heading);
}

.hub-auth__subtitle {
    font: 600 7.5px var(--font-mono); /* 10px on the phone, the shared 8px lockup size at the wide breakpoint */
    font-size: 10px;
    letter-spacing: var(--tracking-lockup-subtitle);
    color: var(--teal);
}

/* ---- Headline ---- */

.hub-auth__headline {
    font: var(--font-login-headline-mobile);
    line-height: 1.14;
    letter-spacing: var(--tracking-title);
    color: var(--text-login-heading);
    margin: 0 0 6px;
}

.hub-auth__headline-accent {
    color: var(--teal);
}

.hub-auth__strapline {
    font: 400 12.5px/1.6 var(--font-ui);
    color: var(--text-login-subhead);
    margin: 0 0 48px;
}

/* The error box needs the room, so the phone screen tightens this gap. Desktop keeps its 60px. */
.hub-auth.is-error .hub-auth__strapline {
    margin-bottom: 34px;
}

/* ---- Card ---- */

.hub-auth__card {
    text-align: left;
    background: var(--surface-login-card);
    border: 1px solid var(--border-login-card);
    border-radius: var(--radius-dialog);
    padding: 22px 20px;
    box-shadow: var(--shadow-login-card);
}

/* ---- Error box, soft red form-error language ---- */

.hub-auth__error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--error-keyline);
    background: var(--error-fill);
    border-radius: var(--radius-field-mobile);
    padding: 12px 13px;
    margin-bottom: 18px;
}

.hub-auth__error-text {
    line-height: 1.45;
}

.hub-auth__error-title {
    font: 600 13px var(--font-ui);
    color: var(--error-text);
}

.hub-auth__error-detail {
    font: 400 12px var(--font-ui);
    color: var(--error-sub);
    margin-top: 2px;
}

/* ---- Fields ---- */

.hub-auth__label {
    display: block;
    font: var(--font-field-label);
    text-transform: uppercase;
    letter-spacing: var(--tracking-field-label-wide);
    color: var(--text-muted);
    margin-bottom: 7px;
}

.hub-auth__input {
    display: block;
    width: 100%;
    height: var(--size-field-mobile);
    box-sizing: border-box;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-field-mobile);
    background: var(--surface-body);
    padding: 0 14px;
    margin-bottom: 16px;
    font: 400 15px var(--font-ui);
    color: var(--text-body);
}

/* The password field is set in mono, which is what the masking dots read as. */
.hub-auth__input--password {
    font-family: var(--font-mono);
    letter-spacing: .2em;
    margin-bottom: 22px;
}

/* Focus uses the accent selection keyline color. */
.hub-auth__input:focus {
    outline: none;
    border-color: var(--accent-keyline-strong);
    box-shadow: 0 0 0 1px var(--accent-keyline-soft);
}

/* The error border on the failed field uses the stronger of the two soft-red alphas. */
.hub-auth__input.is-invalid {
    border-color: var(--error-field-keyline);
}

/* ---- Submit ---- */

.hub-auth__submit {
    display: block;
    width: 100%;
    height: var(--size-button-mobile);
    border: 0;
    border-radius: var(--radius-card-large);
    background: var(--accent);
    color: var(--accent-on-fill);
    font: var(--font-button-mobile-large);
    margin-bottom: 16px;
    cursor: pointer;
}

/* ---- Card footer ---- */

.hub-auth__card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hub-auth__link {
    border: 0;
    background: none;
    padding: 0;
    font: 400 13px var(--font-ui);
    color: var(--teal);
    cursor: pointer;
}

.hub-auth__version {
    font: 400 11px var(--font-mono);
    color: var(--text-disabled);
}

/*
    ---- Company logo, at the foot of every auth screen ----

    The logo is sized for readability and carries no dimming. On the phone it is pinned to the
    bottom of the frame and the bottom padding on .hub-auth reserves its room. At 900px and above
    it sits in flow after the card and margin-top auto pushes it to the floor of the viewport,
    keeping at least the card's own bottom margin between the two when the viewport is short.
*/

.hub-auth__company {
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    height: 96px;
    width: auto;
    opacity: 1;
}

/*
    ---- Dialog ----

    A native dialog element styled as the panel itself, with the scrim on its backdrop. The browser
    centres it in the top layer while it is open and hides it when it is not, so it needs no
    display or positioning rules of its own.
*/

.hub-dialog {
    width: calc(100% - 40px);
    max-width: 392px;
    padding: 0;
    background: var(--surface-login-card);
    border: 1px solid var(--border-login-card);
    border-radius: var(--radius-dialog);
    box-shadow: var(--shadow-dialog);
    overflow: hidden;
    text-align: left;
    color: inherit;
}

.hub-dialog::backdrop {
    background: var(--scrim);
}

.hub-dialog__header {
    padding: 15px 18px;
    border-bottom: 1px solid var(--border-login-card);
    display: flex;
    align-items: center;
    gap: 11px;
}

.hub-dialog__title {
    font: var(--font-dialog-title);
    color: var(--text-primary);
}

/*
    The close control keeps the mobile hit target without stretching the header, so it pulls its
    own extra height back out with negative margins.
*/
.hub-dialog__close {
    margin: -7px -9px -7px auto;
    width: var(--size-hit-target-min);
    height: var(--size-hit-target-min);
    flex: none;
    border: 0;
    background: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 400 15px var(--font-ui);
    color: var(--text-muted);
    cursor: pointer;
}

.hub-dialog__body {
    padding: 16px 18px 18px;
}

.hub-dialog__text {
    font: var(--font-body-mobile);
    color: var(--text-tertiary);
    margin: 0;
}

.hub-dialog__footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}

.hub-dialog__primary {
    margin-left: auto;
    border: 0;
    border-radius: var(--radius-button-desktop);
    background: var(--accent);
    color: var(--accent-on-fill);
    font: var(--font-button);
    padding: 11px 20px;
    cursor: pointer;
}

/* ---- Desktop ---- */

@media (min-width: 900px) {

    .hub-auth {
        padding: clamp(32px, 8vh, 88px) 24px 30px;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
    }

    .hub-auth__spotlight {
        top: -210px;
        width: 1000px;
        height: 620px;
    }

    .hub-auth__content {
        width: 400px;
        margin-bottom: 40px;
    }

    .hub-auth__mobile-only {
        display: none;
    }

    .hub-auth__desktop-only {
        display: block;
    }

    .hub-auth__lockup {
        margin-bottom: 18px;
    }

    .hub-auth__lockup-inner {
        gap: 12px;
        margin-right: 6px;
    }

    .hub-auth__wordmark {
        font: var(--font-nav-wordmark-login);
    }

    .hub-auth__subtitle {
        font: var(--font-lockup-subtitle);
    }

    .hub-auth__headline {
        font: var(--font-login-headline);
        line-height: 1.14;
    }

    .hub-auth__strapline {
        font: 400 13.5px/1.6 var(--font-ui);
        margin-bottom: 60px;
    }

    .hub-auth.is-error .hub-auth__strapline {
        margin-bottom: 60px;
    }

    .hub-auth__card {
        padding: 26px 24px;
    }

    .hub-auth__error {
        border-radius: var(--radius-field);
        padding: 11px 13px;
    }

    .hub-auth__error-title {
        font: var(--font-card-title); /* 600 12.5px */
    }

    .hub-auth__error-detail {
        font: 400 11.5px var(--font-ui);
    }

    .hub-auth__label {
        margin-bottom: 6px;
    }

    /* Desktop inputs use the page background to contrast with the login card. */
    .hub-auth__input {
        height: auto;
        border-radius: var(--radius-field);
        background: var(--surface-login);
        padding: 12px 14px;
        font: 400 14px var(--font-ui);
    }

    .hub-auth__input--password {
        font-family: var(--font-mono);
    }

    .hub-auth__submit {
        height: auto;
        border-radius: var(--radius-field);
        padding: 13px;
        font: 600 14px var(--font-ui);
        margin-bottom: 14px;
    }

    .hub-auth__link {
        font: 400 12.5px var(--font-ui);
    }

    .hub-auth__company {
        position: static;
        left: auto;
        bottom: auto;
        transform: none;
        margin-top: auto;
        height: 96px;
    }

    .hub-dialog__text {
        font: var(--font-body);
    }
}
