/*
 * The three Materialize widgets this site actually used, rewritten by hand:
 * the preloader, the indeterminate progress bar, the toast and the tooltip.
 * Behaviour for the last two lives in js/ui.js.
 */

/* preloader, replacing Materialize .preloader-wrapper */

.spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid var(--border-strong);
    border-top-color: var(--accent-strong);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.spinner-sm {
    width: 1.1rem;
    height: 1.1rem;
    border-width: 2px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* indeterminate progress bar, replacing Materialize .progress */

.progress {
    position: relative;
    height: 6px;
    margin: 1.5rem 0;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 25%, var(--surface));
}

.progress .bar {
    position: absolute;
    inset-block: 0;
    width: 40%;
    border-radius: inherit;
    background: var(--accent-strong);
    animation: slide 1.6s ease-in-out infinite;
}

@keyframes slide {
    0% {
        left: -40%;
    }

    100% {
        left: 100%;
    }
}

/* toast, replacing Materialize.toast */

.toast-stack {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    translate: -50% 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    align-items: center;
    pointer-events: none;
}

.toast {
    background: #323232;
    color: #fff;
    padding: .7rem 1.1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-2);
    font-size: .9rem;
    max-width: min(90vw, 30rem);
    animation: toast-in var(--speed) ease;
}

.toast.is-leaving {
    opacity: 0;
    transition: opacity var(--speed) ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        translate: 0 .5rem;
    }
}

/* tooltip, replacing $.fn.tooltip and driven by the same data-tooltip attributes */

.tooltip {
    position: absolute;
    z-index: 1100;
    max-width: 18rem;
    padding: .4rem .6rem;
    border-radius: var(--radius-sm);
    background: #323232;
    color: #fff;
    font-size: .78rem;
    line-height: 1.35;
    pointer-events: none;
    box-shadow: var(--shadow-2);
}
