/* Log in and sign up screens (base/authsurround.html.j2).

   The moving dots canvas fills the viewport behind everything, on the blue gradient. Above it,
   one column sits left of centre: the logo, the tagline, then a solid card holding the flash
   messages and the page's adminbuilder content. The card's direct children are laid out with
   flex-wrap: each takes a full row, except the "other action" links (a.btn-link) after the <hr>,
   which share a row along the bottom with the <hr> acting as the top border. */

.auth-page {
    --auth-sky-top: #0099ff;
    --auth-sky-bottom: #007dd1;
    --auth-card-bg: #ffffff;
    --auth-card-shadow: 0 24px 48px -12px rgb(0 40 90 / 0.35), 0 6px 14px -6px rgb(0 40 90 / 0.25);

    min-height: 100vh;
    margin: 0;
    background: linear-gradient(135deg, var(--auth-sky-top) 0%, var(--auth-sky-bottom) 100%) fixed;
    /* The gradient is the page colour, so overscroll and the area behind the canvas match it */
    background-color: var(--auth-sky-bottom);
}

[data-bs-theme="dark"] .auth-page {
    --auth-sky-top: #0b3a66;
    --auth-sky-bottom: #07223f;
    --auth-card-bg: #151b23;
    --auth-card-shadow: 0 24px 48px -12px rgb(0 0 0 / 0.6), 0 6px 14px -6px rgb(0 0 0 / 0.5);
    background-color: var(--auth-sky-bottom);
}

.auth-dots {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* The stage lets clicks fall through to the dots; the stack takes them back */
.auth-stage {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center start;
    padding-block: 40px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    pointer-events: none;
}

.auth-stack {
    /* A left gap that grows with the screen, leaving more of the dots showing on the right */
    --auth-offset: clamp(0px, 9vw, 180px);
    width: calc(100% - var(--auth-offset));
    max-width: 880px;
    margin-left: var(--auth-offset);
    display: grid;
    gap: 28px;
    pointer-events: auto;
}

.auth-brand {
    display: grid;
    justify-items: start;
    gap: 10px;
    color: #fff;
}

/* The image is cropped to the wordmark, so its left edge lines up with the card's */
.auth-logo {
    display: block;
    width: min(280px, 64vw);
    height: auto;
    cursor: pointer;
}

/* Bold at 1.2rem counts as large text, so white passes contrast (3:1) on the lightest blue */
.auth-tagline {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
    text-wrap: balance;
}

/* Card */

.auth-card {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 24px;
    background: var(--auth-card-bg);
    border-radius: 14px;
    box-shadow: var(--auth-card-shadow);
    padding: clamp(24px, 5vw, 44px);
    text-align: left;
}

.auth-card > * {
    flex: 1 0 100%;
    min-width: 0;
}

.auth-card > :last-child {
    margin-bottom: 0;
}

.auth-card h1 {
    line-height: 1.15;
    text-wrap: balance;
}

/* Intro text under the heading, including intro text wrapped in a card */
.auth-card > p,
.auth-card > .card > .card-body > p {
    max-width: 62ch;
    color: var(--bs-secondary-color);
}

/* Everything in the card reads from the left, including content marked up as centred */
.auth-card .text-center {
    text-align: left !important;
}

/* Fine print (terms, cookie note) */
.auth-card > p.small {
    margin: 16px 0 0;
    font-size: 0.875rem;
}

.auth-card .alert {
    margin-bottom: 20px;
}

/* Adminbuilder forms and cards sit flat inside the auth card */
.auth-card .card {
    background: transparent;
    border: 0;
    box-shadow: none;
}

.auth-card .card-body {
    padding: 0;
}

.auth-card .form-control {
    padding: 0.625rem 0.875rem;
}

/* The magic code and authenticator code fields: large, evenly spaced digits */
.auth-card input[type="number"].form-control {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    font-variant-numeric: tabular-nums;
}

.auth-card img {
    max-width: 100%;
    height: auto;
}

/* Number fields (the codes) have no use for spin buttons */
.auth-card input[type="number"]::-webkit-inner-spin-button,
.auth-card input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.auth-card input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Turnstile sizes itself to its container with data-size="flexible" */
.auth-card .cf-turnstile {
    margin-inline: 0 !important;
}

/* The "other action" links: a row along the bottom, under a rule */
.auth-card > hr {
    margin: 24px 0 16px;
    border: 0;
    border-top: 1px solid var(--bs-border-color);
    opacity: 1;
}

.auth-card > a.btn-link {
    flex: 0 0 auto;
    width: auto !important;
    padding: 4px 0;
    margin-bottom: 0;
    border: 0;
    text-align: left;
    text-wrap: wrap;
    white-space: normal !important;
    font-size: 0.95rem;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.auth-card > a.btn-link:hover {
    text-decoration-thickness: 2px;
}

.auth-card a.btn-link:focus-visible {
    box-shadow: none;
    outline: 2px solid var(--bs-link-color);
    outline-offset: 2px;
    border-radius: 2px;
}

/* A full-width secondary action, such as re-sending the code */
.auth-card > a.btn:not(.btn-link) {
    margin-top: 4px;
}

@media (max-width: 575.98px) {
    .auth-stage {
        padding-block: 24px;
    }

    .auth-stack {
        --auth-offset: 0px;
        gap: 20px;
    }
}
