document.addEventListener('DOMContentLoaded', function() { const buttons = document.querySelectorAll('.button-container button'); const sections = document.querySelectorAll('section'); // Initially hide all sections sections.forEach(section => { section.classList.remove('active'); }); // Add click event to each button buttons.forEach(button => { button.addEventListener('click', function() { const sectionId = this.getAttribute('data-section'); // Hide all sections sections.forEach(section => { section.classList.remove('active'); }); // Show the corresponding section document.getElementById(sectionId).classList.add('active'); // Update button states buttons.forEach(btn => { btn.classList.remove('active'); }); this.classList.add('active'); }); }); // Optional: Activate first button by default // buttons[0].click(); });