/* ==========================================================================
   MIPSICOGESTIÓN — SPLASH SCREEN NATIVO & 3D FLOATING BRAIN ANIMATION
   ========================================================================== */

/* Prevenir parpadeo si ya se mostró en esta sesión */
html.splash-already-seen #mipsico-splash {
    display: none !important;
}

.mipsico-splash {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: #0B0E14;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.55s cubic-bezier(0.4, 0, 0.2, 1),
                filter 0.55s ease,
                visibility 0.55s ease;
}

.mipsico-splash--dismiss {
    opacity: 0 !important;
    transform: scale(1.04) !important;
    filter: blur(6px) !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Fondo con halo sutil bioluminiscente */
.mipsico-splash__backdrop {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.mipsico-splash__halo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 520px;
    height: 520px;
    background: radial-gradient(circle at center, 
        rgba(13, 148, 136, 0.16) 0%, 
        rgba(168, 85, 247, 0.12) 38%, 
        rgba(11, 14, 20, 0) 70%);
    border-radius: 50%;
    animation: splashHaloPulse 3s ease-in-out infinite alternate;
}

@keyframes splashHaloPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.7;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 1;
    }
}

/* Contenedor central */
.mipsico-splash__container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 20px;
    text-align: center;
}

/* Envoltorio del Logo 3D */
.mipsico-splash__logo-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Animación combinada: primero aparece en el medio, luego comprime y sube */
    animation: splashLogoMotion 1.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    transform-origin: center center;
}

/* Imagen del cerebro 3D flotante */
.mipsico-splash__brain {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 10px 30px rgba(13, 148, 136, 0.45)) 
            drop-shadow(0 0 50px rgba(192, 132, 252, 0.35));
    /* Flotación levitante 3D continua */
    animation: splashBrainHover 2.6s ease-in-out infinite alternate;
}

/* Resplandor extra bajo el cerebro */
.mipsico-splash__glow {
    position: absolute;
    width: 100px;
    height: 30px;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(13, 148, 136, 0.5) 0%, rgba(11, 14, 20, 0) 75%);
    border-radius: 50%;
    filter: blur(6px);
    pointer-events: none;
    animation: splashShadowPulse 2.6s ease-in-out infinite alternate;
}

/* Bloque de texto y título */
.mipsico-splash__text-wrap {
    opacity: 0;
    transform: translateY(28px) scale(0.92);
    margin-top: 18px;
    animation: splashTextReveal 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.75s forwards;
    pointer-events: none;
}

.mipsico-splash__title {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 0;
    padding: 0;
    /* Gradiente plateado con reflejos cian/esmeralda */
    background: linear-gradient(135deg, #FFFFFF 25%, #E2E8F0 60%, #67E8F9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 14px rgba(255, 255, 255, 0.2));
}

.mipsico-splash__subtitle {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #94A3B8;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 8px;
    opacity: 0.9;
}

/* ==========================================================================
   KEYFRAMES DE ANIMACIÓN
   ========================================================================== */

/* 
   Secuencia del Logo:
   - 0% a 45%: El logo aparece grande y centrado en la pantalla (escala 1.1 -> 1.0).
   - 55% a 100%: Se comprime ligeramente en tamaño (escala 0.8) mientras se desplaza hacia arriba (-45px).
*/
@keyframes splashLogoMotion {
    0% {
        opacity: 0;
        transform: translateY(25px) scale(1.18);
    }
    45% {
        opacity: 1;
        transform: translateY(0) scale(1.05);
    }
    60% {
        opacity: 1;
        transform: translateY(0) scale(1.0);
    }
    100% {
        opacity: 1;
        transform: translateY(-42px) scale(0.82);
    }
}

/* Levitación 3D del cerebro */
@keyframes splashBrainHover {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-8px) rotate(1.2deg);
    }
    100% {
        transform: translateY(2px) rotate(-0.8deg);
    }
}

/* Sombra/resplandor pulsante debajo del cerebro */
@keyframes splashShadowPulse {
    0% {
        transform: translateX(-50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translateX(-50%) scale(0.8);
        opacity: 0.3;
    }
    100% {
        transform: translateX(-50%) scale(1.08);
        opacity: 0.7;
    }
}

/* Revelación elegante del texto MiPsicoGestión en el centro */
@keyframes splashTextReveal {
    0% {
        opacity: 0;
        transform: translateY(26px) scale(0.92);
        letter-spacing: -0.06em;
    }
    60% {
        opacity: 0.85;
    }
    100% {
        opacity: 1;
        transform: translateY(-16px) scale(1);
        letter-spacing: -0.03em;
    }
}

/* Ajustes Responsive para Móviles */
@media (max-width: 480px) {
    .mipsico-splash__logo-wrap {
        width: 125px;
        height: 125px;
    }

    .mipsico-splash__title {
        font-size: 1.85rem;
    }

    .mipsico-splash__subtitle {
        font-size: 0.78rem;
    }

    @keyframes splashLogoMotion {
        0% {
            opacity: 0;
            transform: translateY(20px) scale(1.15);
        }
        45% {
            opacity: 1;
            transform: translateY(0) scale(1.02);
        }
        60% {
            opacity: 1;
            transform: translateY(0) scale(0.98);
        }
        100% {
            opacity: 1;
            transform: translateY(-38px) scale(0.80);
        }
    }

    @keyframes splashTextReveal {
        0% {
            opacity: 0;
            transform: translateY(22px) scale(0.92);
        }
        100% {
            opacity: 1;
            transform: translateY(-12px) scale(1);
        }
    }
}
