/*
 * Movement for the web panels (administrator and every partner portal), matching the apps: the same short durations and the same ease-out.
 * Paint and opacity only: nothing here changes the size, spacing or position of anything once it has settled. All of it is switched off when
 * the computer asks for reduced motion.
 */
:root {
    --rd-fast: 150ms;
    --rd-base: 250ms;
    --rd-ease: cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* A page arrives once, when it loads. Livewire updates inside it do not replay this. */
@keyframes rd-arrive {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

body.portal main,
.fi-main {
    /* "backwards" only: when it has run there is no transform left, which would otherwise trap fixed-position dialogs inside the page */
    animation: rd-arrive var(--rd-base) var(--rd-ease) backwards;
}

/* Things that answer the pointer ease rather than snap. */
body.portal a,
body.portal button,
body.portal input,
body.portal select,
body.portal textarea {
    transition: background-color var(--rd-fast) var(--rd-ease), border-color var(--rd-fast) var(--rd-ease), color var(--rd-fast) var(--rd-ease),
        box-shadow var(--rd-fast) var(--rd-ease), opacity var(--rd-fast) var(--rd-ease), transform var(--rd-fast) var(--rd-ease);
}

body.portal button:not(:disabled):active,
body.portal a[class*="bg-"]:active {
    transform: scale(0.98);
}

/* A thin bar across the top while something the person asked for is on its way (see partials/motion). */
@keyframes rd-slide {
    from { transform: translateX(-100%); }
    to { transform: translateX(300%); }
}

html::before {
    content: "";
    position: fixed;
    inset: 0 auto auto 0;
    width: 33%;
    height: 3px;
    background: #ffa500;
    opacity: 0;
    pointer-events: none;
    z-index: 100000;
}

html.rd-busy::before {
    opacity: 1;
    /* only when it takes long enough to be worth saying */
    transition: opacity var(--rd-fast) linear 200ms;
    animation: rd-slide 1.1s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    body.portal main,
    .fi-main { animation: none; }

    body.portal a,
    body.portal button,
    body.portal input,
    body.portal select,
    body.portal textarea { transition: none; }

    body.portal button:not(:disabled):active,
    body.portal a[class*="bg-"]:active { transform: none; }

    html.rd-busy::before { animation: none; width: 100%; opacity: 0.6; }
}
