// Cyberpunk Effects and Animations
document.addEventListener('DOMContentLoaded', function() {
    // Initialize glowing effects
    initGlowEffects();
    
    // Initialize smooth scrolling
    initSmoothScroll();
    
    // Initialize fade-in animations
    initFadeInElements();
});

function initGlowEffects() {
    // Add glow effect to interactive elements
    const glowElements = document.querySelectorAll('.cyber-button, .cyber-panel');
    
    glowElements.forEach(element => {
        element.addEventListener('mousemove', (e) => {
            const rect = element.getBoundingClientRect();
            const x = e.clientX - rect.left;
            const y = e.clientY - rect.top;
            
            element.style.setProperty('--x', `${x}px`);
            element.style.setProperty('--y', `${y}px`);
        });
    });
}

function initSmoothScroll() {
    // Smooth scroll for anchor links
    document.querySelectorAll('a[href^="#"]').forEach(anchor => {
        anchor.addEventListener('click', function(e) {
            e.preventDefault();
            const target = document.querySelector(this.getAttribute('href'));
            if (target) {
                target.scrollIntoView({
                    behavior: 'smooth',
                    block: 'start'
                });
            }
        });
    });
}

function initFadeInElements() {
    // Fade in elements on scroll
    const fadeElements = document.querySelectorAll('.fade-in');
    
    const observer = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.add('visible');
            }
        });
    }, {
        threshold: 0.1
    });
    
    fadeElements.forEach(element => {
        observer.observe(element);
    });
}

// Page transition handler
window.addEventListener('beforeunload', () => {
    document.body.classList.add('page-transition');
}); 