(function(){ var cv=document.getElementById('dust'),cx=cv.getContext('2d'),W,H; function size(){W=cv.width=innerWidth;H=cv.height=innerHeight}size();addEventListener('resize',size); var P=[];var GOLD=[255,217,138],PERI=[159,176,255],WHITE=[240,243,255]; function spawn(x,y,opt){opt=opt||{};var c=[GOLD,PERI,WHITE][Math.random()*3|0]; P.push({x:x,y:y,vx:(Math.random()-.5)*(opt.sp||1.2),vy:(Math.random()-.5)*1.2,life:1,decay:.012+Math.random()*.02,s:opt.s||(1+Math.random()*2.2),c:c,tw:Math.random()*6.28});} addEventListener('mousemove',function(e){for(var i=0;i<3;i++)spawn(e.clientX+(Math.random()-.5)*10,e.clientY+(Math.random()-.5)*10,{sp:.9});}); setInterval(function(){spawn(Math.random()*W,Math.random()*H*.6,{sp:.3,s:1});},280); function loop(){cx.clearRect(0,0,W,H);cx.globalCompositeOperation='lighter'; for(var i=P.length-1;i>=0;i--){var p=P[i];p.x+=p.vx;p.y+=p.vy;p.life-=p.decay;p.tw+=.25; if(p.life<=0){P.splice(i,1);continue} var a=p.life*(.55+.45*Math.sin(p.tw)); var g=cx.createRadialGradient(p.x,p.y,0,p.x,p.y,p.s*3.2); g.addColorStop(0,'rgba('+p.c[0]+','+p.c[1]+','+p.c[2]+','+a+')');g.addColorStop(1,'rgba('+p.c[0]+','+p.c[1]+','+p.c[2]+',0)'); cx.fillStyle=g;cx.beginPath();cx.arc(p.x,p.y,p.s*3.2,0,6.28);cx.fill();} requestAnimationFrame(loop);}loop(); var io=new IntersectionObserver(function(es){es.forEach(function(e){if(e.isIntersecting)e.target.classList.add('awake');});},{threshold:.18}); document.querySelectorAll('.awaken').forEach(function(el){io.observe(el)}); var box=document.getElementById('skybox'); if(box){for(var i=0;i<140;i++){var s=document.createElement('i');s.className='st'; var r=Math.random();var cls='',sz=2; if(r>.97){cls='r8';sz=5;}else if(r>.82){cls='r5';sz=3;} if(cls)s.className+=' '+cls; s.style.cssText='left:'+(Math.random()*100)+'%;top:'+(Math.random()*100)+'%;width:'+sz+'px;height:'+sz+'px;--td:'+(2.5+Math.random()*4)+'s'; box.appendChild(s);}} var cn=document.getElementById('cnum'),started=false; var io2=new IntersectionObserver(function(es){es.forEach(function(e){if(e.isIntersecting&&!started){started=true; var t0=null;function step(ts){if(!t0)t0=ts;var p=Math.min((ts-t0)/1800,1);cn.textContent='Thousands'.toLocaleString('en-US');if(p<1)requestAnimationFrame(step);}requestAnimationFrame(step);}});},{threshold:.4}); if(cn)io2.observe(cn.parentElement); var idx=94.2,el=document.getElementById('sidx'); var mk=[{v:92,vb:'m1v',bb:'m1b'},{v:88,vb:'m2v',bb:'m2b'},{v:91,vb:'m3v',bb:'m3b'}]; setInterval(function(){idx=Math.max(90,Math.min(98,idx+(Math.random()-.48)*.4));el.textContent=idx.toFixed(1); mk.forEach(function(m){m.v=Math.max(70,Math.min(99,m.v+(Math.random()-.5)*2)); document.getElementById(m.vb).textContent=Math.round(m.v)+'%';document.getElementById(m.bb).style.width=m.v+'%';});},2600); var FEED=[['A distributor rose to ✦✦✦✦','Toronto'],['BioCrystal Topper inquiry','Vancouver'],['New distributor joined the family','Zagreb'],['Mattress shared through the family','Mississauga'],['Eye Mask question answered','Seoul'],['Heating Pad warmed a home','Calgary'],['Pillow pair found a bedroom','Osijek'],['An eight-star distributor lit a meetup','Split'],['Knee Massager inquiry','Niagara'],['A distributor rose to ✦✦','Busan'],['Topper shared through the family','Ottawa'],['New distributor joined the family','Rijeka']]; var fl=document.getElementById('flist'),fi=0; function pushFeed(){var f=FEED[fi%FEED.length];fi++; var d=document.createElement('div');d.className='fitem'; var ago=Math.floor(2+Math.random()*38); d.innerHTML='<span>✦ <b>'+f[0]+'</b> · '+f[1]+'</span><span class="tm">'+ago+'m ago</span>'; fl.insertBefore(d,fl.firstChild); while(fl.children.length>8)fl.removeChild(fl.lastChild);} for(var k=0;k<6;k++)pushFeed(); setInterval(pushFeed,3400); var heads=['<b>ScienceDaily</b> — a pill for sleep apnea shows promise','<b>Stanford</b> — AI reads disease risk in one night of sleep','<b>AASM</b> — marijuana and sleep: belief may beat chemistry','<b>CES 2026</b> — the year sleep tech grew up','<b>SLEEP 2026</b> — Baltimore, June 14–17','<b>Research</b> — weak body clocks may warn of dementia early']; var tk=document.getElementById('tk');var row='';heads.forEach(function(h){row+='<span>'+h+'</span>'}); tk.innerHTML=row+row; })();