/*
 * The small wait: two rings of smoke rising in turn, in currentColor (lib/busy.js).
 * A busy button (.btn, or .busy-host set by busy()) keeps its width: the label goes transparent, the puff takes the
 * icon slot in the middle. .puff-ring is the same puff inline (a rating saving, a picker list loading). The big hookah
 * loader (lib/loading.js) is for whole content areas only. Loaded by the app and by the EasyAdmin pages.
 */
.puff-ring { position: relative; display: inline-block; flex: none; width: 20px; height: 20px; vertical-align: middle; }

.btn[aria-busy="true"], .busy-host[aria-busy="true"] { pointer-events: none; -webkit-text-fill-color: transparent; }
.busy-host[aria-busy="true"] { position: relative; }
.btn[aria-busy="true"] > *, .busy-host[aria-busy="true"] > * { opacity: 0; }

.puff-ring::before, .puff-ring::after,
.btn[aria-busy="true"]::before, .btn[aria-busy="true"]::after,
.busy-host[aria-busy="true"]::before, .busy-host[aria-busy="true"]::after,
.ea-edit button[class*="action-save"][disabled]::after, .ea-new button[class*="action-save"][disabled]::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 14px;
    height: 7px;
    margin: auto;
    border: 2px solid currentColor;
    border-radius: 50%;
    box-shadow: 0 0 3px color-mix(in oklab, currentColor 45%, transparent), inset 0 0 2px color-mix(in oklab, currentColor 30%, transparent);
    opacity: 0;
    pointer-events: none;
    animation: puff-rise 1.6s cubic-bezier(0.25, 0.6, 0.35, 1) infinite;
}
.puff-ring::after, .btn[aria-busy="true"]::after, .busy-host[aria-busy="true"]::after { animation-delay: -0.8s; }

/* EasyAdmin disables its save buttons while the form is sent: the label fades under one rising ring. */
.ea-edit button[class*="action-save"][disabled], .ea-new button[class*="action-save"][disabled] { position: relative; -webkit-text-fill-color: transparent; }
.ea-edit button[class*="action-save"][disabled] > *, .ea-new button[class*="action-save"][disabled] > * { opacity: 0; }

@keyframes puff-rise {
    0% { opacity: 0; transform: translateY(6px) scale(0.35); border-width: 3px; }
    25% { opacity: 0.95; }
    100% { opacity: 0; transform: translateY(-7px) scale(1.3); border-width: 1px; }
}
@keyframes puff-glow { from { opacity: 0.35; } to { opacity: 0.9; } }

@media (prefers-reduced-motion: reduce) {
    .puff-ring::before, .btn[aria-busy="true"]::before, .busy-host[aria-busy="true"]::before,
    .ea-edit button[class*="action-save"][disabled]::after, .ea-new button[class*="action-save"][disabled]::after { animation: puff-glow 1.2s ease-in-out infinite alternate; }
    .puff-ring::after, .btn[aria-busy="true"]::after, .busy-host[aria-busy="true"]::after { display: none; }
}
