/**
 * rz-page-loader.css — enterprise brand loader (namespaced rz-pl- / #rz-pl-*).
 * Animations use transform + opacity only for compositor-friendly 60fps motion.
 * Enter / loop animations are gated by #rz-pl-overlay.rz-pl-anim so JS can replay them.
 */

#rz-pl-overlay {
    --rz-pl-blue: #2563EB;
    --rz-pl-blue-mid: #3B82F6;
    --rz-pl-blue-deep: #1E40AF;
    --rz-pl-navy: #1E3A8A;
    --rz-pl-ink: #0F172A;
    --rz-pl-muted: #64748B;
    /* Glass veil: page stays subtly visible under the loader */
    --rz-pl-veil: rgba(255, 255, 255, 0.42);
    --rz-pl-veil-fallback: rgba(255, 255, 255, 0.78);
    --rz-pl-glass-blur: 10px;

    position: fixed;
    inset: 0;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    /* Fallback first (no backdrop-filter); enhanced below via @supports */
    background: var(--rz-pl-veil-fallback);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    /* Avoid paint/isolation containment that blocks backdrop-filter */
    contain: layout style;
    overflow: hidden;
    will-change: opacity;
    -webkit-font-smoothing: antialiased;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    #rz-pl-overlay {
        background: var(--rz-pl-veil);
        -webkit-backdrop-filter: blur(var(--rz-pl-glass-blur)) saturate(1.08);
        backdrop-filter: blur(var(--rz-pl-glass-blur)) saturate(1.08);
    }
}

#rz-pl-overlay.rz-pl-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#rz-pl-overlay.rz-pl-exiting {
    opacity: 0;
    visibility: visible;
    pointer-events: none;
}

#rz-pl-overlay.rz-pl-exiting .rz-pl-stage {
    transform: scale(0.97) translate3d(0, 6px, 0);
    opacity: 0.7;
    transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

html.rz-pl-lock,
html.rz-pl-lock body {
    overflow: hidden !important;
}

/* ── Background ── */
.rz-pl-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.rz-pl-bg-mesh {
    position: absolute;
    inset: -10%;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.035) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
    opacity: 0;
}

.rz-pl-bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0;
    will-change: transform, opacity;
}

.rz-pl-bg-glow--a {
    width: min(520px, 70vw);
    height: min(520px, 70vw);
    left: 50%;
    top: 42%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.18) 0%, transparent 68%);
    transform: translate3d(-50%, -50%, 0);
}

.rz-pl-bg-glow--b {
    width: min(280px, 50vw);
    height: min(280px, 50vw);
    left: 22%;
    top: 68%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
}

.rz-pl-bg-glow--c {
    width: min(260px, 45vw);
    height: min(260px, 45vw);
    right: 18%;
    top: 22%;
    left: auto;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.09) 0%, transparent 70%);
}

/* ── Particles ── */
.rz-pl-particles {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.rz-pl-particles i {
    position: absolute;
    display: block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--rz-pl-blue-mid);
    opacity: 0;
    bottom: 8%;
    will-change: transform, opacity;
}

.rz-pl-particles i:nth-child(1)  { left: 10%; }
.rz-pl-particles i:nth-child(2)  { left: 18%; width: 2px; height: 2px; }
.rz-pl-particles i:nth-child(3)  { left: 28%; }
.rz-pl-particles i:nth-child(4)  { left: 36%; width: 4px; height: 4px; }
.rz-pl-particles i:nth-child(5)  { left: 45%; }
.rz-pl-particles i:nth-child(6)  { left: 52%; width: 2px; height: 2px; }
.rz-pl-particles i:nth-child(7)  { left: 60%; }
.rz-pl-particles i:nth-child(8)  { left: 68%; width: 4px; height: 4px; }
.rz-pl-particles i:nth-child(9)  { left: 74%; }
.rz-pl-particles i:nth-child(10) { left: 80%; width: 2px; height: 2px; }
.rz-pl-particles i:nth-child(11) { left: 86%; }
.rz-pl-particles i:nth-child(12) { left: 92%; }
.rz-pl-particles i:nth-child(13) { left: 14%; width: 2px; height: 2px; }
.rz-pl-particles i:nth-child(14) { left: 42%; }
.rz-pl-particles i:nth-child(15) { left: 56%; width: 4px; height: 4px; }
.rz-pl-particles i:nth-child(16) { left: 78%; }

