The rotation comes from two CSS variables, --rotate-x and --rotate-y, and the perspective on the parent turns that into depth. transform-style: preserve-3d lets the tag, title and text sit at different heights above the card (translateZ), so they slide against the surface as it tilts. That parallax is what sells the 3D.
A long transition when the pointer leaves makes the card settle back softly, while a short one during tracking keeps it responsive. The math: the pointer's position across the card runs from 0 to 1, so subtracting 0.5 and doubling gives −1 to 1, which scales to ±maxTilt degrees.
Touch: press and drag across the card; it flattens when you lift your finger. With reduced motion on, the tilt is capped at 5° instead of 14°.