/* ✨ SPLASH SCREEN ESPECTACULAR - POSTGRESQL STARS ✨ */
/* Copyright (C) 2025 Germán Luis Aracil Boned <garacilb@gmail.com> */
/* License: GPL v3 */

/* Pantalla principal de splash con fondo blanco */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 1s ease-out;
}

/* Arcoíris eliminado - solo fondo blanco limpio */
.rainbow-background {
    display: none;
}

/* Animación del arcoíris atravesando de izquierda a derecha */
@keyframes rainbowSweep {
    0% {
        left: -100%;
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    50% {
        left: -50%;
        opacity: 0.9;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        left: 0%;
        opacity: 0.6;
    }
}

/* Ocultar splash screen */
#splash-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Contenedor de estrellas */
.stars-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Estrellas con forma de estrella real - Desprenden del texto PostgreSQL */
.star {
    position: absolute;
    width: 12px;
    height: 12px;
    opacity: 0;
    animation: starBurst 3.5s ease-out forwards;
    will-change: transform, opacity;
    z-index: 5;
}

.star::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: currentColor;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    box-shadow: 
        0 0 8px currentColor,
        0 0 16px currentColor,
        0 0 24px currentColor;
}

/* Colores de estrellas - Tonos brillantes como arcoíris */
.star.color-1 { color: #ff0000; }  /* Rojo */
.star.color-2 { color: #ff8000; }  /* Naranja */
.star.color-3 { color: #ffff00; }  /* Amarillo */
.star.color-4 { color: #80ff00; }  /* Verde amarillo */
.star.color-5 { color: #00ff00; }  /* Verde */
.star.color-6 { color: #00ff80; }  /* Verde azul */
.star.color-7 { color: #00ffff; }  /* Cyan */
.star.color-8 { color: #0080ff; }  /* Azul */
.star.color-9 { color: #0000ff; }  /* Azul oscuro */
.star.color-10 { color: #8000ff; } /* Violeta */

/* Animación de estrellas: desprenden → dispersan → forman web → desvanecen */
@keyframes starBurst {
    0% {
        opacity: 0;
        transform: translateX(0px) translateY(0px) scale(0) rotate(0deg);
    }
    15% {
        opacity: 1;
        transform: translateX(calc(var(--drift-x) * 0.2)) translateY(calc(var(--drift-y) * 0.2)) scale(1.2) rotate(72deg);
    }
    40% {
        opacity: 0.9;
        transform: translateX(calc(var(--drift-x) * 0.8)) translateY(calc(var(--drift-y) * 0.8)) scale(1) rotate(180deg);
    }
    60% {
        opacity: 0.8;
        transform: translateX(var(--drift-x)) translateY(var(--drift-y)) scale(0.8) rotate(270deg);
    }
    75% {
        /* Las estrellas se mueven para formar la estructura web */
        opacity: 1;
        transform: translateX(calc(var(--web-x) - 50vw)) translateY(calc(var(--web-y) - 50vh)) scale(1.5) rotate(360deg);
        filter: blur(0px);
        box-shadow: 
            0 0 10px currentColor,
            0 0 20px currentColor,
            0 0 30px currentColor;
    }
    85% {
        /* Mantienen la forma de web brevemente */
        opacity: 0.9;
        transform: translateX(calc(var(--web-x) - 50vw)) translateY(calc(var(--web-y) - 50vh)) scale(1.2) rotate(380deg);
        filter: blur(1px);
    }
    100% {
        /* Se desvanecen rápidamente */
        opacity: 0;
        transform: translateX(calc(var(--web-x) - 50vw)) translateY(calc(var(--web-y) - 50vh)) scale(0.1) rotate(720deg);
        filter: blur(5px);
    }
}

/* Texto PostgreSQL - SE CONVIERTE EN ESTRELLAS Y SALE EN ESPIRAL */
.postgresql-text {
    position: relative;
    z-index: 10;
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 4rem;
    font-weight: 900;
    color: #ffffff;
    opacity: 0;
    animation: postgresqlAppear 1.8s ease-out 0.5s forwards;
    letter-spacing: 0.3em;
    text-align: center;
    filter: drop-shadow(0 0 25px rgba(255, 215, 0, 1)) drop-shadow(0 0 35px rgba(78, 205, 196, 0.8));
}

/* Letras individuales de PostgreSQL */
.postgresql-letter {
    display: inline-block;
    text-shadow: 
        0 0 3px #336791,
        0 0 6px #336791,
        0 0 12px #336791,
        0 0 20px #336791,
        0 0 30px #4ecdc4,
        0 0 40px #4ecdc4,
        0 0 50px #FFD700,
        0 0 60px #FFD700,
        0 0 70px #FFD700,
        0 0 80px #FFD700,
        0 0 90px #FFD700,
        0 0 100px #FFD700;
    animation: 
        letterGlow 2s ease-in-out 2s 2 alternate,
        letterToStar 2.5s ease-in-out 4s forwards;
    transition: all 0.3s ease;
}

/* Animación de aparición del texto - FELICIDAD ABSOLUTA */
@keyframes postgresqlAppear {
    0% {
        opacity: 0;
        transform: scale(0.3);
        filter: blur(10px);
        text-shadow: 
            0 0 5px #336791,
            0 0 10px #336791;
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
        filter: blur(2px);
        text-shadow: 
            0 0 15px #336791,
            0 0 25px #4ecdc4,
            0 0 35px #FFD700;
    }
    100% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0px);
        text-shadow: 
            0 0 5px #336791,
            0 0 10px #336791,
            0 0 20px #336791,
            0 0 30px #336791,
            0 0 40px #4ecdc4,
            0 0 50px #4ecdc4,
            0 0 60px #FFD700,
            0 0 70px #FFD700,
            0 0 80px #FFD700,
            0 0 90px #FFD700;
    }
}

/* Animación de brillo para letras individuales */
@keyframes letterGlow {
    0% {
        text-shadow: 
            0 0 3px #336791,
            0 0 6px #336791,
            0 0 12px #336791,
            0 0 20px #336791,
            0 0 30px #4ecdc4,
            0 0 40px #4ecdc4,
            0 0 50px #FFD700,
            0 0 60px #FFD700,
            0 0 70px #FFD700,
            0 0 80px #FFD700,
            0 0 90px #FFD700,
            0 0 100px #FFD700;
    }
    100% {
        text-shadow: 
            0 0 8px #336791,
            0 0 15px #336791,
            0 0 25px #336791,
            0 0 35px #336791,
            0 0 45px #4ecdc4,
            0 0 55px #4ecdc4,
            0 0 65px #FFD700,
            0 0 75px #FFD700,
            0 0 85px #FFD700,
            0 0 95px #FFD700,
            0 0 105px #FFD700,
            0 0 115px #FFD700,
            0 0 125px #FFD700;
    }
}

/* Animación: Cada letra se convierte en estrella y sale en espiral */
@keyframes letterToStar {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: blur(0px);
    }
    20% {
        opacity: 0.9;
        transform: scale(1.3) rotate(45deg);
        filter: blur(1px);
        text-shadow: 
            0 0 15px #FFD700,
            0 0 25px #FFD700,
            0 0 35px #4ecdc4;
    }
    40% {
        opacity: 0.7;
        transform: scale(1) rotate(90deg);
        filter: blur(3px);
        text-shadow: 
            0 0 20px #FFD700,
            0 0 40px #FFD700,
            0 0 60px #4ecdc4;
    }
    60% {
        opacity: 0.5;
        transform: scale(0.7) rotate(180deg);
        filter: blur(6px);
        clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
        text-shadow: 
            0 0 25px #FFD700,
            0 0 45px #4ecdc4,
            0 0 65px #336791;
    }
    80% {
        opacity: 0.3;
        transform: scale(0.4) rotate(270deg) translateX(var(--spiral-x, 500px)) translateY(var(--spiral-y, -300px));
        filter: blur(10px);
        clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    }
    100% {
        opacity: 0;
        transform: scale(0.1) rotate(360deg) translateX(var(--spiral-x, 1500px)) translateY(var(--spiral-y, -800px));
        filter: blur(15px);
        clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    }
}

/* Efecto de pulso en el texto - SIN MARCO */
.postgresql-text::after {
    content: '';
    display: none; /* Eliminar el marco completamente */
}

/* Eliminar cualquier partícula de fondo */
.background-particles {
    display: none;
}

/* Efecto de desvanecimiento final */
.fade-out {
    animation: fadeOutSplash 1s ease-out forwards;
}

@keyframes fadeOutSplash {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.1);
    }
}

/* Responsive design - Optimizado para velocidad */
@media (max-width: 768px) {
    .postgresql-text {
        font-size: 2.5rem;
        letter-spacing: 0.1em;
        animation: postgresqlAppear 1.2s ease-out 0.3s forwards;
    }
    
    .star {
        width: 8px;
        height: 8px;
        animation: starBurst 3s ease-out forwards;
        box-shadow: 
            0 0 6px #ffffff,
            0 0 12px currentColor;
    }
}

@media (max-width: 480px) {
    .postgresql-text {
        font-size: 2rem;
        letter-spacing: 0.05em;
        animation: postgresqlAppear 1s ease-out 0.2s forwards;
    }
    
    .star {
        width: 6px;
        height: 6px;
        animation: starBurst 2.5s ease-out forwards;
        box-shadow: 
            0 0 4px #ffffff,
            0 0 8px currentColor;
    }
}

/* Clase adicional para estrellas cuando forman la web */
.star.forming-web {
    animation: starBurst 3.5s ease-out forwards, webPulse 0.5s ease-in-out 2.5s 3;
}

/* Pulso adicional cuando forman la web */
@keyframes webPulse {
    0%, 100% {
        filter: brightness(1) blur(0px);
    }
    50% {
        filter: brightness(2) blur(2px);
        transform: scale(1.3);
    }
}

/* Efectos adicionales para navegadores que soportan backdrop-filter - SIN FONDO */
@supports (backdrop-filter: blur(10px)) {
    .postgresql-text {
        /* Sin fondo, sin bordes - solo las letras */
        backdrop-filter: none;
        background: transparent;
        padding: 0;
        border-radius: 0;
        border: none;
    }
}

/* Preloader adicional para casos de carga muy lenta */
.loading-dots {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    opacity: 0;
    animation: dotsAppear 1s ease-out 3s forwards;
}

.loading-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #336791;
    animation: dotPulse 1.5s ease-in-out infinite;
}

.loading-dots .dot:nth-child(2) { animation-delay: 0.3s; }
.loading-dots .dot:nth-child(3) { animation-delay: 0.6s; }

@keyframes dotsAppear {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes dotPulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.7;
    }
    50% { 
        transform: scale(1.5);
        opacity: 1;
    }
}