(()=>{
const NX=window.NURVEXAIDesignSystem_4750bb;const H=window.NXH;const {useState,useEffect}=React;
const PAGES=[{k:'home',l:'Home',f:'index.html',d:'Build smarter. Automate faster.'},
  {k:'services',l:'Services',f:'services.html',d:'Websites, apps, AI agents, voice AI and automation.'},
  {k:'lab',l:'AI Systems',f:'ai-systems.html',d:'Experience our AI agents yourself.',tip:'Experience our AI agents yourself.'},
  {k:'work',l:'Explore Our Work',f:'work.html',d:'Selected projects and concepts.',tip:'Check our Work'},
  {k:'process',l:'The Studio',f:'the-studio.html',d:'Our process, our founder, our clients.'}];
const ALIAS={'AI Lab':'AI Systems','Work':'Explore Our Work','Try Our Solutions':'Explore Our Work','Process':'The Studio','About':'The Studio'};
const goPage=l=>{l=ALIAS[l]||l;const p=PAGES.find(x=>x.l===l);if(p)location.href=p.f};
const FOOT={'AI Agents':'agents','Voice AI':'voice','Automation':'auto','Web Development':'web','App Development':'app'};
const FCOLS=[['Services',['AI Agents','Voice AI','Automation','Web Development','App Development']],['Company',['Home','Services','AI Systems','Explore Our Work','The Studio','Contact']],['Social',['LinkedIn','Instagram','YouTube']]];
function SiteFooter({onNavigate,onCta}){
  return <footer className="ft"><div className="ft-glow"></div><div className="ft-in">
    <div className="ft-brand"><div className="ft-vid"><video src={(window.__resources&&window.__resources.logoVideo)||"assets/nurvex-logo-animated.mp4"} autoPlay muted loop playsInline preload="metadata" aria-label="NURVEX AI logo assembling"></video><i></i></div>
      <div className="ft-tag">Build smarter.<br/><span>Automate faster.</span></div>
      <p className="ft-sub">Intelligent digital systems for modern businesses.</p>
      <button className="ft-cta" onClick={onCta}><span>Book a strategy call</span><b>→</b></button></div>
    {FCOLS.map(([h,items])=><nav key={h} className="ft-col" aria-label={h}><div className="ft-h mono">{h}</div><ul>{items.map(i=><li key={i}><a href="#" onClick={e=>{e.preventDefault();onNavigate(i)}}><span className="ft-a">{i}</span><b className="ft-ar">{h==='Social'?'↗':'→'}</b></a></li>)}</ul></nav>)}
  </div><div className="ft-bot mono"><span>© 2026 NURVEX AI. All rights reserved.</span><span className="ft-on"><i></i>NURVEX AI Systems — Online</span></div></footer>;
}
function CallBtn({size='md',onClick=H.openForm,full}){
  return <button className={'nx-call nx-call-'+size+(full?' full':'')} onClick={onClick}><span className="nx-call-beam"></span><span className="nx-call-ring"><i></i></span><span className="nx-call-l">Book a strategy call</span><span className="nx-call-a">→</span></button>;
}
function Menu({page,onClose}){
  useEffect(()=>{const k=e=>e.key==='Escape'&&onClose();addEventListener('keydown',k);document.body.style.overflow='hidden';return()=>{removeEventListener('keydown',k);document.body.style.overflow=''}},[]);
  return <div className="mm" role="dialog" aria-modal="true" aria-label="Menu">
    <div className="mm-bg"></div>
    <div className="mm-top"><NX.Logo variant="lockup" height={28}/><button className="mm-x" aria-label="Close menu" onClick={onClose}><i></i><i></i></button></div>
    <div className="mm-status"><NX.StatusLine>NURVEX AI SYSTEMS — ONLINE</NX.StatusLine></div>
    <ul className="mm-list">{PAGES.map((p,i)=><li key={p.k} style={{'--i':i}}><a href={p.f} className={p.k===page?'on':''} onClick={e=>{if(p.k===page){e.preventDefault();onClose()}}}>
      <span className="mm-n mono">{String(i+1).padStart(2,'0')}</span><span className="mm-t"><span className="mm-l">{p.l}</span><span className="mm-d">{p.d}</span></span><span className="mm-a">{p.k===page?<span className="mono" style={{color:'var(--status-online)',fontSize:10}}>● Here</span>:'→'}</span></a></li>)}</ul>
    <div className="mm-foot"><CallBtn size="lg" full onClick={()=>{onClose();H.openForm()}}/></div>
  </div>;
}
function Shell({page,children}){
  const [sc,setSc]=useState(false);const [menu,setMenu]=useState(false);const [form,setForm]=useState(false);
  useEffect(()=>{const f=()=>setSc(scrollY>40);f();addEventListener('scroll',f,{passive:true});
    const of=()=>setForm(true);addEventListener('nx-form',of);
    let raf=0;const reveal=()=>{const lim=innerHeight*.94;document.querySelectorAll('.rv:not(.in)').forEach(el=>{if(el.getBoundingClientRect().top<lim)el.classList.add('in')})};
    const rv=()=>{cancelAnimationFrame(raf);raf=requestAnimationFrame(reveal)};addEventListener('scroll',rv,{passive:true});addEventListener('resize',rv);
    const t=setTimeout(reveal,60);const t2=setInterval(reveal,800);
    const io={disconnect:()=>{removeEventListener('scroll',rv);removeEventListener('resize',rv);clearInterval(t2)}};
    if(location.hash)setTimeout(()=>H.scrollToId(location.hash.slice(1)),500);
    return()=>{removeEventListener('scroll',f);removeEventListener('nx-form',of);io.disconnect();clearTimeout(t)}},[]);
  useEffect(()=>{document.querySelectorAll('.nx-nav-links a').forEach(a=>{const p=PAGES.find(x=>x.tip&&x.l===a.textContent.trim());if(p){a.setAttribute('data-tip',p.tip);a.classList.add('has-tip')}})},[sc,page]);
  const cur=PAGES.find(p=>p.k===page);
  const foot=l=>{if(FOOT[l]){location.href='services.html#svc-'+FOOT[l];return}if(l==='Contact'){H.openForm();return}goPage(l)};
  return <>
    <h1 className="sr-only">{(PAGES.find(p=>p.k===page)||{}).l==='Home'?'NURVEX AI: Build Smarter. Automate Faster.':'NURVEX AI — '+((PAGES.find(p=>p.k===page)||{}).l)}</h1><H.Particles/><H.Cursor/>
    <div className={'nx-navwrap'+(sc?' sc':'')}>
      <NX.Navbar links={PAGES.map(p=>p.l)} active={cur&&cur.l} scrolled={sc} onNavigate={goPage}/>
      <div className="sn-right"><span className="sn-cta"><CallBtn size="sm"/></span><button className="sn-burger" aria-label="Open menu" onClick={()=>setMenu(true)}><i></i><i></i><i></i></button></div>
    </div>
    <main style={{position:'relative',zIndex:1}}>{children}</main>
    <div style={{position:'relative',zIndex:1}}><SiteFooter onNavigate={foot} onCta={H.openForm}/></div>
    {menu?<Menu page={page} onClose={()=>setMenu(false)}/>:null}
    {form?<window.NXContactForm onClose={()=>setForm(false)}/>:null}
  </>;
}
Object.assign(window,{NXShell:Shell,NXCallBtn:CallBtn,NXPages:PAGES});
})();
