/* css/animations.css - Toutes les animations */

/* === ANIMATIONS DE BASE === */

/* Animation de respiration pour le hero background */
@keyframes heroBreathing {
    0%, 100% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.6;
    }
}

.hero-bg {
    animation: heroBreathing 4s ease-in-out infinite;
}

/* Animation d'entrée pour l'avatar */
@keyframes avatarEntry {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-180deg);
    }
    60% {
        transform: scale(1.1) rotate(10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.hero-avatar {
    animation: avatarEntry 1s ease-out;
}

/* Rotation continue de l'anneau avatar */
@keyframes ringRotation {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.avatar-ring {
    animation: ringRotation 3s linear infinite;
}

/* Animation de bounce pour l'indicateur de scroll */
@keyframes scrollBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

.scroll-indicator {
    animation: scrollBounce 2s ease-in-out infinite;
}

/* Animation de shimmer pour les barres de compétences */
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Animation de flottement pour les éléments autour de l'image */
@keyframes floatAround {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.8;
    }
    25% {
        transform: translateY(-10px) rotate(90deg);
        opacity: 1;
    }
    50% {
        transform: translateY(-5px) rotate(180deg);
        opacity: 0.6;
    }
    75% {
        transform: translateY(-15px) rotate(270deg);
        opacity: 1;
    }
}

.float-element {
    animation: floatAround 6s ease-in-out infinite;
}

/* === ANIMATIONS D'ENTRÉE === */

/* Fade in up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in down */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide in left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide in right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale in */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Bounce in */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotation entrance */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-200deg);
    }
    to {
        opacity: 1;
        transform: rotate(0deg);
    }
}

/* === CLASSES D'ANIMATION AU SCROLL === */

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.animate-on-scroll.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Animations spécifiques pour différents éléments */
.animate-on-scroll.fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
}

.animate-on-scroll.fade-in-down {
    animation: fadeInDown 0.8s ease forwards;
}

.animate-on-scroll.slide-in-left {
    animation: slideInLeft 0.8s ease forwards;
}

.animate-on-scroll.slide-in-right {
    animation: slideInRight 0.8s ease forwards;
}

.animate-on-scroll.scale-in {
    animation: scaleIn 0.8s ease forwards;
}

.animate-on-scroll.bounce-in {
    animation: bounceIn 1s ease forwards;
}

.animate-on-scroll.rotate-in {
    animation: rotateIn 0.8s ease forwards;
}

/* === ANIMATIONS DE TYPING === */

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        border-color: var(--primary-color);
    }
    51%, 100% {
        border-color: transparent;
    }
}

.typing-text {
    overflow: hidden;
    border-right: 3px solid var(--primary-color);
    white-space: nowrap;
    animation: 
        typing 2s steps(20, end),
        blink 1s step-end infinite;
}

/* === ANIMATIONS DE HOVER === */

/* Hover lift */
.hover-lift {
    transition: transform var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-5px);
}

/* Hover glow */
.hover-glow {
    transition: all var(--transition-normal);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow);
}

/* Hover scale */
.hover-scale {
    transition: transform var(--transition-normal);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Hover rotate */
.hover-rotate {
    transition: transform var(--transition-normal);
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* === ANIMATIONS DE PARTICULES === */

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.1;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.3;
    }
}

.particle {
    animation: particleFloat 6s ease-in-out infinite;
}

/* Différents délais pour les particules */
.particle:nth-child(odd) {
    animation-delay: 0s;
    animation-duration: 8s;
}

.particle:nth-child(even) {
    animation-delay: 2s;
    animation-duration: 6s;
}

.particle:nth-child(3n) {
    animation-delay: 4s;
    animation-duration: 10s;
}

/* === ANIMATIONS DE LOADING === */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading-spin {
    animation: spin 1s linear infinite;
}

/* === ANIMATIONS DE PROGRESSION === */

@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: var(--target-width, 100%);
    }
}

.skill-progress.animate {
    animation: progressFill 1.5s ease-out forwards;
}

