| 160 | } |
| 161 | |
| 162 | function initRevealObserver() { |
| 163 | const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; |
| 164 | const elements = document.querySelectorAll('.value-card, .tool-card, .ai-provider, .preview-item, .download-btn'); |
| 165 | if (reduceMotion || !('IntersectionObserver' in window)) return; |
| 166 | |
| 167 | elements.forEach(function (element) { |
| 168 | element.classList.add('reveal-on-scroll'); |
| 169 | }); |
| 170 | |
| 171 | const observer = new IntersectionObserver(function (entries) { |
| 172 | entries.forEach(function (entry) { |
| 173 | if (!entry.isIntersecting) return; |
| 174 | entry.target.classList.add('is-visible'); |
| 175 | observer.unobserve(entry.target); |
| 176 | }); |
| 177 | }, { |
| 178 | threshold: 0.12, |
| 179 | rootMargin: '0px 0px -40px 0px' |
| 180 | }); |
| 181 | |
| 182 | elements.forEach(function (element) { |
| 183 | observer.observe(element); |
| 184 | }); |
| 185 | } |