document.addEventListener('DOMContentLoaded', function() { // Smooth scrolling for anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); }); // Enhanced Intersection Observer with staggered animations const animateOnScroll = new IntersectionObserver((entries) => { entries.forEach((entry, index) => { if (entry.isIntersecting) { setTimeout(() => { entry.target.classList.add('animate-fadeInUp'); if (entry.target.classList.contains('float-animate')) { entry.target.style.animationDelay = `${index * 0.1}s`; } animateOnScroll.unobserve(entry.target); }, index * 100); } }); }, { threshold: 0.1, rootMargin: '0px 0px -100px 0px' }); // Add particle effect to hero section function initParticles() { const hero = document.querySelector('.futuristic-bg'); if (!hero) return; const particleCount = 30; for (let i = 0; i < particleCount; i++) { const particle = document.createElement('div'); particle.className = 'particle'; particle.style.left = `${Math.random() * 100}%`; particle.style.top = `${Math.random() * 100}%`; particle.style.width = `${Math.random() * 3 + 1}px`; particle.style.height = particle.style.width; particle.style.background = `rgba(0, ${Math.random() * 155 + 100}, 255, ${Math.random() * 0.5 + 0.3})`; particle.style.animationDuration = `${Math.random() * 10 + 5}s`; hero.appendChild(particle); } } // Initialize effects when DOM is loaded document.addEventListener('DOMContentLoaded', () => { initParticles(); }); document.querySelectorAll('.scroll-animate').forEach(el => { animateOnScroll.observe(el); }); // Mobile menu toggle (will be handled by navbar component) // Form submission handling const forms = document.querySelectorAll('form'); forms.forEach(form => { form.addEventListener('submit', function(e) { e.preventDefault(); // Here you would typically handle form submission with fetch or similar console.log('Form submitted'); // Show success message const successMsg = document.createElement('div'); successMsg.className = 'fixed top-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg z-50'; successMsg.textContent = 'Thank you! Your message has been sent.'; document.body.appendChild(successMsg); setTimeout(() => { successMsg.remove(); }, 5000); }); }); }); // Initialize feather icons feather.replace(); // Initialize tooltips tippy('[data-tippy-content]', { arrow: true, animation: 'fade', });