@@ -544,10 +544,30 @@ let cx=0,cy=0;
544544 setTimeout(()=>document.getElementById('scroll-wrap').classList.remove('shake'),400);
545545 const hint=document.getElementById('pill-hint');
546546 if(hint)hint.style.opacity='0';
547- setTimeout(()=>{
548- const target=type==='blue'?'#act-blue':'#act-red';
549- document.querySelector(target).scrollIntoView({behavior:'smooth'});
550- },400);
547+
548+ if(type==='blue'){
549+ setTimeout(()=>document.querySelector('#act-blue').scrollIntoView({behavior:'smooth'}),400);
550+ }else{
551+ // Red: wait for shatter video to nearly finish, then scroll
552+ const vShatter=document.getElementById('vid-hero-shatter');
553+ if(vShatter&&vShatter.duration){
554+ const waitMs=Math.max(0,(vShatter.duration-vShatter.currentTime-0.5)*1000);
555+ setTimeout(()=>document.querySelector('#act-red').scrollIntoView({behavior:'smooth'}),waitMs);
556+ }else{
557+ setTimeout(()=>document.querySelector('#act-red').scrollIntoView({behavior:'smooth'}),5000);
558+ }
559+ }
560+
561+ // When hero leaves viewport, reset video back to calm
562+ const resetObs=new IntersectionObserver(entries=>{
563+ if(!entries[0].isIntersecting){
564+ const vc=document.getElementById('vid-hero-calm');
565+ const vs=document.getElementById('vid-hero-shatter');
566+ if(vc&&vs){vc.style.opacity='1';vs.style.opacity='0'}
567+ resetObs.disconnect();
568+ }
569+ },{threshold:0});
570+ resetObs.observe(document.getElementById('act-choice'));
551571 });
552572
553573 let pmx=0,pmy=0;
0 commit comments