/*
 * Fb Helpdesk: the sign-in page, and GLPI's other pages for people not
 * logged in (templates/layout/page_card_notlogged.html.twig, body class
 * "welcome-anonymous"). Registered through add_css_anonymous_page.
 *
 * HOW IT SITS ON FBBRANDING
 * The fbbranding plugin already brands this page: fonts, tokens, the form
 * stacked with single sign-on first and the local form behind a disclosure
 * (its fbbranding-login.js). All of that stays. What this file replaces is the
 * composition: fbbranding's flat Racing Green panel on the left gives way to
 * the company's own photograph on the right, the form moves onto white beside
 * it, and the page gets the portal's shapes and motion. fbbranding's styles
 * load first (plugin order), so rules here win at equal specificity; where
 * fbbranding draws something this layout does not use (its panel, its narrow
 * band), it is switched off here, by name.
 *
 * THE PHOTOGRAPH
 * The Racing Green office wall, the company's Teams background, with its own
 * "INTRA LOGISTICS AT ITS BEST." line. It is aligned right, so the line and
 * the plant stay in view at every width from 992px, and the logo printed in
 * its left corner is cut off: the page's logo is the full-colour lockup on
 * white, the guide's primary use (p.7). fbbranding's welcome headline says the
 * same line again, so it is hidden where the photograph shows; a welcome
 * message, if one is configured, stays. There is no edge between the white
 * column and the photograph: the wall fades in from the white, and the block
 * band runs along the whole foot of the page, under both.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

body.welcome-anonymous {
    --fbhd-deep: var(--fb-deep, #043623);
    --fbhd-green: var(--fb-green, #1ec95b);
    --fbhd-green-text: var(--fb-green-text, #13803a);
    --fbhd-red: var(--fb-red, #fa4646);
    --fbhd-line: #dde5e1;
    --fbhd-control: var(--fb-border-control, #779288);
    --fbhd-muted: #4a665b;
    --fbhd-photo: clamp(26rem, 56vw, 72rem);
    --fbhd-band: clamp(22px, 2.4vw, 36px);
    --fbhd-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --fbhd-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

:root:not([data-glpi-theme-dark="1"]) body.welcome-anonymous {
    background-color: #fff;
}

/* ---- The column ---------------------------------------------------------- */

body.welcome-anonymous .page-anonymous {
    min-height: 100dvh;
}

body.welcome-anonymous .page-anonymous > .flex-fill {
    margin-top: 0 !important;
}

/* Logo, heading, sign-in and footer share one left edge. */
body.welcome-anonymous .page-anonymous .text-center:has(> .col-md > .glpi-logo),
body.welcome-anonymous .page-anonymous .main-content-card {
    max-width: 25rem;
    margin-inline: auto;
}

/* The form column loses Bootstrap's gutter (it differs by breakpoint), so
 * everything inside is inset by fbbranding's 0.5rem alone, as the logo and
 * the footer are: one left edge at every width. */
body.welcome-anonymous .page-anonymous form > .row {
    margin-inline: 0;
}

body.welcome-anonymous .page-anonymous form > .row > [class*="col-"] {
    padding-inline: 0;
}

body.welcome-anonymous .page-anonymous .text-center:has(> .col-md > .glpi-logo) {
    padding-inline: 0.5rem;
    text-align: start !important;
    animation: fbhd-login-rise 700ms var(--fbhd-ease) both;
}

/* The full-colour lockup on white: the logo's primary use (guide p.7). */
body.welcome-anonymous .page-anonymous .glpi-logo {
    display: block;
    width: 5.75rem;
    height: 5.75rem;
    margin: 0 0 2.25rem;
}

body.welcome-anonymous .page-anonymous form > .row > [class*="col-"] {
    max-width: 25rem;
}

body.welcome-anonymous .page-anonymous .card-header:has(> h2) {
    margin-bottom: 1.75rem !important;
    border-bottom: 0;
    animation: fbhd-login-rise 700ms var(--fbhd-ease) 70ms both;
}

