/* ─────────────────────────────────────────────────────────────
   Healixa loading overlay
   • Centers the brand letters in the viewport (flex centering)
   • Wave bounce on letters with a soft staggered delay
   • Breathing halo glow + accent progress bar underneath
   • Respects prefers-reduced-motion
   ───────────────────────────────────────────────────────────── */

/* Hidden by default, becomes a centered overlay when body.loading */
.loading-a {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    /* Centering primitives — applied as soon as the overlay becomes flex */
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 28px;
}

[data-theme="dark"] .loading-a {
    background: rgba(13, 13, 13, .82);
}

body.loading {
    overflow: hidden;
}

body.loading .loading-a {
    display: flex;
    animation: loadingFadeIn 0.18s ease-out;
}

@keyframes loadingFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Halo: a soft breathing glow behind the wordmark ── */
.loading-a__halo {
    position: absolute;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(254, 159, 67, 0.22) 0%,
        rgba(254, 159, 67, 0.08) 40%,
        rgba(254, 159, 67, 0) 70%
    );
    pointer-events: none;
    animation: loadingHaloPulse 2.4s ease-in-out infinite;
}

@keyframes loadingHaloPulse {
    0%, 100% { transform: scale(1);    opacity: .85; }
    50%      { transform: scale(1.08); opacity: 1;   }
}

/* ── Brand: letter row, centered, with relative anchor for letters ── */
.loading-a__brand {
    position: relative;
    display: inline-flex;
    align-items: flex-end;
    gap: 4px;
    z-index: 1;
    /* Reserve vertical space so the bouncing transform doesn't clip the page  */
    padding: 30px 0;
}

/* ── Letters ── */
.loading-a-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    font-weight: 800;
    font-size: 36px;
    line-height: 1;
    color: #fff;
    /* Soft tinted glow so each letter feels lit by the halo */
    box-shadow: 0 6px 14px -4px var(--lc, rgba(0, 0, 0, .35));
    will-change: transform;
}

/* Wave bounce — staggered by nth-child */
.loading-a-item {
    animation: loadingBounce 0.9s cubic-bezier(.5, 0, .5, 1) infinite;
}
.loading-a-item:nth-child(1) { animation-delay: 0.00s; }
.loading-a-item:nth-child(2) { animation-delay: 0.08s; }
.loading-a-item:nth-child(3) { animation-delay: 0.16s; }
.loading-a-item:nth-child(4) { animation-delay: 0.24s; }
.loading-a-item:nth-child(5) { animation-delay: 0.32s; }
.loading-a-item:nth-child(6) { animation-delay: 0.40s; }
.loading-a-item:nth-child(7) { animation-delay: 0.48s; }

@keyframes loadingBounce {
    0%, 60%, 100% {
        transform: translateY(0) scale(1, 1);
    }
    20% {
        transform: translateY(-22px) scale(0.95, 1.08);
    }
    40% {
        transform: translateY(0) scale(1.08, 0.92);
    }
}

/* ── Progress bar — accent-colored sliver under the wordmark ── */
.loading-a__progress {
    position: relative;
    width: 220px;
    height: 3px;
    border-radius: 999px;
    background: rgba(254, 159, 67, 0.18);
    overflow: hidden;
    z-index: 1;
}

.loading-a__progress > span {
    position: absolute;
    inset: 0;
    width: 40%;
    border-radius: inherit;
    background: linear-gradient(90deg,
        rgba(254, 159, 67, 0) 0%,
        #FE9F43 50%,
        rgba(254, 159, 67, 0) 100%);
    animation: loadingProgressSlide 1.4s cubic-bezier(.4, .1, .3, 1) infinite;
}

[dir="rtl"] .loading-a__progress > span {
    animation-name: loadingProgressSlideRtl;
}

@keyframes loadingProgressSlide {
    0%   { left: -40%; }
    100% { left: 100%; }
}

@keyframes loadingProgressSlideRtl {
    0%   { left: 100%; }
    100% { left: -40%; }
}

/* ── Reduced motion: settle into a calm pulse ── */
@media (prefers-reduced-motion: reduce) {
    .loading-a-item {
        animation: loadingPulseCalm 1.6s ease-in-out infinite;
    }
    .loading-a__halo {
        animation-duration: 4s;
    }
    .loading-a__progress > span {
        animation-duration: 2.2s;
    }
    @keyframes loadingPulseCalm {
        0%, 100% { transform: scale(1);    opacity: 1;  }
        50%      { transform: scale(1.04); opacity: .8; }
    }
}
