'use client'; import React, { useRef, useState, useCallback } from 'react'; interface Kinetic3DTextProps { primaryText: string; highlightText?: string; subtitle?: string; className?: string; } export function Kinetic3DText({ primaryText, highlightText, subtitle, className = '', }: Kinetic3DTextProps) { const [tilt, setTilt] = useState({ rx: 0, ry: 0, active: false }); const containerRef = 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; setTilt({ rx: Math.max(Math.min(-ny * 10, 8), -8), ry: Math.max(Math.min(nx * 12, 10), -10), active: true, }); }, []); const handleMouseLeave = useCallback(() => { setTilt({ rx: 0, ry: 0, active: false }); }, []); return (
{/* Main Floating Headline (100% Visible, Crisp, Zero Disappearance) */}

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

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

{subtitle}

)}
); }