Spaces:
Running

File size: 2,421 Bytes
7d8d684
 
 
 
 
 
 
de8577d
7d8d684
 
 
 
 
 
 
 
de8577d
 
 
 
7d8d684
de8577d
 
 
 
 
 
 
 
 
 
7d8d684
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de8577d
7d8d684
 
 
de8577d
 
 
 
 
 
 
 
 
 
 
7d8d684
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

document.addEventListener('DOMContentLoaded', function() {
    // Initialize mobile menu
    initMobileMenu();
    
    // Initialize smooth scrolling
    initSmoothScrolling();
    
    // Initialize intersection observer for animations
    initIntersectionObserver();
    
    // Re-render feather icons after dynamic content loads
    setTimeout(feather.replace, 300);
});

function initMobileMenu() {
    const mobileMenuBtn = document.querySelector('custom-navbar')?.shadowRoot.querySelector('.mobile-menu-btn');
    const navLinks = document.querySelector('custom-navbar')?.shadowRoot.querySelector('.nav-links');
    
    if (mobileMenuBtn && navLinks) {
        mobileMenuBtn.addEventListener('click', function() {
            const isOpen = navLinks.style.display === 'flex';
            navLinks.style.display = isOpen ? 'none' : 'flex';
            
            const icon = mobileMenuBtn.querySelector('i');
            if (icon) {
                icon.setAttribute('data-feather', isOpen ? 'menu' : 'x');
                feather.replace();
            }
        });
    }
}

function initSmoothScrolling() {
    document.querySelectorAll('a[href^="#"]').forEach(function(anchor) {
        anchor.addEventListener('click', function(e) {
e.preventDefault();
            
            const targetId = this.getAttribute('href');
            if (targetId === '#') return;
            
            const targetElement = document.querySelector(targetId);
            if (targetElement) {
                targetElement.scrollIntoView({
                    behavior: 'smooth'
                });
                
                // Update URL without triggering page reload
                history.pushState(null, null, targetId);
            }
        });
    });
function initIntersectionObserver() {
    const sections = document.querySelectorAll('section');
    const observer = new IntersectionObserver(function(entries) {
        entries.forEach(function(entry) {
if (entry.isIntersecting) {
                entry.target.classList.add('fade-in');
            }
        });
    }, {
        threshold: 0.1
    });
    
    sections.forEach(section => {
        section.classList.add('opacity-0');
        observer.observe(section);
    });
    }, {
        threshold: 0.1
    });

    sections.forEach(function(section) {
        section.classList.add('opacity-0');
        observer.observe(section);
    });
}