/* ── Stage ── */
.rz-pl-stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    width: min(320px, 100%);
    text-align: center;
    /* Keep logo / type / meter crisp above the glass layer */
    isolation: isolate;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform, opacity;
}

.rz-pl-core {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.rz-pl-halo {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

.rz-pl-halo--outer {
    inset: 0;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.16) 0%, transparent 68%);
}

.rz-pl-halo--mid {
    inset: 18px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.22) 0%, transparent 70%);
}

.rz-pl-halo--inner {
    inset: 36px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.28) 0%, transparent 72%);
    filter: blur(8px);
}

.rz-pl-orbit-svg {
    position: absolute;
    inset: 0;
    width: 160px;
    height: 160px;
    color: var(--rz-pl-blue);
    opacity: 0;
}

.rz-pl-orbit-track {
    stroke: rgba(37, 99, 235, 0.1);
    stroke-width: 1;
}

.rz-pl-orbit-spin {
    transform-box: view-box;
    transform-origin: center;
    will-change: transform;
}

.rz-pl-orbit-arc {
    stroke-linecap: round;
    stroke-width: 1.75;
}

.rz-pl-orbit-arc--a {
    stroke: var(--rz-pl-blue);
    stroke-dasharray: 70 360;
    opacity: 0.85;
}

.rz-pl-orbit-arc--b {
    stroke: var(--rz-pl-blue-mid);
    stroke-dasharray: 40 320;
    opacity: 0.55;
}

.rz-pl-orbit-dot {
    fill: currentColor;
    opacity: 0.95;
}

.rz-pl-logo-wrap {
    position: relative;
    z-index: 2;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    opacity: 0;
    will-change: transform, opacity;
}

.rz-pl-logo-shadow {
    position: absolute;
    inset: 6px -2px -8px;
    border-radius: 20px;
    background: rgba(30, 58, 138, 0.28);
    filter: blur(12px);
    z-index: 0;
}

.rz-pl-logo {
    position: relative;
    z-index: 1;
    display: block;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    object-fit: cover;
    box-shadow:
        0 12px 32px rgba(30, 58, 138, 0.28),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.rz-pl-logo-shine {
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: 18px;
    overflow: hidden;
    pointer-events: none;
}

.rz-pl-logo-shine::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        115deg,
        transparent 35%,
        rgba(255, 255, 255, 0.35) 50%,
        transparent 65%
    );
    transform: translate3d(-130%, 0, 0);
}

.rz-pl-brand {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
}

.rz-pl-title {
    margin: 0;
    font-family: Poppins, Inter, system-ui, -apple-system, sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--rz-pl-ink);
    line-height: 1.2;
}

.rz-pl-subtitle {
    margin: 6px 0 0;
    font-family: Inter, Poppins, system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 450;
    letter-spacing: 0.02em;
    color: var(--rz-pl-muted);
    line-height: 1.35;
}

.rz-pl-meter {
    width: min(168px, 52vw);
    opacity: 0;
    transform: translate3d(0, 8px, 0);
}

.rz-pl-meter-track {
    position: relative;
    height: 3px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.rz-pl-meter-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 38%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        var(--rz-pl-navy),
        var(--rz-pl-blue),
        var(--rz-pl-blue-mid)
    );
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.45);
    will-change: transform;
}

.rz-pl-status {
    margin: 0;
    min-height: 1.2em;
    font-family: Inter, system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--rz-pl-muted);
    letter-spacing: 0.01em;
    opacity: 0;
    transform: translate3d(0, 8px, 0);
}

/* ═══════════════════════════════════════════
   Multi-stage enter + idle (gated by .rz-pl-anim)
   Stage 1 (~0–0.4s): core + logo
   Stage 2 (~0.35–0.7s): orbits + glow
   Stage 3 (~0.5–0.85s): brand + meter + status
   Then continuous idle loops
   ═══════════════════════════════════════════ */