/* === ANIMATIONS SPÉCIALES === */

/* Animation de matrix effect */
@keyframes matrix {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

.matrix-bg {
    background: linear-gradient(45deg, transparent 30%, rgba(99, 102, 241, 0.1) 50%, transparent 70%);
    background-size: 20px 20px;
    animation: matrix 10s linear infinite;
}

/* Animation de glitch effect */
@keyframes glitch {
    0%, 100% {
        transform: translate(0);
    }
    10% {
        transform: translate(-2px, 2px);
    }
    20% {
        transform: translate(2px, -2px);
    }
    30% {
        transform: translate(-2px, -2px);
    }
    40% {
        transform: translate(2px, 2px);
    }
    50% {
        transform: translate(-2px, 2px);
    }
    60% {
        transform: translate(2px, -2px);
    }
    70% {
        transform: translate(-2px, -2px);
    }
    80% {
        transform: translate(2px, 2px);
    }
    90% {
        transform: translate(-2px, 2px);
    }
}

.glitch-effect:hover {
    animation: glitch 0.3s ease-in-out;
}

/* === ANIMATIONS D'INTERACTION === */

/* Animation pour les boutons */
@keyframes buttonPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

.cta-button:active {
    animation: buttonPress 0.1s ease-in-out;
}

/* Animation pour les cartes */
@keyframes cardFlip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

.card-flip:hover {
    animation: cardFlip 0.6s ease-in-out;
}

/* === ANIMATIONS DE TEXTE === */

/* Animation de highlight */
@keyframes highlight {
    0% {
        background-size: 0% 100%;
    }
    100% {
        background-size: 100% 100%;
    }
}

.text-highlight {
    background: linear-gradient(120deg, var(--primary-color) 0%, var(--primary-color) 100%);
    background-repeat: no-repeat;
    background-size: 0% 100%;
    background-position: 0 0;
    color: white;
    transition: background-size 0.3s ease;
}

.text-highlight:hover,
.text-highlight.animate {
    background-size: 100% 100%;
}

/* Animation de typewriter */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes cursor {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    animation: 
        typewriter 3s steps(30, end),
        cursor 0.5s step-end infinite alternate;
}

/* === ANIMATIONS RESPONSIVES === */

/* Réduire les animations sur mobile pour les performances */
@media (max-width: 768px) {
    .hero-bg {
        animation-duration: 6s;
    }
    
    .avatar-ring {
        animation-duration: 4s;
    }
    
    .float-element {
        animation-duration: 8s;
    }
    
    .particle {
        animation-duration: 8s;
    }
}

/* Désactiver les animations coûteuses sur très petit écran */
@media (max-width: 480px) {
    .particle,
    .matrix-bg {
        animation: none;
    }
    
    .float-element {
        opacity: 0.5;
        animation: none;
    }
}

/* === ANIMATIONS D'ÉTAT === */

/* Animation d'erreur */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.error-shake {
    animation: shake 0.5s ease-in-out;
}

/* Animation de succès */
@keyframes success {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-pulse {
    animation: success 0.5s ease-in-out;
}

/* === ANIMATIONS DE TRANSITION DE PAGE === */

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageExit {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.page-enter {
    animation: pageEnter 0.5s ease-out;
}

.page-exit {
    animation: pageExit 0.5s ease-in;
}

/* === ANIMATIONS AVANCÉES === */

/* Animation de morphing */
@keyframes morph {
    0%, 100% {
        border-radius: 50% 50% 50% 50%;
    }
    25% {
        border-radius: 60% 40% 60% 40%;
    }
    50% {
        border-radius: 40% 60% 40% 60%;
    }
    75% {
        border-radius: 50% 40% 30% 70%;
    }
}

.morphing-shape {
    animation: morph 4s ease-in-out infinite;
}

/* Animation de particle explosion */
@keyframes explode {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(2) rotate(360deg);
        opacity: 0;
    }
}

.explode-effect {
    animation: explode 0.5s ease-out forwards;
}