/* HEART Technology Park - Optimized 3D Animations */

/* Master Animation Controller */
.building-3d {
    animation-duration: 8s;
    animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
    animation-iteration-count: infinite;
    animation-fill-mode: both;
    will-change: transform;
}

/* Enhanced Building Float Animation */
@keyframes building-float {
    0% { 
        transform: translateY(0px) rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1); 
        filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.4));
    }
    12.5% { 
        transform: translateY(-8px) rotateX(0.8deg) rotateY(-0.3deg) rotateZ(0.2deg) scale(1.01); 
        filter: drop-shadow(0 35px 65px rgba(0, 0, 0, 0.35));
    }
    25% { 
        transform: translateY(-15px) rotateX(1.2deg) rotateY(-0.5deg) rotateZ(0.4deg) scale(1.02); 
        filter: drop-shadow(0 40px 70px rgba(0, 0, 0, 0.3));
    }
    37.5% { 
        transform: translateY(-18px) rotateX(0.6deg) rotateY(0.2deg) rotateZ(0.1deg) scale(1.025); 
        filter: drop-shadow(0 45px 75px rgba(0, 0, 0, 0.25));
    }
    50% { 
        transform: translateY(-20px) rotateX(0deg) rotateY(0.5deg) rotateZ(-0.2deg) scale(1.03); 
        filter: drop-shadow(0 50px 80px rgba(0, 0, 0, 0.2));
    }
    62.5% { 
        transform: translateY(-16px) rotateX(-0.4deg) rotateY(0.3deg) rotateZ(-0.3deg) scale(1.02); 
        filter: drop-shadow(0 45px 75px rgba(0, 0, 0, 0.25));
    }
    75% { 
        transform: translateY(-10px) rotateX(-0.8deg) rotateY(-0.2deg) rotateZ(0.1deg) scale(1.01); 
        filter: drop-shadow(0 40px 70px rgba(0, 0, 0, 0.3));
    }
    87.5% { 
        transform: translateY(-4px) rotateX(-0.3deg) rotateY(-0.4deg) rotateZ(0.2deg) scale(1.005); 
        filter: drop-shadow(0 35px 65px rgba(0, 0, 0, 0.35));
    }
    100% { 
        transform: translateY(0px) rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1); 
        filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.4));
    }
}

/* Pause Animation on Hover (for better UX) */
.building-3d:hover {
    animation-play-state: paused;
}

/* Optimized Window Breathing Animation */
@keyframes window-glow {
    0% { 
        opacity: 0.85;
        transform: scale(1);
        filter: brightness(1) saturate(1);
    }
    20% { 
        opacity: 0.95;
        transform: scale(1.01);
        filter: brightness(1.1) saturate(1.1);
    }
    40% { 
        opacity: 1;
        transform: scale(1.02);
        filter: brightness(1.2) saturate(1.2);
    }
    60% { 
        opacity: 0.95;
        transform: scale(1.01);
        filter: brightness(1.1) saturate(1.1);
    }
    80% { 
        opacity: 0.9;
        transform: scale(1.005);
        filter: brightness(1.05) saturate(1.05);
    }
    100% { 
        opacity: 0.85;
        transform: scale(1);
        filter: brightness(1) saturate(1);
    }
}

/* Antenna Pulsing Animation */
@keyframes antenna-blink {
    0%, 100% { 
        opacity: 0.8; 
        transform: scale(1);
        box-shadow: 
            2px 0 0 #FFB74D,
            4px 0 0 #FFA726,
            0 -10px 0 rgba(255,167,38,0.8);
    }
    25% { 
        opacity: 0.9; 
        transform: scale(1.05);
        box-shadow: 
            2px 0 0 #FFD54F,
            4px 0 0 #FFB74D,
            0 -10px 0 rgba(255,167,38,0.9),
            0 0 15px rgba(255,167,38,0.6);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.1);
        box-shadow: 
            2px 0 0 #FFEB3B,
            4px 0 0 #FFD54F,
            0 -10px 0 rgba(255,167,38,1),
            0 0 25px rgba(255,167,38,0.8),
            0 0 40px rgba(255,167,38,0.6);
    }
    75% { 
        opacity: 0.95; 
        transform: scale(1.05);
        box-shadow: 
            2px 0 0 #FFD54F,
            4px 0 0 #FFB74D,
            0 -10px 0 rgba(255,167,38,0.9),
            0 0 20px rgba(255,167,38,0.7);
    }
}

/* Logo Glow Animation with Pulse */
@keyframes logo-glow {
    0% { 
        color: #FFA726; 
        text-shadow: 
            0 2px 4px rgba(0,0,0,0.5),
            0 0 10px rgba(255,167,38,0.3);
        transform: scale(1);
    }
    25% { 
        color: #FFB74D; 
        text-shadow: 
            0 2px 4px rgba(0,0,0,0.5),
            0 0 15px rgba(255,167,38,0.5),
            0 0 25px rgba(255,167,38,0.3);
        transform: scale(1.02);
    }
    50% { 
        color: #FFD54F; 
        text-shadow: 
            0 2px 4px rgba(0,0,0,0.5),
            0 0 20px rgba(255,167,38,0.8),
            0 0 35px rgba(255,167,38,0.5),
            0 0 50px rgba(255,167,38,0.3);
        transform: scale(1.05);
    }
    75% { 
        color: #FFB74D; 
        text-shadow: 
            0 2px 4px rgba(0,0,0,0.5),
            0 0 15px rgba(255,167,38,0.6),
            0 0 30px rgba(255,167,38,0.4);
        transform: scale(1.02);
    }
    100% { 
        color: #FFA726; 
        text-shadow: 
            0 2px 4px rgba(0,0,0,0.5),
            0 0 10px rgba(255,167,38,0.3);
        transform: scale(1);
    }
}

