// Mobile menu function toggleMenu() { document.getElementById('mobileMenu').classList.toggle('open'); } // AOS scroll animations function initAOS() { const els = document.querySelectorAll('[data-aos]'); const observer = new IntersectionObserver((entries) => { entries.forEach(e => { if (e.isIntersecting) { e.target.classList.add('visible'); } }); }, { threshold: 0.12 }); els.forEach(el => observer.observe(el)); } // Lead form submit function submitForm(e) { e.preventDefault(); const btn = e.target.querySelector('.btn-submit'); btn.disabled = true; btn.textContent = 'Submitting...'; // Simulate API call — replace with your actual endpoint setTimeout(() => { document.getElementById('leadForm').style.display = 'none'; document.getElementById('formSuccess').style.display = 'block'; // Redirect to thank-you page after 2 seconds setTimeout(() => { window.location.href = 'thank-you.html'; }, 2000); }, 1200); } // Nav shadow on scroll window.addEventListener('scroll', () => { const nav = document.querySelector('.nav'); if (nav) nav.style.boxShadow = window.scrollY > 20 ? '0 2px 20px rgba(0,0,0,0.4)' : 'none'; }); // Init document.addEventListener('DOMContentLoaded', initAOS); // Hero lead form function submitHeroForm(e) { e.preventDefault(); const btn = document.getElementById('heroSubmitBtn'); btn.disabled = true; btn.textContent = 'Submitting...'; // Collect data const data = { name: document.getElementById('h-name').value, phone: document.getElementById('h-phone').value, email: document.getElementById('h-email').value, city: document.getElementById('h-city').value, units: document.getElementById('h-units').value, }; // TODO: replace with your actual API endpoint / CRM webhook // fetch('/api/leads', { method:'POST', body: JSON.stringify(data) }) // Simulated success (remove setTimeout when wired to real backend) setTimeout(() => { document.getElementById('heroLeadForm').style.display = 'none'; document.getElementById('heroFormSuccess').style.display = 'block'; // Optional: redirect to thank-you page // window.location.href = 'thank-you.html'; }, 1000); }