document.addEventListener('DOMContentLoaded', () => { console.log('Adesk Reimagined - Ready'); // Smooth Scroll for Anchor Links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const targetId = this.getAttribute('href').substring(1); const target = document.getElementById(targetId); if (target) { target.scrollIntoView({ behavior: 'smooth' }); } }); }); // Intersection Observer for Scroll Animations const observerOptions = { root: null, rootMargin: '0px', threshold: 0.1 }; const observer = new IntersectionObserver((entries, observer) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.classList.add('visible'); observer.unobserve(entry.target); // Only animate once } }); }, observerOptions); // Navbar Scroll Effect const navbar = document.querySelector('.navbar'); window.addEventListener('scroll', () => { if (window.scrollY > 50) { navbar.classList.add('scrolled'); } else { navbar.classList.remove('scrolled'); } }); // Select elements to animate const animateElements = document.querySelectorAll('.card, .stat-item, .benefit-item, .content-block, .image-placeholder'); animateElements.forEach(el => { el.style.opacity = '0'; el.style.transform = 'translateY(20px)'; el.style.transition = 'opacity 0.6s ease-out, transform 0.6s ease-out'; observer.observe(el); }); // Add visible class style dynamically const styleSheet = document.createElement("style"); styleSheet.innerText = ` .visible { opacity: 1 !important; transform: translateY(0) !important; } `; document.head.appendChild(styleSheet); });