document.addEventListener('DOMContentLoaded', () => {
    // Newsletter form submission
    const form = document.getElementById('newsletter-form');
    form.addEventListener('submit', async (e) => {
        e.preventDefault();
        const email = e.target.querySelector('input[type="email"]').value;
        const subscribe = e.target.querySelector('input[id="subscribe"]').value;
        const message = e.target.querySelector('input[id="sub_message"]');
		    message.setAttribute('type','text');
		    message.type = 'text';
		    const response = await fetch('http://localhost:3001/newsletter', {
            method: 'POST',
            body: JSON.stringify({
                "email": email,
                "subscribe": subscribe
                }), 
            headers: {
              'Content-Type': 'application/json'
            }
            });  
    });
		
    // Add subtle parallax effect to video background
    document.addEventListener('mousemove', (e) => {
        const mouseX = e.clientX / window.innerWidth;
        const mouseY = e.clientY / window.innerHeight;
        
        const video = document.getElementById('background-video');
        video.style.transform = `scale(1.1) translate(${mouseX * -20}px, ${mouseY * -20}px)`;
    });
});
