// Custom cursor — small green dot with a soft radial-gradient glow, replaces the system cursor on desktop. const CursorFX = () => { const dotRef = React.useRef(null); const glowRef = React.useRef(null); React.useEffect(() => { const isFinePointer = window.matchMedia("(pointer: fine)").matches; if (!isFinePointer) return; document.body.classList.add("ev-cursor-active"); const onMove = (e) => { const { clientX: x, clientY: y } = e; if (dotRef.current) { dotRef.current.style.transform = `translate(${x}px, ${y}px)`; dotRef.current.style.opacity = "1"; } if (glowRef.current) { glowRef.current.style.transform = `translate(${x}px, ${y}px)`; glowRef.current.style.opacity = "1"; } }; const onLeave = () => { if (dotRef.current) dotRef.current.style.opacity = "0"; if (glowRef.current) glowRef.current.style.opacity = "0"; }; const onEnter = () => { if (dotRef.current) dotRef.current.style.opacity = "1"; if (glowRef.current) glowRef.current.style.opacity = "1"; }; window.addEventListener("mousemove", onMove); document.addEventListener("mouseleave", onLeave); document.addEventListener("mouseenter", onEnter); return () => { document.body.classList.remove("ev-cursor-active"); window.removeEventListener("mousemove", onMove); document.removeEventListener("mouseleave", onLeave); document.removeEventListener("mouseenter", onEnter); }; }, []); return ( <>
> ); }; window.CursorFX = CursorFX;