Welcome to WordPress. This is your first post. Edit or delete it, then start writing!
* Works alongside index.html (same CSS variables required)
*/
(function(){
'use strict';
/* CURSOR */
var cur=document.getElementById('cur'),ring=document.getElementById('cur-o');
var mx=-200,my=-200,rx=-200,ry=-200;
if(cur&&ring){
document.addEventListener('mousemove',function(e){mx=e.clientX;my=e.clientY;cur.style.left=mx+'px';cur.style.top=my+'px';},{passive:true});
document.addEventListener('mousedown',function(){document.body.classList.add('click')});
document.addEventListener('mouseup',function(){document.body.classList.remove('click')});
(function loop(){rx+=(mx-rx)*.1;ry+=(my-ry)*.1;ring.style.left=Math.round(rx*10)/10+'px';ring.style.top=Math.round(ry*10)/10+'px';requestAnimationFrame(loop);})();
document.querySelectorAll('a,button,.sv-c,.bl-c,.wf,.pr-step,.te-c,.ind-c,.faq-q,.dropz').forEach(function(el){
el.addEventListener('mouseenter',function(){document.body.classList.add('hov')});
el.addEventListener('mouseleave',function(){document.body.classList.remove('hov')});
});
}
/* PROGRESS BAR */
var prog=document.getElementById('prog');
window.addEventListener('scroll',function(){if(!prog)return;var t=document.documentElement.scrollHeight-window.innerHeight;prog.style.width=(t>0?(window.scrollY/t*100):0)+'%';},{passive:true});
/* NAV SCROLL STATE */
var nav=document.getElementById('nav');
window.addEventListener('scroll',function(){if(nav)nav.classList.toggle('scrolled',window.scrollY>60);},{passive:true});
/* BACK TO TOP */
var btop=document.getElementById('btop');
window.addEventListener('scroll',function(){if(btop)btop.classList.toggle('vis',window.scrollY>700);},{passive:true});
/* HAMBURGER */
var burger=document.getElementById('burger'),mob=document.getElementById('mob');
if(burger&&mob){
burger.addEventListener('click',function(){var o=burger.classList.toggle('open');mob.classList.toggle('open',o);document.body.style.overflow=o?'hidden':'';});
mob.querySelectorAll('a').forEach(function(a){a.addEventListener('click',function(){burger.classList.remove('open');mob.classList.remove('open');document.body.style.overflow='';});});
}
/* SMOOTH SCROLL */
document.querySelectorAll('a[href^="#"]').forEach(function(a){
a.addEventListener('click',function(e){var id=this.getAttribute('href');if(id==='#')return;var t=document.querySelector(id);if(t){e.preventDefault();window.scrollTo({top:t.getBoundingClientRect().top+window.scrollY-78,behavior:'smooth'});}});
});
/* SCROLL REVEAL */
var rObs=new IntersectionObserver(function(entries){
entries.forEach(function(en){
if(!en.isIntersecting)return;
var sibs=Array.from(en.target.parentElement.querySelectorAll('.rv,.rv-l,.rv-r'));
var i=sibs.indexOf(en.target);
setTimeout(function(){en.target.classList.add('in');},Math.max(0,i)*90);
rObs.unobserve(en.target);
});
},{threshold:0.1,rootMargin:'0px 0px -40px 0px'});
document.querySelectorAll('.rv,.rv-l,.rv-r').forEach(function(el){rObs.observe(el);});
/* HERO ENTRANCE */
[{id:'heb',d:100},{id:'hhl',d:260},{id:'hsb',d:420},{id:'hbt',d:560},{id:'hst',d:700},{id:'hvis',d:350}].forEach(function(s){
var el=document.getElementById(s.id);if(!el)return;
el.style.cssText='opacity:0;transform:translateY(28px)';
setTimeout(function(){el.style.transition='opacity 1s cubic-bezier(.16,1,.3,1),transform 1s cubic-bezier(.16,1,.3,1)';el.style.opacity='1';el.style.transform='none';},s.d);
});
/* COUNTERS */
function runCounter(el){
var to=parseInt(el.getAttribute('data-to'),10),suf=el.getAttribute('data-suf')||'',start=performance.now(),dur=2400;
(function tick(now){var p=Math.min((now-start)/dur,1),e=1-Math.pow(1-p,3),v=Math.round(e*to);el.textContent=(v>=1000?v.toLocaleString('en-IN'):v)+(p>=1?suf:'');if(p<1)requestAnimationFrame(tick);})(start);
}
var cObs=new IntersectionObserver(function(entries){entries.forEach(function(en){if(en.isIntersecting){runCounter(en.target);cObs.unobserve(en.target);}});},{threshold:0.6});
document.querySelectorAll('.cnt-n[data-to]').forEach(function(el){cObs.observe(el);});
/* FAQ ACCORDION */
document.querySelectorAll('.faq-item').forEach(function(item){
item.querySelector('.faq-q').addEventListener('click',function(){
var o=item.classList.contains('open');
document.querySelectorAll('.faq-item.open').forEach(function(x){x.classList.remove('open');});
if(!o)item.classList.add('open');
});
});
/* FILE DRAG & DROP */
var dz=document.getElementById('dropz'),fi=document.getElementById('f-cv'),dic=document.getElementById('d-ic'),dtx=document.getElementById('d-tx');
function escHtml(s){return s.replace(/[&<>"']/g,function(c){return({'&':'&','<':'<','>':'>','"':'"',"'":'''})[c];});}
function applyFile(f){if(!f)return;if(dic)dic.textContent='✓';if(dtx)dtx.innerHTML=''+escHtml(f.name)+'
'+(f.size/1024).toFixed(0)+' KB · Ready';if(dz){dz.style.borderColor='var(--gold)';dz.style.background='var(--gold-pale)';}}
if(fi)fi.addEventListener('change',function(){applyFile(this.files[0]);});
if(dz){
['dragenter','dragover'].forEach(function(ev){dz.addEventListener(ev,function(e){e.preventDefault();dz.classList.add('over');},{passive:false});});
dz.addEventListener('dragleave',function(){dz.classList.remove('over');});
dz.addEventListener('drop',function(e){e.preventDefault();dz.classList.remove('over');var f=e.dataTransfer&&e.dataTransfer.files[0];if(f){try{var dt=new DataTransfer();dt.items.add(f);fi.files=dt.files;}catch(err){}applyFile(f);}});
}
/* TOAST */
function showToast(msg,isErr){var t=document.getElementById('toast');if(!t)return;t.textContent=msg;t.className='toast'+(isErr?' err':'');requestAnimationFrame(function(){t.classList.add('show');});setTimeout(function(){t.classList.remove('show');},4200);}
/* CV SUBMIT */
window.submitCV=function(e){
var btn=e.currentTarget,fn=document.getElementById('f-fn'),em=document.getElementById('f-em');
if(fn&&!fn.value.trim()){showToast('Please enter your first name.',true);fn.focus();return;}
if(em&&(!em.value||em.value.indexOf('@')<1)){showToast('Please enter a valid email.',true);em.focus();return;}
btn.textContent='Submitting…';btn.style.opacity='.65';btn.disabled=true;
setTimeout(function(){btn.textContent='✓ Profile Submitted';btn.style.cssText='background:#3a6b22;opacity:1;letter-spacing:.12em';showToast('Thank you. Our team will be in touch within 24 hours.');},1900);
};
/* ACTIVE NAV */
var aObs=new IntersectionObserver(function(entries){entries.forEach(function(en){if(en.isIntersecting){var id='#'+en.target.id;document.querySelectorAll('.n-links a[href^="#"]').forEach(function(a){a.classList.toggle('act',a.getAttribute('href')===id);});}});},{threshold:0.45});
document.querySelectorAll('section[id]').forEach(function(s){aObs.observe(s);});
/* SERVICE CARD TILT */
document.querySelectorAll('.sv-c').forEach(function(c){
c.addEventListener('mousemove',function(e){var r=c.getBoundingClientRect(),x=(e.clientX-r.left)/r.width-.5,y=(e.clientY-r.top)/r.height-.5;c.style.transform='perspective(1000px) rotateY('+(x*5)+'deg) rotateX('+(-y*5)+'deg) translateZ(4px)';});
c.addEventListener('mouseleave',function(){c.style.transform='';});
});
/* PROCESS CIRCLES LIGHT UP */
var prObs=new IntersectionObserver(function(entries){entries.forEach(function(en){if(en.isIntersecting){document.querySelectorAll('.pr-circ').forEach(function(c,i){setTimeout(function(){c.classList.add('lit');},i*140);});prObs.disconnect();}});},{threshold:0.35});
var prGrid=document.querySelector('.pr-steps');if(prGrid)prObs.observe(prGrid);
/* HERO PARALLAX */
window.addEventListener('scroll',function(){var g=document.querySelector('.hero-dec-grid');if(g&&window.scrollY