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

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

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(-50%, 0, 0);
    }
    40%, 43% {
        transform: translate3d(-50%, -8px, 0);
    }
    70% {
        transform: translate3d(-50%, -4px, 0);
    }
    90% {
        transform: translate3d(-50%, -2px, 0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translate(0px, 0px) rotate(0deg);
    }
    33% {
        transform: translate(30px, -30px) rotate(120deg);
    }
    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(0, 212, 255, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 212, 255, 0);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 212, 255, 0.6), 0 0 40px rgba(90, 228, 255, 0.4);
    }
}

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

@keyframes blink {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--primary-cyan);
    }
}

@keyframes cursor-fade {
    0%, 90% {
        border-right-color: var(--primary-cyan);
    }
    100% {
        border-right-color: transparent;
    }
}

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

@keyframes morphing {
    0% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0px) translateX(0px) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: translateY(-20px) translateX(10px) rotate(90deg);
        opacity: 0.8;
    }
    50% {
        transform: translateY(-10px) translateX(-10px) rotate(180deg);
        opacity: 0.6;
    }
    75% {
        transform: translateY(-30px) translateX(5px) rotate(270deg);
        opacity: 0.8;
    }
}

/* ===== CLASSI DI ANIMAZIONE ===== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

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

.slide-in-left {
    animation: slideInLeft 0.8s ease-out forwards;
}

.slide-in-right {
    animation: slideInRight 0.8s ease-out forwards;
}

.slide-in-up {
    animation: slideInUp 0.8s ease-out forwards;
}

.fade-in {
    animation: fadeIn 1s ease-out forwards;
}

.fade-in-scale {
    animation: fadeInScale 0.6s ease-out forwards;
}

/* ===== EFFETTI HOVER ===== */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-2xl);
}

.hover-scale {
    transition: transform var(--transition-base);
}

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

.hover-rotate {
    transition: transform var(--transition-base);
}

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

.hover-glow {
    transition: all var(--transition-base);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

/* ===== ANIMAZIONI SPECIFICHE ===== */
.hero-particles::before,
.hero-particles::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 50%;
    animation: particleFloat 15s infinite ease-in-out;
}

.hero-particles::before {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.hero-particles::after {
    bottom: 20%;
    right: 10%;
    animation-delay: 7s;
}

/* Animazione del logo nel navbar */
.nav-brand .logo {
    transition: all var(--transition-base);
}

.nav-brand .logo:hover {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 4px 8px rgba(0, 212, 255, 0.3));
}

/* Animazioni per i service cards */
.service-icon {
    animation: pulse 3s infinite;
    transition: all var(--transition-base);
}

.service-card:hover .service-icon {
    animation: none;
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

/* Animazione per il typing effect nel codice hero */
.typing-line {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--primary-cyan);
    animation: typing 3.5s steps(40, end), cursor-fade 3.5s ease-in-out forwards;
    margin-bottom: var(--space-2);
}

.typing-line:nth-child(1) {
    animation-delay: 0s;
}

.typing-line:nth-child(2) {
    animation-delay: 1s;
}

.typing-line:nth-child(3) {
    animation-delay: 2s;
}

.typing-line:nth-child(4) {
    animation-delay: 3s;
}

/* Effetto parallax per le sezioni */
.parallax-bg {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Animazioni per le statistiche */
.stat-number {
    transition: all var(--transition-base);
}

.stat-item:hover .stat-number {
    transform: scale(1.2);
}

/* Effetti per i project cards */
.project-card {
    overflow: hidden;
    position: relative;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.8s;
    z-index: 1;
}

.project-card:hover::before {
    left: 100%;
}

/* Animazioni per i form elements */
.form-group input,
.form-group select,
.form-group textarea {
    position: relative;
    z-index: 1;
}

.form-group {
    position: relative;
}

.form-group::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition-base);
    z-index: 0;
}

.form-group:focus-within::before {
    width: 100%;
}

/* Loading spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* Gradient text animation */
.gradient-text-animated {
    background: linear-gradient(
        270deg,
        var(--primary-cyan),
        var(--secondary-cyan),
        var(--accent-blue),
        var(--primary-cyan)
    );
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

/* Morphing shapes */
.morphing-shape {
    width: 100px;
    height: 100px;
    background: var(--gradient-primary);
    animation: morphing 8s ease-in-out infinite;
    opacity: 0.1;
    position: absolute;
}

/* Smooth scroll per tutto il documento */
html {
    scroll-behavior: smooth;
}

/* Animazioni per il menu mobile */
.nav-menu {
    transition: all var(--transition-base);
}

.nav-menu.active {
    animation: slideInDown 0.3s ease-out;
}

/* Effetti per i social links */
.social-link {
    position: relative;
    overflow: hidden;
}

.social-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    transition: left var(--transition-base);
    z-index: -1;
}

.social-link:hover::before {
    left: 0;
}

/* Animazioni per i tech tags */
.tech-tag {
    transition: all var(--transition-fast);
    position: relative;
}

.tech-tag:hover {
    background: var(--gradient-primary);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Effetto typewriter per il hero title */
.typewriter {
    overflow: hidden;
    border-right: 0.15em solid var(--primary-cyan);
    white-space: nowrap;
    margin: 0 auto;
    letter-spacing: 0.15em;
    animation: typing 3.5s steps(30, end), blink 0.75s step-end infinite;
}

/* Responsive animations */
@media (max-width: 768px) {
    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover {
        transform: none;
    }
    
    .animate-on-scroll {
        transform: translateY(20px);
    }
    
    .service-card:hover .service-icon {
        transform: none;
        animation: pulse 3s infinite;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .animate-on-scroll {
        opacity: 1;
        transform: none;
    }
} 