File size: 3,064 Bytes
442bf6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
79
80
81
82
83
84
85
86
87
88
89
90
// Main JavaScript for Echo Shop Landing Page
document.addEventListener('DOMContentLoaded', function() {
    // FAQ Accordion functionality
    const faqButtons = document.querySelectorAll('#duvidas button');
    
    faqButtons.forEach(button => {
        button.addEventListener('click', () => {
            const content = button.nextElementSibling;
            const icon = button.querySelector('i');
            
            // Toggle content
            if (content.style.maxHeight) {
                content.style.maxHeight = null;
                icon.setAttribute('data-feather', 'chevron-down');
            } else {
                content.style.maxHeight = content.scrollHeight + 'px';
                icon.setAttribute('data-feather', 'chevron-up');
            }
            
            feather.replace();
        });
    });
    
    // Smooth scroll 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) {
                window.scrollTo({
                    top: targetElement.offsetTop - 80,
                    behavior: 'smooth'
                });
            }
        });
    });
    
    // Animation on scroll
    const animateOnScroll = () => {
        const elements = document.querySelectorAll('.animate-on-scroll');
        
        elements.forEach(element => {
            const elementPosition = element.getBoundingClientRect().top;
            const windowHeight = window.innerHeight;
            
            if (elementPosition < windowHeight - 100) {
                element.classList.add('animate-fade-in');
            }
        });
    };
    
    // Initialize animations
    document.querySelectorAll('section').forEach((section, index) => {
        if (index > 0) { // Skip first section
            section.querySelectorAll('h2, p, div').forEach(el => {
                el.classList.add('animate-on-scroll');
                el.style.opacity = '0';
            });
        }
    });
    
    window.addEventListener('scroll', animateOnScroll);
    animateOnScroll(); // Run once on load
    
    // Sticky navigation
    const nav = document.querySelector('nav');
    const navOffset = nav.offsetTop;
    
    window.addEventListener('scroll', () => {
        if (window.pageYOffset > navOffset) {
            nav.classList.add('shadow-md', 'bg-opacity-90');
            nav.style.backdropFilter = 'blur(8px)';
        } else {
            nav.classList.remove('shadow-md', 'bg-opacity-90');
            nav.style.backdropFilter = 'none';
        }
    });
    
    // Replace all feather icons
    feather.replace();
    
    // Button hover effects
    document.querySelectorAll('a[href="#cta"]').forEach(button => {
        button.classList.add('btn-hover-effect');
    });
});