const ham=document.querySelector('.hamburger'),nav=document.querySelector('.nav-links');
if(ham&&nav)ham.addEventListener('click',()=>nav.classList.toggle('open'));
document.querySelectorAll('.nav-dropdown>a').forEach(l=>{
  l.addEventListener('click',e=>{if(window.innerWidth<=768){e.preventDefault();l.closest('.nav-dropdown').classList.toggle('dd-open');}});
});
const cur=window.location.pathname.split('/').pop()||'index.html';
document.querySelectorAll('.nav-links a').forEach(l=>{if(l.getAttribute('href')?.endsWith(cur))l.classList.add('active');});
const ef=document.getElementById('enquiryForm');
if(ef)ef.addEventListener('submit',function(e){
  e.preventDefault();const b=this.querySelector('button[type="submit"]');
  b.textContent='Sending…';b.disabled=true;
  setTimeout(()=>{b.textContent='✓ Message Sent!';b.style.background='#25d366';ef.reset();
  setTimeout(()=>{b.textContent='Send Enquiry';b.style.background='';b.disabled=false;},3000);},1200);
});
const obs=new IntersectionObserver(es=>{es.forEach(e=>{if(e.isIntersecting){e.target.classList.add('visible');obs.unobserve(e.target);}});},{threshold:0.08});
document.querySelectorAll('.product-card,.why-card,.brand-card,.industry-item,.milestone,.pl-card,.two-col').forEach((el,i)=>{
  el.style.transitionDelay=`${i*0.04}s`;el.classList.add('reveal');obs.observe(el);
});
