/* FILE: wwwroot/css/splash.css
   PURPOSE: Ecrã de splash branded que cobre a app enquanto o Blazor arranca.
            Removido via JS (classe .splash--hidden) após OnAfterRenderAsync.
   TOKENS:  atlântico profundo + dourado-farol.
   AI-NOTE: Premium e leve (só CSS, sem imagens pesadas): gradiente atlântico em
            movimento lento, halo dourado, logótipo com entrada elástica, barra de
            progresso indeterminada. Transição de saída 380ms. Respeita reduced-motion. */

#app-splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);

    /* Gradiente atlântico profundo com variação subtil de tonalidade */
    background: linear-gradient(160deg, #06283b 0%, #0B4F6C 48%, #0e6a8f 100%);
    background-size: 200% 200%;
    animation: splash-pan 9s ease-in-out infinite alternate;

    /* Transição de saída */
    transition: opacity .38s ease, visibility .38s ease;
}

@keyframes splash-pan {
    from { background-position: 0% 0%; }
    to   { background-position: 100% 100%; }
}

#app-splash.splash--hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Halo dourado suave atrás do logótipo — profundidade sem ruído */
.splash__halo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 420px;
    height: 420px;
    transform: translate(-50%, -56%);
    background: radial-gradient(circle, rgba(255, 209, 102, .20) 0%, rgba(255, 209, 102, .06) 38%, transparent 68%);
    filter: blur(10px);
    pointer-events: none;
}

.splash__content {
    position: relative;
    z-index: 2; /* acima das ondas */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    padding: 0 24px;
    /* sobe um pouco para não colidir com as ondas da base */
    transform: translateY(-4vh);
}

/* Logo oficial pequeno dentro de um "chip" de vidro — evita o aspeto de autocolante
   branco colado no azul e disfarça a baixa resolução (mostramos a 56px, perto do nativo). */
.splash__logo {
    line-height: 0;
    display: grid;
    place-items: center;
    padding: 12px;
    border-radius: 22px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .14);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .38);
    animation: splash-logo-in .6s cubic-bezier(.34,1.4,.64,1) both;
}

.splash__logo img {
    width: 56px;
    height: 54px;
    border-radius: 14px; /* suaviza os cantos quadrados da imagem */
    display: block;
}

@keyframes splash-logo-in {
    from { transform: scale(.72) translateY(8px); opacity: 0; }
    to   { transform: scale(1)    translateY(0);   opacity: 1; }
}

/* Wordmark tipográfico nítido (não é imagem → nítido em qualquer ecrã). */
.splash__wordmark {
    font-weight: 800;
    font-size: 2.1rem;
    letter-spacing: -.8px;
    line-height: 1;
    color: #fff;
    text-shadow: 0 2px 14px rgba(0, 0, 0, .35);
    opacity: 0;
    animation: splash-fade-up .45s ease .18s forwards;
}

.splash__wordmark .splash__dot { color: #FFD166; }

/* "life" em itálico dourado — eco do wordmark oficial */
.splash__wordmark em {
    font-style: italic;
    font-weight: 700;
    color: #FFD166;
}

.splash__tagline {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .66);
    opacity: 0;
    animation: splash-fade-up .45s ease .3s forwards;
}

@keyframes splash-fade-up {
    from { transform: translateY(10px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Barra de progresso indeterminada — mais premium e informativa que um spinner */
.splash__bar {
    width: 148px;
    height: 3px;
    margin-top: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    overflow: hidden;
    opacity: 0;
    animation: splash-fade-up .45s ease .42s forwards;
}

.splash__bar span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #FFD166, #ffb648);
    animation: splash-bar 1.05s ease-in-out infinite;
}

@keyframes splash-bar {
    0%   { transform: translateX(-110%); }
    100% { transform: translateX(280%); }
}

/* ── Ondas na base — duas camadas em deriva horizontal suave (parallax) ── */
.splash__ondas {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 150px;
    z-index: 1;
    pointer-events: none;
}

.splash__onda {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;           /* duplicada para deriva contínua sem corte */
    height: 100%;
}

.splash__onda path { fill: rgba(255, 255, 255, .08); }

.splash__onda--tras {
    animation: splash-deriva 12s linear infinite;
}

.splash__onda--frente {
    animation: splash-deriva 7s linear infinite reverse;
}

.splash__onda--frente path { fill: rgba(255, 255, 255, .14); }

@keyframes splash-deriva {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* Acessibilidade: desliga animações para quem prefere menos movimento */
@media (prefers-reduced-motion: reduce) {
    #app-splash { animation: none; }
    .splash__logo, .splash__wordmark, .splash__tagline, .splash__bar { animation: none; opacity: 1; }
    .splash__bar span { animation: none; width: 100%; }
    .splash__onda { animation: none; }
}