body.welcome-anonymous .page-anonymous .card-header h2 {
    margin: 0 !important;
    font-size: clamp(2.25rem, 1.6rem + 2vw, 3.25rem);
    letter-spacing: -0.03em;
    line-height: 1;
    text-align: start;
    text-wrap: balance;
}

body.welcome-anonymous .page-anonymous .col-md-5 > .col-auto {
    padding-inline: 0.5rem !important;
    text-align: start !important;
    animation: fbhd-login-rise 700ms var(--fbhd-ease) 140ms both;
}

/* The same line is printed on the photograph. */
body.welcome-anonymous .fb-login-panel__headline {
    display: none;
}

body.welcome-anonymous .fb-login-panel {
    max-width: none;
    margin: 0 0 1.25rem;
}

/* ---- Single sign-on ------------------------------------------------------
 * The entra plugin's button stays neutral: Microsoft's brand rules govern how
 * "Sign in with Microsoft" may look. It leads by size and place, not colour. */

body.welcome-anonymous .page-anonymous .en-sso {
    margin: 0 0 0.75rem;
}

body.welcome-anonymous .page-anonymous .en-sso__button {
    min-height: 3.5rem;
    padding-block: 0.85rem;
    border: 1px solid #c3cfca;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgb(4 54 35 / 6%);
    font-size: 1rem;
    touch-action: manipulation;
    transition: border-color 160ms ease, box-shadow 200ms ease, transform 200ms var(--fbhd-ease), background-color 160ms ease;
}

body.welcome-anonymous .page-anonymous .en-sso__button:hover,
body.welcome-anonymous .page-anonymous .en-sso__button:focus-visible {
    border-color: var(--fbhd-green-text);
    background: #fff;
    box-shadow: 0 10px 24px -14px rgb(4 54 35 / 45%);
    transform: translateY(-1px);
}

body.welcome-anonymous .page-anonymous .en-sso__button:active {
    transform: scale(0.99);
}

/* ---- The local form, behind its disclosure ----------------------------- */

body.welcome-anonymous .fb-local-toggle {
    padding: 0.6rem 0.25rem;
    border-radius: 8px;
    text-align: start;
    touch-action: manipulation;
}

/* With Entra's sign-in on the page, fbbranding's "Mit GLPI-Konto anmelden"
 * goes as well, and the red dot of "AT ITS BEST." on the photograph brings
 * the form back (js/login.js). The script sets .fbhd-egg only once the dot
 * is in place and removes it whenever the form must show, so without the
 * script the link stays. The dot's position per layout is in the media
 * queries below. */
body.welcome-anonymous.fbhd-egg .fb-local-toggle {
    display: none !important;
}

body.welcome-anonymous .fbhd-dot {
    position: fixed;
    z-index: 2;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: default;
    touch-action: manipulation;
}

body.welcome-anonymous:not(.fbhd-egg) .fbhd-dot {
    display: none;
}

/* Each click answers with a ring around the dot. */
body.welcome-anonymous .fbhd-dot::after {
    content: "";
    position: absolute;
    inset: 13px;
    border: 2px solid var(--fbhd-red);
    border-radius: 50%;
    opacity: 0;
}

body.welcome-anonymous .fbhd-dot--pulse::after {
    animation: fbhd-dot-pulse 650ms ease-out;
}

body.welcome-anonymous .fb-local-login {
    margin-top: 0.5rem;
    padding-top: 1.25rem;
    border-top-color: var(--fbhd-line);
    transition: opacity 320ms ease, transform 320ms var(--fbhd-ease), display 320ms allow-discrete;
}

@starting-style {
    body.welcome-anonymous .fb-local-login:not([hidden]) {
        opacity: 0;
        transform: translateY(-8px);
    }
}

body.welcome-anonymous .page-anonymous .form-label {
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
    letter-spacing: 0;
    text-transform: none;
}

body.welcome-anonymous .page-anonymous :is(.form-control, .form-select, .select2-selection) {
    min-height: 2.9rem;
    border-color: var(--fbhd-control);
    border-radius: 8px !important;
}

