/* /Components/Layout/ReconnectModal.razor.rz.scp.css */
/* Scoped, and therefore unlayered: these rules sit above every layer in
   app.css by design, because they belong to this component alone. */

.components-reconnect-first-attempt-visible[b-9jxi76foya],
.components-reconnect-repeated-attempt-visible[b-9jxi76foya],
.components-reconnect-failed-visible[b-9jxi76foya],
.components-pause-visible[b-9jxi76foya],
.components-resume-failed-visible[b-9jxi76foya],
.components-rejoining-animation[b-9jxi76foya] {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible[b-9jxi76foya],
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation[b-9jxi76foya],
#components-reconnect-modal.components-reconnect-paused .components-pause-visible[b-9jxi76foya],
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible[b-9jxi76foya],
#components-reconnect-modal.components-reconnect-retrying[b-9jxi76foya],
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible[b-9jxi76foya],
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation[b-9jxi76foya],
#components-reconnect-modal.components-reconnect-failed[b-9jxi76foya],
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible[b-9jxi76foya] {
    display: block;
}

#components-reconnect-modal[b-9jxi76foya] {
    inline-size: 20rem;
    margin: 20vh auto;
    padding: var(--s-6);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-raised);
    color: var(--ink);
    box-shadow: var(--shadow-modal);
    opacity: 0;
    transition: display 0.5s allow-discrete, overlay 0.5s allow-discrete;
    animation: components-reconnect-modal-fadeOutOpacity-b-9jxi76foya 0.5s both;

    &[open] {
        animation:
            components-reconnect-modal-slideUp-b-9jxi76foya 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s,
            components-reconnect-modal-fadeInOpacity-b-9jxi76foya 0.5s ease-in-out 0.3s;
        animation-fill-mode: both;
    }
}

#components-reconnect-modal[b-9jxi76foya]::backdrop {
    background: oklch(0.15 0.01 258 / 0.55);
    animation: components-reconnect-modal-fadeInOpacity-b-9jxi76foya 0.5s ease-in-out;
    opacity: 1;
}

@keyframes components-reconnect-modal-slideUp-b-9jxi76foya {
    0%   { transform: translateY(30px) scale(0.95); }
    100% { transform: translateY(0); }
}

@keyframes components-reconnect-modal-fadeInOpacity-b-9jxi76foya {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes components-reconnect-modal-fadeOutOpacity-b-9jxi76foya {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

.components-reconnect-container[b-9jxi76foya] {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-4);
}

#components-reconnect-modal p[b-9jxi76foya] {
    margin: 0;
    text-align: center;
    text-wrap: balance;
}

/* The rejoining indicator is the one place motion runs unprompted, and
   it is doing real work: it says the connection is still being tried. */
.components-rejoining-animation[b-9jxi76foya] {
    position: relative;
    inline-size: 80px;
    block-size: 80px;
}

.components-rejoining-animation div[b-9jxi76foya] {
    position: absolute;
    border: 2px solid var(--accent);
    border-radius: 50%;
    opacity: 1;
    animation: components-rejoining-animation-b-9jxi76foya 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.components-rejoining-animation div:nth-child(2)[b-9jxi76foya] {
    animation-delay: -0.5s;
}

@keyframes components-rejoining-animation-b-9jxi76foya {
    0%,
    4.9% { top: 40px; left: 40px; width: 0;    height: 0;    opacity: 0; }
    5%   { top: 40px; left: 40px; width: 0;    height: 0;    opacity: 1; }
    100% { top: 0;    left: 0;    width: 80px; height: 80px; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    #components-reconnect-modal[b-9jxi76foya],
    #components-reconnect-modal[open][b-9jxi76foya],
    #components-reconnect-modal[b-9jxi76foya]::backdrop {
        animation-duration: 1ms;
    }

    .components-rejoining-animation div[b-9jxi76foya] {
        animation-duration: 3s;
        animation-timing-function: linear;
    }
}
