"use client"; import Image from "next/image"; import { useEffect, useRef, useState } from "react"; const word = "MONO"; const sideImages = [ { src: "/images/hero-side-1.png", alt: "Modern architecture with corten steel", position: "left", span: 1, }, { src: "/images/hero-side-2.png", alt: "Aerial view of modern home", position: "left", span: 1, }, { src: "/images/hero-side-3.png", alt: "Interior view with landscape", position: "right", span: 1, }, { src: "/images/hero-side-4.png", alt: "Modern architecture at night", position: "right", span: 1, }, ]; export function HeroSection() { const sectionRef = useRef(null); const [scrollProgress, setScrollProgress] = useState(0); useEffect(() => { const handleScroll = () => { if (!sectionRef.current) return; const rect = sectionRef.current.getBoundingClientRect(); const scrollableHeight = window.innerHeight * 2; const scrolled = -rect.top; const progress = Math.max(0, Math.min(1, scrolled / scrollableHeight)); setScrollProgress(progress); }; window.addEventListener("scroll", handleScroll, { passive: true }); handleScroll(); return () => { window.removeEventListener("scroll", handleScroll); }; }, []); // Text fades out first (0 to 0.2) const textOpacity = Math.max(0, 1 - (scrollProgress / 0.2)); // Image transforms start after text fades (0.2 to 1) const imageProgress = Math.max(0, Math.min(1, (scrollProgress - 0.2) / 0.8)); // Smooth interpolations - More balanced distribution const centerWidth = 100 - (imageProgress * 80); // 100% to 20% (same as each side image) const centerHeight = 100; // Always 100% height const sideWidth = imageProgress * 40; // 0% to 40% (20% per image, 2 images = 40%) const sideOpacity = imageProgress; const sideTranslateLeft = -100 + (imageProgress * 100); // -100% to 0% const sideTranslateRight = 100 - (imageProgress * 100); // 100% to 0% const borderRadius = 0; // No border radius const gap = imageProgress * 8; // 0px to 8px // Vertical offset for side columns to move them up on mobile const sideTranslateY = -(imageProgress * 15); // Move up by 15% when fully expanded return (
{/* Sticky container for scroll animation */}
{/* Bento Grid Container */}
{/* Left Column */}
{sideImages.filter(img => img.position === "left").map((img, idx) => (
{img.alt}
))}
{/* Main Hero Image - Center */}
{/* Text Behind - Fades out first */}

{word.split("").map((letter, index) => ( {letter} ))}

Modern architectural structure with reflection
{/* Right Column */}
{sideImages.filter(img => img.position === "right").map((img, idx) => (
{img.alt}
))}
{/* Tagline Section - Fixed at bottom */}

Lightweight, durable
and adventure-ready.

{/* Scroll space to enable animation */}
); }