/* ============================================================
   CMR Splash / Boot screen — before Blazor mounts
   Uses hardcoded brand colors (Mud tokens not ready yet).
   ============================================================ */

.cmr-splash {
    --splash-primary: #2BA8A2;
    --splash-primary-dark: #1E8C86;
    --splash-primary-soft: rgba(43, 168, 162, 0.12);
    --splash-bg-top: #f4fbfa;
    --splash-bg-bottom: #eef5f4;
    --splash-text: #0a0a0a;
    --splash-text-muted: #5c6b6a;
    --splash-track: rgba(10, 10, 10, 0.08);
    --splash-glow: rgba(43, 168, 162, 0.18);

    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    padding: 1.5rem;
    box-sizing: border-box;
    font-family: "Vazirmatn", "iranyekan", system-ui, sans-serif;
    color: var(--splash-text);
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, var(--splash-glow), transparent 55%),
        linear-gradient(165deg, var(--splash-bg-top) 0%, var(--splash-bg-bottom) 100%);
    transition: opacity 280ms cubic-bezier(0.4, 0, 0.2, 1), visibility 280ms;
}

html[data-theme="dark"] .cmr-splash {
    --splash-primary: #3CC4BD;
    --splash-primary-dark: #2BA8A2;
    --splash-primary-soft: rgba(60, 196, 189, 0.14);
    --splash-bg-top: #0f1414;
    --splash-bg-bottom: #0a0e0e;
    --splash-text: #f5f5f5;
    --splash-text-muted: #9aabb0;
    --splash-track: rgba(255, 255, 255, 0.1);
    --splash-glow: rgba(60, 196, 189, 0.14);
}

.cmr-splash--done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.cmr-splash__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    animation: cmr-splash-enter 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cmr-splash__mark {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--splash-primary) 0%, var(--splash-primary-dark) 100%);
    box-shadow:
        0 2px 6px rgba(43, 168, 162, 0.25),
        0 8px 24px rgba(43, 168, 162, 0.18);
    margin-bottom: 0.5rem;
    animation: cmr-splash-mark 2.4s ease-in-out infinite;
}

.cmr-splash__mark svg {
    width: 32px;
    height: 32px;
    fill: #fff;
}

.cmr-splash__title {
    margin: 0;
    font-size: clamp(1.5rem, 4vw, 1.875rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--splash-text);
}

.cmr-splash__subtitle {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--splash-text-muted);
    line-height: 1.5;
}

.cmr-splash__progress {
    width: min(280px, 72vw);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: cmr-splash-enter 420ms cubic-bezier(0.22, 1, 0.36, 1) 80ms both;
}

.cmr-splash__bar {
    height: 3px;
    border-radius: 9999px;
    background: var(--splash-track);
    overflow: hidden;
}

.cmr-splash__bar-fill {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--splash-primary), var(--splash-primary-dark));
    transition: width 180ms linear;
    box-shadow: 0 0 12px var(--splash-glow);
}

.cmr-splash__status {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--splash-text-muted);
    letter-spacing: 0.01em;
}

.cmr-splash__percent {
    font-variant-numeric: tabular-nums;
    color: var(--splash-primary-dark);
    min-width: 2.5em;
    text-align: end;
}

html[data-theme="dark"] .cmr-splash__percent {
    color: var(--splash-primary);
}

html[dir="ltr"] .cmr-splash__percent {
    text-align: start;
}

@keyframes cmr-splash-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cmr-splash-mark {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 2px 6px rgba(43, 168, 162, 0.25),
            0 8px 24px rgba(43, 168, 162, 0.18);
    }
    50% {
        transform: scale(1.03);
        box-shadow:
            0 2px 8px rgba(43, 168, 162, 0.3),
            0 12px 28px rgba(43, 168, 162, 0.28);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cmr-splash__brand,
    .cmr-splash__progress,
    .cmr-splash__mark {
        animation: none;
    }

    .cmr-splash {
        transition: none;
    }

    .cmr-splash__bar-fill {
        transition: none;
    }
}
