/* The sign-in and sign-out transition of the EBD design: a sheet in the
   topbar's own navy. It grows down from the bar along the top of the page,
   and rolls back up to exactly that bar, so on arrival it becomes the portal's
   topbar (or the login page's bar after signing out).

   web/js/page-transition.js is shared with the old design: it waits for the
   keyframes named page-transition-cover-exit, and gives up after 800 ms on the
   login page and 1900 ms in the portal, so both exits end before that. */

.page-transition {
    --pt-bar: 64px; /* .topbar and .ebd-login__bar */
    --pt-ease: cubic-bezier(.65, 0, .35, 1);
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(105deg, #1e3a8a 0%, #243f91 54%, #2f50a9 100%);
    clip-path: inset(0 0 calc(100% - var(--pt-bar)) 0);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: clip-path .32s var(--pt-ease), opacity .1s ease, visibility .1s ease;
}

.page-transition__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .24s ease .08s, transform .24s ease .08s;
}

.page-transition__mark {
    position: relative;
    display: grid;
    width: 112px;
    height: 112px;
    margin-bottom: 22px;
    place-items: center;
}

.page-transition__mark svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.page-transition__hex {
    fill: #fff;
    stroke: rgba(255, 255, 255, .2);
    stroke-width: 7;
    stroke-linejoin: round;
}

.page-transition__sweep {
    fill: none;
    stroke: #71d7ef;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 20 80;
    animation: page-transition-sweep 1.5s linear infinite;
}

.page-transition__logo {
    position: relative;
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.page-transition__content p {
    margin: 0;
    color: #fff;
    font-family: "Space Grotesk", sans-serif;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -.01em;
}

.page-transition__caption {
    margin-top: 8px;
    color: rgba(219, 240, 247, .65);
    font-family: "Space Grotesk", sans-serif;
    font-size: 10px;
    letter-spacing: .18em;
}

.page-transition.is-active {
    clip-path: inset(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.page-transition.is-active .page-transition__content {
    opacity: 1;
    transform: translateY(0);
}

/* Arriving: the sheet is already down, the same as it left the last page. */
html.login-entrance-pending .page-transition,
html.workspace-entrance-pending .page-transition {
    clip-path: inset(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

html.login-entrance-pending .page-transition__content,
html.workspace-entrance-pending .page-transition__content {
    opacity: 1;
    transform: translateY(0);
}

html.login-entrance-pending .page-transition {
    animation: page-transition-cover-exit .5s var(--pt-ease) .12s forwards;
}

html.login-entrance-pending .page-transition__content {
    animation: page-transition-content-exit .16s ease .12s forwards;
}

html.workspace-entrance-pending .page-transition {
    animation: page-transition-cover-exit .56s var(--pt-ease) .7s forwards;
}

html.workspace-entrance-pending .page-transition__content {
    animation: page-transition-content-exit .18s ease .7s forwards;
}

/* The last stretch is a fade: the sheet has reached the bar, and only the
   corner over the sidebar's brand still has something to uncover. */
@keyframes page-transition-cover-exit {
    0% {
        clip-path: inset(0);
        opacity: 1;
        visibility: visible;
    }

    84% {
        clip-path: inset(0 0 calc(100% - var(--pt-bar)) 0);
        opacity: 1;
        visibility: visible;
    }

    100% {
        clip-path: inset(0 0 calc(100% - var(--pt-bar)) 0);
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes page-transition-content-exit {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes page-transition-sweep {
    to {
        stroke-dashoffset: -100;
    }
}

@media (max-width: 575.98px) {
    .page-transition {
        --pt-bar: 60px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .page-transition,
    .page-transition__content {
        transition-duration: .01ms !important;
        transition-delay: 0ms !important;
        animation-duration: .01ms !important;
        animation-delay: 0ms !important;
    }

    .page-transition__sweep {
        animation: none !important;
    }
}
