/* ==========================================
   ANIMATIONS & VISUAL EFFECTS
   F.W.A. - Fav Web Agency
   ========================================== */

/* ========== KEYFRAME ANIMATIONS ========== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

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

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(30, 144, 255, 0.5);
        filter: drop-shadow(0 0 5px rgba(30, 144, 255, 0.3));
    }
    50% {
        text-shadow: 0 0 15px rgba(30, 144, 255, 0.8);
        filter: drop-shadow(0 0 15px rgba(30, 144, 255, 0.6));
    }
}

@keyframes glowNode {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(79, 168, 255, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(30, 144, 255, 0.8));
    }
}

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

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

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

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

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

@keyframes blinkGlow {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

@keyframes waves {
    0%, 100% {
        d: path('M0,64 Q16,48 32,64 T64,64 T96,64');
        opacity: 0.3;
    }
    50% {
        d: path('M0,64 Q16,80 32,64 T64,64 T96,64');
        opacity: 0.6;
    }
}

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

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

@keyframes slideRight {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes expand {
    from {
        opacity: 0;
        transform: scale(0.9);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: scale(1);
        max-height: 500px;
    }
}

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

/* ========== REVEAL ON SCROLL ANIMATIONS ========== */
/* Transition-based approach — JS adds .revealed class via IntersectionObserver */
.reveal-on-scroll {
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Stagger via transition-delay (applies within parent containers) */
.reveal-on-scroll:nth-child(1) { transition-delay: 0s; }
.reveal-on-scroll:nth-child(2) { transition-delay: 0.08s; }
.reveal-on-scroll:nth-child(3) { transition-delay: 0.16s; }
.reveal-on-scroll:nth-child(4) { transition-delay: 0.24s; }
.reveal-on-scroll:nth-child(5) { transition-delay: 0.32s; }
.reveal-on-scroll:nth-child(6) { transition-delay: 0.4s; }

/* ========== INTERACTIVE HOVER EFFECTS ========== */

/* Glow effect on elements */
.glow-effect {
    transition: all 0.6s ease;
}

.glow-effect:hover {
    filter: drop-shadow(0 0 15px rgba(30, 144, 255, 0.6));
}

/* Glassmorphism blur on hover */
.glass-hover {
    transition: all 0.6s ease;
}

.glass-hover:hover {
    background: rgba(30, 144, 255, 0.15);
    backdrop-filter: blur(10px);
    border-color: rgba(30, 144, 255, 0.5);
}

/* ========== SPECIFIC COMPONENT ANIMATIONS ========== */

/* Hero content animations */
.hero-content {
    animation: fadeInUp 1s ease-out;
}

.hero-title {
    animation: slideInLeft 1s ease-out 0.2s both;
}

.hero-subtitle {
    animation: slideInLeft 1s ease-out 0.3s both;
}

.hero-buttons {
    animation: slideInLeft 1s ease-out 0.4s both;
}

/* Metric counter animation */
.counter {
    display: inline-block;
    animation: countUp 0.6s ease-out;
}

/* Metric cards */
.metric-card {
    animation: scaleIn 0.8s ease-out;
}

/* metric cards — transition-delay стаггер (reveal через transition) */
.metric-card:nth-child(1) { transition-delay: 0s;    }
.metric-card:nth-child(2) { transition-delay: 0.06s; }
.metric-card:nth-child(3) { transition-delay: 0.12s; }
.metric-card:nth-child(4) { transition-delay: 0.18s; }

/* Service card hover effect */
.service-card {
    position: relative;
    overflow: hidden;
}

.service-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(30, 144, 255, 0.1);
    transition: left 0.6s ease;
    pointer-events: none;
}

.service-card:hover::after {
    left: 100%;
}

/* Map nodes pulsing animation */
.map-node {
    animation: glowNode 2s ease-in-out infinite;
}

.map-node-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Connection lines animation */
.connection-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: lineIn 3s ease-in-out forwards;
}

.connection-line:nth-of-type(1) {
    animation-delay: 0s;
}

.connection-line:nth-of-type(2) {
    animation-delay: 0.5s;
}

.connection-line:nth-of-type(3) {
    animation-delay: 1s;
}

/* Italy expansion badge animation */
.highlight-badge {
    animation: bounce 2s ease-in-out infinite;
}

