/* ── Sticky header base ── */ .site-header { position: sticky !important; top: 0; z-index: 9999; box-shadow: 0 2px 8px rgba(0,0,0,.10); transition: box-shadow .2s; } /* ── Smooth scroll + section offset ── */ html { scroll-behavior: smooth; } section[id], div[id] { scroll-margin-top: 80px; } /* ── Desktop nav links ── */ .main-nav a, .wp-block-navigation .main-nav a { position: relative; text-decoration: none; transition: color .2s; } .main-nav a.active-section, .wp-block-navigation a.active-section { font-weight: 700; border-bottom: 2px solid currentColor; } /* ── Hamburger button ── */ .hamburger-btn { display: none; flex-direction: column; justify-content: space-between; width: 28px; height: 20px; background: transparent; border: none; cursor: pointer; padding: 0; z-index: 10000; } .hamburger-btn span { display: block; width: 100%; height: 2px; background: currentColor; border-radius: 2px; transition: transform .3s, opacity .3s; } .hamburger-btn.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); } .hamburger-btn.open span:nth-child(2) { opacity: 0; } .hamburger-btn.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); } /* ── Mobile menu panel ── */ .mobile-menu { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 9998; padding: 16px 24px 24px; background: inherit; box-shadow: 0 4px 12px rgba(0,0,0,.12); } .mobile-menu nav { display: flex; flex-direction: column; gap: 16px; } .mobile-menu nav a { font-size: 1.05rem; text-decoration: none; padding: 6px 0; border-bottom: 1px solid rgba(0,0,0,.07); transition: color .2s; } .mobile-menu nav a.active-section { font-weight: 700; } .mobile-menu.open { display: block; } /* ── Responsive breakpoint ── */ @media (max-width: 768px) { .main-nav { display: none !important; } .hamburger-btn { display: flex !important; } } @media (min-width: 769px) { .mobile-menu { display: none !important; } } (function () { /* ── Config: map nav labels → anchor IDs ── */ var sections = [ { id: ‘home’, selector: ‘#home’ }, { id: ‘about’, selector: ‘#about’ }, { id: ‘services’, selector: ‘#services’ }, { id: ‘dumpster-size’,selector: ‘#dumpster-size’ }, { id: ‘contact’, selector: ‘#contact’ } ]; /* ── Smooth-scroll: desktop nav links ── */ document.addEventListener(‘click’, function (e) { var a = e.target.closest(‘a[href^=”#”]’); if (!a) return; var target = document.querySelector(a.getAttribute(‘href’)); if (!target) return; e.preventDefault(); target.scrollIntoView({ behavior: ‘smooth’, block: ‘start’ }); /* close mobile menu if open */ var menu = document.getElementById(‘mobile-menu’); var btn = document.querySelector(‘.hamburger-btn’); if (menu && menu.classList.contains(‘open’)) { menu.classList.remove(‘open’); btn && btn.classList.remove(‘open’); btn && btn.setAttribute(‘aria-expanded’,’false’); } }); /* ── Hamburger toggle ── */ document.addEventListener(‘click’, function (e) { var btn = e.target.closest(‘.hamburger-btn’); if (!btn) return; var menu = document.getElementById(‘mobile-menu’); var open = menu.classList.toggle(‘open’); btn.classList.toggle(‘open’, open); btn.setAttribute(‘aria-expanded’, open ? ‘true’ : ‘false’); }); /* ── Active-section highlighting via IntersectionObserver ── */ function initObserver () { var allLinks = Array.from( document.querySelectorAll( ‘.main-nav a[href^=”#”], .mobile-menu nav a[href^=”#”]’ ) ); if (!allLinks.length) return; var headerH = (document.querySelector(‘.site-header’) || {}).offsetHeight || 80; var activeId = null; var obs = new IntersectionObserver(function (entries) { entries.forEach(function (entry) { if (entry.isIntersecting) { activeId = entry.target.id; } }); allLinks.forEach(function (link) { var href = link.getAttribute(‘href’).replace(‘#’,”); link.classList.toggle(‘active-section’, href === activeId); }); }, { rootMargin: ‘-‘ + headerH + ‘px 0px -60% 0px’, threshold: 0 }); sections.forEach(function (s) { var el = document.getElementById(s.id); if (el) obs.observe(el); }); } /* Run after DOM is ready */ if (document.readyState === ‘loading’) { document.addEventListener(‘DOMContentLoaded’, initObserver); } else { initObserver(); } })();

Category: Uncategorized