document.addEventListener('DOMContentLoaded', () => { const toggle = document.querySelector('[data-nav-toggle]'); const links = document.querySelector('[data-nav-links]'); if (toggle && links) { toggle.addEventListener('click', () => { const open = links.classList.toggle('open'); toggle.setAttribute('aria-expanded', open ? 'true' : 'false'); }); } document.querySelectorAll('[data-print]').forEach(btn => { btn.addEventListener('click', () => window.print()); }); document.querySelectorAll('[data-choice-group]').forEach(group => { const output = document.getElementById(group.dataset.output || ''); const buttons = group.querySelectorAll('button[data-text]'); buttons.forEach(btn => { btn.addEventListener('click', () => { buttons.forEach(b => b.classList.remove('active')); btn.classList.add('active'); if (output) output.textContent = btn.dataset.text; }); }); }); const signupType = document.getElementById('signup-type'); const signupHint = document.getElementById('signup-hint'); if (signupType && signupHint) { const hints = { homeschool: 'Start with the free starter pack, a few preview pages, and updates when the full platform opens.', schoolfamily: 'Empathy School families receive a free account. Use this path to request activation and future login details.', teacher: 'Use this path for co-ops, pods, classrooms, and educator previews.' }; const updateHint = () => signupHint.textContent = hints[signupType.value] || hints.homeschool; signupType.addEventListener('change', updateHint); updateHint(); } }); document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('[data-copy-link]').forEach(btn => { btn.addEventListener('click', async () => { try { const target = btn.getAttribute('data-copy-link'); const url = new URL(target, window.location.href).href; await navigator.clipboard.writeText(url); const original = btn.textContent; btn.textContent = 'Link copied'; setTimeout(() => btn.textContent = original, 1400); } catch (e) { window.prompt('Copy this link:', btn.getAttribute('data-copy-link')); } }); }); }); document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('[data-signup-placeholder]').forEach(link => { link.addEventListener('click', (e) => { if (link.getAttribute('href') === '#connect-service') { e.preventDefault(); const note = document.getElementById('service-wire-note'); if (note) note.scrollIntoView({behavior:'smooth', block:'center'}); } }); }); });