2026-11-03 16:44:13 +05:30
'use client' ;
2026-11-03 17:17:02 +05:30
import React , { useRef , useEffect , useState , useCallback } from 'react' ;
2026-11-03 16:44:13 +05:30
import Link from 'next/link' ;
2026-11-03 17:17:02 +05:30
import { Sparkles , ArrowRight , Smartphone , ChevronLeft , ChevronRight } from 'lucide-react' ;
2026-11-03 16:44:13 +05:30
import { Cinematic3DComparison } from '@/components/ui/Cinematic3DComparison' ;
interface ShowcaseCard {
id : string ;
index : string ;
category : string ;
model : string ;
latency : string ;
title : string ;
tagline : string ;
description : string ;
toolSlug : string ;
appSlug : string ;
appName : string ;
beforeUrl : string ;
afterUrl : string ;
specs : string [];
}
const showcaseCards : ShowcaseCard [] = [
{
id : 'matting' ,
index : '01 / 03' ,
category : 'ALPHA MATTING ARCHIVE' ,
model : 'P3M-Net Dual-Stream Alpha' ,
latency : '< 520ms Stream' ,
title : 'Hair-Strand Matting & Alpha Isolation' ,
tagline : 'Sub-pixel edge detection with microscopic flyaway hair preservation.' ,
description : 'Trained on high-resolution studio portraits, P3M-Net isolates individual flyaway hair strands, fur, and translucent fabrics without halo artifacts or jagged edges. Streams transparent alpha PNGs in real-time.' ,
toolSlug : 'background-remover' ,
appSlug : 'bg-cleaner-app' ,
appName : 'Magic Cutout Studio' ,
beforeUrl : 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=800&auto=format&fit=crop&q=80' ,
afterUrl : 'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=800&auto=format&fit=crop&q=80' ,
specs : [ 'Sub-pixel flyaway detection' , 'Lossless alpha PNG export' , 'Zero edge halo bleeding' ],
},
{
id : 'retouch' ,
index : '02 / 03' ,
category : 'DERMAL RESTORATION' ,
model : 'RetouchGAN v2.1 Micro-Pore' ,
latency : '< 380ms Stream' ,
title : 'Sub-Pore Skin Retouching & Blemish Removal' ,
tagline : 'Authentic microscopic texture preservation without plastic smoothing.' ,
description : 'Unlike standard beauty filters that smear your face into plastic, RetouchGAN operates at the dermal level—erasing acne, blemishes, and under-eye redness while reconstructing microscopic skin pore geometry.' ,
toolSlug : 'blemish-remover' ,
appSlug : 'portrait-app' ,
appName : 'Portrait Studio AI' ,
beforeUrl : 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=800&auto=format&fit=crop&q=80' ,
afterUrl : 'https://images.unsplash.com/photo-1517841905240-472988babdf9?w=800&auto=format&fit=crop&q=80' ,
specs : [ 'Microscopic pore geometry' , 'Instant scar & redness repair' , 'True-to-life dermal tones' ],
},
{
id : 'enhancer' ,
index : '03 / 03' ,
category : '4K SUPER-RESOLUTION' ,
model : 'GFPGAN + RealESRGAN Ultra' ,
latency : '< 460ms Stream' ,
title : '4K Super-Resolution & Facial Deblurring' ,
tagline : 'Transform low-resolution snapshots into crystal-clear 4K portraits.' ,
description : 'Deep neural priors restore authentic iris sharpness, eyelash detail, and facial contours on blurry, out-of-focus, or highly compressed photos, yielding gallery-ready clarity with zero guesswork.' ,
toolSlug : 'photo-enhancer' ,
appSlug : 'photo-enhancer-pro' ,
appName : 'Enhance Ultra AI' ,
beforeUrl : 'https://images.unsplash.com/photo-1544005313-94ddf0286df2?w=800&auto=format&fit=crop&q=80' ,
afterUrl : 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=800&auto=format&fit=crop&q=80' ,
specs : [ 'Iris & eyelash synthesis' , '400% lossless super-resolution' , 'Studio-grade crispness' ],
},
];
export function CinematicHorizontalScrollSection() {
const containerRef = useRef < HTMLDivElement >( null );
const trackRef = useRef < HTMLDivElement >( null );
2026-11-03 16:49:56 +05:30
const bgTextRef = useRef < HTMLDivElement >( null );
const progressBarRef = useRef < HTMLDivElement >( null );
const progressTextRef = useRef < HTMLSpanElement >( null );
2026-11-03 17:17:02 +05:30
const [ activeCardIndex , setActiveCardIndex ] = useState ( 0 );
const scrollToCard = useCallback (( index : number ) => {
if ( ! containerRef . current ) return ;
const rect = containerRef . current . getBoundingClientRect ();
const containerTop = rect . top + window . scrollY ;
const scrollableDistance = Math . max ( containerRef . current . offsetHeight - window . innerHeight , 1 );
const targetY = containerTop + ( index / 2 ) * scrollableDistance ;
window . scrollTo ({ top : targetY , behavior : 'smooth' });
}, []);
const navigateStep = useCallback (( delta : number ) => {
const nextIdx = Math . max ( 0 , Math . min ( 2 , activeCardIndex + delta ));
scrollToCard ( nextIdx );
}, [ activeCardIndex , scrollToCard ]);
2026-11-03 16:44:13 +05:30
useEffect (() => {
2026-11-03 17:17:02 +05:30
let ticking = false ;
let containerTop = 0 ;
let scrollableDistance = 1 ;
let maxTranslate = 1 ;
let cardStep = 780 ;
let screenCenter = window . innerWidth / 2 ;
2026-11-03 16:44:13 +05:30
2026-11-03 17:17:02 +05:30
const measure = () => {
if ( ! containerRef . current || ! trackRef . current ) return ;
const rect = containerRef . current . getBoundingClientRect ();
containerTop = rect . top + window . scrollY ;
scrollableDistance = Math . max ( containerRef . current . offsetHeight - window . innerHeight , 1 );
maxTranslate = Math . max ( trackRef . current . scrollWidth - window . innerWidth , 1 );
screenCenter = window . innerWidth / 2 ;
const firstCard = trackRef . current . children [ 0 ] as HTMLElement | undefined ;
if ( firstCard ) {
cardStep = firstCard . offsetWidth + 48 ; // card width + gap
2026-11-03 16:44:13 +05:30
}
};
2026-11-03 17:17:02 +05:30
measure ();
window . addEventListener ( 'resize' , measure , { passive : true });
// Ultra-fast direct 1:1 synchronization with smooth scroll (Zero double-damping lag)
const updatePosition = () => {
const sy = window . scrollY ;
const offset = sy - containerTop ;
const progress = Math . min ( Math . max ( offset / scrollableDistance , 0 ), 1 );
const currentX = progress * maxTranslate ;
if ( trackRef . current ) {
// Direct GPU compositor translation (100% synchronized with Lenis)
trackRef . current . style . transform = `translate3d(- ${ currentX . toFixed ( 1 ) } px, 0, 0)` ;
if ( bgTextRef . current ) {
bgTextRef . current . style . transform = `translate3d(- ${ ( currentX * 0.35 ). toFixed ( 1 ) } px, 0, 0) rotateX(8deg)` ;
}
if ( progressBarRef . current ) {
progressBarRef . current . style . width = ` ${ Math . max ( progress * 100 , 4 ). toFixed ( 1 ) } %` ;
}
if ( progressTextRef . current ) {
progressTextRef . current . textContent = `PROGRESS ${ Math . round ( progress * 100 ) } %` ;
}
const currentActive = Math . min ( Math . round ( progress * 2 ), 2 );
setActiveCardIndex ( currentActive );
// Arithmetic 3D perspective rotation (zero forced reflows)
const cards = trackRef . current . children ;
const padLeft = window . innerWidth > 640 ? 48 : 24 ;
for ( let i = 0 ; i < cards . length ; i ++ ) {
const card = cards [ i ] as HTMLElement ;
const cardCenter = padLeft + i * cardStep + ( cardStep - 48 ) / 2 - currentX ;
const dist = ( cardCenter - screenCenter ) / ( screenCenter * 1.2 );
const rotY = Math . max ( Math . min ( dist * - 6 , 9 ), - 9 );
const scale = Math . max ( 1 - Math . abs ( dist ) * 0.03 , 0.96 );
card . style . transform = `perspective(1100px) rotateY( ${ rotY . toFixed ( 2 ) } deg) scale3d( ${ scale . toFixed ( 3 ) } , ${ scale . toFixed ( 3 ) } , 1)` ;
}
}
};
const handleScroll = () => {
if ( ! ticking ) {
ticking = true ;
requestAnimationFrame (() => {
updatePosition ();
ticking = false ;
});
}
};
// Trackpad horizontal swipe listener (converts two-finger deltaX directly into scroll)
const handleWheel = ( e : WheelEvent ) => {
if ( ! containerRef . current ) return ;
const rect = containerRef . current . getBoundingClientRect ();
if ( rect . top <= 20 && rect . bottom >= window . innerHeight - 20 ) {
if ( Math . abs ( e . deltaX ) > Math . abs ( e . deltaY ) && Math . abs ( e . deltaX ) > 2 ) {
window . scrollBy ({ top : e.deltaX * 0.9 , behavior : 'instant' });
}
}
};
window . addEventListener ( 'scroll' , handleScroll , { passive : true });
window . addEventListener ( 'wheel' , handleWheel , { passive : true });
// Initial sync
updatePosition ();
2026-11-03 16:44:13 +05:30
return () => {
2026-11-03 17:17:02 +05:30
window . removeEventListener ( 'resize' , measure );
window . removeEventListener ( 'scroll' , handleScroll );
window . removeEventListener ( 'wheel' , handleWheel );
2026-11-03 16:44:13 +05:30
};
}, []);
return (
< section
id = "flagship-models"
ref = { containerRef }
2026-11-03 17:17:02 +05:30
className = "relative h-[150vh] sm:h-[170vh] bg-[#FAF8F5] border-t border-slate-900/[0.08] overflow-visible"
2026-11-03 16:44:13 +05:30
>
{ /* Sticky Fullscreen Camera Viewport */ }
2026-11-03 17:17:02 +05:30
< div className = "sticky top-0 h-screen w-full overflow-hidden flex flex-col justify-between py-8 sm:py-12 select-none" >
2026-11-03 16:49:56 +05:30
{ /* Massive 3D Kinetic Background Typography Ribbon (Parallax Drift) */ }
< div
ref = { bgTextRef }
2026-11-03 17:17:02 +05:30
className = "absolute top-1/2 -translate-y-1/2 left-0 w-max whitespace-nowrap pointer-events-none -z-10 opacity-25 select-none preserve-3d"
2026-11-03 16:49:56 +05:30
aria-hidden = "true"
>
< span className = "font-display font-black text-[13vw] uppercase tracking-tighter text-transparent bg-clip-text bg-gradient-to-r from-slate-900/10 via-blue-900/15 to-amber-900/10 block leading-none" >
01 ALPHA MATTING // 02 DERMAL RETOUCH // 03 4K SUPER-RES // STUDIO ARCHIVE //
</ span >
</ div >
2026-11-03 16:44:13 +05:30
2026-11-03 16:49:56 +05:30
{ /* Ambient Subtle Gradients */ }
< div className = "absolute top-1/4 left-1/3 w-[500px] h-[500px] bg-blue-500/[0.035] rounded-full blur-3xl pointer-events-none -z-10" />
< div className = "absolute bottom-1/4 right-1/4 w-[450px] h-[450px] bg-amber-500/[0.03] rounded-full blur-3xl pointer-events-none -z-10" />
{ /* Section Top Header & Navigation Telemetry with 3D Depth */ }
2026-11-03 16:44:13 +05:30
< div className = "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 w-full z-10 flex flex-col sm:flex-row sm:items-end justify-between gap-4" >
2026-11-03 16:49:56 +05:30
< div className = "preserve-3d" >
2026-11-03 17:08:23 +05:30
< div className = "badge-3d inline-flex items-center gap-2 px-3.5 py-1 rounded-full bg-blue-50/90 border border-blue-200/80 text-[11px] font-mono font-semibold text-blue-700 mb-2 shadow-sm" >
2026-11-03 16:44:13 +05:30
< Sparkles className = "w-3.5 h-3.5 text-blue-600" />
< span > HORIZONTAL 3 D CINEMATIC ARCHIVE </ span >
</ div >
2026-11-03 17:08:23 +05:30
< h2 className = "text-2xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight text-3d-chiseled" >
Flagship Transformations < span className = "text-transparent bg-clip-text bg-gradient-to-r from-blue-700 via-indigo-600 to-amber-600 text-3d-gradient" > In Real - Time </ span >
2026-11-03 16:44:13 +05:30
</ h2 >
</ div >
2026-11-03 17:17:02 +05:30
< div className = "flex flex-wrap items-center gap-2.5 sm:gap-3" >
{ /* Quick Card Jump Pills */ }
< div className = "hidden sm:flex items-center gap-1.5 bg-slate-100/80 backdrop-blur-sm p-1 rounded-full border border-slate-200/80" >
{ showcaseCards . map (( c , i ) => (
< button
key = { c . id }
onClick = {() => scrollToCard ( i )}
className = { `px-3 py-1 rounded-full text-xs font-mono font-bold transition-all duration-200 ${
activeCardIndex === i
? 'bg-blue-600 text-white shadow-sm'
: 'text-slate-600 hover:text-slate-900'
} ` }
>
0 { i + 1 }
</ button >
))}
</ div >
{ /* Quick Step Controls */ }
< div className = "flex items-center gap-1" >
< button
onClick = {() => navigateStep ( - 1 )}
disabled = { activeCardIndex === 0 }
aria-label = "Previous card"
className = "w-8 h-8 rounded-full bg-white border border-slate-200 shadow-sm flex items-center justify-center text-slate-700 hover:text-blue-600 hover:border-blue-300 disabled:opacity-40 disabled:cursor-not-allowed transition-all"
>
< ChevronLeft className = "w-4 h-4" />
</ button >
< button
onClick = {() => navigateStep ( 1 )}
disabled = { activeCardIndex === 2 }
aria-label = "Next card"
className = "w-8 h-8 rounded-full bg-white border border-slate-200 shadow-sm flex items-center justify-center text-slate-700 hover:text-blue-600 hover:border-blue-300 disabled:opacity-40 disabled:cursor-not-allowed transition-all"
>
< ChevronRight className = "w-4 h-4" />
</ button >
</ div >
{ /* Progress Badge */ }
< div className = "flex items-center gap-1.5 px-3 py-1 rounded-full bg-white/90 backdrop-blur-sm border border-slate-900/[0.08] text-xs font-mono font-bold text-slate-800 shadow-sm" >
2026-11-03 16:44:13 +05:30
< span className = "w-2 h-2 rounded-full bg-blue-600 animate-ping inline-block" />
2026-11-03 16:49:56 +05:30
< span ref = { progressTextRef }> PROGRESS 0 % </ span >
2026-11-03 16:44:13 +05:30
</ div >
</ div >
</ div >
2026-11-03 16:49:56 +05:30
{ /* Horizontal Sliding Filmstrip Track (Zero CSS transition conflicts, 100% hardware GPU translation) */ }
2026-11-03 16:44:13 +05:30
< div className = "relative w-full my-auto overflow-visible py-4" >
< div
ref = { trackRef }
2026-11-03 17:17:02 +05:30
className = "flex items-center gap-8 sm:gap-12 px-6 sm:px-12 w-max will-change-transform preserve-3d"
2026-11-03 16:44:13 +05:30
>
2026-11-03 16:49:56 +05:30
{ showcaseCards . map (( card ) => (
2026-11-03 16:44:13 +05:30
< div
key = { card . id }
2026-11-03 16:49:56 +05:30
className = "w-[85vw] sm:w-[620px] lg:w-[740px] shrink-0 bg-white/95 backdrop-blur-xl rounded-3xl p-5 sm:p-8 border border-slate-900/[0.08] shadow-cinematic-3d hover:shadow-cinematic-hover transition-shadow duration-300 preserve-3d group"
2026-11-03 16:44:13 +05:30
>
2026-11-03 16:49:56 +05:30
{ /* Card Top Metadata Bar (translateZ 30px) */ }
< div
className = "flex items-center justify-between pb-4 border-b border-slate-900/[0.06] mb-5 preserve-3d"
style = {{ transform : 'translateZ(30px)' }}
>
2026-11-03 16:44:13 +05:30
< div className = "flex items-center gap-3" >
< span className = "font-mono text-xs font-black text-blue-700 tracking-wider" >
{ card . index }
</ span >
< span className = "h-3 w-px bg-slate-300" />
< span className = "font-mono text-[10px] sm:text-xs font-bold text-slate-500 uppercase tracking-widest" >
{ card . category }
</ span >
</ div >
< div className = "flex items-center gap-2" >
< span className = "px-2.5 py-1 rounded-md bg-amber-50 border border-amber-200/60 text-[10px] font-mono font-semibold text-amber-800" >
{ card . latency }
</ span >
</ div >
</ div >
2026-11-03 17:17:02 +05:30
{ /* 3D Cinematic Comparison Viewport (autoSlide false to save CPU/GPU cycles during horizontal pan) */ }
2026-11-03 16:44:13 +05:30
< div className = "mb-6 relative z-10" >
< Cinematic3DComparison
beforeUrl = { card . beforeUrl }
afterUrl = { card . afterUrl }
beforeLabel = "RAW SOURCE"
afterLabel = { card . model }
aspectRatio = "aspect-[16/10]"
2026-11-03 17:17:02 +05:30
autoSlide = { false }
2026-11-03 16:44:13 +05:30
/>
</ div >
2026-11-03 16:49:56 +05:30
{ /* Card 3D Stereoscopic Typography Stack */ }
< div className = "space-y-3 preserve-3d" >
2026-11-03 17:08:23 +05:30
{ /* Headline at translateZ 45px with 3D Chiseled Extrusion */ }
2026-11-03 16:49:56 +05:30
< h3
2026-11-03 17:08:23 +05:30
className = "text-xl sm:text-2xl font-display font-bold text-slate-900 tracking-tight preserve-3d text-3d-chiseled"
2026-11-03 16:49:56 +05:30
style = {{ transform : 'translateZ(45px)' }}
>
2026-11-03 16:44:13 +05:30
{ card . title }
</ h3 >
2026-11-03 16:49:56 +05:30
{ /* Description at translateZ 25px */ }
< p
className = "text-sm text-slate-600 leading-relaxed font-normal preserve-3d"
style = {{ transform : 'translateZ(25px)' }}
>
2026-11-03 16:44:13 +05:30
{ card . description }
</ p >
2026-11-03 16:49:56 +05:30
{ /* Specs Chips at translateZ 35px */ }
< div
className = "flex flex-wrap gap-2 pt-2 preserve-3d"
style = {{ transform : 'translateZ(35px)' }}
>
2026-11-03 16:44:13 +05:30
{ card . specs . map (( spec , i ) => (
< span
key = { i }
className = "px-2.5 py-1 rounded-lg bg-slate-100 text-slate-700 text-xs font-mono font-medium border border-slate-200/60"
>
✓ { spec }
</ span >
))}
</ div >
2026-11-03 16:49:56 +05:30
{ /* Actions at translateZ 50px */ }
< div
className = "pt-4 flex flex-wrap items-center justify-between gap-3 border-t border-slate-900/[0.06] preserve-3d"
style = {{ transform : 'translateZ(50px)' }}
>
2026-11-03 16:44:13 +05:30
< Link
href = { `/tools/ ${ card . toolSlug } ` }
className = "inline-flex items-center gap-2 text-xs font-bold text-blue-700 hover:text-blue-900 group/link"
>
< span > Launch Interactive Studio </ span >
< ArrowRight className = "w-3.5 h-3.5 group-hover/link:translate-x-1 transition-transform" />
</ Link >
< Link
href = { `/apps/ ${ card . appSlug } ` }
className = "inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-slate-900 text-white text-xs font-bold hover:bg-blue-700 transition-colors shadow-sm"
>
2026-11-03 17:17:02 +05:30
< Smartphone className = "w-3 h-3 text-blue-400" />
2026-11-03 16:44:13 +05:30
< span >{ card . appName }</ span >
</ Link >
</ div >
</ div >
</ div >
))}
</ div >
</ div >
2026-11-03 17:17:02 +05:30
{ /* Bottom Cinematic Control & Progress Rail */ }
2026-11-03 16:44:13 +05:30
< div className = "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 w-full z-10" >
2026-11-03 17:17:02 +05:30
< div className = "flex flex-col sm:flex-row sm:items-center justify-between gap-3 py-3 border-t border-slate-900/[0.06]" >
{ /* Visual Progress Bar Track */ }
< div className = "flex-1 max-w-md h-1.5 bg-slate-200/80 rounded-full overflow-hidden" >
< div
ref = { progressBarRef }
className = "h-full bg-gradient-to-r from-blue-600 via-indigo-600 to-amber-500 rounded-full will-change-transform"
style = {{ width : '4%' }}
/>
</ div >
{ /* Model Metadata Tags */ }
< div className = "flex items-center gap-4 text-xs font-mono text-slate-500" >
< span > ARCHIVE : VOL. 26 </ span >
< span > • </ span >
< span > NEURAL VISION ACCELERATOR </ span >
</ div >
2026-11-03 16:44:13 +05:30
</ div >
</ div >
</ div >
</ section >
);
}