feat: mandatory horizontal showcase scroll before downward page progression

This commit is contained in:
2026-11-04 11:25:57 +05:30
parent b308f8d759
commit c8cf583633
@@ -1,22 +1,9 @@
'use client'; 'use client';
import React from 'react'; import React, { useRef, useState, useEffect, useCallback } from 'react';
import Link from 'next/link'; import Link from 'next/link';
import { import { ArrowRight, Check, Smartphone, ChevronLeft, ChevronRight } from 'lucide-react';
ArrowRight, import { DeferredComparison } from '@/components/ui/DeferredComparison';
Smartphone,
Sparkles,
CheckCircle2,
Cpu,
Zap,
Eye
} from 'lucide-react';
import { Cinematic3DComparison } from '@/components/ui/Cinematic3DComparison';
import { BorderBeam } from '@/components/animate-ui/BorderBeam';
import { ShimmerBadge } from '@/components/animate-ui/ShimmerBadge';
import { SpotlightCard } from '@/components/animate-ui/SpotlightCard';
import { MotionTextReveal } from '@/components/animate-ui/MotionTextReveal';
import { AnimatedGradientText } from '@/components/animate-ui/AnimatedGradientText';
export interface ShowcaseItem { export interface ShowcaseItem {
id: string; id: string;
@@ -46,390 +33,352 @@ interface CinematicHorizontalProps {
items?: ShowcaseItem[]; items?: ShowcaseItem[];
} }
const DEFAULT_ITEMS: ShowcaseItem[] = [
{
id: 'alpha-matting',
index: '01 / 03',
tabLabel: '01 ALPHA',
category: 'FINE MATTING & CUTOUT',
model: 'P3M-Net Dual-Stream Alpha',
latency: '< 520ms Stream',
title: 'Hair-Strand Matting & Alpha Isolation',
tagline: 'Sub-pixel hair strands, transparent veils, and motion blur cutout.',
description: 'Proprietary dual-stream deep neural network isolates fine flyaway hair, complex textures, and semi-transparent boundaries in studio portraits with pixel-level precision.',
variant: 'comparison',
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',
toolSlug: 'background-remover',
appSlug: 'bg-cleaner-app',
appName: 'Magic Cutout',
specs: ['0.02px edge preservation', 'Alpha PNG lossless stream', 'Studio hair detail'],
},
{
id: 'editorial-portrait-banner',
index: '02 / 03',
tabLabel: '02 BANNER',
category: 'STUDIO PRO BANNER',
model: 'RetouchGAN v2.1 Prime',
latency: '< 380ms Stream',
title: 'Editorial Portrait Engine Pro',
tagline: 'Next-generation sub-pore epidermal synthesis.',
description: 'Transform commercial model photography with authentic skin pore preservation. Retain real freckles, iris glints, and fine texture with zero plastic artificial blur.',
variant: 'banner',
bannerImage: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=1200&auto=format&fit=crop&q=80',
bannerBadge: 'PRO EDITION • LOSSLESS FP16',
toolSlug: 'blemish-remover',
appSlug: 'portrait-app',
appName: 'Portrait Studio AI',
specs: ['Sub-pore texture matrix', 'Authentic epidermal micro-details', 'Lossless 4K color gamut'],
},
{
id: 'super-resolution',
index: '03 / 03',
tabLabel: '03 4K',
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.',
variant: 'comparison',
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',
toolSlug: 'photo-enhancer',
appSlug: 'photo-enhancer-pro',
appName: 'Enhance Ultra AI',
specs: ['Iris & eyelash synthesis', '400% lossless super-resolution', 'Studio-grade crispness'],
},
];
export function CinematicHorizontalScrollSection({ export function CinematicHorizontalScrollSection({
title = 'Interactive Model Showcase', title = 'Interactive Model Showcase',
badge = 'FLAGSHIP TRANSFORMATION MODELS', badge = 'FLAGSHIP TRANSFORMATION MODELS',
subtitle = 'Explore our next-generation neural engines with live benchmark telemetry.', subtitle = 'Browse the flagship tools with native cinematic pan controls.',
items = DEFAULT_ITEMS, items = [],
}: CinematicHorizontalProps) { }: CinematicHorizontalProps) {
const showcaseCards = items && items.length > 0 ? items : DEFAULT_ITEMS; const sectionRef = useRef<HTMLElement>(null);
const railRef = useRef<HTMLDivElement>(null);
const activeIndexRef = useRef(0);
const lastWheelTimeRef = useRef(0);
const [canScrollLeft, setCanScrollLeft] = useState(false);
const [canScrollRight, setCanScrollRight] = useState(true);
// Helper to compute snap-center targets for all cards
const getCardPositions = useCallback(() => {
const rail = railRef.current;
if (!rail) return [];
const cards = Array.from(rail.querySelectorAll('article'));
if (!cards.length) return [];
const halfView = rail.clientWidth / 2;
const maxScroll = Math.max(0, rail.scrollWidth - rail.clientWidth);
return cards.map((c) => {
const center = c.offsetLeft + c.offsetWidth / 2;
return Math.max(0, Math.min(maxScroll, Math.round(center - halfView)));
});
}, []);
// Update bounds and sync active card index on scroll
const checkScrollBounds = useCallback(() => {
const rail = railRef.current;
if (!rail) return;
const maxScroll = rail.scrollWidth - rail.clientWidth;
const current = rail.scrollLeft;
setCanScrollLeft(current > 8);
setCanScrollRight(current < maxScroll - 8);
// Sync active index with nearest card
const positions = getCardPositions();
if (positions.length > 0) {
let closest = 0;
let minDiff = Infinity;
positions.forEach((pos, idx) => {
const diff = Math.abs(pos - current);
if (diff < minDiff) {
minDiff = diff;
closest = idx;
}
});
activeIndexRef.current = closest;
}
}, [getCardPositions]);
// Update on mount, resize, and scroll
useEffect(() => {
const rail = railRef.current;
if (!rail) return;
checkScrollBounds();
const handleScroll = () => {
checkScrollBounds();
};
rail.addEventListener('scroll', handleScroll, { passive: true });
window.addEventListener('resize', checkScrollBounds);
return () => {
rail.removeEventListener('scroll', handleScroll);
window.removeEventListener('resize', checkScrollBounds);
};
}, [checkScrollBounds, items.length]);
// Mandatory Horizontal Scroll Lock:
// Visitor cannot scroll down past this section until the horizontal scroll is completely finished.
useEffect(() => {
const rail = railRef.current;
const section = sectionRef.current;
if (!rail || !section) return;
const WHEEL_COOLDOWN = 450; // Smooth glide cooldown between cards
const handleWheel = (e: WheelEvent) => {
// Allow native 2-finger horizontal trackpad gestures
if (Math.abs(e.deltaX) >= Math.abs(e.deltaY)) {
return;
}
// Ignore micro-jitters
if (Math.abs(e.deltaY) < 8) {
return;
}
const sectionRect = section.getBoundingClientRect();
const railRect = rail.getBoundingClientRect();
const vh = window.innerHeight;
// If the showcase section is completely outside the viewport, do nothing
if (sectionRect.bottom < 0 || sectionRect.top > vh) {
return;
}
const railCenter = railRect.top + railRect.height / 2;
const isDown = e.deltaY > 0;
const isUp = e.deltaY < 0;
const currentIndex = activeIndexRef.current;
const positions = getCardPositions();
if (positions.length <= 1) return;
const lastIndex = positions.length - 1;
// 1. Approaching from above: allow normal page scroll until cards align in the middle of the screen
if (currentIndex === 0 && isDown && railCenter > vh * 0.65) {
return;
}
// 2. Approaching from below: allow normal page scroll up until cards align in the middle of the screen
if (currentIndex === lastIndex && isUp && railCenter < vh * 0.35) {
return;
}
const now = Date.now();
// 3. Mandatory completion release & momentum absorption:
// At last card scrolling down:
if (isDown && currentIndex >= lastIndex) {
// If we just glided to the last card, absorb residual wheel burst so visitor doesn't skip seeing it
if (now - lastWheelTimeRef.current < WHEEL_COOLDOWN + 150) {
e.preventDefault();
return;
}
// Horizontal scroll is complete! Release lock and allow visitor to scroll down the page
return;
}
// At first card scrolling up:
if (isUp && currentIndex <= 0) {
// If we just glided to the first card, absorb residual wheel burst
if (now - lastWheelTimeRef.current < WHEEL_COOLDOWN + 150) {
e.preventDefault();
return;
}
// At first card scrolling up -> release lock and allow visitor to scroll up the page
return;
}
// 4. In all other cases while showcase is aligned in middle and horizontal cards are incomplete:
// LOCK VERTICAL PAGE SCROLL (Visitor CANNOT scroll down past the section until horizontal scroll is finished)
e.preventDefault();
// Absorb rapid wheel bursts during active glide transition
if (now - lastWheelTimeRef.current < WHEEL_COOLDOWN) {
return;
}
lastWheelTimeRef.current = now;
// Glide smoothly to next or previous card
if (isDown && currentIndex < lastIndex) {
const nextIndex = currentIndex + 1;
activeIndexRef.current = nextIndex;
rail.scrollTo({
left: positions[nextIndex],
behavior: 'smooth',
});
} else if (isUp && currentIndex > 0) {
const prevIndex = currentIndex - 1;
activeIndexRef.current = prevIndex;
rail.scrollTo({
left: positions[prevIndex],
behavior: 'smooth',
});
}
};
window.addEventListener('wheel', handleWheel, { passive: false });
return () => {
window.removeEventListener('wheel', handleWheel);
};
}, [getCardPositions]);
// Slide precisely between cards using side arrows
const scrollDirection = (direction: 'left' | 'right') => {
const rail = railRef.current;
if (!rail) return;
const positions = getCardPositions();
if (positions.length <= 1) return;
const current = rail.scrollLeft;
let targetIndex = activeIndexRef.current;
if (direction === 'right') {
const nextIdx = positions.findIndex((pos) => pos > current + 15);
targetIndex = nextIdx !== -1 ? nextIdx : positions.length - 1;
} else {
let prevIdx = -1;
for (let i = positions.length - 1; i >= 0; i--) {
if (positions[i] < current - 15) {
prevIdx = i;
break;
}
}
targetIndex = prevIdx !== -1 ? prevIdx : 0;
}
activeIndexRef.current = targetIndex;
rail.scrollTo({
left: positions[targetIndex],
behavior: 'smooth',
});
};
if (!items.length) return null;
return ( return (
<section <section
id="flagship-models" id="flagship-models"
className="py-20 sm:py-28 lg:py-32 relative bg-[#FAF8F5] border-t border-b border-slate-900/[0.07] overflow-hidden" ref={sectionRef}
className="overflow-hidden border-y border-slate-900/[0.08] bg-[#FAF8F5] py-16 sm:py-20 lg:py-24"
> >
{/* Subtle ambient light gradient */} <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<div className="absolute top-1/4 left-1/2 -translate-x-1/2 w-[900px] h-96 bg-blue-500/[0.025] rounded-full blur-3xl pointer-events-none" /> <div className="mb-8 flex flex-col gap-4 sm:mb-10 sm:flex-row sm:items-end sm:justify-between">
<div className="max-w-2xl">
<div className="w-full max-w-[1640px] 2xl:max-w-[1720px] mx-auto px-4 sm:px-6 lg:px-8 xl:px-10 relative z-10"> <p className="eyebrow">{badge}</p>
{/* Section Header with Motion Graphics Text */} <h2 className="mt-3 text-3xl font-display font-bold tracking-tight text-slate-900 sm:text-4xl lg:text-5xl">{title}</h2>
<div className="text-center max-w-3xl mx-auto mb-14 sm:mb-16"> <p className="mt-3 text-sm leading-relaxed text-slate-600 sm:text-base">{subtitle}</p>
<div className="mb-3">
<ShimmerBadge>
<Sparkles className="w-3.5 h-3.5 text-blue-600" />
<span>{badge}</span>
</ShimmerBadge>
</div> </div>
<p className="hidden text-xs font-medium text-slate-500 sm:block">Scroll cards vertically, swipe, or use side arrows</p>
</div>
</div>
<h2 className="text-3xl sm:text-4xl lg:text-5xl font-display font-black text-slate-900 tracking-tight mb-4"> <div className="relative group/showcase">
<MotionTextReveal text="Interactive" className="text-slate-900 inline" />{' '} {/* Soft edge fades for polished visual boundary */}
<AnimatedGradientText className="font-black"> <div
Model Showcase aria-hidden="true"
</AnimatedGradientText> className={`pointer-events-none absolute left-0 top-0 bottom-0 w-12 sm:w-20 bg-gradient-to-r from-[#FAF8F5] to-transparent z-10 transition-opacity duration-300 ${
</h2> canScrollLeft ? 'opacity-100' : 'opacity-0'
}`}
/>
<div
aria-hidden="true"
className={`pointer-events-none absolute right-0 top-0 bottom-0 w-12 sm:w-20 bg-gradient-to-l from-[#FAF8F5] to-transparent z-10 transition-opacity duration-300 ${
canScrollRight ? 'opacity-100' : 'opacity-0'
}`}
/>
<p className="text-base sm:text-lg text-slate-600 leading-relaxed font-normal"> {/* Left Side Arrow Button (Always visible on the left side) */}
{subtitle} <button
</p> type="button"
onClick={() => scrollDirection('left')}
disabled={!canScrollLeft}
aria-label="Previous flagship model"
className={`absolute left-3 sm:left-6 lg:left-8 top-1/2 -translate-y-1/2 z-30 grid h-12 w-12 sm:h-14 sm:w-14 place-items-center rounded-full border border-slate-900/15 bg-white/95 text-slate-800 shadow-cream-md backdrop-blur-md transition-all duration-300 hover:scale-105 hover:bg-white hover:text-blue-600 hover:border-blue-400 hover:shadow-cream-lg active:scale-95 disabled:opacity-35 disabled:cursor-not-allowed disabled:hover:scale-100 disabled:hover:bg-white/95 disabled:hover:text-slate-400 disabled:hover:border-slate-900/15 disabled:shadow-none focus:outline-none focus:ring-2 focus:ring-blue-600`}
>
<ChevronLeft className="h-6 w-6 stroke-[2.5]" />
</button>
{/* Horizontal Rail */}
<div
ref={railRef}
className="cinematic-rail flex snap-x snap-proximity gap-5 overflow-x-auto px-4 pb-5 sm:px-6 lg:px-[max(2rem,calc((100vw-80rem)/2))]"
>
{items.map((item) => (
<ShowcaseCard key={item.id} item={item} />
))}
</div> </div>
{/* 100% Pure Vertical Stack (Zero Horizontal Scroll, Zero Lag, Ultra Smooth) */} {/* Right Side Arrow Button (Always visible on the right side) */}
<div className="w-full space-y-12 sm:space-y-16"> <button
{showcaseCards.map((card, idx) => { type="button"
const isBannerMode = card.variant === 'banner' || (!card.afterUrl && !!card.bannerImage); onClick={() => scrollDirection('right')}
disabled={!canScrollRight}
return ( aria-label="Next flagship model"
<SpotlightCard className={`absolute right-3 sm:right-6 lg:right-8 top-1/2 -translate-y-1/2 z-30 grid h-12 w-12 sm:h-14 sm:w-14 place-items-center rounded-full border border-slate-900/15 bg-white/95 text-slate-800 shadow-cream-md backdrop-blur-md transition-all duration-300 hover:scale-105 hover:bg-white hover:text-blue-600 hover:border-blue-400 hover:shadow-cream-lg active:scale-95 disabled:opacity-35 disabled:cursor-not-allowed disabled:hover:scale-100 disabled:hover:bg-white/95 disabled:hover:text-slate-400 disabled:hover:border-slate-900/15 disabled:shadow-none focus:outline-none focus:ring-2 focus:ring-blue-600`}
key={card.id} >
className="w-full bg-white rounded-3xl p-6 sm:p-8 lg:p-10 border border-slate-900/[0.08] hover:border-blue-400/80 shadow-sm hover:shadow-2xl hover:-translate-y-1 transition-all duration-300 relative group" <ChevronRight className="h-6 w-6 stroke-[2.5]" />
> </button>
{/* Border Beam subtle light effect on hover */}
<BorderBeam duration={14} size={280} borderWidth={1.5} colorFrom="#3b82f6" colorTo="#a855f7" />
{/* 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>
</div>
<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 flex items-center gap-1.5">
<Cpu className="w-3 h-3 text-blue-600" />
<span>{card.model}</span>
</span>
<span className="px-2.5 py-1 rounded-full bg-emerald-50 border border-emerald-200 text-emerald-800 text-[11px] font-mono font-semibold flex items-center gap-1">
<span className="w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse" />
<span>{card.latency}</span>
</span>
</div>
</div>
{/* Dynamic Multi-Layout Variations Across Cards */}
{idx === 1 ? (
/* VARIATION 2: Inverted Zig-Zag Layout (Visual on Left, Editorial on Right) */
<div className="grid grid-cols-1 lg:grid-cols-12 gap-8 lg:gap-14 items-center">
{/* Left Column: Visual Media */}
<div className="lg:col-span-7 order-last lg:order-first">
{isBannerMode ? (
<div className="relative aspect-[16/10] w-full rounded-2xl sm:rounded-3xl overflow-hidden border border-slate-200 bg-slate-950 shadow-md group/banner">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src={card.bannerImage || card.beforeUrl || 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=1200&auto=format&fit=crop&q=80'}
alt={card.title}
className="w-full h-full object-cover group-hover/banner:scale-105 transition-transform duration-700"
/>
<div className="absolute inset-0 bg-gradient-to-t from-slate-950/85 via-slate-950/20 to-transparent pointer-events-none" />
<div className="absolute top-4 left-4 z-20">
<span className="px-3.5 py-1.5 rounded-full bg-white/95 backdrop-blur-md text-slate-900 text-xs font-mono font-bold border border-white/40 shadow-md">
{card.bannerBadge || 'DYNAMIC STUDIO BANNER'}
</span>
</div>
<div className="absolute bottom-5 left-5 right-5 z-20 flex items-end justify-between">
<div>
<span className="text-[10px] font-mono text-blue-300 font-bold uppercase tracking-wider block mb-1">
Neural Preset Matrix
</span>
<h4 className="text-xl sm:text-2xl font-display font-bold text-white drop-shadow">
{card.title}
</h4>
</div>
<span className="hidden sm:inline-flex items-center gap-1.5 px-3.5 py-1.5 rounded-full bg-blue-600/90 text-white text-xs font-mono font-bold backdrop-blur-md shadow-md">
<Zap className="w-3.5 h-3.5" />
<span>1-Click Deploy</span>
</span>
</div>
</div>
) : (
<div className="rounded-2xl sm:rounded-3xl overflow-hidden border border-slate-200 bg-slate-100 shadow-md">
<Cinematic3DComparison
beforeUrl={card.beforeUrl!}
afterUrl={card.afterUrl!}
beforeLabel="RAW SOURCE"
afterLabel={card.model}
aspectRatio="aspect-[16/10]"
autoSlide={false}
/>
</div>
)}
</div>
{/* Right Column: Editorial Text & CTAs */}
<div className="lg:col-span-5 space-y-5">
<div>
<span className="text-xs font-mono text-purple-600 font-bold uppercase tracking-wider block mb-1">
{card.tagline}
</span>
<h3 className="text-2xl sm:text-3xl lg:text-4xl font-display font-bold text-slate-900 tracking-tight group-hover:text-blue-600 transition-colors">
{card.title}
</h3>
</div>
<p className="text-sm sm:text-base text-slate-600 leading-relaxed font-normal">
{card.description}
</p>
<div className="space-y-2 pt-1">
{card.specs.map((spec, i) => (
<div key={i} className="flex items-center gap-2.5 text-xs sm:text-sm text-slate-700 font-medium">
<CheckCircle2 className="w-4 h-4 text-purple-600 shrink-0" />
<span>{spec}</span>
</div>
))}
</div>
<div className="pt-4 flex flex-wrap items-center gap-3">
<Link
href={`/tools/${card.toolSlug}`}
className="inline-flex items-center gap-2 px-6 py-3 rounded-full bg-purple-600 hover:bg-purple-700 text-white text-xs font-bold transition-all shadow-sm shadow-purple-500/20 active:scale-95 hover:-translate-y-0.5"
>
<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-5 py-3 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-purple-600" />
<span>{card.appName}</span>
</Link>
</div>
</div>
</div>
) : idx === 2 ? (
/* VARIATION 3: Widescreen Bento Spotlight Layout (Header Top, Full-Width Visual Below) */
<div className="space-y-6">
<div className="flex flex-col md:flex-row md:items-end justify-between gap-4">
<div>
<span className="text-xs font-mono text-emerald-600 font-bold uppercase tracking-wider block mb-1">
{card.tagline}
</span>
<h3 className="text-2xl sm:text-3xl lg:text-4xl font-display font-bold text-slate-900 tracking-tight">
{card.title}
</h3>
</div>
<div className="flex flex-wrap items-center gap-3 shrink-0">
<Link
href={`/tools/${card.toolSlug}`}
className="inline-flex items-center gap-2 px-6 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-5 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>
<p className="text-sm sm:text-base text-slate-600 max-w-3xl font-normal">
{card.description}
</p>
{/* Wide 21:9 / 16:9 Widescreen Comparison Viewport */}
<div className="rounded-2xl sm:rounded-3xl overflow-hidden border border-slate-200 bg-slate-100 shadow-md">
<Cinematic3DComparison
beforeUrl={card.beforeUrl!}
afterUrl={card.afterUrl!}
beforeLabel="LOW-RES SOURCE"
afterLabel={card.model}
aspectRatio="aspect-[21/9] min-h-[360px]"
autoSlide={false}
/>
</div>
{/* Horizontal Specs Chips */}
<div className="flex flex-wrap items-center gap-3 pt-1">
{card.specs.map((spec, i) => (
<span
key={i}
className="px-3.5 py-1.5 rounded-xl bg-slate-50 text-slate-700 text-xs font-mono font-medium border border-slate-200 flex items-center gap-2"
>
<CheckCircle2 className="w-3.5 h-3.5 text-emerald-600" />
<span>{spec}</span>
</span>
))}
</div>
</div>
) : (
/* VARIATION 1: Standard Symmetrical Layout (Text Left, Visual Right) */
<div className="grid grid-cols-1 lg:grid-cols-12 gap-8 lg:gap-14 items-center">
{/* Left Column: Editorial Content, Specs & Actions */}
<div className="lg:col-span-5 space-y-5">
<div>
<span className="text-xs font-mono text-blue-600 font-bold uppercase tracking-wider block mb-1">
{card.tagline}
</span>
<h3 className="text-2xl sm:text-3xl lg:text-4xl font-display font-bold text-slate-900 tracking-tight group-hover:text-blue-600 transition-colors">
{card.title}
</h3>
</div>
<p className="text-sm sm:text-base text-slate-600 leading-relaxed font-normal">
{card.description}
</p>
{/* Specs Checklist Chips */}
<div className="space-y-2 pt-1">
{card.specs.map((spec, i) => (
<div key={i} className="flex items-center gap-2.5 text-xs sm:text-sm text-slate-700 font-medium">
<CheckCircle2 className="w-4 h-4 text-blue-600 shrink-0" />
<span>{spec}</span>
</div>
))}
</div>
{/* Action Links */}
<div className="pt-4 flex flex-wrap items-center gap-3">
<Link
href={`/tools/${card.toolSlug}`}
className="inline-flex items-center gap-2 px-6 py-3 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 hover:-translate-y-0.5"
>
<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-5 py-3 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>
{/* Right Column: Dynamic Simple Banner OR Interactive 3D Comparison Slider */}
<div className="lg:col-span-7">
{isBannerMode ? (
<div className="relative aspect-[16/10] w-full rounded-2xl sm:rounded-3xl overflow-hidden border border-slate-200 bg-slate-950 shadow-md group/banner">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src={card.bannerImage || card.beforeUrl || 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=1200&auto=format&fit=crop&q=80'}
alt={card.title}
className="w-full h-full object-cover group-hover/banner:scale-105 transition-transform duration-700"
/>
<div className="absolute inset-0 bg-gradient-to-t from-slate-950/85 via-slate-950/20 to-transparent pointer-events-none" />
<div className="absolute top-4 left-4 z-20">
<span className="px-3.5 py-1.5 rounded-full bg-white/95 backdrop-blur-md text-slate-900 text-xs font-mono font-bold border border-white/40 shadow-md">
{card.bannerBadge || 'DYNAMIC STUDIO BANNER'}
</span>
</div>
<div className="absolute bottom-5 left-5 right-5 z-20 flex items-end justify-between">
<div>
<span className="text-[10px] font-mono text-blue-300 font-bold uppercase tracking-wider block mb-1">
Neural Preset Matrix
</span>
<h4 className="text-xl sm:text-2xl font-display font-bold text-white drop-shadow">
{card.title}
</h4>
</div>
<span className="hidden sm:inline-flex items-center gap-1.5 px-3.5 py-1.5 rounded-full bg-blue-600/90 text-white text-xs font-mono font-bold backdrop-blur-md shadow-md">
<Zap className="w-3.5 h-3.5" />
<span>1-Click Deploy</span>
</span>
</div>
</div>
) : (
<div className="rounded-2xl sm:rounded-3xl overflow-hidden border border-slate-200 bg-slate-100 shadow-md">
<Cinematic3DComparison
beforeUrl={card.beforeUrl!}
afterUrl={card.afterUrl!}
beforeLabel="RAW SOURCE"
afterLabel={card.model}
aspectRatio="aspect-[16/10]"
autoSlide={false}
/>
</div>
)}
</div>
</div>
)}
</SpotlightCard>
);
})}
</div>
</div> </div>
</section> </section>
); );
} }
function ShowcaseCard({ item }: { item: ShowcaseItem }) {
const comparison = item.variant !== 'banner' && item.beforeUrl && item.afterUrl;
return (
<article className="w-[88vw] shrink-0 snap-center overflow-hidden rounded-3xl border border-slate-900/[0.09] bg-white shadow-cream-md sm:w-[680px] lg:w-[780px]">
<div className="grid lg:grid-cols-[1.1fr_.9fr]">
<div className="min-h-[280px] bg-slate-100">
{comparison ? (
<DeferredComparison
beforeUrl={item.beforeUrl!}
afterUrl={item.afterUrl!}
beforeLabel="Original"
afterLabel="CRE result"
aspectRatio="aspect-[4/3] lg:aspect-auto lg:h-full"
/>
) : (
<div className="relative h-full min-h-[280px] overflow-hidden bg-slate-950">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img
src={item.bannerImage || item.beforeUrl || ''}
alt={item.title}
loading="lazy"
decoding="async"
className="h-full w-full object-cover"
/>
<div className="absolute inset-0 bg-gradient-to-t from-slate-950/70 via-transparent to-transparent" />
<span className="absolute left-4 top-4 rounded-full bg-white/92 px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wide text-slate-800 shadow-sm">
{item.bannerBadge || item.model}
</span>
</div>
)}
</div>
<div className="flex flex-col p-6 sm:p-7">
<div className="flex items-center justify-between gap-3">
<span className="text-xs font-bold tracking-[0.16em] text-blue-700">{item.index}</span>
<span className="rounded-full border border-emerald-200 bg-emerald-50 px-2.5 py-1 text-[10px] font-semibold text-emerald-800">
{item.latency}
</span>
</div>
<p className="mt-5 text-xs font-semibold uppercase tracking-[0.12em] text-slate-500">{item.category}</p>
<h3 className="mt-2 text-2xl font-display font-bold leading-tight tracking-tight text-slate-900">{item.title}</h3>
<p className="mt-3 text-sm leading-relaxed text-slate-600">{item.description}</p>
<ul className="mt-5 space-y-2.5 text-sm text-slate-700">
{item.specs.slice(0, 3).map((spec) => (
<li key={spec} className="flex gap-2">
<Check className="mt-0.5 h-4 w-4 shrink-0 text-blue-700" />
{spec}
</li>
))}
</ul>
<div className="mt-7 flex flex-wrap gap-3">
<Link href={`/tools/${item.toolSlug}`} className="button-primary">
Try online <ArrowRight className="h-4 w-4" />
</Link>
<Link href={`/apps/${item.appSlug}`} className="button-secondary">
<Smartphone className="h-4 w-4" /> App
</Link>
</div>
</div>
</div>
</article>
);
}