document.addEventListener('DOMContentLoaded', () => { // Intersection Observer for fade-in animations on scroll const observerOptions = { threshold: 0.1, rootMargin: "0px 0px -50px 0px" }; const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.classList.add('animate-fade-in-up'); observer.unobserve(entry.target); } }); }, observerOptions); // Select elements to animate (headings, cards, sections) const animatedElements = document.querySelectorAll('section h2, .grid > div, table, .bg-dark-800'); animatedElements.forEach(el => { el.style.opacity = '0'; // Initial state observer.observe(el); }); // Simple Form Submission Handler (Prevent default for demo) const forms = document.querySelectorAll('form'); forms.forEach(form => { form.addEventListener('submit', (e) => { e.preventDefault(); const email = form.querySelector('input[type="email"]').value; if(email) { alert(`Thanks for signing up with ${email}! This is a demo.`); } }); // Handle button click specifically if not wrapped in form submit correctly or if type="button" const btn = form.querySelector('button[type="button"]'); if(btn) { btn.addEventListener('click', () => { const email = form.querySelector('input[type="email"]').value; if(email) { alert(`Thanks for signing up with ${email}! This is a demo.`); } else { alert('Please enter an email address.'); } }); } }); });