/* ==========================================================================
   SPLASH_BOX.CSS - Ultra-Elegant Minimalist Glass Loading Experience
   Modern, sleek, and refined presentation for web applications
   
   COLOR THEME SYSTEM
   Dynamically inherits from --brand-primary (injected from config.json)
   or falls back gracefully to a polished, premium sapphire tone.
   ========================================================================== */

/* Theme Variables & Atmosphere */
body.splash-page:has(.mud-wasm-cont) {
    /* Primary accent color from config / brand */
    --primary-accent: var(--brand-primary, #1976D2);
    /* Derived tonal spectrum */
    --splash-accent-soft: color-mix(in srgb, var(--primary-accent) 75%, white 25%);
    --splash-accent-glow: color-mix(in srgb, var(--primary-accent) 55%, transparent 45%);
    --splash-accent-deep: color-mix(in srgb, var(--primary-accent) 45%, #050811 55%);
    /* Premium dark canvas layers */
    --bg-canvas: #090c14;
    --bg-layer-1: color-mix(in srgb, var(--primary-accent) 14%, #07090e);
    --bg-layer-2: color-mix(in srgb, var(--primary-accent) 8%, #04060a);
    /* Glass card tokens */
    --glass-surface: linear-gradient( 145deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 60%, rgba(255, 255, 255, 0.04) 100% );
    --glass-inner-tint: color-mix(in srgb, var(--primary-accent) 9%, rgba(13, 17, 23, 0.82));
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-border-top: rgba(255, 255, 255, 0.24);
    /* Typography */
    --text-primary: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.72);
    /* Elegant, deep atmospheric background */
    background-color: var(--bg-canvas);
    background-image: radial-gradient(ellipse 90% 70% at 50% -10%, color-mix(in srgb, var(--primary-accent) 26%, transparent 74%), transparent 70%), radial-gradient(ellipse 70% 50% at 50% 110%, color-mix(in srgb, var(--primary-accent) 18%, transparent 82%), transparent 70%), linear-gradient(180deg, var(--bg-layer-1) 0%, var(--bg-layer-2) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

    /* Subtle atmospheric luminous ambient behind the scene */
    body.splash-page:has(.mud-wasm-cont)::before {
        content: "";
        position: fixed;
        top: 50%;
        left: 50%;
        width: clamp(340px, 70vw, 750px);
        height: clamp(340px, 70vw, 750px);
        transform: translate(-50%, -50%);
        background: radial-gradient(circle, var(--splash-accent-glow) 0%, transparent 68%);
        filter: blur(80px);
        opacity: 0.35;
        pointer-events: none;
        z-index: 0;
        animation: ambientDrift 10s ease-in-out infinite alternate;
    }

@keyframes ambientDrift {
    0% {
        transform: translate(-50%, -50%) scale(0.92);
        opacity: 0.28;
    }

    100% {
        transform: translate(-50%, -52%) scale(1.08);
        opacity: 0.42;
    }
}

/* Body and root defaults */
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: "Montserrat", "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100vh;
}

/* ==========================================================================
   GLASS MORPHISM CARD CONTAINER
   ========================================================================== */

.mud-wasm-cont {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    box-sizing: border-box;
    width: min(88vw, 420px);
    padding: 2.75rem 2.5rem 2.25rem;
    /* Frosted glass layers */
    background: var(--glass-surface), var(--glass-inner-tint);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    /* Fine-grain precision borders */
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-border-top);
    border-radius: 28px;
    /* Sophisticated deep ambient shadows & inner bevel */
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.65), 0 10px 24px -8px rgba(0, 0, 0, 0.4), 0 0 70px -15px color-mix(in srgb, var(--primary-accent) 22%, transparent), inset 0 1px 0 0 rgba(255, 255, 255, 0.16), inset 0 -1px 0 0 rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    z-index: 10;
    /* Graceful entrance */
    animation: cardEntrance 0.85s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardEntrance {
    0% {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.96);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Subtle, breathing card halo */
.mud-wasm-cont::before {
    content: "";
    position: absolute;
    inset: -12px;
    border-radius: 36px;
    background: radial-gradient( ellipse at center, color-mix(in srgb, var(--primary-accent) 25%, transparent) 0%, transparent 72% );
    filter: blur(24px);
    opacity: 0.6;
    z-index: -1;
    pointer-events: none;
    animation: haloPulse 6s ease-in-out infinite alternate;
}

@keyframes haloPulse {
    0% {
        opacity: 0.45;
        transform: scale(0.98);
    }

    100% {
        opacity: 0.8;
        transform: scale(1.02);
    }
}

/* ==========================================================================
   LOGO STYLING - REFINED & WEIGHTLESS
   ========================================================================== */

.splash-logo {
    width: clamp(190px, 42vmin, 280px);
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    /* Gentle, weightless levitation - no tilting/wobble */
    animation: logoLevitate 4.5s ease-in-out infinite alternate;
    /* Crisp drop shadow & gentle primary accent bloom */
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 28px color-mix(in srgb, var(--primary-accent) 35%, transparent));
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: default;
    user-select: none;
    -webkit-user-drag: none;
}

@keyframes logoLevitate {
    0% {
        transform: translateY(0px);
    }

    100% {
        transform: translateY(-7px);
    }
}

.splash-logo:hover {
    transform: translateY(-9px) scale(1.02);
    filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 36px color-mix(in srgb, var(--primary-accent) 55%, transparent));
}

/* ==========================================================================
   PROGRESS BAR - SLEEK PRECISION DESIGN
   ========================================================================== */

.loader-progress {
    width: clamp(200px, 46vmin, 280px);
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    overflow: hidden;
    margin: 0.25rem auto 0;
    position: relative;
    /* Track refinement */
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(255, 255, 255, 0.04);
}

    /* Progress Fill */
    .loader-progress .loader-bar {
        width: 0%;
        height: 100%;
        background: linear-gradient( 90deg, color-mix(in srgb, var(--primary-accent) 80%, black 20%) 0%, var(--primary-accent) 50%, var(--splash-accent-soft) 100% );
        border-radius: inherit;
        position: relative;
        /* Luminous glow along the line */
        box-shadow: 0 0 14px color-mix(in srgb, var(--primary-accent) 65%, transparent), 0 0 4px rgba(255, 255, 255, 0.4);
        transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    }

        /* Smooth gloss shimmer travelling through the progress bar */
        .loader-progress .loader-bar::after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient( 90deg, transparent 0%, rgba(255, 255, 255, 0.5) 50%, transparent 100% );
            background-size: 200% 100%;
            animation: barShimmer 2.2s infinite ease-in-out;
            border-radius: inherit;
        }

@keyframes barShimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Subtle luminous beacon at the leading tip */
.loader-progress .loader-bar::before {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 8px #ffffff, 0 0 16px var(--splash-accent-soft);
    opacity: 0.9;
}

/* ==========================================================================
   PERCENTAGE & STATUS TEXT - TYPOGRAPHIC ELEGANCE
   ========================================================================== */

.loader-percent {
    margin-top: -0.25rem;
    color: var(--text-muted);
    font-family: "Montserrat", "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(12px, 2.2vmin, 13px);
    font-weight: 500;
    letter-spacing: 0.12em;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    transition: color 0.3s ease;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .mud-wasm-cont {
        padding: 2.25rem 2rem 1.85rem;
        width: min(88vw, 380px);
        gap: 1.35rem;
        border-radius: 24px;
    }

    .splash-logo {
        width: clamp(165px, 42vmin, 240px);
    }

    .loader-progress {
        width: clamp(175px, 46vmin, 240px);
        height: 4.5px;
    }

    .loader-percent {
        font-size: 12px;
        letter-spacing: 0.1em;
    }
}

@media (max-width: 480px) {
    .mud-wasm-cont {
        padding: 2rem 1.6rem 1.6rem;
        width: min(92vw, 330px);
        gap: 1.2rem;
        border-radius: 22px;
    }

    .splash-logo {
        width: clamp(150px, 48vmin, 200px);
    }

    .loader-progress {
        width: clamp(150px, 52vw, 200px);
        height: 4px;
    }

    .loader-percent {
        font-size: 11px;
    }
}

/* ==========================================================================
   ACCESSIBILITY & PREFERENCES
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .splash-logo {
        animation: none !important;
    }

    body.splash-page:has(.mud-wasm-cont)::before,
    .mud-wasm-cont::before,
    .loader-progress .loader-bar::after {
        animation: none !important;
    }
}

@media (prefers-contrast: high) {
    .mud-wasm-cont {
        background: #000000;
        border: 2px solid #ffffff;
        box-shadow: none;
    }

    .loader-progress {
        background: #222222;
        border: 1px solid #ffffff;
    }

    .loader-bar {
        background: #ffffff !important;
        box-shadow: none !important;
    }

    .loader-percent {
        color: #ffffff;
        font-weight: 700;
    }
}
