(() => { 'use strict'; // ═══════════════ VERTICAL SCROLL PROGRESS ═══════════════ const progressWrap = document.createElement('div'); progressWrap.className = 'scroll-progress-wrap'; progressWrap.innerHTML = `
0%
`; document.body.appendChild(progressWrap); const scrollFill = progressWrap.querySelector('.scroll-fill'); const scrollGlow = progressWrap.querySelector('.scroll-glow'); const scrollPct = progressWrap.querySelector('.scroll-pct'); const scrollDotsContainer = progressWrap.querySelector('.scroll-dots'); const progressSections = [ { id: 'hero', label: 'Home' }, { id: 'sih24', label: 'SIH\'24' }, { id: 'about', label: 'About' }, { id: 'experience', label: 'Experience' }, { id: 'training', label: 'Training' }, { id: 'skills', label: 'Skills' }, { id: 'offers', label: 'Offers' }, { id: 'gallery', label: 'Gallery' }, { id: 'tamil', label: 'Tamil' }, { id: 'awards', label: 'Awards' }, { id: 'contact', label: 'Contact' }, ]; progressSections.forEach(({ id, label }) => { const dot = document.createElement('button'); dot.className = 'scroll-dot-nav'; dot.dataset.label = label; dot.dataset.section = id; dot.addEventListener('click', () => { const target = document.getElementById(id); if (target) target.scrollIntoView({ behavior: 'smooth' }); }); scrollDotsContainer.appendChild(dot); }); let scrollTimeout; let currentProgress = 0; let targetProgress = 0; // ═══════════════ CURSOR GLOW ═══════════════ const cursorGlow = document.createElement('div'); cursorGlow.className = 'cursor-glow'; document.body.appendChild(cursorGlow); let cursorX = 0, cursorY = 0, glowX = 0, glowY = 0; document.addEventListener('mousemove', e => { cursorX = e.clientX; cursorY = e.clientY; }, { passive: true }); function animateCursorGlow() { glowX += (cursorX - glowX) * 0.08; glowY += (cursorY - glowY) * 0.08; cursorGlow.style.left = glowX + 'px'; cursorGlow.style.top = glowY + 'px'; requestAnimationFrame(animateCursorGlow); } animateCursorGlow(); // ═══════════════ TYPEWRITER ═══════════════ const tw = document.getElementById('typewriter'); const phrases = [ 'Uber, Ola & EY', 'Power BI & Tableau', 'SQL, Python & ML', 'International Programs', 'Hackathon Teams', '6000+ Professionals', ]; let pi = 0, ci = 0, deleting = false; function type() { const word = phrases[pi]; tw.textContent = deleting ? word.substring(0, ci--) : word.substring(0, ci++); if (!deleting && ci > word.length) { setTimeout(() => { deleting = true; type(); }, 2200); return; } if (deleting && ci < 0) { deleting = false; pi = (pi + 1) % phrases.length; setTimeout(type, 500); return; } setTimeout(type, deleting ? 35 : 70); } type(); // ═══════════════ SCROLL HANDLER (Progress + Parallax) ═══════════════ const navbar = document.getElementById('navbar'); function onScroll() { const scrollTop = window.scrollY; const docHeight = document.documentElement.scrollHeight - window.innerHeight; targetProgress = docHeight > 0 ? scrollTop / docHeight : 0; navbar.classList.toggle('scrolled', scrollTop > 60); progressWrap.classList.add('scrolling'); clearTimeout(scrollTimeout); scrollTimeout = setTimeout(() => progressWrap.classList.remove('scrolling'), 1500); const dots = scrollDotsContainer.querySelectorAll('.scroll-dot-nav'); dots.forEach(dot => { const sec = document.getElementById(dot.dataset.section); if (!sec) return; const rect = sec.getBoundingClientRect(); const inView = rect.top < window.innerHeight * 0.5 && rect.bottom > 0; dot.classList.toggle('active', inView); }); document.querySelectorAll('.parallax-slow').forEach(el => { const speed = parseFloat(el.dataset.speed || 0.05); const rect = el.getBoundingClientRect(); const center = rect.top + rect.height / 2 - window.innerHeight / 2; el.style.transform = `translateY(${center * speed}px)`; }); document.querySelectorAll('.parallax-fast').forEach(el => { const speed = parseFloat(el.dataset.speed || 0.12); const rect = el.getBoundingClientRect(); const center = rect.top + rect.height / 2 - window.innerHeight / 2; el.style.transform = `translateY(${center * speed}px)`; }); } function animateProgress() { currentProgress += (targetProgress - currentProgress) * 0.12; const pct = Math.round(currentProgress * 100); scrollFill.style.height = pct + '%'; scrollGlow.style.height = pct + '%'; scrollPct.textContent = pct + '%'; const hue = 250 + currentProgress * 130; scrollFill.style.boxShadow = `0 0 8px 2px hsla(${hue}, 70%, 60%, 0.3)`; requestAnimationFrame(animateProgress); } requestAnimationFrame(animateProgress); window.addEventListener('scroll', onScroll, { passive: true }); onScroll(); // ═══════════════ MOBILE MENU ═══════════════ const hamburger = document.getElementById('hamburger'); const navLinks = document.getElementById('navLinks'); hamburger.addEventListener('click', () => { hamburger.classList.toggle('active'); navLinks.classList.toggle('open'); }); navLinks.querySelectorAll('a').forEach(a => { a.addEventListener('click', () => { hamburger.classList.remove('active'); navLinks.classList.remove('open'); }); }); // ═══════════════ ACTIVE NAV LINK ═══════════════ const sections = document.querySelectorAll('.section, .sih-jury-banner, .tamil-heritage'); const navItems = document.querySelectorAll('.nav-links a'); const navObserver = new IntersectionObserver(entries => { entries.forEach(e => { if (e.isIntersecting) { navItems.forEach(a => a.classList.remove('active')); const match = document.querySelector(`.nav-links a[href="#${e.target.id}"]`); if (match) match.classList.add('active'); } }); }, { rootMargin: '-35% 0px -65% 0px' }); sections.forEach(s => { if (s.id) navObserver.observe(s); }); // ═══════════════ REVEAL ON SCROLL (Advanced) ═══════════════ const revealClasses = ['.reveal', '.reveal-left', '.reveal-right', '.reveal-scale']; const allReveals = document.querySelectorAll(revealClasses.join(',')); const revealObserver = new IntersectionObserver(entries => { entries.forEach(e => { if (e.isIntersecting) { e.target.classList.add('visible'); revealObserver.unobserve(e.target); } }); }, { threshold: 0.1 }); allReveals.forEach(el => revealObserver.observe(el)); // ═══════════════ STAGGER CHILDREN ═══════════════ document.querySelectorAll('.stagger-children').forEach(parent => { const children = parent.querySelectorAll('.reveal, .reveal-left, .reveal-right, .reveal-scale'); children.forEach((child, i) => child.style.setProperty('--i', i)); }); // ═══════════════ ANIMATED COUNTERS ═══════════════ const counterEls = document.querySelectorAll('.ticker-num, .fc-number, .tamil-stat-num, .popup-stats strong'); const counterObserver = new IntersectionObserver(entries => { entries.forEach(e => { if (e.isIntersecting && !e.target.dataset.counted) { e.target.dataset.counted = '1'; animateCounter(e.target); } }); }, { threshold: 0.5 }); counterEls.forEach(el => counterObserver.observe(el)); function animateCounter(el) { const text = el.textContent.trim(); const match = text.match(/^(\d+)/); if (!match) return; const target = parseInt(match[1]); const suffix = text.replace(match[1], ''); const duration = 1500; const startTime = performance.now(); function step(now) { const elapsed = now - startTime; const progress = Math.min(elapsed / duration, 1); const eased = 1 - Math.pow(1 - progress, 3); const current = Math.round(target * eased); el.textContent = current + suffix; if (progress < 1) requestAnimationFrame(step); else el.classList.add('counting'); } requestAnimationFrame(step); } // ═══════════════ 3D TILT EFFECT ═══════════════ function initTilt() { document.querySelectorAll('.training-card, .award-card, .offer-highlight, .info-card').forEach(card => { card.classList.add('tilt-card'); const shine = document.createElement('div'); shine.className = 'tilt-shine'; card.appendChild(shine); card.addEventListener('mousemove', e => { const rect = card.getBoundingClientRect(); const x = (e.clientX - rect.left) / rect.width; const y = (e.clientY - rect.top) / rect.height; const tiltX = (y - 0.5) * 8; const tiltY = (x - 0.5) * -8; card.style.transform = `perspective(800px) rotateX(${tiltX}deg) rotateY(${tiltY}deg) scale(1.02)`; shine.style.setProperty('--mx', (x * 100) + '%'); shine.style.setProperty('--my', (y * 100) + '%'); }); card.addEventListener('mouseleave', () => { card.style.transform = ''; }); }); } initTilt(); // ═══════════════ MAGNETIC BUTTONS ═══════════════ document.querySelectorAll('.btn-glow, .btn-whatsapp, .btn-call').forEach(btn => { btn.classList.add('btn-magnetic'); btn.addEventListener('mousemove', e => { const rect = btn.getBoundingClientRect(); const x = e.clientX - rect.left - rect.width / 2; const y = e.clientY - rect.top - rect.height / 2; btn.style.transform = `translate(${x * 0.15}px, ${y * 0.15}px) scale(1.04)`; }); btn.addEventListener('mouseleave', () => { btn.style.transform = ''; }); }); // ═══════════════ EMOJI REACTIONS ON SECTION SCROLL ═══════════════ const sectionEmojis = { 'sih24': ['🏆', '⭐', '🎯', '🔥'], 'about': ['💼', '🧠', '📊', '🚀'], 'experience': ['💻', '📈', '🏢', '⚡'], 'training': ['🎓', '📚', '🌍', '✨'], 'skills': ['⚙️', '🛠️', '💡', '🔧'], 'offers': ['🎉', '🏅', '💰', '🔑'], 'gallery': ['📸', '🖼️', '🎬', '✨'], 'tamil': ['🎤', '🏛️', '📜', '🪔'], 'awards': ['🏆', '🥇', '⭐', '🎖️'], 'contact': ['📬', '🤝', '💬', '❤️'], }; const emojiObserver = new IntersectionObserver(entries => { entries.forEach(e => { if (e.isIntersecting && !e.target.dataset.emojiFired) { e.target.dataset.emojiFired = '1'; const emojis = sectionEmojis[e.target.id]; if (emojis) burstSectionEmojis(e.target, emojis); } }); }, { threshold: 0.2 }); document.querySelectorAll('.section, .sih-jury-banner, .tamil-heritage').forEach(s => { if (s.id && sectionEmojis[s.id]) emojiObserver.observe(s); }); function burstSectionEmojis(section, emojis) { const rect = section.getBoundingClientRect(); for (let i = 0; i < 8; i++) { setTimeout(() => { const emoji = emojis[Math.floor(Math.random() * emojis.length)]; const span = document.createElement('span'); span.className = 'emoji-particle'; span.textContent = emoji; const startX = rect.left + Math.random() * rect.width; const startY = rect.top + window.scrollY + 60; span.style.left = startX + 'px'; span.style.top = startY + 'px'; const dx = (Math.random() - 0.5) * 120; span.style.setProperty('--dx', dx + 'px'); span.style.setProperty('--dx2', dx * 1.5 + 'px'); document.body.appendChild(span); setTimeout(() => span.remove(), 2600); }, i * 120); } } // ═══════════════ CARD CLICK EMOJI BURST ═══════════════ const cardEmojis = ['🔥', '⭐', '💫', '✨', '🚀', '💯', '🎯', '❤️']; function addEmojiOnClick(el) { el.addEventListener('click', e => { for (let i = 0; i < 6; i++) { const emoji = cardEmojis[Math.floor(Math.random() * cardEmojis.length)]; const span = document.createElement('span'); span.className = 'emoji-burst'; span.textContent = emoji; const angle = (i / 6) * Math.PI * 2; const dist = 40 + Math.random() * 40; const bx = Math.cos(angle) * dist; const by = Math.sin(angle) * dist; span.style.setProperty('--bx', bx + 'px'); span.style.setProperty('--by', by + 'px'); span.style.setProperty('--bx2', bx * 1.8 + 'px'); span.style.setProperty('--by2', (by * 1.8 - 30) + 'px'); span.style.left = (e.offsetX || el.offsetWidth / 2) + 'px'; span.style.top = (e.offsetY || el.offsetHeight / 2) + 'px'; el.appendChild(span); setTimeout(() => span.remove(), 1100); } }); } document.querySelectorAll('.offer-card, .award-card, .training-card, .skill-cat, .test-card').forEach(addEmojiOnClick); // ═══════════════ GALLERY HOVER EMOJIS ═══════════════ const galleryEmojis = ['📸', '🔥', '⭐', '💫', '✨', '👀', '🎯', '💜']; document.querySelectorAll('.gallery-item').forEach(item => { const emojiSpan = document.createElement('span'); emojiSpan.className = 'hover-emoji'; emojiSpan.textContent = galleryEmojis[Math.floor(Math.random() * galleryEmojis.length)]; item.appendChild(emojiSpan); }); // ═══════════════ FLOATING SECTION EMOJI DECORATIONS ═══════════════ const sectionDecoEmojis = { 'experience': [{ e: '💼', t: '10%', l: '5%', d: '0s' }, { e: '📈', t: '20%', r: '8%', d: '2s' }], 'training': [{ e: '🌏', t: '15%', r: '5%', d: '1s' }, { e: '📚', t: '40%', l: '3%', d: '3s' }], 'skills': [{ e: '⚡', t: '12%', l: '6%', d: '0.5s' }, { e: '🧠', t: '30%', r: '4%', d: '2.5s' }], 'offers': [{ e: '🏅', t: '8%', r: '6%', d: '0s' }, { e: '💰', t: '45%', l: '4%', d: '1.5s' }], 'tamil': [{ e: '🪔', t: '10%', l: '5%', d: '0s' }, { e: '📜', t: '25%', r: '6%', d: '2s' }], }; Object.entries(sectionDecoEmojis).forEach(([id, emojis]) => { const section = document.getElementById(id); if (!section) return; section.style.position = 'relative'; emojis.forEach(({ e, t, l, r, d }) => { const span = document.createElement('span'); span.className = 'section-emoji'; span.textContent = e; span.style.top = t; if (l) span.style.left = l; if (r) span.style.right = r; span.style.animationDelay = d; section.appendChild(span); }); }); // ═══════════════ CARD RIPPLE EFFECT ═══════════════ document.querySelectorAll('.offer-card, .training-card, .award-card').forEach(card => { card.style.position = 'relative'; card.style.overflow = 'hidden'; card.addEventListener('mouseenter', e => { const ripple = document.createElement('div'); ripple.className = 'ripple-effect'; const rect = card.getBoundingClientRect(); const size = Math.max(rect.width, rect.height); ripple.style.width = ripple.style.height = size + 'px'; ripple.style.left = (e.clientX - rect.left - size / 2) + 'px'; ripple.style.top = (e.clientY - rect.top - size / 2) + 'px'; card.appendChild(ripple); setTimeout(() => ripple.remove(), 700); }); }); // ═══════════════ TEXT SCRAMBLE FOR SECTION TITLES ═══════════════ function scrambleText(el) { const original = el.textContent; const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%'; let iterations = 0; const interval = setInterval(() => { el.textContent = original.split('').map((char, i) => { if (char === ' ') return ' '; if (i < iterations) return original[i]; return chars[Math.floor(Math.random() * chars.length)]; }).join(''); iterations += 0.8; if (iterations >= original.length) { clearInterval(interval); el.textContent = original; } }, 30); } const titleObserver = new IntersectionObserver(entries => { entries.forEach(e => { if (e.isIntersecting && !e.target.dataset.scrambled) { e.target.dataset.scrambled = '1'; scrambleText(e.target); } }); }, { threshold: 0.5 }); document.querySelectorAll('.section-label').forEach(el => titleObserver.observe(el)); // ═══════════════ GALLERY FILTER ═══════════════ const tabs = document.querySelectorAll('.gtab'); const galleryItems = document.querySelectorAll('.gallery-item'); tabs.forEach(tab => { tab.addEventListener('click', () => { tabs.forEach(t => t.classList.remove('active')); tab.classList.add('active'); const filter = tab.dataset.filter; galleryItems.forEach((item, i) => { if (filter === 'all' || item.dataset.category === filter) { item.classList.remove('hidden'); item.style.animationDelay = (i * 0.05) + 's'; item.style.animation = 'none'; item.offsetHeight; item.style.animation = 'galleryFadeIn 0.5s ease forwards'; } else { item.classList.add('hidden'); } }); }); }); // ═══════════════ LIGHTBOX ═══════════════ const lightbox = document.getElementById('lightbox'); const lbImg = document.getElementById('lbImg'); const lbCaption = document.getElementById('lbCaption'); const lbClose = document.getElementById('lbClose'); const lbPrev = document.getElementById('lbPrev'); const lbNext = document.getElementById('lbNext'); let lbIndex = 0; function getVisibleItems() { return [...document.querySelectorAll('.gallery-item:not(.hidden)')]; } function openLightbox(idx) { const visible = getVisibleItems(); lbIndex = idx; const item = visible[idx]; lbImg.src = item.querySelector('img').src; lbCaption.textContent = item.querySelector('h4')?.textContent || ''; lightbox.classList.add('open'); document.body.style.overflow = 'hidden'; } function closeLightbox() { lightbox.classList.remove('open'); document.body.style.overflow = ''; } function navigate(dir) { const visible = getVisibleItems(); lbIndex = (lbIndex + dir + visible.length) % visible.length; const item = visible[lbIndex]; lbImg.src = item.querySelector('img').src; lbCaption.textContent = item.querySelector('h4')?.textContent || ''; } galleryItems.forEach(item => { item.addEventListener('click', () => { const visible = getVisibleItems(); const idx = visible.indexOf(item); if (idx >= 0) openLightbox(idx); }); }); lbClose.addEventListener('click', closeLightbox); lbPrev.addEventListener('click', () => navigate(-1)); lbNext.addEventListener('click', () => navigate(1)); lightbox.addEventListener('click', e => { if (e.target === lightbox) closeLightbox(); }); document.addEventListener('keydown', e => { if (!lightbox.classList.contains('open')) return; if (e.key === 'Escape') closeLightbox(); if (e.key === 'ArrowLeft') navigate(-1); if (e.key === 'ArrowRight') navigate(1); }); // ═══════════════ PROFILE POPUP ═══════════════ const profileAvatar = document.getElementById('profileAvatar'); const profilePopup = document.getElementById('profilePopup'); const popupClose = document.getElementById('popupClose'); const popupBackdrop = document.getElementById('popupBackdrop'); profileAvatar.addEventListener('click', () => { profilePopup.classList.add('open'); document.body.style.overflow = 'hidden'; }); function closePopup() { profilePopup.classList.remove('open'); document.body.style.overflow = ''; } popupClose.addEventListener('click', closePopup); popupBackdrop.addEventListener('click', closePopup); document.addEventListener('keydown', e => { if (e.key === 'Escape' && profilePopup.classList.contains('open')) closePopup(); }); // ═══════════════ SIH'24 IMAGE SLIDER ═══════════════ const jurySlides = document.querySelectorAll('.jury-slider .slide'); const sliderDots = document.getElementById('sliderDots'); const sliderPrev = document.getElementById('sliderPrev'); const sliderNext = document.getElementById('sliderNext'); let currentSlide = 0; let slideTimer; jurySlides.forEach((_, i) => { const dot = document.createElement('button'); dot.classList.add('slider-dot'); if (i === 0) dot.classList.add('active'); dot.addEventListener('click', () => goToSlide(i)); sliderDots.appendChild(dot); }); function goToSlide(idx) { jurySlides[currentSlide].classList.remove('active'); sliderDots.children[currentSlide].classList.remove('active'); currentSlide = (idx + jurySlides.length) % jurySlides.length; jurySlides[currentSlide].classList.add('active'); sliderDots.children[currentSlide].classList.add('active'); resetAutoSlide(); } sliderPrev.addEventListener('click', () => goToSlide(currentSlide - 1)); sliderNext.addEventListener('click', () => goToSlide(currentSlide + 1)); function resetAutoSlide() { clearInterval(slideTimer); slideTimer = setInterval(() => goToSlide(currentSlide + 1), 4000); } resetAutoSlide(); // ═══════════════ TAMIL SLIDER ═══════════════ const tamilSlider = document.getElementById('tamilSlider'); if (tamilSlider) { const tSlides = tamilSlider.querySelectorAll('.tamil-slide'); const tPrev = document.getElementById('tamilSliderPrev'); const tNext = document.getElementById('tamilSliderNext'); const tDots = document.getElementById('tamilSliderDots'); let tCurrent = 0; let tTimer; tSlides.forEach((_, i) => { const dot = document.createElement('button'); dot.classList.add('tamil-slider-dot'); if (i === 0) dot.classList.add('active'); dot.addEventListener('click', () => goToTamilSlide(i)); tDots.appendChild(dot); }); function goToTamilSlide(idx) { tSlides[tCurrent].classList.remove('active'); tDots.children[tCurrent].classList.remove('active'); tCurrent = (idx + tSlides.length) % tSlides.length; tSlides[tCurrent].classList.add('active'); tDots.children[tCurrent].classList.add('active'); resetTamilAutoSlide(); } tPrev.addEventListener('click', () => goToTamilSlide(tCurrent - 1)); tNext.addEventListener('click', () => goToTamilSlide(tCurrent + 1)); function resetTamilAutoSlide() { clearInterval(tTimer); tTimer = setInterval(() => goToTamilSlide(tCurrent + 1), 5000); } resetTamilAutoSlide(); } // ═══════════════ CONTACT FORM ═══════════════ const form = document.getElementById('contactForm'); form.addEventListener('submit', e => { e.preventDefault(); const btn = form.querySelector('button[type="submit"]'); const orig = btn.innerHTML; btn.innerHTML = 'Message Sent! 🎉'; btn.style.background = '#22c55e'; btn.disabled = true; form.reset(); burstSectionEmojis(form, ['🎉', '✅', '❤️', '📬', '🚀']); setTimeout(() => { btn.innerHTML = orig; btn.style.background = ''; btn.disabled = false; }, 3000); }); // ═══════════════ SMOOTH SCROLL FOR ALL ANCHORS ═══════════════ document.querySelectorAll('a[href^="#"]').forEach(a => { a.addEventListener('click', e => { const target = document.querySelector(a.getAttribute('href')); if (target) { e.preventDefault(); target.scrollIntoView({ behavior: 'smooth' }); } }); }); // ═══════════════ PARALLAX ON HERO GLOWS ═══════════════ document.querySelectorAll('.hero-glow').forEach(glow => { glow.classList.add('parallax-slow'); glow.dataset.speed = '0.06'; }); document.querySelectorAll('.floating-card').forEach(fc => { fc.classList.add('parallax-fast'); fc.dataset.speed = '0.08'; }); // ═══════════════ ADD BREATHING BORDER TO HIGHLIGHT CARDS ═══════════════ document.querySelectorAll('.offer-highlight, .tamil-highlight').forEach(el => { el.classList.add('breathing-border'); }); // ═══════════════ SHIMMER ON SECTION TITLES ═══════════════ const shimmerObserver = new IntersectionObserver(entries => { entries.forEach(e => { if (e.isIntersecting && !e.target.dataset.shimmered) { e.target.dataset.shimmered = '1'; const gradientSpan = e.target.querySelector('.gradient-text'); if (gradientSpan) gradientSpan.classList.add('shimmer-text'); } }); }, { threshold: 0.5 }); document.querySelectorAll('.section-title').forEach(t => shimmerObserver.observe(t)); })(); (() => { 'use strict'; document.body.classList.add('neo-theme'); // Ambient particle canvas const canvas = document.createElement('canvas'); canvas.className = 'ambient-canvas'; document.body.prepend(canvas); const ctx = canvas.getContext('2d'); let w = 0; let h = 0; const particles = []; function resizeCanvas() { w = canvas.width = window.innerWidth; h = canvas.height = window.innerHeight; } resizeCanvas(); window.addEventListener('resize', resizeCanvas, { passive: true }); for (let i = 0; i < 55; i += 1) { particles.push({ x: Math.random() * w, y: Math.random() * h, r: Math.random() * 2.2 + 0.6, vx: (Math.random() - 0.5) * 0.26, vy: (Math.random() - 0.5) * 0.26, hue: 220 + Math.random() * 120, }); } function drawParticles() { if (!ctx) return; ctx.clearRect(0, 0, w, h); particles.forEach(p => { p.x += p.vx; p.y += p.vy; if (p.x < 0 || p.x > w) p.vx *= -1; if (p.y < 0 || p.y > h) p.vy *= -1; ctx.beginPath(); ctx.arc(p.x, p.y, p.r, 0, Math.PI * 2); ctx.fillStyle = `hsla(${p.hue}, 90%, 68%, 0.35)`; ctx.fill(); }); for (let i = 0; i < particles.length; i += 1) { for (let j = i + 1; j < particles.length; j += 1) { const a = particles[i]; const b = particles[j]; const dx = a.x - b.x; const dy = a.y - b.y; const dist = Math.sqrt(dx * dx + dy * dy); if (dist < 110) { ctx.beginPath(); ctx.moveTo(a.x, a.y); ctx.lineTo(b.x, b.y); ctx.strokeStyle = `rgba(167,139,250,${(110 - dist) / 900})`; ctx.lineWidth = 1; ctx.stroke(); } } } requestAnimationFrame(drawParticles); } drawParticles(); const hasAnime = typeof window.anime === 'function'; if (!hasAnime) { document.querySelectorAll('.hero-title .line, .hero-badge, .hero-subtitle, .hero-desc, .hero-actions .btn, .hero-image-wrapper, .floating-card').forEach(el => { el.style.opacity = '1'; }); return; } const heroTargets = '.hero-badge, .hero-title .line, .hero-subtitle, .hero-desc, .hero-actions .btn, .hero-image-wrapper, .floating-card'; window.anime.timeline({ easing: 'easeOutExpo', duration: 900, }) .add({ targets: '.hero-badge', opacity: [0, 1], translateY: [24, 0], delay: window.anime.stagger(120), }) .add({ targets: '.hero-title .line', opacity: [0, 1], translateY: [48, 0], delay: window.anime.stagger(160), }, '-=520') .add({ targets: '.hero-subtitle, .hero-desc', opacity: [0, 1], translateY: [24, 0], delay: window.anime.stagger(110), }, '-=450') .add({ targets: '.hero-actions .btn', opacity: [0, 1], translateY: [20, 0], scale: [0.94, 1], delay: window.anime.stagger(90), }, '-=420') .add({ targets: '.hero-image-wrapper', opacity: [0, 1], scale: [0.82, 1], rotate: [-3, 0], }, '-=560') .add({ targets: '.floating-card', opacity: [0, 1], translateY: [30, 0], delay: window.anime.stagger(120), }, '-=460'); // Scroll-synced section entrance const sectionObserver = new IntersectionObserver(entries => { entries.forEach(entry => { if (!entry.isIntersecting || entry.target.dataset.aosDone) return; entry.target.dataset.aosDone = '1'; window.anime({ targets: entry.target.querySelectorAll('.section-title, .section-subtitle, .training-card, .skill-cat, .offer-card, .award-card, .gallery-item'), opacity: [0, 1], translateY: [40, 0], scale: [0.98, 1], duration: 700, delay: window.anime.stagger(45, { from: 'first' }), easing: 'easeOutCubic', }); }); }, { threshold: 0.2 }); document.querySelectorAll('.section').forEach(s => sectionObserver.observe(s)); // Premium hover micro-interaction document.querySelectorAll('.training-card, .skill-cat, .offer-card, .award-card, .gallery-item').forEach(card => { card.addEventListener('mouseenter', () => { window.anime.remove(card); window.anime({ targets: card, scale: 1.02, translateY: -4, duration: 280, easing: 'easeOutQuad', }); }); card.addEventListener('mouseleave', () => { window.anime.remove(card); window.anime({ targets: card, scale: 1, translateY: 0, duration: 260, easing: 'easeOutQuad', }); }); }); })();