document.addEventListener('DOMContentLoaded', () => { // Add fade-in animation to all cards const cards = document.querySelectorAll('.grid > div'); cards.forEach((card, index) => { card.style.animationDelay = `${index * 0.1}s`; card.classList.add('fade-in'); }); // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); }); }); // Vibe detection from mouse movement let movementEnergy = 0; let lastMoveTime = Date.now(); document.addEventListener('mousemove', (e) => { const now = Date.now(); const timeDiff = now - lastMoveTime; movementEnergy = Math.min(100, movementEnergy + 5 + (1000 / Math.max(100, timeDiff))); lastMoveTime = now; // Slowly decay energy setTimeout(() => { movementEnergy = Math.max(0, movementEnergy - 1); }, 500); }); // Theme toggle functionality function toggleTheme() { const html = document.documentElement; html.classList.toggle('dark'); localStorage.setItem('theme', html.classList.contains('dark') ? 'dark' : 'light'); }