2026-11-03 16:44:13 +05:30
'use client' ;
2026-11-03 17:31:00 +05:30
import React , { useRef , useState , useEffect , useCallback } from 'react' ;
2026-11-03 16:44:13 +05:30
import Link from 'next/link' ;
2026-11-03 17:31:00 +05:30
import { Sparkles , ArrowRight , Smartphone , ChevronLeft , ChevronRight , Layers } 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() {
2026-11-03 17:31:00 +05:30
const scrollRef = useRef < HTMLDivElement >( null );
const [ activeIndex , setActiveIndex ] = useState ( 0 );
const [ isDragging , setIsDragging ] = useState ( false );
const [ dragStartX , setDragStartX ] = useState ( 0 );
const [ dragScrollLeft , setDragScrollLeft ] = useState ( 0 );
2026-11-03 17:17:02 +05:30
2026-11-03 17:31:00 +05:30
// Smoothly scroll to a specific card index
2026-11-03 17:17:02 +05:30
const scrollToCard = useCallback (( index : number ) => {
2026-11-03 17:31:00 +05:30
if ( ! scrollRef . current ) return ;
const container = scrollRef . current ;
const card = container . children [ index ] as HTMLElement | undefined ;
if ( card ) {
const containerWidth = container . offsetWidth ;
const cardWidth = card . offsetWidth ;
const cardLeft = card . offsetLeft ;
// Center the card in the viewport
const targetLeft = cardLeft - ( containerWidth - cardWidth ) / 2 ;
container . scrollTo ({
left : Math.max ( 0 , targetLeft ),
behavior : 'smooth' ,
});
setActiveIndex ( index );
}
2026-11-03 17:17:02 +05:30
}, []);
2026-11-03 17:31:00 +05:30
const handlePrev = useCallback (() => {
scrollToCard ( Math . max ( 0 , activeIndex - 1 ));
}, [ activeIndex , scrollToCard ]);
2026-11-03 16:44:13 +05:30
2026-11-03 17:31:00 +05:30
const handleNext = useCallback (() => {
scrollToCard ( Math . min ( showcaseCards . length - 1 , activeIndex + 1 ));
}, [ activeIndex , scrollToCard ]);
// Update active index based on scroll position via lightweight scroll listener
2026-11-03 16:44:13 +05:30
useEffect (() => {
2026-11-03 17:31:00 +05:30
const container = scrollRef . current ;
if ( ! container ) return ;
2026-11-03 17:17:02 +05:30
2026-11-03 17:31:00 +05:30
let timeoutId : NodeJS.Timeout ;
2026-11-03 17:17:02 +05:30
const handleScroll = () => {
2026-11-03 17:31:00 +05:30
clearTimeout ( timeoutId );
timeoutId = setTimeout (() => {
if ( ! container ) return ;
const scrollLeft = container . scrollLeft ;
const containerCenter = scrollLeft + container . offsetWidth / 2 ;
2026-11-03 17:17:02 +05:30
2026-11-03 17:31:00 +05:30
let closestIdx = 0 ;
let minDiff = Infinity ;
for ( let i = 0 ; i < container . children . length ; i ++ ) {
const child = container . children [ i ] as HTMLElement ;
const childCenter = child . offsetLeft + child . offsetWidth / 2 ;
const diff = Math . abs ( containerCenter - childCenter );
if ( diff < minDiff ) {
minDiff = diff ;
closestIdx = i ;
}
2026-11-03 17:17:02 +05:30
}
2026-11-03 17:31:00 +05:30
setActiveIndex ( closestIdx );
}, 50 );
2026-11-03 17:17:02 +05:30
};
2026-11-03 17:31:00 +05:30
container . addEventListener ( 'scroll' , handleScroll , { passive : true });
2026-11-03 16:44:13 +05:30
return () => {
2026-11-03 17:31:00 +05:30
clearTimeout ( timeoutId );
container . removeEventListener ( 'scroll' , handleScroll );
2026-11-03 16:44:13 +05:30
};
}, []);
2026-11-03 17:31:00 +05:30
// Mouse Drag to Scroll handlers
const onMouseDown = ( e : React.MouseEvent ) => {
// Only drag when clicking background/card frame, not when interacting with inputs/buttons
const target = e . target as HTMLElement ;
if ( target . closest ( 'button' ) || target . closest ( 'a' ) || target . closest ( 'input' )) return ;
if ( ! scrollRef . current ) return ;
setIsDragging ( true );
setDragStartX ( e . pageX - scrollRef . current . offsetLeft );
setDragScrollLeft ( scrollRef . current . scrollLeft );
};
const onMouseMove = ( e : React.MouseEvent ) => {
if ( ! isDragging || ! scrollRef . current ) return ;
e . preventDefault ();
const x = e . pageX - scrollRef . current . offsetLeft ;
const walk = ( x - dragStartX ) * 1.5 ; // Drag speed multiplier
scrollRef . current . scrollLeft = dragScrollLeft - walk ;
};
const onMouseUp = () => {
setIsDragging ( false );
};
2026-11-03 16:44:13 +05:30
return (
< section
id = "flagship-models"
2026-11-03 17:31:00 +05:30
className = "py-20 sm:py-28 lg:py-32 bg-[#FAF8F5] border-t border-slate-900/[0.08] relative overflow-hidden"
2026-11-03 16:44:13 +05:30
>
2026-11-03 17:31:00 +05:30
{ /* Subtle Ambient Background Gradient */ }
< div className = "absolute top-1/4 left-1/3 w-[500px] h-[500px] bg-blue-500/[0.025] 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.02] rounded-full blur-3xl pointer-events-none -z-10" />
2026-11-03 16:44:13 +05:30
2026-11-03 17:31:00 +05:30
{ /* Massive Typographic Watermark (Lightweight CSS) */ }
< div
className = "absolute top-6 left-1/2 -translate-x-1/2 w-max select-none pointer-events-none opacity-[0.03] -z-10"
aria-hidden = "true"
>
< span className = "font-display font-black text-[12vw] uppercase tracking-tighter text-slate-900 block leading-none" >
FLAGSHIP VISION ARCHIVE
</ span >
</ div >
2026-11-03 16:49:56 +05:30
2026-11-03 17:31:00 +05:30
< div className = "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-8 sm:mb-12" >
{ /* Header Row: Title & Editorial Badge */ }
< div className = "flex flex-col md:flex-row md:items-end justify-between gap-6 pb-6 border-b border-slate-200" >
< div >
< div className = "inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-blue-50 border border-blue-200 text-xs font-mono font-semibold text-blue-700 mb-3 shadow-sm" >
2026-11-03 16:44:13 +05:30
< Sparkles className = "w-3.5 h-3.5 text-blue-600" />
2026-11-03 17:31:00 +05:30
< span > FLAGSHIP TRANSFORMATION MODELS </ span >
2026-11-03 16:44:13 +05:30
</ div >
2026-11-03 17:31:00 +05:30
< h2 className = "text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight" >
Interactive < span className = "text-transparent bg-clip-text bg-gradient-to-r from-blue-700 via-indigo-600 to-amber-600" > Model Showcase </ span >
2026-11-03 16:44:13 +05:30
</ h2 >
</ div >
2026-11-03 17:31:00 +05:30
{ /* Navigation Controls: Tabs & Arrow Buttons */ }
< div className = "flex flex-wrap items-center gap-3" >
{ /* Quick Model Tabs */ }
< div className = "inline-flex items-center gap-1 p-1 bg-white rounded-full border border-slate-200 shadow-sm" >
{ showcaseCards . map (( card , idx ) => {
const isActive = activeIndex === idx ;
return (
< button
key = { card . id }
onClick = {() => scrollToCard ( idx )}
className = { `px-3.5 py-1.5 rounded-full text-xs font-mono font-bold transition-all duration-200 ${
isActive
? 'bg-blue-600 text-white shadow-sm shadow-blue-500/20'
: 'text-slate-600 hover:text-slate-950 hover:bg-slate-100'
} ` }
>
< span > 0 { idx + 1 }</ span >
< span className = "hidden sm:inline ml-1 font-sans text-xs" >
{ card . category . split ( ' ' )[ 0 ]}
</ span >
</ button >
);
})}
2026-11-03 17:17:02 +05:30
</ div >
2026-11-03 17:31:00 +05:30
{ /* Prev / Next Arrows */ }
< div className = "flex items-center gap-1.5" >
2026-11-03 17:17:02 +05:30
< button
2026-11-03 17:31:00 +05:30
onClick = { handlePrev }
disabled = { activeIndex === 0 }
aria-label = "Previous Model"
className = "w-9 h-9 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-35 disabled:cursor-not-allowed transition-all active:scale-95"
2026-11-03 17:17:02 +05:30
>
< ChevronLeft className = "w-4 h-4" />
</ button >
< button
2026-11-03 17:31:00 +05:30
onClick = { handleNext }
disabled = { activeIndex === showcaseCards . length - 1 }
aria-label = "Next Model"
className = "w-9 h-9 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-35 disabled:cursor-not-allowed transition-all active:scale-95"
2026-11-03 17:17:02 +05:30
>
< ChevronRight className = "w-4 h-4" />
</ button >
</ div >
2026-11-03 16:44:13 +05:30
</ div >
</ div >
2026-11-03 17:31:00 +05:30
</ div >
2026-11-03 16:44:13 +05:30
2026-11-03 17:31:00 +05:30
{ /* Panoramic Native Scroll Filmstrip (100% GPU-accelerated, Zero Lag, Native Touch & Drag) */ }
< div
ref = { scrollRef }
onMouseDown = { onMouseDown }
onMouseMove = { onMouseMove }
onMouseUp = { onMouseUp }
onMouseLeave = { onMouseUp }
className = "flex gap-6 sm:gap-8 px-4 sm:px-8 lg:px-12 overflow-x-auto scroll-smooth snap-x snap-mandatory no-scrollbar pb-6 cursor-grab active:cursor-grabbing"
style = {{
WebkitOverflowScrolling : 'touch' ,
}}
>
{ showcaseCards . map (( card , idx ) => {
const isActive = activeIndex === idx ;
return (
< div
key = { card . id }
className = { `snap-center shrink-0 w-[90vw] sm:w-[680px] lg:w-[840px] bg-white rounded-3xl p-6 sm:p-9 border transition-all duration-300 ${
isActive
? 'border-blue-500/40 shadow-xl shadow-slate-900/[0.06] scale-[1.01]'
: 'border-slate-900/[0.08] shadow-md opacity-90 hover:opacity-100 hover:border-slate-300'
} ` }
>
{ /* Card Header Metadata Bar */ }
< div className = "flex flex-wrap items-center justify-between gap-3 pb-4 border-b border-slate-100 mb-6" >
< div className = "flex items-center gap-3" >
< span className = "font-mono text-sm font-black text-blue-700 tracking-wider" >
{ card . index }
</ span >
< span className = "h-3.5 w-px bg-slate-300" />
< span className = "font-mono text-xs font-bold text-slate-500 uppercase tracking-widest" >
{ card . category }
</ span >
2026-11-03 16:44:13 +05:30
</ div >
2026-11-03 17:31:00 +05:30
< div className = "flex items-center gap-2" >
< span className = "px-3 py-1 rounded-full bg-blue-50 border border-blue-200 text-blue-700 text-xs font-mono font-semibold" >
{ card . model }
</ span >
< span className = "px-2.5 py-1 rounded-full bg-amber-50 border border-amber-200 text-amber-800 text-[11px] font-mono font-semibold" >
{ card . latency }
</ span >
2026-11-03 16:44:13 +05:30
</ div >
</ div >
2026-11-03 17:31:00 +05:30
{ /* Interactive Comparison Viewport */ }
< div className = "mb-6 rounded-2xl overflow-hidden border border-slate-200 bg-slate-100" >
< Cinematic3DComparison
beforeUrl = { card . beforeUrl }
afterUrl = { card . afterUrl }
beforeLabel = "RAW SOURCE"
afterLabel = { card . model }
aspectRatio = "aspect-[16/10]"
autoSlide = { false }
/>
</ div >
{ /* Card Editorial Content & Specifications */ }
< div className = "space-y-4" >
< div className = "flex flex-col sm:flex-row sm:items-baseline justify-between gap-2" >
< h3 className = "text-2xl sm:text-3xl font-display font-bold text-slate-900 tracking-tight" >
{ card . title }
</ h3 >
< span className = "text-xs font-mono text-blue-600 font-semibold shrink-0" >
{ card . tagline }
</ span >
</ div >
< p className = "text-sm sm:text-base text-slate-600 leading-relaxed font-normal" >
{ card . description }
</ p >
{ /* Specs Chips */ }
< div className = "flex flex-wrap gap-2 pt-1" >
{ card . specs . map (( spec , i ) => (
< span
key = { i }
className = "px-3 py-1 rounded-lg bg-slate-50 text-slate-700 text-xs font-mono font-medium border border-slate-200"
>
✓ { spec }
</ span >
))}
</ div >
{ /* Direct Action Links */ }
< div className = "pt-4 flex flex-wrap items-center justify-between gap-3 border-t border-slate-100" >
< Link
href = { `/tools/ ${ card . toolSlug } ` }
className = "inline-flex items-center gap-2 px-5 py-2.5 rounded-full bg-blue-600 hover:bg-blue-700 text-white text-xs font-bold transition-all shadow-sm shadow-blue-500/20 active:scale-95"
>
< span > Launch Online Studio </ span >
< ArrowRight className = "w-3.5 h-3.5" />
</ Link >
< Link
href = { `/apps/ ${ card . appSlug } ` }
className = "inline-flex items-center gap-1.5 px-4 py-2.5 rounded-full bg-slate-100 hover:bg-slate-200 text-slate-800 text-xs font-bold transition-colors"
>
< Smartphone className = "w-3.5 h-3.5 text-blue-600" />
< span >{ card . appName }</ span >
</ Link >
</ div >
</ div >
</ div >
);
})}
</ div >
{ /* Bottom Progress Bar Indicator */ }
< div className = "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-6" >
< div className = "flex items-center justify-between gap-4" >
< div className = "flex-1 max-w-xs h-1.5 bg-slate-200 rounded-full overflow-hidden" >
< div
className = "h-full bg-gradient-to-r from-blue-600 to-indigo-600 rounded-full transition-all duration-300"
style = {{
width : ` ${ (( activeIndex + 1 ) / showcaseCards . length ) * 100 } %` ,
}}
/>
2026-11-03 16:44:13 +05:30
</ div >
2026-11-03 17:31:00 +05:30
< div className = "flex items-center gap-3 text-xs font-mono text-slate-500" >
< span > MODEL { activeIndex + 1 } OF { showcaseCards . length }</ span >
< span > • </ span >
< span > SWIPE OR DRAG TO EXPLORE </ span >
2026-11-03 16:44:13 +05:30
</ div >
</ div >
</ div >
</ section >
);
}