/* Case items animation */
.case-item {
    animation: scaleIn 0.8s ease-out;
}

.case-item:nth-child(1) {
    animation-delay: 0s;
}

.case-item:nth-child(2) {
    animation-delay: 0.1s;
}

.case-item:nth-child(3) {
    animation-delay: 0.2s;
}

.case-item:nth-child(4) {
    animation-delay: 0.3s;
}

/* CTA section animation */
.cta-content {
    animation: scaleIn 0.8s ease-out;
}

/* ========== SMOOTH TRANSITIONS ========== */

.smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-transition-slow {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-transition-slower {
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* ========== TEXT ANIMATIONS ========== */

.text-glow {
    animation: glow 2s ease-in-out infinite;
}

.text-shimmer {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 3s infinite;
}

/* ========== BUTTON ANIMATIONS ========== */

.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.6s ease;
}

.btn:hover::before {
    left: 100%;
}

/* ========== NAVIGATION ANIMATIONS ========== */

.nav-link {
    position: relative;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: width 0.3s ease;
}

.nav-link:hover::before {
    width: 100%;
}

/* ========== SCROLL ANIMATIONS ========== */

.scroll-fade {
    opacity: 1;
    transition: opacity 0.6s ease;
}

.scroll-fade.scroll-out {
    opacity: 0;
}

/* ========== PARALLAX-LIKE EFFECTS ========== */

.parallax-element {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== RESPONSIVE ANIMATIONS ========== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 768px) {
    /* Simplify animations on mobile */
    .reveal-on-scroll {
        animation-delay: 0 !important;
    }
    
    h1 {
        animation: slideInLeft 0.8s ease-out !important;
    }
    
    .hero-buttons {
        animation: slideInLeft 0.8s ease-out 0.2s both !important;
    }
}

/* ========== SPECIAL EFFECTS ========== */

/* Floating animation for icons */
.floating {
    animation: float 3s ease-in-out infinite;
}

/* Pulsing animation */
.pulsing {
    animation: pulse 2s ease-in-out infinite;
}

/* Rotating animation */
.rotating {
    animation: rotate 20s linear infinite;
}

.rotating-reverse {
    animation: rotateReverse 20s linear infinite;
}

/* Blinking glow */
.blink-glow {
    animation: blinkGlow 1.5s ease-in-out infinite;
}

/* Fade in and out */
/* ========== FADE IN AND OUT ========== */

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

/* ========== ADVANCED GLOW EFFECTS ========== */

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(30, 144, 255, 0.5), inset 0 0 10px rgba(30, 144, 255, 0.2);
    }
    50% {
        box-shadow: 0 0 30px rgba(30, 144, 255, 0.8), inset 0 0 20px rgba(30, 144, 255, 0.4);
    }
}

@keyframes glowPulseAlt {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(79, 168, 255, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(79, 168, 255, 0.8));
    }
}

@keyframes shimmerGlass {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* ========== LIQUID WAVE EFFECT ========== */

@keyframes liquidWave {
    0%, 100% {
        transform: translateX(0) skewX(0deg);
    }
    25% {
        transform: translateX(5px) skewX(1deg);
    }
    50% {
        transform: translateX(0) skewX(0deg);
    }
    75% {
        transform: translateX(-5px) skewX(-1deg);
    }
}

/* ========== MAGNETIC PULL ========== */

@keyframes magneticPull {
    0% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0, 0);
    }
}

/* ========== NEON FLICKER ========== */

@keyframes neonFlicker {
    0%, 100% {
        text-shadow: 0 0 5px rgba(30, 144, 255, 0.5);
        filter: drop-shadow(0 0 5px rgba(30, 144, 255, 0.5));
    }
    50% {
        text-shadow: 0 0 15px rgba(30, 144, 255, 0.9), 0 0 30px rgba(79, 168, 255, 0.5);
        filter: drop-shadow(0 0 10px rgba(30, 144, 255, 0.8));
    }
}

/* ========== CRYSTAL SHINE ========== */

@keyframes crystalShine {
    0% {
        opacity: 0;
        transform: translateX(-100%) skewX(-20deg);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateX(100%) skewX(-20deg);
    }
}

/* ========== BREATHING EFFECT ========== */

