(function (){
if(window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
if(window.__kurtechDisableParticles) return;
var PAL=['#7C3CFF', '#FF2F92', '#FF7A2F', '#34D5FF', '#B89CFF'];
var SVC=['#7C3CFF', '#FF2F92', '#34D5FF', '#B89CFF', '#FF7A2F', '#3DFFB5', '#7AA2FF'];
function hexRgb(h){ h=h.replace('#', ''); var n=parseInt(h, 16); return [n >> 16 & 255, n >> 8 & 255, n & 255]; }
function rgbA(c, a){ return 'rgba(' + Math.round(c[0]) + ',' + Math.round(c[1]) + ',' + Math.round(c[2]) + ',' + a + ')'; }
function clamp(v, a, b){ return v < a ? a:v > b ? b:v; }
var host=document.querySelector('.launch-inner');
if(!host) return;
var cv=document.createElement('canvas');
cv.setAttribute('aria-hidden', 'true');
cv.style.cssText='position:absolute;inset:0;width:100%;height:100%;pointer-events:none;opacity:.85;z-index:2';
host.insertBefore(cv, host.firstChild);
var ctx, w=0, h=0, ns=[], tint=hexRgb(SVC[0]);
function fit(){
w=cv.clientWidth; h=cv.clientHeight;
if(w < 4||h < 4) return false;
var d=w > 2560 ? 1:Math.min(window.devicePixelRatio||1, 1.5);
cv.width=w * d; cv.height=h * d;
ctx=cv.getContext('2d');
ctx.setTransform(d, 0, 0, d, 0, 0);
var N=Math.min(70, Math.max(26, Math.round(w * h / 20000)));
ns=[];
for (var i=0; i < N; i++) ns.push({
x: Math.random() * w, y: Math.random() * h,
vx: (Math.random() - .5) * .26, vy: (Math.random() - .5) * .26,
c: hexRgb(PAL[i % PAL.length])
});
return true;
}
var lastY=window.scrollY, vSm=0, lastProg=-1, lastFrameT=0;
function loop(ts){
requestAnimationFrame(loop);
if(document.hidden) return;
if(ts - lastFrameT < 15) return;
lastFrameT=ts;
var y=window.scrollY, v=y - lastY; lastY=y;
vSm +=(v - vSm) * 0.12;
var doc=document.documentElement;
if(v!==0||lastProg < 0){
var prog=doc.scrollHeight > window.innerHeight ? y / (doc.scrollHeight - window.innerHeight):0;
prog=clamp(prog, 0, 1);
lastProg=prog;
}
var r=host.getBoundingClientRect();
if(r.bottom < -100||r.top > window.innerHeight + 100) return;
if(!ctx||Math.abs(cv.clientWidth - w) > 40){ if(!fit()) return; }
var phase=parseFloat(doc.style.getPropertyValue('--wall-phase'))||0;
var target=hexRgb(SVC[clamp(Math.round(phase), 0, 6)]);
tint=[tint[0] + (target[0] - tint[0]) * 0.04, tint[1] + (target[1] - tint[1]) * 0.04, tint[2] + (target[2] - tint[2]) * 0.04];
ctx.clearRect(0, 0, w, h);
var boost=1 + Math.min(Math.abs(vSm) * 0.03, 0.8); 
var N=ns.length, i, j;
for (i=0; i < N; i++){
var n=ns[i];
n.x +=n.vx * boost; n.y +=n.vy * boost;
if(n.x < 0||n.x > w) n.vx *=-1;
if(n.y < 0||n.y > h) n.vy *=-1;
}
for (i=0; i < N; i++) for (j=i + 1; j < N; j++){
var a=ns[i], b=ns[j];
var d=Math.hypot(a.x - b.x, a.y - b.y);
if(d < 140){
var bl=[(a.c[0] + tint[0]) / 2, (a.c[1] + tint[1]) / 2, (a.c[2] + tint[2]) / 2];
ctx.strokeStyle=rgbA(bl, (1 - d / 140) * 0.13);
ctx.lineWidth=.6;
ctx.beginPath(); ctx.moveTo(a.x, a.y); ctx.lineTo(b.x, b.y); ctx.stroke();
}}
for (i=0; i < N; i++){
var n2=ns[i];
var bc=[(n2.c[0] + tint[0]) / 2, (n2.c[1] + tint[1]) / 2, (n2.c[2] + tint[2]) / 2];
ctx.fillStyle=rgbA(bc, 0.72);
ctx.beginPath(); ctx.arc(n2.x, n2.y, 1.5, 0, 7); ctx.fill();
}}
var rsTimer=0;
window.addEventListener('resize', function (){
clearTimeout(rsTimer);
rsTimer=setTimeout(fit, 200);
});
loop();
})();
(function (){
if(window.matchMedia&&window.matchMedia('(pointer: coarse)').matches) return;
var tiles=[].slice.call(document.querySelectorAll('.work-tile[data-live]'));
tiles.forEach(function (tile){
tile.addEventListener('click', function (e){ e.preventDefault(); });
tile.addEventListener('pointerenter', function (){
if(tile.dataset.live&&!tile.__iframe){
var f=document.createElement('iframe');
f.className='work-live';
f.loading='lazy';
f.referrerPolicy='no-referrer';
f.src=tile.dataset.live;
var scale=tile.clientWidth / 1280;
f.style.transform='scale(' + scale + ')';
f.style.height=Math.ceil(tile.clientHeight / scale) + 'px';
f.addEventListener('load', function (){ tile.classList.add('live-ready'); });
tile.insertBefore(f, tile.querySelector('.work-spot'));
tile.__iframe=f;
setTimeout(function (){ tile.classList.add('live-ready'); }, 1600);
}});
tile.addEventListener('pointermove', function (e){
var r=tile.getBoundingClientRect();
var px=(e.clientX - r.left) / r.width;
var py=(e.clientY - r.top) / r.height;
tile.style.setProperty('--mx', (px * 100).toFixed(1) + '%');
tile.style.setProperty('--my', (py * 100).toFixed(1) + '%');
tile.style.transform='perspective(700px) rotateX(' + ((0.5 - py) * 8).toFixed(2) + 'deg) rotateY(' + ((px - 0.5) * 10).toFixed(2) + 'deg) translateZ(6px)';
});
tile.addEventListener('pointerleave', function (){
tile.style.transform='';
});
});
})();