/* Studio-site motion layer — scroll reveals, masked reveals, marquee. No deps. */
(()=>{
const EASE='cubic-bezier(.16,1,.3,1)';

function Reveal(props){
  const {children,y=30,x=0,delay=0,dur=700,once=true,threshold=0.15,as='div',style,...rest}=props;
  const ref=React.useRef(null);
  const [seen,setSeen]=React.useState(false);
  React.useEffect(()=>{
    const el=ref.current; if(!el) return;
    if(typeof IntersectionObserver==='undefined'){setSeen(true);return;}
    const io=new IntersectionObserver((es)=>{es.forEach(e=>{
      if(e.isIntersecting){setSeen(true); if(once) io.disconnect();}
      else if(!once) setSeen(false);
    });},{threshold});
    io.observe(el); return ()=>io.disconnect();
  },[]);
  const Tag=as;
  const t=dur+'ms '+EASE+' '+delay+'ms';
  return React.createElement(Tag,{ref,style:{opacity:seen?1:0,transform:seen?'none':('translate('+x+'px,'+y+'px)'),transition:'opacity '+t+', transform '+t,willChange:'opacity, transform',...style},...rest},children);
}

/* Masked reveal — inner content wipes up from behind a clipped edge */
function RevealMask(props){
  const {children,delay=0,dur=850,threshold=0.2,as='div',style,...rest}=props;
  const ref=React.useRef(null);
  const [seen,setSeen]=React.useState(false);
  React.useEffect(()=>{
    const el=ref.current; if(!el) return;
    if(typeof IntersectionObserver==='undefined'){setSeen(true);return;}
    const io=new IntersectionObserver((es)=>{es.forEach(e=>{if(e.isIntersecting){setSeen(true);io.disconnect();}});},{threshold});
    io.observe(el); return ()=>io.disconnect();
  },[]);
  const Tag=as;
  const t=dur+'ms '+EASE+' '+delay+'ms';
  return React.createElement(Tag,{ref,style:{overflow:'hidden',...style},...rest},
    React.createElement('div',{style:{transform:seen?'translateY(0)':'translateY(108%)',opacity:seen?1:0,transition:'transform '+t+', opacity '+dur+'ms ease '+delay+'ms',willChange:'transform'}},children));
}

/* Infinite marquee band */
let marqCSS=false;
function ensureMarqCSS(){if(marqCSS||typeof document==='undefined')return;marqCSS=true;const s=document.createElement('style');s.textContent='@keyframes igo-marq{from{transform:translateX(0)}to{transform:translateX(-50%)}}';document.head.appendChild(s);}
function Marquee(props){
  ensureMarqCSS();
  const {items=[],speed=28,size=72,color='#fff',bg='var(--ink-900)',dot='var(--accent-500)'}=props;
  const seq=[];
  items.forEach((it,i)=>{
    seq.push(React.createElement('span',{key:'t'+i,style:{fontFamily:"'Bebas Neue',sans-serif",fontSize:size,lineHeight:1,color,letterSpacing:'.01em',whiteSpace:'nowrap'}},it));
    seq.push(React.createElement('span',{key:'d'+i,style:{display:'inline-block',width:size*0.22,height:size*0.22,borderRadius:'50%',background:dot,margin:'0 '+size*0.4+'px',flex:'none'}}));
  });
  const track=React.createElement('div',{style:{display:'flex',alignItems:'center',flex:'none',paddingRight:size*0.6}},seq);
  return React.createElement('div',{style:{background:bg,overflow:'hidden',padding:(size*0.34)+'px 0',display:'flex',width:'100%'}},
    React.createElement('div',{style:{display:'flex',animation:'igo-marq '+speed+'s linear infinite',willChange:'transform'}},track,
      React.cloneElement(track,{key:'dup'})));
}

Object.assign(window,{Reveal,RevealMask,Marquee});
})();