body.welcome-anonymous .page-anonymous .form-control:focus-visible {
    border-color: var(--fbhd-green-text);
    box-shadow: 0 0 0 3px rgb(30 201 91 / 25%);
}

body.welcome-anonymous .page-anonymous .btn-primary {
    min-height: 3rem;
    border-radius: 8px;
    letter-spacing: 0;
    text-transform: none;
    touch-action: manipulation;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 200ms var(--fbhd-ease);
}

body.welcome-anonymous .page-anonymous .btn-primary:active {
    transform: scale(0.99);
}

body.welcome-anonymous .page-anonymous .forgot_password a {
    color: var(--fbhd-green-text);
    font-weight: 700;
}

/* ---- The frame: logo at the top, the form in the middle, the fine print
 * at the foot. The form's container fills the column's height; the logo
 * opens it, the form takes the middle (auto margins), two lines of fine print
 * close it. All three stay in the same container, so they share its left
 * edge at every width. On phones the sheet reads from the top instead. The
 * fine print's block also holds GLPI's hidden cron trigger, so it is moved,
 * not rebuilt; js/login.js puts Fb's notice in front of GLPI's. */

body.welcome-anonymous .page-anonymous > .flex-fill {
    padding-block: 0 !important;
}

body.welcome-anonymous .page-anonymous .container-tight {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding-block: clamp(1.75rem, 6vh, 3.25rem) 0 !important;
}

/* As flex items they would shrink to their content; they keep the width
 * (and the 25rem cap) they had as blocks. */
body.welcome-anonymous .page-anonymous .container-tight > * {
    width: 100%;
}

body.welcome-anonymous .page-anonymous .main-content-card {
    margin-block: auto !important;
}

/* Quiet, but readable: #5f786d is 4.8:1 on white, above WCAG AA's 4.5:1 for
 * text this small, in both layouts. */
body.welcome-anonymous main .text-muted:has(> .copyright) {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.5rem;
    max-width: 25rem;
    margin: 0 auto !important;
    padding: 2rem 0.5rem 0;
    color: #5f786d !important;
    font-size: 0.75rem;
    line-height: 1.5;
    text-align: start !important;
    animation: fbhd-login-fade 600ms ease 300ms both;
}

/* The company's notice fills the first line; the team and GLPI share the second. */
body.welcome-anonymous main .fbhd-legal {
    flex-basis: 100%;
    color: var(--fbhd-muted);
    font-weight: 500;
}

body.welcome-anonymous main .copyright {
    margin: 0;
    color: inherit;
    font-size: inherit;
    text-decoration: none;
}

body.welcome-anonymous main .copyright:hover {
    color: var(--fbhd-green-text);
}

/* Below 1200px GLPI's link gets a finger-sized target, 44px tall, without
 * moving a line: it reaches down into the empty space under the last line
 * (above it is the rest of the fine print). Its focus ring stays around the
 * words. From 1200px the fine print runs up the page's edge instead. */
@media (max-width: 1199.98px) {
    body.welcome-anonymous main .copyright {
        position: relative;
        padding-block-end: calc(44px - 1lh);
        margin-block-end: calc(1lh - 44px);
    }

    body.welcome-anonymous main .copyright:focus-visible {
        outline: 0;
    }

    body.welcome-anonymous main .copyright:focus-visible::after {
        content: "";
        position: absolute;
        inset: 0 0 calc(44px - 1lh);
        border-radius: inherit;
        outline: 2px solid var(--fbhd-green-text);
        outline-offset: 2px;
    }
}

/* From 1200px the fine print leaves the column and runs up the page's left
 * edge, bottom to top, like a photo credit: the column holds only the logo
 * and the form. A window too short for one line wraps it into a second.
 * Below 1200px the margin beside the form is too narrow for it, and it stays
 * at the column's foot; phones keep it at the foot of the sheet. */
