// Detecta QUALQUER elemento fixo no topo const fixedEls = [...document.querySelectorAll('*')] .filter(el => { const s = window.getComputedStyle(el); return (s.position === 'fixed' || s.position === 'sticky') && parseInt(s.top) === 0 && el.offsetHeight > 40; }); // soma altura de todos fixos no topo const fixedOffset = fixedEls.reduce((acc, el) => acc + el.offsetHeight, 0); // scroll final corrigido const top = target.getBoundingClientRect().top + window.pageYOffset - (fixedOffset + 12); window.scrollTo({ top: top, behavior: 'smooth' });