#rz-pl-overlay.rz-pl-anim .rz-pl-bg-mesh {
    animation: rz-pl-fade-in 0.8s ease 0.1s both;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-bg-glow--a {
    animation:
        rz-pl-fade-in 0.9s ease 0.05s both,
        rz-pl-glow-breathe 4.5s ease-in-out 0.9s infinite;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-bg-glow--b {
    animation:
        rz-pl-fade-in 1s ease 0.2s both,
        rz-pl-drift-a 9s ease-in-out 1s infinite alternate;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-bg-glow--c {
    animation:
        rz-pl-fade-in 1s ease 0.25s both,
        rz-pl-drift-b 11s ease-in-out 1.2s infinite alternate;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-particles i {
    animation: rz-pl-particle 8s linear infinite;
}
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(1)  { animation-delay: 0s;    animation-duration: 7.5s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(2)  { animation-delay: 1.2s;  animation-duration: 9s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(3)  { animation-delay: 0.4s;  animation-duration: 8.2s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(4)  { animation-delay: 2.1s;  animation-duration: 10s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(5)  { animation-delay: 0.8s;  animation-duration: 7.8s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(6)  { animation-delay: 1.7s;  animation-duration: 8.6s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(7)  { animation-delay: 0.2s;  animation-duration: 9.4s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(8)  { animation-delay: 2.5s;  animation-duration: 7.2s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(9)  { animation-delay: 1.0s;  animation-duration: 8.8s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(10) { animation-delay: 0.6s;  animation-duration: 9.8s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(11) { animation-delay: 1.9s;  animation-duration: 7.6s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(12) { animation-delay: 0.9s;  animation-duration: 10.2s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(13) { animation-delay: 3.0s;  animation-duration: 8.4s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(14) { animation-delay: 2.8s;  animation-duration: 9.1s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(15) { animation-delay: 3.3s;  animation-duration: 7.9s; }
#rz-pl-overlay.rz-pl-anim .rz-pl-particles i:nth-child(16) { animation-delay: 2.2s;  animation-duration: 8.7s; }

#rz-pl-overlay.rz-pl-anim .rz-pl-core {
    animation: rz-pl-core-in 0.85s cubic-bezier(0.16, 1, 0.3, 1) both;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-halo--outer {
    animation: rz-pl-halo-pulse 3.2s ease-in-out 0.6s infinite;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-halo--mid {
    animation: rz-pl-halo-pulse 2.6s ease-in-out 0.9s infinite;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-halo--inner {
    animation: rz-pl-halo-pulse 2.2s ease-in-out 1.1s infinite;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-orbit-svg {
    animation: rz-pl-fade-in 0.7s ease 0.35s both;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-orbit-spin--a {
    animation: rz-pl-spin 2.4s linear infinite;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-orbit-spin--b {
    animation: rz-pl-spin-rev 3.6s linear infinite;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-orbit-spin--dot {
    animation: rz-pl-spin 3s linear infinite;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-logo-wrap {
    animation:
        rz-pl-logo-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both,
        rz-pl-logo-float 4s ease-in-out 1.1s infinite;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-logo-shadow {
    animation: rz-pl-shadow-breathe 4s ease-in-out 1.1s infinite;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-logo-shine::after {
    animation: rz-pl-shine 3.4s ease-in-out 1.4s infinite;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-brand {
    animation: rz-pl-rise 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.45s both;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-meter {
    animation: rz-pl-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.62s both;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-meter-fill {
    animation: rz-pl-meter-sweep 1.65s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

#rz-pl-overlay.rz-pl-anim .rz-pl-status {
    animation: rz-pl-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.72s both;
}

/* ── Keyframes ── */
@keyframes rz-pl-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rz-pl-rise {
    from { opacity: 0; transform: translate3d(0, 12px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes rz-pl-core-in {
    from { opacity: 0; transform: scale(0.88); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes rz-pl-logo-in {
    from { opacity: 0; transform: scale(0.78) translate3d(0, 10px, 0); }
    to { opacity: 1; transform: scale(1) translate3d(0, 0, 0); }
}

@keyframes rz-pl-logo-float {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(0, -5px, 0); }
}

@keyframes rz-pl-shadow-breathe {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.06); }
}

@keyframes rz-pl-shine {
    0%, 60% { transform: translate3d(-140%, 0, 0); }
    85%, 100% { transform: translate3d(140%, 0, 0); }
}

@keyframes rz-pl-halo-pulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

@keyframes rz-pl-glow-breathe {
    0%, 100% { opacity: 0.75; transform: translate3d(-50%, -50%, 0) scale(1); }
    50% { opacity: 1; transform: translate3d(-50%, -50%, 0) scale(1.08); }
}

@keyframes rz-pl-drift-a {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(18px, -14px, 0); }
}

@keyframes rz-pl-drift-b {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(-16px, 12px, 0); }
}

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

@keyframes rz-pl-spin-rev {
    to { transform: rotate(-360deg); }
}

@keyframes rz-pl-particle {
    0%   { transform: translate3d(0, 20px, 0) scale(0.6); opacity: 0; }
    12%  { opacity: 0.5; }
    70%  { opacity: 0.18; }
    100% { transform: translate3d(14px, -105vh, 0) scale(1); opacity: 0; }
}

@keyframes rz-pl-meter-sweep {
    0%   { transform: translate3d(-120%, 0, 0); }
    100% { transform: translate3d(320%, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
    #rz-pl-overlay,
    #rz-pl-overlay.rz-pl-exiting {
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }
    #rz-pl-overlay.rz-pl-exiting .rz-pl-stage {
        transition: none;
        transform: none;
        opacity: 1;
    }
    #rz-pl-overlay.rz-pl-anim .rz-pl-bg-mesh,
    #rz-pl-overlay.rz-pl-anim .rz-pl-bg-glow,
    #rz-pl-overlay.rz-pl-anim .rz-pl-particles i,
    #rz-pl-overlay.rz-pl-anim .rz-pl-halo,
    #rz-pl-overlay.rz-pl-anim .rz-pl-orbit-svg,
    #rz-pl-overlay.rz-pl-anim .rz-pl-orbit-spin,
    #rz-pl-overlay.rz-pl-anim .rz-pl-logo-wrap,
    #rz-pl-overlay.rz-pl-anim .rz-pl-logo-shadow,
    #rz-pl-overlay.rz-pl-anim .rz-pl-logo-shine::after,
    #rz-pl-overlay.rz-pl-anim .rz-pl-core,
    #rz-pl-overlay.rz-pl-anim .rz-pl-brand,
    #rz-pl-overlay.rz-pl-anim .rz-pl-meter,
    #rz-pl-overlay.rz-pl-anim .rz-pl-meter-fill,
    #rz-pl-overlay.rz-pl-anim .rz-pl-status {
        animation: none !important;
    }
    .rz-pl-bg-mesh,
    .rz-pl-bg-glow--a,
    .rz-pl-orbit-svg,
    .rz-pl-logo-wrap,
    .rz-pl-core,
    .rz-pl-brand,
    .rz-pl-meter,
    .rz-pl-status {
        opacity: 1;
        transform: none;
    }
    .rz-pl-bg-glow--a {
        transform: translate3d(-50%, -50%, 0);
        opacity: 0.85;
    }
    .rz-pl-particles { display: none; }
    .rz-pl-logo-shine { display: none; }
    .rz-pl-meter-fill {
        width: 42%;
        left: 29%;
        transform: none;
    }
}

@media (max-width: 480px) {
    .rz-pl-core,
    .rz-pl-orbit-svg {
        width: 140px;
        height: 140px;
    }
    .rz-pl-logo-wrap,
    .rz-pl-logo {
        width: 64px;
        height: 64px;
        border-radius: 16px;
    }
    .rz-pl-title { font-size: 1.35rem; }
    .rz-pl-halo--mid { inset: 14px; }
    .rz-pl-halo--inner { inset: 30px; }
}