@media (min-width: 1200px) {
    body.welcome-anonymous main .text-muted:has(> .copyright) {
        position: fixed;
        z-index: 2;
        bottom: calc(var(--fbhd-band) + 1.5rem);
        left: 1.4rem;
        width: auto;
        max-width: none;
        max-inline-size: calc(100vh - var(--fbhd-band) - 3rem);
        margin: 0 !important;
        padding: 0;
        gap: 0.5rem 0.5rem;
        font-size: 0.6875rem;
        letter-spacing: 0.04em;
        white-space: nowrap;
        writing-mode: vertical-rl;
        transform: rotate(180deg);
    }

    body.welcome-anonymous main .fbhd-legal {
        flex-basis: auto;
        margin-inline-end: 0.4rem;
        font-weight: 600;
    }
}

body.welcome-anonymous :is(a, button, input, select, [tabindex]):focus-visible {
    outline: 2px solid var(--fbhd-green-text);
    outline-offset: 2px;
}

/* ---- Wide: form on white, photograph on the right ------------------------ */

@media (min-width: 992px) {
    /* The photograph reaches a little into the empty margin beside the form
     * (--fbhd-bleed) and fades in across that margin and the plain wall
     * after it (--fbhd-fade). Three things keep the fade from looking like a
     * sheet laid over the page:
     * - The picture reaches beyond the window at the top and the bottom: its
     *   ceiling strip showed through the fade, and its floor did at the
     *   foot. The block band is the floor now.
     * - The curve is ease-in-out: a straight one leaves a visible stripe.
     * - Racing Green is laid over the wall within it. That part of the wall
     *   lies in shadow, nearly black, and fading black into white passes
     *   through grey; with the green it passes through tints of the brand
     *   green.
     * Both widths shrink with the room there is: the margin beside the 25rem
     * form, and the wall before the photograph's own line. That line starts
     * about 62vh from the right edge: the 16:9 picture is scaled to 115% of
     * the window's height and pushed 6vh past the right edge, which only
     * cuts into the window frame there. */
    body.welcome-anonymous {
        --fbhd-bleed: clamp(0px, (100vw - var(--fbhd-photo) - 25rem) / 2 - 2.5rem, 6rem);
        --fbhd-fade: calc(var(--fbhd-bleed) + clamp(4rem, (var(--fbhd-photo) - 62vh) * 0.6, 20rem));
        --fbhd-ramp: linear-gradient(to right,
            rgb(0 0 0 / 0%) 0%, rgb(0 0 0 / 1.3%) 8.1%, rgb(0 0 0 / 4.9%) 15.5%,
            rgb(0 0 0 / 10.4%) 22.5%, rgb(0 0 0 / 17.5%) 29%, rgb(0 0 0 / 25.9%) 35.3%,
            rgb(0 0 0 / 35.2%) 41.2%, rgb(0 0 0 / 45%) 47.1%, rgb(0 0 0 / 55%) 52.9%,
            rgb(0 0 0 / 64.8%) 58.8%, rgb(0 0 0 / 74.1%) 64.7%, rgb(0 0 0 / 82.5%) 71%,
            rgb(0 0 0 / 89.6%) 77.5%, rgb(0 0 0 / 95.1%) 84.5%, rgb(0 0 0 / 98.7%) 91.9%,
            #000 100%);
    }

    body.welcome-anonymous .page-anonymous {
        margin-inline: 0 var(--fbhd-photo);
        padding-bottom: calc(var(--fbhd-band) + 1.5rem);
    }

    body.welcome-anonymous::before {
        content: "";
        position: fixed;
        inset-block: -12vh -3vh;
        inset-inline: auto 0;
        width: calc(var(--fbhd-photo) + var(--fbhd-bleed));
        background:
            linear-gradient(to right, var(--fbhd-deep), transparent) 0 0 / var(--fbhd-fade) 100% no-repeat,
            url("../img/login-1920.jpg") calc(100% + 6vh) 100% / cover no-repeat,
            var(--fbhd-deep);
        /* The ramp over the first --fbhd-fade, solid after it (1px overlap,
         * so no hairline where the two layers meet). */
        -webkit-mask:
            var(--fbhd-ramp) 0 0 / var(--fbhd-fade) 100% no-repeat,
            linear-gradient(#000 0 0) 100% 0 / calc(100% - var(--fbhd-fade) + 1px) 100% no-repeat;
        mask:
            var(--fbhd-ramp) 0 0 / var(--fbhd-fade) 100% no-repeat,
            linear-gradient(#000 0 0) 100% 0 / calc(100% - var(--fbhd-fade) + 1px) 100% no-repeat;
        animation: fbhd-login-photo 1600ms var(--fbhd-ease) both;
    }

    /* The block band of the guide's Identity spreads, along the whole foot
     * of the page as on those spreads: the floor the plants stand on, under
     * the form as much as under the photograph. */
    body.welcome-anonymous::after {
        content: "";
        position: fixed;
        z-index: 1;
        inset-inline: 0;
        bottom: 0;
        height: var(--fbhd-band);
        background:
            radial-gradient(circle calc(var(--fbhd-band) * 0.32) at 86.1% 52%, var(--fbhd-red) calc(100% - 0.75px), transparent calc(100% + 0.75px)),
            linear-gradient(to right, var(--fbhd-deep) 0 16.3%, var(--fbhd-green) 16.3% 22.8%, var(--fb-grey, #f3f3f3) 22.8% 48.2%, #fff 48.2% 100%);
        animation: fbhd-login-wipe 1100ms var(--fbhd-ease-in-out) 350ms both;
    }

    /* The dot sits at 17.84% of the picture's height from its right edge and
     * 65.19% from its bottom (both photographs). The picture is 115vh tall,
     * or wider than 16:9 allows, and reaches 6vh past the right edge and 3vh
     * below the window. */
    body.welcome-anonymous .fbhd-dot {
        --fbhd-img-h: max(115vh, (var(--fbhd-photo) + var(--fbhd-bleed)) * 0.5625);
        right: calc(var(--fbhd-img-h) * 0.1784 - 6vh - 22px);
        bottom: calc(var(--fbhd-img-h) * 0.6519 - 3vh - 22px);
    }

    /* fbbranding hides the marked-up logo because its panel carried one. */
    body.welcome-anonymous .glpi-logo {
        display: block;
    }
}

/* ---- Narrow: the photograph as a band on top, the form on a sheet over it */

@media (max-width: 991.98px) {
    body.welcome-anonymous {
        --fbhd-photo-h: clamp(13rem, 36vh, 20rem);
        background-color: var(--fbhd-deep) !important;
    }

    body.welcome-anonymous::before {
        content: "";
        position: absolute;
        inset: 0 0 auto;
        height: calc(var(--fbhd-photo-h) + 2rem);
        background: url("../img/login-1280.jpg") 100% 38% / cover no-repeat, var(--fbhd-deep);
        animation: fbhd-login-photo 1400ms var(--fbhd-ease) both;
        /* The zoom it enters with is anchored where the picture is. From the
         * middle it grew past the right edge, and this band, unlike the
         * fixed photograph on wide screens, is in the page: a phone made the
         * page up to 10px wider for it. Past the left edge nothing scrolls. */
        transform-origin: 100% 38%;
    }

    /* The dot in the band: the picture fills its width or height, stands
     * right, and 38% of what does not fit is cut off at the top. */
    body.welcome-anonymous .fbhd-dot {
        --fbhd-band-h: calc(var(--fbhd-photo-h) + 2rem);
        --fbhd-img-h: max(var(--fbhd-band-h), 100vw * 0.5625);
        position: absolute;
        right: calc(var(--fbhd-img-h) * 0.1784 - 22px);
        top: calc((var(--fbhd-band-h) - var(--fbhd-img-h)) * 0.38 + var(--fbhd-img-h) * 0.3481 - 22px);
    }

    /* fbbranding's narrow band; the photograph does its job here. */
    body.welcome-anonymous::after {
        content: none;
    }

    /* The sheet starts where the photograph ends and reads from the top. */
    body.welcome-anonymous .page-anonymous {
        position: relative;
        z-index: 1;
        min-height: calc(100dvh - var(--fbhd-photo-h));
        margin-top: var(--fbhd-photo-h);
        padding: 2rem max(1rem, env(safe-area-inset-left)) calc(1.75rem + env(safe-area-inset-bottom));
        border-radius: 22px 22px 0 0;
        background: #fff;
        box-shadow: 0 -12px 32px -18px rgb(0 0 0 / 55%);
        justify-content: flex-start;
        animation: fbhd-login-sheet 700ms var(--fbhd-ease) both;
    }


    body.welcome-anonymous .page-anonymous > .flex-fill {
        flex: 1 1 auto !important;
        justify-content: flex-start !important;
    }

    /* The sheet reads from the top: the form right under the logo, the fine
     * print pushed to the sheet's foot. */
    body.welcome-anonymous .page-anonymous .main-content-card {
        margin-block: 0 auto !important;
    }

    body.welcome-anonymous .page-anonymous > .flex-fill,
    body.welcome-anonymous .page-anonymous .container-tight {
        padding-block: 0 !important;
    }

    body.welcome-anonymous .page-anonymous .glpi-logo {
        width: 4.5rem;
        height: 4.5rem;
        margin-bottom: 1.5rem;
    }
}

/* "Mit Microsoft Entra anmelden" on one line, down to 360px phones. */
@media (max-width: 420px) {
    body.welcome-anonymous .page-anonymous .en-sso__button {
        padding-inline: 0.75rem;
        font-size: 0.875rem;
    }
}

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

@keyframes fbhd-login-rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes fbhd-login-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fbhd-login-photo {
    from {
        opacity: 0;
        transform: scale(1.05);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes fbhd-login-wipe {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0 0 0 0); }
}

@keyframes fbhd-dot-pulse {
    from {
        opacity: 0.9;
        transform: scale(0.7);
    }

    to {
        opacity: 0;
        transform: scale(2.2);
    }
}

@keyframes fbhd-login-sheet {
    from { transform: translateY(24px); }
    to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    body.welcome-anonymous *,
    body.welcome-anonymous *::before,
    body.welcome-anonymous *::after,
    body.welcome-anonymous::before,
    body.welcome-anonymous::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ---- Automatic sign-in --------------------------------------------------- */

/*
 * The screen the Entra plugin shows while Edge signs in by itself: on the
 * sign-in page instead of the form, and on its "Angemeldet" page after
 * Microsoft (Entra's Sso\AutoSignInPage). That second page is not a GLPI page
 * and has no body.welcome-anonymous, but it links this stylesheet so the two
 * frames match. Every rule is therefore written for both bodies,
 * body.welcome-anonymous (the sign-in page, where the script moves the screen
 * to the body) and body.en-auto-page (that callback page), and takes
 * fbbranding's tokens directly: the --fbhd-* ones live on the sign-in body only.
 *
 * The page's own language: the logo on white, the headline in Montserrat
 * Black with the red full stop, and the block band along the foot, which here
 * is the progress bar.
 */
body.welcome-anonymous .en-auto,
body.en-auto-page .en-auto {
    --en-auto-bg: #fff;
    --en-auto-fg: var(--fb-deep, #043623);
    --en-auto-muted: #4a665b;
    --en-auto-accent: var(--fb-green, #1ec95b);
    --en-auto-font: var(--fb-font-body, "Fb Montserrat", "Segoe UI", system-ui, sans-serif);
    --fbhd-auto-band: clamp(22px, 2.4vw, 36px);
    padding-block-end: calc(var(--fbhd-auto-band) + 2rem);
}

body.welcome-anonymous .en-auto__body,
body.en-auto-page .en-auto__body {
    gap: 0;
    max-inline-size: 40rem;
}

/* The full-colour lockup on white, the logo's primary use (guide p.7). */
body.welcome-anonymous .en-auto__body::before,
body.en-auto-page .en-auto__body::before {
    content: "";
    display: block;
    inline-size: 5.75rem;
    block-size: 5.75rem;
    margin-block-end: 2.5rem;
    background: url("../../fbbranding/img/logo.svg") center / contain no-repeat;
    animation: en-auto-rise 700ms var(--en-auto-ease) both;
}

body.welcome-anonymous .en-auto--resume .en-auto__body::before,
body.en-auto-page .en-auto--resume .en-auto__body::before {
    animation: none;
}

/* Microsoft's squares move into the line under the headline, small. */
body.welcome-anonymous .en-auto__mark,
body.en-auto-page .en-auto__mark {
    display: none;
}

body.welcome-anonymous .en-auto__title,
body.en-auto-page .en-auto__title {
    font-size: clamp(2rem, 1.25rem + 2.4vw, 3.25rem);
    font-weight: 900;
    line-height: 1.02;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    text-wrap: balance;
}

body.welcome-anonymous .en-auto__state::after,
body.en-auto-page .en-auto__state::after {
    content: ".";
    color: var(--fb-red, #fa4646);
}

body.welcome-anonymous .en-auto__note,
body.en-auto-page .en-auto__note {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
    margin-block-start: 1.25rem;
    font-size: 1rem;
    font-weight: 500;
}

body.welcome-anonymous .en-auto__note::before,
body.en-auto-page .en-auto__note::before {
    content: "";
    flex: 0 0 auto;
    inline-size: 14px;
    block-size: 14px;
    background:
        linear-gradient(#f25022 0 0) 0 0 / 6px 6px no-repeat,
        linear-gradient(#7fba00 0 0) 8px 0 / 6px 6px no-repeat,
        linear-gradient(#00a4ef 0 0) 0 8px / 6px 6px no-repeat,
        linear-gradient(#ffb900 0 0) 8px 8px / 6px 6px no-repeat;
}

/* The band: Fb's two greens running along the grey floor while Microsoft
 * answers, then Vibrant Green across the whole width once signed in. */
body.welcome-anonymous .en-auto__progress,
body.en-auto-page .en-auto__progress {
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    inline-size: auto;
    block-size: var(--fbhd-auto-band);
    margin: 0;
    border-radius: 0;
    background: var(--fb-grey, #f3f3f3);
    animation: fbhd-auto-band-in 900ms var(--en-auto-ease) both;
}

body.welcome-anonymous .en-auto--resume .en-auto__progress,
body.en-auto-page .en-auto--resume .en-auto__progress {
    animation: none;
}

body.welcome-anonymous .en-auto__bar,
body.en-auto-page .en-auto__bar {
    inline-size: 28%;
    border-radius: 0;
    background: linear-gradient(to right, var(--fb-deep, #043623) 0 72%, var(--fb-green, #1ec95b) 72% 100%);
    animation: fbhd-auto-run 1500ms cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

/* On the callback page the running block would restart at the left edge; it
 * stays out of sight there until the fill sweeps in. */
body.welcome-anonymous .en-auto--resume[data-state="working"] .en-auto__bar,
body.en-auto-page .en-auto--resume[data-state="working"] .en-auto__bar {
    visibility: hidden;
}

body.welcome-anonymous .en-auto[data-state="done"] .en-auto__bar,
body.en-auto-page .en-auto[data-state="done"] .en-auto__bar {
    inline-size: 100%;
    background: var(--fb-green, #1ec95b);
    animation: fbhd-auto-fill 520ms var(--en-auto-ease) both;
    transform-origin: left center;
}

@keyframes fbhd-auto-band-in {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0); }
}

@keyframes fbhd-auto-run {
    from { transform: translateX(-100%); }
    to { transform: translateX(360%); }
}

@keyframes fbhd-auto-fill {
    from { transform: scaleX(0); }
    to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    body.welcome-anonymous .en-auto__body::before,
    body.en-auto-page .en-auto__body::before,
    body.welcome-anonymous .en-auto__progress,
    body.en-auto-page .en-auto__progress {
        animation: none;
    }

    body.welcome-anonymous .en-auto__bar,
    body.en-auto-page .en-auto__bar {
        inline-size: 100%;
        background: var(--fb-deep, #043623);
        animation: en-auto-glow 1600ms ease-in-out infinite alternate;
    }
}
