/** * AFG CARS 2026 - Main JavaScript */ document.addEventListener('DOMContentLoaded', function() { // Add scroll event for navbar glassmorphism intensity const navbar = document.querySelector('.navbar'); window.addEventListener('scroll', function() { if (window.scrollY > 20) { navbar.style.background = 'rgba(2, 6, 23, 0.9)'; navbar.style.boxShadow = '0 10px 30px -10px rgba(0,0,0,0.5)'; navbar.style.height = '70px'; } else { navbar.style.background = 'rgba(2, 6, 23, 0.7)'; navbar.style.boxShadow = 'none'; navbar.style.height = '80px'; } }); // Form submission feedback const forms = document.querySelectorAll('form'); forms.forEach(form => { form.addEventListener('submit', function() { const btn = this.querySelector('button[type="submit"]'); if (btn) { const originalText = btn.innerHTML; btn.innerHTML = 'Processing...'; btn.style.opacity = '0.7'; btn.disabled = true; } }); }); // Intersection Observer for scroll animations const observerOptions = { threshold: 0.1 }; const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.style.opacity = '1'; entry.target.style.transform = 'translateY(0)'; } }); }, observerOptions); document.querySelectorAll('.glass-card').forEach(card => { card.style.opacity = '0'; card.style.transform = 'translateY(20px)'; card.style.transition = 'all 0.6s cubic-bezier(0.4, 0, 0.2, 1)'; observer.observe(card); }); });