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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useEffect, useRef } from 'react';
|
| 2 |
+
import { gsap } from 'gsap';
|
| 3 |
+
import { ArrowDown, Play, Sparkles, Terminal } from 'lucide-react';
|
| 4 |
+
|
| 5 |
+
export default function Hero() {
|
| 6 |
+
const heroRef = useRef(null);
|
| 7 |
+
const titleRef = useRef(null);
|
| 8 |
+
const subtitleRef = useRef(null);
|
| 9 |
+
const ctaRef = useRef(null);
|
| 10 |
+
const canvasRef = useRef(null);
|
| 11 |
+
|
| 12 |
+
useEffect(() => {
|
| 13 |
+
// Binary rain animation
|
| 14 |
+
const canvas = canvasRef.current;
|
| 15 |
+
const ctx = canvas.getContext('2d');
|
| 16 |
+
let animationId;
|
| 17 |
+
|
| 18 |
+
const resize = () => {
|
| 19 |
+
canvas.width = window.innerWidth;
|
| 20 |
+
canvas.height = window.innerHeight;
|
| 21 |
+
};
|
| 22 |
+
resize();
|
| 23 |
+
window.addEventListener('resize', resize);
|
| 24 |
+
|
| 25 |
+
const chars = '01γ’γ€γ¦γ¨γͺγ«γγ―γ±γ³γ΅γ·γΉγ»γ½γΏγγγγγγγγγγγγγγγγγ γ‘γ’γ€γ¦γ¨γ©γͺγ«γ¬γγ―γ²γ³';
|
| 26 |
+
const fontSize = 14;
|
| 27 |
+
const columns = canvas.width / fontSize;
|
| 28 |
+
const drops = Array(Math.floor(columns)).fill(1);
|
| 29 |
+
|
| 30 |
+
const draw = () => {
|
| 31 |
+
ctx.fillStyle = 'rgba(10, 10, 15, 0.05)';
|
| 32 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
| 33 |
+
ctx.fillStyle = '#00f0ff';
|
| 34 |
+
ctx.font = `${fontSize}px JetBrains Mono`;
|
| 35 |
+
|
| 36 |
+
drops.forEach((drop, i) => {
|
| 37 |
+
const char = chars[Math.floor(Math.random() * chars.length)];
|
| 38 |
+
ctx.fillText(char, i * fontSize, drop * fontSize);
|
| 39 |
+
drops[i] = drop * fontSize > canvas.height && Math.random() > 0.975 ? 0 : drop + 1;
|
| 40 |
+
});
|
| 41 |
+
};
|
| 42 |
+
|
| 43 |
+
const animate = () => {
|
| 44 |
+
draw();
|
| 45 |
+
animationId = requestAnimationFrame(animate);
|
| 46 |
+
};
|
| 47 |
+
animate();
|
| 48 |
+
|
| 49 |
+
// GSAP Animations
|
| 50 |
+
const tl = gsap.timeline({ defaults: { ease: 'power4.out' } });
|
| 51 |
+
|
| 52 |
+
tl.from('.hero-badge', {
|
| 53 |
+
y: 30,
|
| 54 |
+
opacity: 0,
|
| 55 |
+
duration: 0.8,
|
| 56 |
+
})
|
| 57 |
+
.from(titleRef.current, {
|
| 58 |
+
y: 100,
|
| 59 |
+
opacity: 0,
|
| 60 |
+
duration: 1,
|
| 61 |
+
skewY: 7,
|
| 62 |
+
}, '-=0.4')
|
| 63 |
+
.from(subtitleRef.current, {
|
| 64 |
+
y: 50,
|
| 65 |
+
opacity: 0,
|
| 66 |
+
duration: 0.8,
|
| 67 |
+
}, '-=0.6')
|
| 68 |
+
.from('.hero-stats', {
|
| 69 |
+
y: 30,
|
| 70 |
+
opacity: 0,
|
| 71 |
+
duration: 0.6,
|
| 72 |
+
stagger: 0.1,
|
| 73 |
+
}, '-=0.4')
|
| 74 |
+
.from(ctaRef.current, {
|
| 75 |
+
y: 30,
|
| 76 |
+
opacity: 0,
|
| 77 |
+
duration: 0.6,
|
| 78 |
+
}, '-=0.3');
|
| 79 |
+
|
| 80 |
+
// Floating elements animation
|
| 81 |
+
gsap.to('.float-element', {
|
| 82 |
+
y: -20,
|
| 83 |
+
rotation: 5,
|
| 84 |
+
duration: 3,
|
| 85 |
+
ease: 'sine.inOut',
|
| 86 |
+
yoyo: true,
|
| 87 |
+
repeat: -1,
|
| 88 |
+
stagger: 0.5,
|
| 89 |
+
});
|
| 90 |
+
|
| 91 |
+
return () => {
|
| 92 |
+
cancelAnimationFrame(animationId);
|
| 93 |
+
window.removeEventListener('resize', resize);
|
| 94 |
+
};
|
| 95 |
+
}, []);
|
| 96 |
+
|
| 97 |
+
const scrollToWorkbench = () => {
|
| 98 |
+
document.getElementById('workbench').scrollIntoView({ behavior: 'smooth' });
|
| 99 |
+
};
|
| 100 |
+
|
| 101 |
+
return (
|
| 102 |
+
<section ref={heroRef} className="relative min-h-screen flex items-center justify-center overflow-hidden pt-20">
|
| 103 |
+
{/* Binary Rain Canvas */}
|
| 104 |
+
<canvas ref={canvasRef} className="absolute inset-0 pointer-events-none opacity-30" />
|
| 105 |
+
|
| 106 |
+
{/* Gradient Orbs */}
|
| 107 |
+
<div className="absolute top-1/4 left-1/4 w-96 h-96 bg-electric-500/20 rounded-full blur-3xl animate-pulse-slow" />
|
| 108 |
+
<div className="absolute bottom-1/4 right-1/4 w-96 h-96 bg-magma-500/20 rounded-full blur-3xl animate-pulse-slow" style={{ animationDelay: '1s' }} />
|
| 109 |
+
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[600px] h-[600px] bg-gold-500/10 rounded-full blur-3xl animate-pulse-slow" style={{ animationDelay: '2s' }} />
|
| 110 |
+
|
| 111 |
+
{/* Grid Pattern */}
|
| 112 |
+
<div className="absolute inset-0 grid-pattern opacity-50" />
|
| 113 |
+
|
| 114 |
+
{/* Floating Code Elements */}
|
| 115 |
+
<div className="absolute left-10 top-1/3 float-element hidden lg:block">
|
| 116 |
+
<div className="bg-iron-800/80 backdrop-blur-sm border border-iron-600/50 rounded-lg p-4 font-mono text-xs text-electric-400">
|
| 117 |
+
<div className="flex items-center gap-2 mb-2 text-iron-400">
|
| 118 |
+
<Terminal className="w-4 h-4" />
|
| 119 |
+
<span>bash</span>
|
| 120 |
+
</div>
|
| 121 |
+
<p className="terminal-cursor">npm run optimize</p>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
|
| 125 |
+
<div className="absolute right-10 top-1/2 float-element hidden lg:block" style={{ animationDelay: '0.5s' }}>
|
| 126 |
+
<div className="bg-iron-800/80 backdrop-blur-sm border border-iron-600/50 rounded-lg p-4 font-mono text-xs text-magma-400">
|
| 127 |
+
<p>{`{`}</p>
|
| 128 |
+
<p className="pl-2">"performance": "99.9%",</p>
|
| 129 |
+
<p className="pl-2">"optimization": "complete"</p>
|
| 130 |
+
<p>{`}`}</p>
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
|
| 134 |
+
<div className="absolute left-20 bottom-1/3 float-element hidden lg:block" style={{ animationDelay: '1s' }}>
|
| 135 |
+
<div className="bg-iron-800/80 backdrop-blur-sm border border-iron-600/50 rounded-lg p-3 font-mono text-xs text-gold-400">
|
| 136 |
+
<Sparkles className="w-4 h-4 mb-1" />
|
| 137 |
+
<p>AI Enhanced</p>
|
| 138 |
+
</div>
|
| 139 |
+
</div>
|
| 140 |
+
|
| 141 |
+
{/* Main Content */}
|
| 142 |
+
<div className="relative z-10 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
|
| 143 |
+
{/* Badge */}
|
| 144 |
+
<div className="hero-badge inline-flex items-center gap-2 px-4 py-2 rounded-full bg-iron-800/80 border border-electric-500/30 mb-8">
|
| 145 |
+
<span className="w-2 h-2 bg-electric-500 rounded-full animate-pulse" />
|
| 146 |
+
<span className="font-mono text-sm text-electric-400">SYSTEM ONLINE v2.024</span>
|
| 147 |
+
</div>
|
| 148 |
+
|
| 149 |
+
{/* Title */}
|
| 150 |
+
<h1 ref={titleRef} className="text-5xl sm:text-7xl lg:text-8xl font-bold mb-6 tracking-tight">
|
| 151 |
+
<span className="block text-iron-100 glitch" data-text="FORGE YOUR">FORGE YOUR</span>
|
| 152 |
+
<span className="block text-gradient">DIGITAL EDGE</span>
|
| 153 |
+
</h1>
|
| 154 |
+
|
| 155 |
+
{/* Subtitle */}
|
| 156 |
+
<p ref={subtitleRef} className="max-w-2xl mx-auto text-lg sm:text-xl text-iron-300 mb-12 font-mono leading-relaxed">
|
| 157 |
+
Advanced protocols for developers who refuse to settle.
|
| 158 |
+
Master the arcane arts of performance, automation, and system architecture.
|
| 159 |
+
</p>
|
| 160 |
+
|
| 161 |
+
{/* Stats */}
|
| 162 |
+
<div className="flex flex-wrap justify-center gap-8 mb-12">
|
| 163 |
+
{[
|
| 164 |
+
{ value: '500+', label: 'Pro Tips' },
|
| 165 |
+
{ value: '50K+', label: 'Developers' },
|
| 166 |
+
{ value: '99.9%', label: 'Uptime' },
|
| 167 |
+
].map((stat, i) => (
|
| 168 |
+
<div key={i} className="hero-stats text-center">
|
| 169 |
+
<div className="text-3xl sm:text-4xl font-bold text-electric-500 font-mono">{stat.value}</div>
|
| 170 |
+
<div className="text-sm text-iron-400 font-mono uppercase tracking-wider">{stat.label}</div>
|
| 171 |
+
</div>
|
| 172 |
+
))}
|
| 173 |
+
</div>
|
| 174 |
+
|
| 175 |
+
{/* CTA Buttons */}
|
| 176 |
+
<div ref={ctaRef} className="flex flex-col sm:flex-row gap-4 justify-center">
|
| 177 |
+
<button
|
| 178 |
+
onClick={scrollToWorkbench}
|
| 179 |
+
className="group relative px-8 py-4 bg-gradient-to-r from-electric-500 to-electric-400 text-iron-900 font-mono font-semibold rounded-lg overflow-hidden transition-all hover:scale-105"
|
| 180 |
+
>
|
| 181 |
+
<span className="relative z-10 flex items-center justify-center gap-2">
|
| 182 |
+
<Play className="w-5 h-5" />
|
| 183 |
+
ENTER THE LAB
|
| 184 |
+
</span>
|
| 185 |
+
<div className="absolute inset-0 bg-gradient-to-r from-magma-500 to-electric-500 opacity-0 group-hover:opacity-100 transition-opacity duration-500" />
|
| 186 |
+
</button>
|
| 187 |
+
<button className="group px-8 py-4 border border-iron-600 text-iron-200 font-mono font-semibold rounded-lg hover:border-electric-500 hover:text-electric-500 transition-all flex items-center justify-center gap-2">
|
| 188 |
+
<ArrowDown className="w-5 h-5 group-hover:translate-y-1 transition-transform" />
|
| 189 |
+
EXPLORE ARCHIVE
|
| 190 |
+
</button>
|
| 191 |
+
</div>
|
| 192 |
+
</div>
|
| 193 |
+
|
| 194 |
+
{/* Scroll Indicator */}
|
| 195 |
+
<div className="absolute bottom-8 left-1/2 -translate-x-1/2">
|
| 196 |
+
<div className="w-6 h-10 border-2 border-iron-600 rounded-full flex justify-center pt-2">
|
| 197 |
+
<div className="w-1.5 h-3 bg-electric-500 rounded-full animate-bounce" />
|
| 198 |
+
</div>
|
| 199 |
+
</div>
|
| 200 |
+
</section>
|
| 201 |
+
);
|
| 202 |
+
}
|