#uw-cursor-bg { isolation: isolate; }
#uw-cursor-bg .uw-blob {
pointer-events: none;
will-change: transform;
transition: transform 0.1s ease-out;
}
@media (max-width: 767px) {
#uw-cursor-bg .uw-blob { filter: blur(24px) !important; opacity: 0.45 !important; }
}
(function () {
var container = document.getElementById('uw-cursor-bg');
if (!container || container.dataset.uwInit) return;
container.dataset.uwInit = '1';
document.body.appendChild(container);
var blobs = Array.prototype.slice.call(container.querySelectorAll('.uw-blob')).map(function (el) {
return {
el: el,
depth: parseFloat(el.dataset.depth) || 0.03,
curX: 0,
curY: 0,
targetX: 0,
targetY: 0,
phase: Math.random() * Math.PI * 2,
driftSpeed: 0.00045 + Math.random() * 0.00055,
driftAmp: 22 + Math.random() * 26
};
});
var mouseX = null;
var mouseY = null;
var lastMoveTime = Date.now();
var reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
function handleMove(e) {
var clientX = e.touches ? e.touches[0].clientX : e.clientX;
var clientY = e.touches ? e.touches[0].clientY : e.clientY;
mouseX = clientX - window.innerWidth / 2;
mouseY = clientY - window.innerHeight / 2;
lastMoveTime = Date.now();
}
window.addEventListener('mousemove', handleMove, { passive: true });
window.addEventListener('touchmove', handleMove, { passive: true });
function animate(t) {
var idleFor = Date.now() - lastMoveTime;
var influence = mouseX === null ? 0 : Math.max(0, 1 - Math.max(0, idleFor - 3000) / 4000);
blobs.forEach(function (b) {
var driftX = Math.cos(t * b.driftSpeed + b.phase) * b.driftAmp;
var driftY = Math.sin(t * b.driftSpeed * 0.8 + b.phase) * b.driftAmp;
var reactX = mouseX !== null ? mouseX * b.depth * influence : 0;
var reactY = mouseY !== null ? mouseY * b.depth * influence : 0;
b.targetX = driftX + reactX;
b.targetY = driftY + reactY;
b.curX += (b.targetX - b.curX) * 0.12;
b.curY += (b.targetY - b.curY) * 0.12;
b.el.style.transform = 'translate3d(' + b.curX.toFixed(1) + 'px,' + b.curY.toFixed(1) + 'px,0)';
});
if (!reduceMotion) {
requestAnimationFrame(animate);
}
}
if (reduceMotion) {
blobs.forEach(function (b) { b.el.style.transform = 'translate3d(0,0,0)'; });
} else {
requestAnimationFrame(animate);
}
})();