function switchSectionTab(btn, panelId) { // Tab selection uses .is-selected (charter); panel visibility // still uses .active (display: none/block toggle). document.querySelectorAll('.project-sections .section-tab').forEach(function(t) { t.classList.remove('is-selected'); }); document.querySelectorAll('.project-sections .section-panel').forEach(function(p) { p.classList.remove('active'); }); btn.classList.add('is-selected'); var panel = document.getElementById(panelId); if (panel) panel.classList.add('active'); history.replaceState(null, '', '#' + panelId); } (function() { var hash = window.location.hash.replace('#', ''); if (hash) { var panel = document.getElementById(hash); var tab = document.querySelector('.project-sections [data-tab="' + hash + '"]'); if (panel && tab) switchSectionTab(tab, hash); } })();