/* ==========================================================================
   Lafinda PWA Branded Launch Screen (Splash / Loading Experience)
   ========================================================================== */

.pwa-splash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: #0b1b3c;
    background-image: radial-gradient(circle at 50% 42%, #142d5e 0%, #0b1b3c 100%);
    z-index: 999999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    opacity: 1;
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.28s ease;
    will-change: opacity;
}

/* Active state triggered during early PWA boot */
html.pwa-splash-active .pwa-splash,
.pwa-splash.is-active {
    display: flex !important;
}

/* Smooth exit fade */
.pwa-splash.is-dismissing {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Center brand stage */
.pwa-splash__stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1.5rem;
    max-width: 90vw;
}

/* Lafinda brand logo */
.pwa-splash__logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    min-height: 140px;
    animation: splashLogoEntrance 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.pwa-splash__logo {
    width: 140px;
    height: 140px;
    max-width: 55vw;
    max-height: 55vw;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.35));
    display: block;
}

.pwa-splash__fallback-text {
    font-size: 2.25rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
    display: none;
}

.pwa-splash__fallback-text span {
    color: #FE6A07;
}

/* Minimal sleek loading bar */
.pwa-splash__loader {
    width: 44px;
    height: 3px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.pwa-splash__loader-bar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 50%;
    background: linear-gradient(90deg, #FE6A07, #ff8c3a);
    border-radius: 999px;
    animation: splashProgress 1.1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Subtle entrance & loader keyframes */
@keyframes splashLogoEntrance {
    0% {
        opacity: 0;
        transform: scale(0.94) translateY(4px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes splashProgress {
    0% {
        left: -50%;
        width: 30%;
    }
    50% {
        width: 60%;
    }
    100% {
        left: 100%;
        width: 30%;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .pwa-splash {
        transition: opacity 0.15s linear !important;
    }
    .pwa-splash__logo-wrap {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .pwa-splash__loader-bar {
        animation-duration: 2s !important;
    }
}
