// Shared JavaScript across all pages console.log('Peec AI Platform loaded'); // Initialize animations and interactions document.addEventListener('DOMContentLoaded', function() { // Add intersection observer for scroll animations const observerOptions = { threshold: 0.1, rootMargin: '0px 0px -50px 0px' }); // Handle smooth scrolling 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 loading states to buttons document.querySelectorAll('a[href*="app.peec.ai"]').forEach(button => { button.addEventListener('click', function() { this.classList.add('loading'); setTimeout(() => { this.classList.remove('loading'); }, 2000); }); }); } // Handle mobile menu toggle function initMobileMenu() { const mobileMenuButton = document.querySelector('[data-mobile-menu-button]'); const mobileMenu = document.querySelector('[data-mobile-menu]'); if (mobileMenuButton && mobileMenu) { mobileMenuButton.addEventListener('click', function() { mobileMenu.classList.toggle('hidden'); }); } } initMobileMenu(); // Performance monitoring window.addEventListener('load', function() { const loadTime = performance.timing.loadEventEnd - performance.timing.navigationStart; console.log(`Page loaded in ${loadTime}ms`); });