// Main Application Logic document.addEventListener('DOMContentLoaded', () => { // Handle Navigation / SPA Routing const handleNavigation = () => { const hash = window.location.hash || '#home'; const sections = document.querySelectorAll('.view-section'); sections.forEach(section => { if (section.id === hash.substring(1)) { section.classList.remove('hidden'); // Reset animation section.classList.remove('fade-in'); void section.offsetWidth; // trigger reflow section.classList.add('fade-in'); } else { section.classList.add('hidden'); } }); // Update active state in navbar if needed (optional implementation) const navLinks = document.querySelectorAll('a[href^="#"]'); navLinks.forEach(link => { if (link.getAttribute('href') === hash) { link.classList.add('text-primary-400'); } else { link.classList.remove('text-primary-400'); } }); }; // Listen for hash changes window.addEventListener('hashchange', handleNavigation); // Initial load handleNavigation(); // Global initialization for any components that need it console.log('FlowState OS Initialized 🚀'); });