/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0f;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Canvas pour les particules */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Container du logo */
.logo-container {
    position: relative;
    z-index: 10;
    text-align: center;
    perspective: 1000px;
}

.animated-text {
    font-size: clamp(4rem, 15vw, 10rem);
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 0.15em;
    line-height: 1.2;
    position: relative;
    display: inline-block;
}

/* Animation des lettres - Entrée complexe */
.letter {
    display: inline-block;
    position: relative;
    opacity: 0;
    transform-style: preserve-3d;
    animation: letterEntrance 2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    text-shadow: 
        0 0 10px rgba(102, 126, 234, 0.5),
        0 0 20px rgba(102, 126, 234, 0.3),
        0 0 30px rgba(102, 126, 234, 0.2);
}

/* Délais d'animation pour chaque lettre */
.letter:nth-child(1) { animation-delay: 0.1s; }
.letter:nth-child(2) { animation-delay: 0.2s; }
.letter:nth-child(3) { animation-delay: 0.3s; }
.letter:nth-child(4) { animation-delay: 0.4s; }
.letter:nth-child(5) { animation-delay: 0.5s; }
.letter:nth-child(6) { animation-delay: 0.6s; }
.letter:nth-child(7) { animation-delay: 0.7s; }
.letter:nth-child(8) { animation-delay: 0.8s; }
.letter:nth-child(9) { animation-delay: 0.9s; }

/* Animation d'entrée sophistiquée */
@keyframes letterEntrance {
    0% {
        opacity: 0;
        transform: 
            translateY(-200px) 
            translateZ(-500px) 
            rotateX(-90deg) 
            rotateY(-180deg)
            scale(0.3);
        filter: blur(10px);
    }
    30% {
        opacity: 0.3;
        transform: 
            translateY(-50px) 
            translateZ(-200px) 
            rotateX(-45deg) 
            rotateY(-90deg)
            scale(0.6);
        filter: blur(5px);
    }
    60% {
        opacity: 0.7;
        transform: 
            translateY(20px) 
            translateZ(-50px) 
            rotateX(10deg) 
            rotateY(10deg)
            scale(1.1);
        filter: blur(2px);
    }
    80% {
        transform: 
            translateY(-10px) 
            translateZ(20px) 
            rotateX(-5deg) 
            rotateY(-5deg)
            scale(1.05);
        filter: blur(0px);
    }
    100% {
        opacity: 1;
        transform: 
            translateY(0) 
            translateZ(0) 
            rotateX(0deg) 
            rotateY(0deg)
            scale(1);
        filter: blur(0px);
    }
}

/* Point spécial avec animation explosive */
.letter.dot {
    color: #ffd700;
    animation: dotExplosion 2.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.7s;
}

@keyframes dotExplosion {
    0% {
        opacity: 0;
        transform: 
            scale(0) 
            rotate(0deg) 
            translateZ(-1000px);
        filter: blur(20px) brightness(3);
        text-shadow: 
            0 0 0px rgba(255, 215, 0, 0);
    }
    20% {
        opacity: 1;
        transform: 
            scale(3) 
            rotate(180deg) 
            translateZ(100px);
        filter: blur(10px) brightness(2);
        text-shadow: 
            0 0 40px rgba(255, 215, 0, 1),
            0 0 80px rgba(255, 215, 0, 0.8),
            0 0 120px rgba(255, 215, 0, 0.6);
    }
    40% {
        transform: 
            scale(2) 
            rotate(360deg) 
            translateZ(50px);
        filter: blur(5px) brightness(1.5);
    }
    70% {
        transform: 
            scale(1.2) 
            rotate(540deg) 
            translateZ(0px);
        filter: blur(2px) brightness(1.2);
    }
    100% {
        opacity: 1;
        transform: 
            scale(1) 
            rotate(720deg) 
            translateZ(0);
        filter: blur(0px) brightness(1);
        text-shadow: 
            0 0 20px rgba(255, 215, 0, 0.8),
            0 0 40px rgba(255, 215, 0, 0.5),
            0 0 60px rgba(255, 215, 0, 0.3);
    }
}

/* Animation de brillance en continu après l'entrée */
.letter {
    animation-fill-mode: forwards;
}

.letter::after {
    content: attr(data-letter);
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s ease-in-out infinite;
    animation-delay: calc(var(--shine-delay, 2s));
}

@keyframes shine {
    0%, 100% {
        opacity: 0;
        transform: translateX(-100%);
    }
    10%, 90% {
        opacity: 1;
    }
    50% {
        opacity: 1;
        transform: translateX(100%);
    }
}

/* Animation de pulsation subtile */
.animated-text {
    animation: textPulse 4s ease-in-out infinite;
    animation-delay: 2s;
}

@keyframes textPulse {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(102, 126, 234, 0.5),
            0 0 20px rgba(102, 126, 234, 0.3),
            0 0 30px rgba(102, 126, 234, 0.2);
    }
    50% {
        text-shadow: 
            0 0 20px rgba(102, 126, 234, 0.8),
            0 0 40px rgba(102, 126, 234, 0.6),
            0 0 60px rgba(102, 126, 234, 0.4),
            0 0 80px rgba(102, 126, 234, 0.2);
    }
}

/* Animation au survol */
.letter:hover {
    animation: letterBounce 0.6s ease;
    cursor: pointer;
}

@keyframes letterBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    25% {
        transform: translateY(-30px) scale(1.2) rotateZ(-10deg);
    }
    50% {
        transform: translateY(-40px) scale(1.3) rotateZ(0deg);
    }
    75% {
        transform: translateY(-20px) scale(1.15) rotateZ(10deg);
    }
}

.letter.dot:hover {
    animation: dotSpin 0.8s ease;
}

@keyframes dotSpin {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(360deg) scale(1.5);
        color: #ff6b6b;
        text-shadow: 
            0 0 30px rgba(255, 107, 107, 1),
            0 0 60px rgba(255, 107, 107, 0.7);
    }
    100% {
        transform: rotate(720deg) scale(1);
        color: #ffd700;
    }
}

/* Effet de glitch aléatoire */
.letter {
    animation-name: letterEntrance, glitch;
    animation-duration: 2s, 0.3s;
    animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1), steps(2);
    animation-iteration-count: 1, infinite;
    animation-delay: calc(var(--letter-delay, 0s)), calc(5s + var(--glitch-delay, 0s));
}

@keyframes glitch {
    0%, 100% {
        transform: translate(0);
    }
    33% {
        transform: translate(-2px, 2px);
        text-shadow: 
            2px -2px 0 rgba(255, 0, 0, 0.5),
            -2px 2px 0 rgba(0, 255, 255, 0.5);
    }
    66% {
        transform: translate(2px, -2px);
        text-shadow: 
            -2px 2px 0 rgba(255, 0, 0, 0.5),
            2px -2px 0 rgba(0, 255, 255, 0.5);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .animated-text {
        font-size: clamp(2.5rem, 12vw, 6rem);
        letter-spacing: 0.1em;
    }
}

/* Désactivation des animations si préférence utilisateur */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
