// Smooth scroll for anchor links // document.querySelectorAll('a[href^="#"]').forEach(anchor => { // anchor.addEventListener('click', function (e) { // e.preventDefault(); // const target = document.querySelector(this.getAttribute('href')); // if (target) { // target.scrollIntoView({ // behavior: 'smooth', // block: 'start' // }); // } // }); // }); // Add scroll animations const observerOptions = { threshold: 0.1, rootMargin: '0px 0px -50px 0px' }; const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.style.opacity = '1'; entry.target.style.transform = 'translateY(0)'; } }); }, observerOptions); // Observe sections for animation document.addEventListener('DOMContentLoaded', () => { // Add initial state for animated elements const animatedElements = document.querySelectorAll('.step-card, .feature-card-small'); animatedElements.forEach(el => { el.style.opacity = '0'; el.style.transform = 'translateY(30px)'; el.style.transition = 'opacity 0.6s ease, transform 0.6s ease'; observer.observe(el); }); // Button click handlers const buttons = document.querySelectorAll('.btn'); buttons.forEach(button => { button.addEventListener('click', (e) => { // Prevent default for demo purposes // e.preventDefault(); // Add ripple effect const ripple = document.createElement('span'); const rect = button.getBoundingClientRect(); const size = Math.max(rect.width, rect.height); const x = e.clientX - rect.left - size / 2; const y = e.clientY - rect.top - size / 2; ripple.style.width = ripple.style.height = size + 'px'; ripple.style.left = x + 'px'; ripple.style.top = y + 'px'; ripple.classList.add('ripple'); button.style.position = 'relative'; button.style.overflow = 'hidden'; // Add ripple styles ripple.style.position = 'absolute'; ripple.style.borderRadius = '50%'; ripple.style.background = 'rgba(255, 255, 255, 0.5)'; ripple.style.transform = 'scale(0)'; ripple.style.animation = 'ripple-animation 0.6s ease-out'; button.appendChild(ripple); setTimeout(() => { ripple.remove(); }, 600); // You can add actual navigation logic here console.log('Get Started clicked'); }); }); // Add parallax effect to hero let lastScrollY = window.scrollY; const hero = document.querySelector('.hero'); window.addEventListener('scroll', () => { const scrollY = window.scrollY; const heroHeight = hero.offsetHeight; if (scrollY < heroHeight) { hero.style.transform = `translateY(${scrollY * 0.3}px)`; } lastScrollY = scrollY; }); // Stagger animation for step cards const stepCards = document.querySelectorAll('.step-card'); stepCards.forEach((card, index) => { setTimeout(() => { observer.observe(card); }, index * 100); }); }); // Add ripple animation to stylesheet dynamically const style = document.createElement('style'); style.textContent = ` @keyframes ripple-animation { to { transform: scale(4); opacity: 0; } } `; document.head.appendChild(style); // Handle responsive navigation if needed in future window.addEventListener('resize', () => { // Add any responsive behavior adjustments here if (window.innerWidth < 768) { console.log('Mobile view'); } });