/* Background Animation */
.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(45deg, var(--nero) 0%, #2a2a2a 100%);
    overflow: hidden;
}

.animated-background::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, transparent 20%, var(--nero) 80%),
                linear-gradient(45deg, var(--giallo) 0%, transparent 70%);
    opacity: 0.03;
    animation: rotate 25s linear infinite;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Floating Elements Animation */
.floating {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
    100% {
        transform: translateY(0px);
    }
}

/* Glow Effect */
.glow {
    animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px var(--giallo),
                     0 0 20px var(--giallo), 0 0 25px var(--giallo);
    }
    to {
        text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px var(--giallo),
                     0 0 40px var(--giallo), 0 0 50px var(--giallo);
    }
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: .7;
        transform: scale(0.95);
    }
}

/* Feature Hover Animation */
.feature-hover {
    transition: all 0.3s ease;
}

.feature-hover:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 30px rgba(234, 255, 0, 0.2);
}

/* Card Reveal Animation */
.card-reveal {
    opacity: 0;
    transform: translateY(20px);
    animation: revealCard 0.6s ease forwards;
}

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

/* Particle Effect */
.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background-color: var(--giallo);
    border-radius: 50%;
    opacity: 0.3;
    pointer-events: none;
}

.particle-1 { animation: particleAnimation 15s linear infinite; }
.particle-2 { animation: particleAnimation 25s linear infinite; }
.particle-3 { animation: particleAnimation 20s linear infinite; }
.particle-4 { animation: particleAnimation 30s linear infinite; }

@keyframes particleAnimation {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
    }
    50% {
        opacity: 0.3;
    }
    100% {
        transform: translate(100vw, 100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Tech Stack Item Animation */
.tech-item {
    transition: all 0.3s ease;
}

.tech-item:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 5px 15px rgba(234, 255, 0, 0.3);
}

/* Modal Animation */
.modal-fade {
    animation: modalFade 0.3s ease-out;
}

@keyframes modalFade {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Text Reveal Animation */
.text-reveal {
    opacity: 0;
    animation: revealText 1s ease forwards;
}

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

/* Gradient Text Animation */
.gradient-text {
    background: linear-gradient(45deg, var(--giallo), #fff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient 3s linear infinite;
}

@keyframes gradient {
    to {
        background-position: 200% center;
    }
}

/* Animazioni base */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Animazioni per le card */
.story-card {
    animation: scaleIn 0.6s ease-out backwards;
}

.story-card:nth-child(1) { animation-delay: 0.2s; }
.story-card:nth-child(2) { animation-delay: 0.4s; }
.story-card:nth-child(3) { animation-delay: 0.6s; }
.story-card:nth-child(4) { animation-delay: 0.8s; }

/* Effetto hover migliorato per le card */
.story-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(234, 255, 0, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
    z-index: -1;
}

.story-card:hover::before {
    transform: translateX(100%);
}

/* Animazione per il testo */
.gradient-text {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px rgba(234, 255, 0, 0.2),
                     0 0 10px rgba(234, 255, 0, 0.2),
                     0 0 15px rgba(234, 255, 0, 0.2);
    }
    to {
        text-shadow: 0 0 10px rgba(234, 255, 0, 0.4),
                     0 0 20px rgba(234, 255, 0, 0.4),
                     0 0 30px rgba(234, 255, 0, 0.4);
    }
}

/* Animazione per le icone */
.tech-item i {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Animazione per lo scroll reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Effetto particelle di sfondo */
.particle {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(234, 255, 0, 0.1) 0%, transparent 70%);
    animation: particleFloat 20s infinite linear;
    pointer-events: none;
}

@keyframes particleFloat {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    100% {
        transform: translate(100px, 100px) rotate(360deg);
    }
}

.particle:nth-child(1) { animation-duration: 15s; }
.particle:nth-child(2) { animation-duration: 25s; animation-delay: -5s; }
.particle:nth-child(3) { animation-duration: 20s; animation-delay: -10s; }
.particle:nth-child(4) { animation-duration: 30s; animation-delay: -15s; }

/* Animazione per i bottoni */
.tech-badge {
    animation: fadeInUp 0.6s ease backwards;
}

.tech-badge:nth-child(1) { animation-delay: 0.2s; }
.tech-badge:nth-child(2) { animation-delay: 0.4s; }
.tech-badge:nth-child(3) { animation-delay: 0.6s; }
.tech-badge:nth-child(4) { animation-delay: 0.8s; }

/* Animazione per il loading */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.loading {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.1) 25%, 
        rgba(255, 255, 255, 0.2) 50%, 
        rgba(255, 255, 255, 0.1) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Transizioni smooth per tutti gli elementi */
* {
    transition: all 0.3s ease;
}

/* Animazione per il menu mobile */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Effetto hover per i link */
.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.nav-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}
