/*
 * 3D sign-in page: a dusk construction site rendered by login-scene.js,
 * with the sign-in form set on a drafting-film sheet.
 */

:root {
    --night: #041c2a;
    --brand: #023047;
    --amber: #f2a900;
    --amber-deep: #dc9500;
    --film: #f1f3f2;
    --ink: #10222c;
    --ink-muted: #56656d;
    --rule: #c7d0d4;
    --field-border: #9aabb3;
    --danger: #b3261e;

    --font-display: "Big Shoulders Stencil Display", "Archivo", sans-serif;
    --font-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

    --sheet-width: 440px;
    --gutter: clamp(20px, 3.4vw, 56px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body.login-3d {
    min-height: 100svh;
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(90% 55% at 22% 78%, rgba(192, 138, 102, 0.45), transparent 62%),
        linear-gradient(180deg, #041c2a 0%, #0e3a50 62%, #1d3442 100%);
    -webkit-font-smoothing: antialiased;
}

/* ---------- Scene ---------- */

.site {
    position: relative;
    min-height: 100svh;
    display: grid;
    grid-template-columns: 1fr minmax(360px, var(--sheet-width));
    align-items: center;
    padding: var(--gutter);
}

.site__scene {
    position: fixed;
    inset: 0;
    z-index: 0;
}

.site__canvas {
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.9s ease;
}

.scene-ready .site__canvas {
    opacity: 1;
}

.site__caption {
    position: fixed;
    top: var(--gutter);
    left: var(--gutter);
    z-index: 1;
    max-width: calc(100vw - var(--sheet-width) - var(--gutter) * 4);
    color: var(--film);
    pointer-events: none;
}

.wordmark {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(44px, 5.6vw, 92px);
    line-height: 0.88;
    letter-spacing: 0.005em;
    text-transform: uppercase;
    text-wrap: balance;
    text-shadow: 0 2px 24px rgba(4, 28, 42, 0.45);
}

.wordmark-tagline {
    margin: 10px 0 0;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(15px, 1.6vw, 22px);
    letter-spacing: 0.01em;
    color: rgba(241, 243, 242, 0.78);
    text-shadow: 0 1px 10px rgba(4, 28, 42, 0.55);
}

.wordmark-tagline__highlight {
    color: var(--amber);
    font-weight: 700;
}

.site-status {
    margin: 16px 0 0;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(241, 243, 242, 0.74);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 8px rgba(4, 28, 42, 0.9);
}

.no-webgl .site-status {
    display: none;
}

/* ---------- Sheet ---------- */

.sheet {
    position: relative;
    z-index: 2;
    grid-column: 2;
    display: flex;
    flex-direction: column;
    background-color: var(--film);
    /* Faint graph-paper grid, so the "drafting-film sheet" it's built on (see the file
       comment at the top) actually reads as one, instead of a plain card. */
    background-image:
        linear-gradient(rgba(2, 48, 71, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(2, 48, 71, 0.05) 1px, transparent 1px);
    background-size: 24px 24px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.6) inset,
        0 40px 90px -30px rgba(1, 12, 18, 0.8),
        0 12px 24px -12px rgba(1, 12, 18, 0.45);
    animation: sheet-enter 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s both;
}

/* Drawing-sheet border: a hairline frame inset from the edge. */
.sheet::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid var(--rule);
    pointer-events: none;
}

.sheet__body {
    padding: 48px 44px 8px;
}

.sheet__logo {
    display: block;
    max-width: 180px;
    max-height: 56px;
    margin-bottom: 28px;
    object-fit: contain;
}

.sheet__title {
    margin: 0 0 8px;
    font-family: var(--font-body);
    font-size: 32px;
    font-weight: 650;
    font-stretch: 115%;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.sheet__lede {
    margin: 0 0 32px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.sheet__footer {
    margin: 36px 20px 20px;
    padding: 14px 24px 0;
    border-top: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.04em;
    line-height: 1.6;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.sheet__footer a {
    color: inherit;
    text-decoration: none;
}

.sheet__footer a:hover {
    color: var(--ink);
    text-decoration: underline;
}

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

.field {
    margin-bottom: 22px;
}

.field__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.field__label {
    display: block;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink);
}

.field__link {
    font-size: 13px;
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
    border-radius: 2px;
}

.field__link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.field__control {
    position: relative;
}

.field__input {
    display: block;
    width: 100%;
    height: 50px;
    padding: 0 14px;
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--ink);
    background: #fff;
    border: 1.5px solid var(--field-border);
    border-radius: 3px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.field__control .field__input {
    padding-right: 52px;
}

.field__input:hover {
    border-color: #6f848e;
}

.field__input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(2, 48, 71, 0.2);
}

/* jQuery Validate adds its error class to the invalid input as well as the message. */
input.help-block {
    border-color: var(--danger);
}

span.help-block,
.field__error {
    display: block;
    margin: 7px 0 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--danger);
}

.field__error:empty {
    display: none;
}

.pw-toggle {
    position: absolute;
    top: 4px;
    right: 4px;
    bottom: 4px;
    width: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--ink-muted);
    background: transparent;
    border: 0;
    border-radius: 2px;
    cursor: pointer;
}

.pw-toggle:hover {
    color: var(--ink);
}

.pw-toggle__hide,
.pw-toggle[aria-pressed="true"] .pw-toggle__show {
    display: none;
}

.pw-toggle[aria-pressed="true"] .pw-toggle__hide {
    display: block;
}

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

.submit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 54px;
    margin-top: 10px;
    padding: 0 20px;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 650;
    font-stretch: 105%;
    color: #1b1400;
    background-color: var(--amber);
    border: 0;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.submit:hover {
    background-color: var(--amber-deep);
}

.submit:active {
    transform: translateY(1px);
}

.submit__arrow {
    transition: transform 0.2s ease;
}

.submit:hover .submit__arrow {
    transform: translateX(3px);
}

.submit__label--busy,
.submit__label--done {
    display: none;
}

/* Busy: the button turns into moving hazard tape until the server answers. */
.submit[disabled] {
    cursor: progress;
    background-color: var(--amber);
    background-image: repeating-linear-gradient(
        -45deg,
        transparent 0 14px,
        rgba(27, 20, 0, 0.12) 14px 28px
    );
    background-size: 40px 40px;
    animation: hazard 0.8s linear infinite;
}

.submit[disabled] .submit__label--idle {
    display: none;
}

.submit[disabled] .submit__label--busy {
    display: inline;
}

.is-signed-in .submit[disabled] .submit__label--busy {
    display: none;
}

.is-signed-in .submit .submit__label--done {
    display: inline;
}

.is-signed-in .submit {
    animation: none;
    background-image: none;
}

/* ---------- Focus ---------- */

.field__link:focus-visible,
.pw-toggle:focus-visible,
.sheet__footer a:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.submit:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
}

