'use client'; import React, { useRef, useCallback } from 'react'; interface Kinetic3DTextProps { primaryText: string; highlightText?: string; subtitle?: string; className?: string; } export function Kinetic3DText({ primaryText, highlightText, subtitle, className = '', }: Kinetic3DTextProps) { const containerRef = useRef(null); const textRef = useRef(null); const handleMouseMove = useCallback((e: React.MouseEvent) => { if (!containerRef.current) return; const rect = containerRef.current.getBoundingClientRect(); const nx = (e.clientX - rect.left) / rect.width - 0.5; const ny = (e.clientY - rect.top) / rect.height - 0.5; if (!textRef.current || window.matchMedia('(prefers-reduced-motion: reduce)').matches) return; const rx = Math.max(Math.min(-ny * 3, 2.5), -2.5); const ry = Math.max(Math.min(nx * 4, 3), -3); textRef.current.style.transform = `perspective(1000px) rotateX(${rx}deg) rotateY(${ry}deg)`; }, []); const handleMouseLeave = useCallback(() => { if (textRef.current) textRef.current.style.transform = 'perspective(1000px) rotateX(0deg) rotateY(0deg)'; }, []); return (
{/* Main Floating Headline (100% Visible, Crisp, Zero Disappearance) */}

{primaryText}{' '}
{highlightText && ( {highlightText} )}

{/* Subtitle (100% Visible & Crisp) */} {subtitle && (

{subtitle}

)}
); }