File size: 2,354 Bytes
41de87e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// Dark mode toggle functionality
document.addEventListener('DOMContentLoaded', function() {
    // Check for saved dark mode preference or use system preference
    const isDarkMode = localStorage.getItem('darkMode') === 'true' || 
                      (!localStorage.getItem('darkMode') && window.matchMedia('(prefers-color-scheme: dark)').matches);
    
    // Apply initial dark mode state
    if (isDarkMode) {
        document.documentElement.classList.add('dark');
        document.getElementById('darkModeToggle').innerHTML = '<i data-feather="sun"></i>';
    } else {
        document.documentElement.classList.remove('dark');
        document.getElementById('darkModeToggle').innerHTML = '<i data-feather="moon"></i>';
    }
    
    // Initialize feather icons
    feather.replace();
    
    // Set up dark mode toggle
    const darkModeToggle = document.getElementById('darkModeToggle');
    if (darkModeToggle) {
        darkModeToggle.addEventListener('click', function() {
            const isDark = document.documentElement.classList.toggle('dark');
            localStorage.setItem('darkMode', isDark);
            
            if (isDark) {
                this.innerHTML = '<i data-feather="sun"></i>';
            } else {
                this.innerHTML = '<i data-feather="moon"></i>';
            }
            feather.replace();
        });
    }
    
    // Smooth scrolling for anchor links
    document.querySelectorAll('a[href^="#"]').forEach(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'
                });
            }
        });
    });
    
    // Form submission handling
    const contactForm = document.getElementById('contactForm');
    if (contactForm) {
        contactForm.addEventListener('submit', function(e) {
            e.preventDefault();
            // Here you would typically send the form data to your server
            alert('Thank you for your message! We will contact you shortly.');
            this.reset();
        });
    }
});