/**
 * ALGA ARENA — Pointer Parallax
 * Maps mouse movements to minor scene tilts
 */

'use strict';

window.CinematicParallax = (() => {
    let mouse = { x: 0, y: 0, targetX: 0, targetY: 0 };

    const onMouseMove = (e) => {
        mouse.targetX = (e.clientX / window.innerWidth) * 2 - 1;
        mouse.targetY = -(e.clientY / window.innerHeight) * 2 + 1;
    };

    const update = (scene, delta) => {
        if (!scene) return;
        mouse.x += (mouse.targetX - mouse.x) * 0.05;
        mouse.y += (mouse.targetY - mouse.y) * 0.05;

        scene.rotation.y = mouse.x * 0.12;
        scene.rotation.x = mouse.y * 0.08;
    };

    return { onMouseMove, update };
})();