/* ---------- Toastr on this page ---------- */

#toast-container > div {
    font-family: var(--font-body);
    border-radius: 3px;
    box-shadow: 0 12px 30px -10px rgba(1, 12, 18, 0.6);
    opacity: 1;
}

/* ---------- Motion ---------- */

@keyframes sheet-enter {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes sheet-reject {
    0%, 100% { transform: none; }
    18% { transform: translateX(-9px); }
    36% { transform: translateX(8px); }
    54% { transform: translateX(-6px); }
    72% { transform: translateX(3px); }
}

.sheet.is-rejected {
    animation: sheet-reject 0.42s ease both;
}

@keyframes hazard {
    to {
        background-position: 40px 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sheet,
    .sheet.is-rejected,
    .submit[disabled] {
        animation: none;
    }

    .site__canvas,
    .submit,
    .submit__arrow,
    .field__input {
        transition: none;
    }
}

/* ---------- Tablet and phone: scene on top, sheet below ---------- */

@media (max-width: 1023.98px) {
    /* Padding rather than a margin on the sheet, so the offset can't collapse through .site. */
    .site {
        display: block;
        padding: calc(max(46svh, 300px) - 28px) 0 0;
    }

    .site__scene {
        position: absolute;
        inset: 0 0 auto;
        height: 46svh;
        min-height: 300px;
    }

    .site__caption {
        position: absolute;
        top: 20px;
        left: 20px;
        max-width: calc(100vw - 40px);
    }

    .wordmark {
        font-size: clamp(34px, 9vw, 56px);
    }

    .wordmark-tagline {
        margin-top: 6px;
        font-size: 15px;
    }

    .site-status {
        margin-top: 10px;
        font-size: 10px;
    }

    .sheet {
        margin: 0 auto;
        max-width: 560px;
        min-height: calc(100svh - max(46svh, 300px) + 28px);
    }

    .sheet__body {
        flex: 1 0 auto;
        padding: 36px 28px 8px;
    }

    .sheet__footer {
        margin-top: 32px;
    }
}

/* Tablets: full-bleed scene again, with the sheet as a card near the bottom. */
@media (min-width: 600px) and (max-width: 1023.98px) {
    .site {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        align-items: center;
        padding: 0 var(--gutter) var(--gutter);
    }

    .site__scene {
        position: fixed;
        inset: 0;
        height: auto;
    }

    .site__caption {
        position: fixed;
        top: var(--gutter);
        left: var(--gutter);
    }

    .sheet {
        width: 100%;
        max-width: 520px;
        min-height: 0;
    }
}

@media (max-width: 480px) {
    .sheet::before {
        inset: 6px;
    }

    .sheet__body {
        padding: 32px 22px 4px;
    }

    .sheet__title {
        font-size: 28px;
    }

    .sheet__footer {
        margin: 28px 14px 16px;
        padding: 12px 8px 0;
    }
}
