(function(){ var root=document.documentElement; function hdr(){return document.querySelector('.lbf-header:not(.elementor-sticky__spacer)');} function setH(){var h=hdr(); if(!h) return; root.style.setProperty('--lb-hdr-h', Math.round(h.getBoundingClientRect().height)+'px'); var t=h.querySelector('.lbf-top'); if(t){root.style.setProperty('--lb-top-h', Math.round(t.getBoundingClientRect().height)+'px');}} function scr(){var on=window.scrollY>2; if(!on && root.classList.contains('lb-scrolled')){root.classList.remove('lb-scrolled');} else if(on && !root.classList.contains('lb-scrolled')){setH(); root.classList.add('lb-scrolled');}} function hero(){ if(!document.body.classList.contains('home')) return; var s=document.querySelector('.lb-hero-slider'), h=hdr(); if(!s||!h||root.classList.contains('lb-hero-under')) return; var sl=s.querySelector('.lb-slide'); if(!sl) return; var hh=Math.round(h.getBoundingClientRect().height); s.style.setProperty('--lb-slide-h', Math.round(sl.getBoundingClientRect().height)+'px'); s.style.setProperty('--lb-hdr-h0', hh+'px'); root.classList.add('lb-hero-under'); } function init(){ setH(); scr(); hero(); } window.addEventListener('scroll',scr,{passive:true}); window.addEventListener('resize',function(){ setH(); }); if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',init);}else{init();} window.addEventListener('load',function(){ setH(); hero(); }); })();