/* Loading screen, shared by the Web and Maui hosts (their index.html markup is identical).
   Plain CSS, no JS: it paints before .NET starts, and Blazor replaces <app>'s content when it
   renders. A fixed brand colour, not tied to light/dark, so there is no colour change on
   load. The colour matches the MAUI native splash (MauiSplashScreen Color in the Maui csproj
   and maui_splash_color on Android); change them together. */

:root {
    --splash-bg: var(--ra-brand, #E73155);
}

.splash-main {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--splash-bg);
    z-index: 99999;
    overflow: hidden;
}

/* Build version, faded in at the bottom right (filled in by index.html from version.json). */
.splash-version {
    position: absolute;
    bottom: max(12px, env(safe-area-inset-bottom));
    right: 16px;
    color: #fff;
    opacity: 0.55;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    pointer-events: none;
    user-select: none;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 1.6rem;
}

.logo-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.splash-logo {
    border-radius: 26px;
    position: relative;
    filter: none !important;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.splash-title {
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-align: center;
    margin: 0;
    opacity: 0;
    animation: splash-fade-in 1s ease-out 0.3s forwards;
}

@keyframes splash-fade-in {
    to {
        opacity: 1;
    }
}

/* Progress bar: Blazor WebAssembly sets --blazor-load-percentage(-text) while it downloads. */
.splash-meter {
    width: 100%;
    padding: 1rem 0 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.meter-track {
    height: 6px;
    width: 100%;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 2px;
    overflow: hidden;
}

.meter-bar {
    display: block;
    height: 100%;
    width: var(--blazor-load-percentage, 0%);
    background: rgba(255, 255, 255, 0.85);
    border-radius: 2px;
    transition: width 0.3s ease-out;
}

.meter-label {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.meter-label::after {
    content: var(--blazor-load-percentage-text, 0%);
}

/* The MAUI WebView doesn't report download progress, so its splash uses a moving bar and no percentage. */
.splash-meter.indeterminate .meter-bar {
    width: 30%;
    transition: none;
    animation: splash-bar-slide 1.4s ease-in-out infinite;
}

.splash-meter.indeterminate .meter-label {
    display: none;
}

@keyframes splash-bar-slide {
    0% {
        transform: translateX(-110%);
    }

    100% {
        transform: translateX(340%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .splash-title {
        animation: none;
        opacity: 1;
    }

    .splash-meter.indeterminate .meter-bar {
        animation: none;
        width: 100%;
        opacity: 0.5;
    }
}
