/* ============================================================[MONTEFOSCOLI] - SMART FOOTER REVEAL (SAFE OBSERVER) ============================================================ */ @media (min-width: 1025px) { .smart-footer { opacity: 0 !important; pointer-events: none !important; transform: translateY(40px) !important; transition: opacity 0.4s ease, transform 0.4s ease !important; } .smart-footer.mf-show-now { opacity: 1 !important; pointer-events: all !important; transform: translateY(0) !important; } } document.addEventListener("DOMContentLoaded", function() { if (window.innerWidth > 1024) { const footer = document.querySelector('.smart-footer'); const footerWrapper = document.querySelector('.elementor-location-footer'); if (footer && footerWrapper) { // 1. Creiamo il sensore invisibile const trigger = document.createElement('div'); trigger.style.height = '1px'; trigger.style.width = '1px'; trigger.style.position = 'absolute'; // Lo tiriamo su di 50px per far attivare l'animazione un attimo prima trigger.style.top = '-50px'; trigger.style.opacity = '0'; trigger.style.pointerEvents = 'none'; trigger.style.zIndex = '-1'; // 2. IL FIX: Lo inseriamo DENTRO il footer, non nella pagina principale! // Questo crea una "Safe Zone" che non rompe MAI lo Scroll Snap o il Flexbox footerWrapper.style.position = 'relative'; footerWrapper.appendChild(trigger); // 3. L'Observer entra in azione const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { // Se il sensore entra nello schermo... if (entry.isIntersecting) { footer.classList.add('mf-show-now'); } else { // Se si torna indietro... footer.classList.remove('mf-show-now'); } }); }, { root: null, threshold: 0 }); observer.observe(trigger); } } });