/* Building Glow Pulse */
@keyframes glow-pulse {
    0% { 
        opacity: 0.6; 
        transform: scale(1) rotate(0deg);
        filter: blur(20px);
    }
    25% { 
        opacity: 0.8; 
        transform: scale(1.05) rotate(90deg);
        filter: blur(15px);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.1) rotate(180deg);
        filter: blur(10px);
    }
    75% { 
        opacity: 0.8; 
        transform: scale(1.05) rotate(270deg);
        filter: blur(15px);
    }
    100% { 
        opacity: 0.6; 
        transform: scale(1) rotate(360deg);
        filter: blur(20px);
    }
}

/* Night Mode Enhanced Animations */
@keyframes night-window-glow {
    0% { 
        box-shadow: 
            inset 2px 2px 4px rgba(255,255,255,0.4),
            inset -2px -2px 4px rgba(0,0,0,0.2),
            2px 2px 8px rgba(0,0,0,0.3),
            0 0 15px rgba(255,167,38,0.6);
        filter: brightness(1.2) saturate(1.2);
    }
    33% { 
        box-shadow: 
            inset 2px 2px 4px rgba(255,255,255,0.5),
            inset -2px -2px 4px rgba(0,0,0,0.3),
            2px 2px 12px rgba(0,0,0,0.4),
            0 0 25px rgba(255,167,38,0.8),
            0 0 40px rgba(255,167,38,0.4);
        filter: brightness(1.4) saturate(1.4);
    }
    66% { 
        box-shadow: 
            inset 2px 2px 4px rgba(255,255,255,0.6),
            inset -2px -2px 4px rgba(0,0,0,0.4),
            2px 2px 15px rgba(0,0,0,0.5),
            0 0 35px rgba(255,167,38,1),
            0 0 60px rgba(255,167,38,0.6);
        filter: brightness(1.6) saturate(1.6);
    }
    100% { 
        box-shadow: 
            inset 2px 2px 4px rgba(255,255,255,0.4),
            inset -2px -2px 4px rgba(0,0,0,0.2),
            2px 2px 8px rgba(0,0,0,0.3),
            0 0 15px rgba(255,167,38,0.6);
        filter: brightness(1.2) saturate(1.2);
    }
}

/* Entrance Door Animation */
@keyframes entrance-glow {
    0%, 100% { 
        box-shadow: 
            inset 0 -10px 20px rgba(0,0,0,0.3),
            0 0 20px rgba(74, 108, 247, 0.4);
    }
    50% { 
        box-shadow: 
            inset 0 -10px 20px rgba(0,0,0,0.2),
            0 0 30px rgba(74, 108, 247, 0.6),
            0 0 50px rgba(74, 108, 247, 0.3);
    }
}

/* Performance Optimizations */

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .building-3d {
        animation: building-float-reduced 12s ease-in-out infinite;
    }
    
    .window {
        animation: window-glow-reduced 8s ease-in-out infinite;
    }
    
    @keyframes building-float-reduced {
        0%, 100% { 
            transform: translateY(0px); 
        }
        50% { 
            transform: translateY(-5px); 
        }
    }
    
    @keyframes window-glow-reduced {
        0%, 100% { opacity: 0.9; }
        50% { opacity: 1; }
    }
}

/* GPU Acceleration for Smooth Performance */
.building-3d,
.building-facade,
.building-side,
.building-roof,
.window,
.building-glow {
    transform: translateZ(0);
    will-change: transform, opacity, filter;
    backface-visibility: hidden;
}

/* Animation Timing Optimization */
.building-3d {
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.window {
    animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
}

/* Entrance Animation */
.building-entrance {
    animation: entrance-glow 5s ease-in-out infinite;
}

/* Parallax Enhancement During Scroll */
@keyframes scroll-enhance {
    0% { 
        filter: brightness(1) contrast(1) saturate(1);
    }
    100% { 
        filter: brightness(1.1) contrast(1.05) saturate(1.1);
    }
}

/* Enhanced Window Stagger Timing */
.window:nth-child(4n+1) { animation-delay: 0s; animation-duration: 4s; }
.window:nth-child(4n+2) { animation-delay: 1s; animation-duration: 5s; }
.window:nth-child(4n+3) { animation-delay: 2s; animation-duration: 4.5s; }
.window:nth-child(4n+4) { animation-delay: 3s; animation-duration: 4.2s; }

/* Special Conference Room Animation */
.window-conference {
    animation: conference-room-glow 6s ease-in-out infinite;
}

@keyframes conference-room-glow {
    0%, 100% { 
        opacity: 0.9;
        transform: scale(1);
        filter: brightness(1) saturate(1);
        box-shadow: 
            inset 4px 4px 8px rgba(255,255,255,0.6),
            inset -4px -4px 8px rgba(0,0,0,0.4),
            4px 4px 16px rgba(0,0,0,0.5);
    }
    50% { 
        opacity: 1;
        transform: scale(1.03);
        filter: brightness(1.3) saturate(1.3);
        box-shadow: 
            inset 4px 4px 8px rgba(255,255,255,0.8),
            inset -4px -4px 8px rgba(0,0,0,0.2),
            4px 4px 20px rgba(0,0,0,0.6),
            0 0 30px rgba(33,150,243,0.8);
    }
}