@keyframes breathing {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* ========== PARALLAX MOVEMENT ========== */

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

/* ========== AURORA BOREALIS EFFECT ========== */

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

/* ========== ISOMETRIC ROTATION ========== */

@keyframes isometricRotate {
    0% {
        transform: rotateX(0deg) rotateY(0deg);
    }
    100% {
        transform: rotateX(360deg) rotateY(360deg);
    }
}

/* ========== ADVANCED STAGGER ========== */

.stagger-delay-1 {
    animation-delay: 0s !important;
}

.stagger-delay-2 {
    animation-delay: 0.15s !important;
}

.stagger-delay-3 {
    animation-delay: 0.3s !important;
}

.stagger-delay-4 {
    animation-delay: 0.45s !important;
}

.stagger-delay-5 {
    animation-delay: 0.6s !important;
}

/* ========== HOVER LIFT EFFECT ========== */

.hover-lift {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-lift:hover {
    transform: translateY(-12px);
    filter: drop-shadow(0 20px 40px rgba(30, 144, 255, 0.25));
}

/* ========== RIPPLE EFFECT ========== */

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: rgba(30, 144, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.ripple-effect:active::after {
    animation: ripple 0.6s ease-out;
}

/* ========== TEXT SELECTION GLOW ========== */

::selection {
    background: rgba(30, 144, 255, 0.3);
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(30, 144, 255, 0.5);
}

::-moz-selection {
    background: rgba(30, 144, 255, 0.3);
    color: var(--text-primary);
}

/* ========== SCROLL INDICATOR ========== */

@keyframes scrollIndicator {
    0%, 100% {
        opacity: 0.4;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(8px);
    }
}

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

/* ========== BORDER ANIMATION ========== */

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

.border-animated {
    border-image-source: linear-gradient(45deg, var(--accent-primary), var(--accent-soft));
    border-image-slice: 1;
}

/* ========== GLOW EXPANSION ========== */

@keyframes glowExpand {
    0% {
        box-shadow: 0 0 0 0 rgba(30, 144, 255, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(30, 144, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(30, 144, 255, 0);
    }
}

.glow-expand {
    animation: glowExpand 2s infinite;
}

/* ========== SMOOTH LINE REVEAL ========== */

@keyframes lineReveal {
    0% {
        width: 0;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        width: 100%;
        opacity: 1;
    }
}

.line-reveal {
    animation: lineReveal 0.8s ease-out;
}

/* ========== GRADIENT FLOW ========== */

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

.gradient-flow {
    background-size: 200% 200%;
    animation: gradientFlow 3s ease infinite;
}

/* ========== ATTENTION SEEKER ========== */

@keyframes attentionSeeker {
    0%, 100% {
        transform: scale(1);
    }
    10%, 20% {
        transform: scale(0.95) rotate(-3deg);
    }
    30%, 50%, 70%, 90% {
        transform: scale(1.05) rotate(3deg);
    }
    40%, 60%, 80% {
        transform: scale(1.05) rotate(-3deg);
    }
}

.attention-seeker {
    animation: attentionSeeker 1s ease-in-out;
}

/* ========== MAP ANIMATIONS ========== */

@keyframes pulse {
    0%, 100% {
        r: 12px;
        opacity: 1;
    }
    50% {
        r: 18px;
        opacity: 0.5;
    }
}

@keyframes drawLine {
    from {
        stroke-dashoffset: 1000;
        opacity: 0;
    }
    to {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

@keyframes nodeFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes nodeGlow {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(79, 168, 255, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(30, 144, 255, 0.8));
    }
}

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

@keyframes mapTitle {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Map node animations with stagger */
.node-0 {
    animation: nodeFloat 3s ease-in-out infinite;
    animation-delay: 0s;
}

.node-1 {
    animation: nodeFloat 3s ease-in-out infinite;
    animation-delay: 0.3s;
}

.node-2 {
    animation: nodeFloat 3s ease-in-out infinite;
    animation-delay: 0.6s;
}

.node-3 {
    animation: nodeFloat 3s ease-in-out infinite;
    animation-delay: 0.9s;
}

.node-4 {
    animation: nodeFloat 3s ease-in-out infinite;
    animation-delay: 1.2s;
}

.node-5 {
    animation: nodeFloat 3s ease-in-out infinite;
    animation-delay: 1.5s;
}


