import React, { useRef, useEffect, useState, useMemo } from 'react'; interface HeroOverlayProps { visible: boolean; smoothScrollRef: React.MutableRefObject; shiftRef: React.MutableRefObject; shapeMode: string; isMobile: boolean; } // --- OPTIMIZED ANIMATION COMPONENT --- // Memoized to prevent unnecessary re-renders when parent state changes (like the clock) const CinematicReveal = React.memo(({ text, delay = 0, visible, className }: { text: string; delay?: number; visible: boolean; className?: string }) => { return ( {text.split('').map((char, i) => ( {char === " " ? "\u00A0" : char} ))} ); }); export const HeroOverlay: React.FC = ({ visible, smoothScrollRef, shiftRef, shapeMode, isMobile }) => { // Refs for direct DOM manipulation (High Performance) const contentRef = useRef(null); const blurRef = useRef(null); // State for Live Date const [dateTime, setDateTime] = useState({ day: '', date: '' }); // --- LIVE DATE LOGIC --- useEffect(() => { const updateTime = () => { const now = new Date(); // Format: "SATURDAY" const day = now.toLocaleDateString('en-US', { weekday: 'long' }).toUpperCase(); // Format: "DEC 20 2025" const date = now.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }).toUpperCase().replace(',', ''); setDateTime({ day, date }); }; updateTime(); // Update every minute (efficient, no need for second-by-second ticking here) const timer = setInterval(updateTime, 60000); return () => clearInterval(timer); }, []); const getStatus = () => { if (shapeMode === 'triangle') return 'AWAITING INPUT...'; if (shapeMode === 'explode') return 'PROCESSING DATA...'; return 'SYSTEM ONLINE'; }; const getStatusColor = () => { if (shapeMode === 'triangle') return 'text-red-500'; if (shapeMode === 'explode') return 'text-blue-400'; return 'text-emerald-500'; }; // --- SCROLL LOOP (GPU OPTIMIZED) --- useEffect(() => { let frameId: number; const update = () => { if (!visible) return; const y = smoothScrollRef.current; const h = window.innerHeight; const processItem = (ref: React.RefObject, type: 'text' | 'bg', start: number, fade: number = 200) => { if (!ref.current) return; let opacity = 0; let transY = 0; let scale = 1; // Logic: Everything fades out as you scroll down if (y < start + fade) { opacity = 1 - (y / (start + fade)); // Only move/scale the text layer, keep the background fixed so it just fades if (type === 'text') { transY = -y * 0.5; scale = 1 - (y / (start + fade)) * 0.05; } } else { opacity = 0; } ref.current.style.opacity = Math.max(0, opacity).toFixed(3); if (type === 'text') { ref.current.style.transform = `translate3d(0, ${transY.toFixed(3)}px, 0) scale(${scale.toFixed(3)})`; } }; // Apply to Content (Text): Fades and moves up processItem(contentRef, 'text', 0, 0.8 * h); // Apply to Blur Layer: Fades out slightly faster to reveal content below processItem(blurRef, 'bg', 0, 0.7 * h); // Globe Lateral Shifts Logic const SHIFT = isMobile ? 0 : 5.5; let tx = 0; if (!isMobile) { if (y > 0.8 * h && y < 2.0 * h) tx = SHIFT; } if (shiftRef) shiftRef.current = tx; frameId = requestAnimationFrame(update); }; update(); return () => cancelAnimationFrame(frameId); }, [visible, smoothScrollRef, shiftRef, isMobile]); return (
{/* FULL SCREEN BLUR LAYER - inset-0: Covers the whole screen. - backdrop-blur-[2px]: Subtle glass effect. - bg-black/5: Slight tint for readability. - Fades out on scroll via blurRef. */}
{/* Hero Content Wrapper */}
{/* Content Container - Left Aligned */}
{/* Live Date & Day Tags */}
{dateTime.day || "LOADING..."} {dateTime.date || "..."}
{/* Main Headline */}

{/* Subtext */}

We are an advanced R&D collective specializing in high-frequency neural networks and generative interface design. Building the cognitive architecture for the next web.

{/* Bottom Status Bar */}
{shapeMode === 'triangle' ? 'EXEC: NEURAL_VOICE_PROTOCOL' : 'EXEC: TRIANGLE_MAIN_LOOP'}
System {getStatus()}
Latency 12ms
Build v2.0.4-RC
) }