perf(smoothness): eliminate scroll lag via responsive WebP hero, native 120Hz smooth scroll, intersection observer navbar, and removing 50+ backdrop-filter blur bottlenecks
This commit is contained in:
@@ -268,21 +268,30 @@ export function HeroSection({
|
||||
// -------------------------------------------------------------
|
||||
return (
|
||||
<section className="relative min-h-[92vh] sm:min-h-screen flex items-center overflow-hidden bg-black pt-20 sm:pt-24 pb-14 sm:pb-20">
|
||||
{/* 1. Background Image with Left Dark Gradient Overlay */}
|
||||
<div className="absolute inset-0 z-0">
|
||||
<img
|
||||
src="/management/pages/home/Image_homepage.jpg"
|
||||
alt="CRE AI Photo Magic"
|
||||
className="w-full h-full object-cover object-[75%_center] sm:object-right-top select-none pointer-events-none"
|
||||
loading="eager"
|
||||
decoding="async"
|
||||
/>
|
||||
{/* 1. Background Image with Responsive Ultra-Fast Loading */}
|
||||
<div className="absolute inset-0 z-0 overflow-hidden">
|
||||
<picture>
|
||||
<source media="(max-width: 768px)" srcSet="/management/pages/home/hero_mobile.webp" type="image/webp" />
|
||||
<source media="(max-width: 768px)" srcSet="/management/pages/home/hero_mobile.jpg" type="image/jpeg" />
|
||||
<source srcSet="/management/pages/home/hero_desktop.webp" type="image/webp" />
|
||||
<img
|
||||
src="/management/pages/home/hero_desktop.jpg"
|
||||
alt="CRE AI Photo Magic"
|
||||
className="w-full h-full object-cover object-[75%_center] sm:object-right-top select-none pointer-events-none"
|
||||
loading="eager"
|
||||
fetchPriority="high"
|
||||
decoding="async"
|
||||
/>
|
||||
</picture>
|
||||
{/* Dark Gradient Overlay for Maximum Text Readability */}
|
||||
<div className="absolute inset-0 bg-gradient-to-r from-black/95 via-black/75 to-black/30 sm:via-black/55 sm:to-transparent" />
|
||||
<div className="absolute inset-0 bg-gradient-to-r from-black/95 via-black/75 to-black/30 sm:via-black/55 sm:to-transparent pointer-events-none" />
|
||||
{/* Smooth Bottom Blend to Section Below */}
|
||||
<div className="absolute inset-x-0 bottom-0 h-28 bg-gradient-to-t from-[#FAF8F5] via-[#FAF8F5]/70 to-transparent pointer-events-none" />
|
||||
</div>
|
||||
|
||||
{/* Zero-Overhead Scroll Sentinel for Navbar Transformation */}
|
||||
<div id="hero-sentinel" className="absolute bottom-28 left-0 w-full h-1 pointer-events-none opacity-0" aria-hidden="true" />
|
||||
|
||||
{/* 2. Left-Aligned Content Container */}
|
||||
<div className="relative z-10 max-w-[1640px] w-full mx-auto px-4 sm:px-8 lg:px-14 flex flex-col justify-center min-h-[90vh] sm:min-h-[92vh]">
|
||||
<div className="max-w-2xl sm:max-w-3xl">
|
||||
@@ -318,8 +327,8 @@ export function HeroSection({
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{/* Glass Metrics Pill Capsule */}
|
||||
<div className="mt-12 sm:mt-16 w-full max-w-2xl sm:max-w-3xl rounded-3xl sm:rounded-full bg-white/[0.06] backdrop-blur-xl border border-white/20 p-4 sm:py-4 sm:px-8 grid grid-cols-2 sm:grid-cols-4 gap-4 sm:gap-6 shadow-2xl">
|
||||
{/* Glass Metrics Pill Capsule (0% CPU, Hardware-Accelerated) */}
|
||||
<div className="mt-12 sm:mt-16 w-full max-w-2xl sm:max-w-3xl rounded-3xl sm:rounded-full bg-slate-950/75 border border-white/15 p-4 sm:py-4 sm:px-8 grid grid-cols-2 sm:grid-cols-4 gap-4 sm:gap-6 shadow-2xl">
|
||||
{/* Metric 1 */}
|
||||
<div className="flex flex-col text-left">
|
||||
<span className="text-xl sm:text-2xl font-display font-black tracking-tight text-blue-400">
|
||||
|
||||
@@ -188,7 +188,7 @@ function ShiftableRow({ items }: { items: ToolMediaItem[] }) {
|
||||
{item.mediaType === 'comparison' ? (
|
||||
<div
|
||||
style={{ borderRadius: '28px' }}
|
||||
className="group block relative w-full h-[220px] sm:h-[240px] lg:h-[260px] rounded-[28px] sm:rounded-[36px] overflow-hidden isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)] bg-slate-950 border border-slate-900/[0.08] shadow-cream-sm"
|
||||
className="group block relative w-full h-[220px] sm:h-[240px] lg:h-[260px] rounded-[28px] sm:rounded-[36px] overflow-hidden isolate bg-slate-950 border border-slate-900/[0.08] shadow-cream-sm"
|
||||
>
|
||||
{/* GPU-Composited Shadow Elevation Layer */}
|
||||
<div
|
||||
@@ -203,7 +203,7 @@ function ShiftableRow({ items }: { items: ToolMediaItem[] }) {
|
||||
{/* Dedicated Tool Link Pill on top right so sliding never accidentally navigates */}
|
||||
<Link
|
||||
href={`/tools/${item.slug}`}
|
||||
className="absolute top-3 right-3 z-30 inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-[10px] font-mono font-bold tracking-wider uppercase bg-slate-950/85 backdrop-blur-md text-white border border-white/20 hover:bg-blue-600 transition-colors shadow-sm cursor-pointer"
|
||||
className="absolute top-3 right-3 z-30 inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-[10px] font-mono font-bold tracking-wider uppercase bg-slate-950/90 text-white border border-white/20 hover:bg-blue-600 transition-colors shadow-sm cursor-pointer"
|
||||
aria-label={`Open ${item.title}`}
|
||||
>
|
||||
<span>TRY TOOL</span>
|
||||
@@ -214,7 +214,7 @@ function ShiftableRow({ items }: { items: ToolMediaItem[] }) {
|
||||
<Link
|
||||
href={`/tools/${item.slug}`}
|
||||
style={{ borderRadius: '28px' }}
|
||||
className="group block relative w-full h-[220px] sm:h-[240px] lg:h-[260px] rounded-[28px] sm:rounded-[36px] overflow-hidden isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)] bg-slate-950 border border-slate-900/[0.08] shadow-cream-sm cursor-pointer"
|
||||
className="group block relative w-full h-[220px] sm:h-[240px] lg:h-[260px] rounded-[28px] sm:rounded-[36px] overflow-hidden isolate bg-slate-950 border border-slate-900/[0.08] shadow-cream-sm cursor-pointer"
|
||||
>
|
||||
{/* GPU-Composited Shadow Elevation Layer (Opacity-only transition, zero paint thrash) */}
|
||||
<div
|
||||
@@ -453,7 +453,7 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered:
|
||||
return (
|
||||
<div
|
||||
style={{ borderRadius: '28px' }}
|
||||
className="relative w-full h-full overflow-hidden bg-slate-950 rounded-[28px] sm:rounded-[36px] isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)]"
|
||||
className="relative w-full h-full overflow-hidden bg-slate-950 rounded-[28px] sm:rounded-[36px] isolate"
|
||||
>
|
||||
<video
|
||||
ref={videoRef}
|
||||
@@ -491,7 +491,7 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered:
|
||||
touchAction: 'pan-y',
|
||||
borderRadius: '28px',
|
||||
}}
|
||||
className="relative w-full h-full select-none overflow-hidden bg-slate-950 rounded-[28px] sm:rounded-[36px] isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)] cursor-ew-resize"
|
||||
className="relative w-full h-full select-none overflow-hidden bg-slate-950 rounded-[28px] sm:rounded-[36px] isolate cursor-ew-resize"
|
||||
>
|
||||
{/* Layer 1: AFTER Image (Base layer, fixed scale & position, 0% zoom) */}
|
||||
<img
|
||||
@@ -505,7 +505,7 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered:
|
||||
{/* Layer 2: BEFORE Image (Clipped container-sized layer - 100% exact alignment with slider divider on phone & desktop) */}
|
||||
<div
|
||||
ref={clipLayerRef}
|
||||
className="absolute inset-0 overflow-hidden rounded-[28px] sm:rounded-[36px] isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)] pointer-events-none"
|
||||
className="absolute inset-0 overflow-hidden rounded-[28px] sm:rounded-[36px] isolate pointer-events-none"
|
||||
style={{
|
||||
borderRadius: '28px',
|
||||
clipPath: 'inset(0 50% 0 0 round 28px 0 0 28px)',
|
||||
@@ -552,10 +552,10 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered:
|
||||
<div
|
||||
className="absolute bottom-3 inset-x-3 flex justify-between pointer-events-none z-20 text-[9px] font-mono font-bold uppercase tracking-wider text-white"
|
||||
>
|
||||
<span className="bg-slate-950/80 px-2 py-0.5 rounded backdrop-blur border border-white/10 shadow-xs">
|
||||
<span className="bg-slate-950/85 px-2 py-0.5 rounded border border-white/10 shadow-xs">
|
||||
BEFORE
|
||||
</span>
|
||||
<span className="bg-blue-600/90 px-2 py-0.5 rounded backdrop-blur border border-white/20 shadow-xs">
|
||||
<span className="bg-blue-600 px-2 py-0.5 rounded border border-white/20 shadow-xs">
|
||||
AFTER
|
||||
</span>
|
||||
</div>
|
||||
@@ -567,7 +567,7 @@ function ToolWindowMedia({ item, isHovered }: { item: ToolMediaItem; isHovered:
|
||||
return (
|
||||
<div
|
||||
style={{ borderRadius: '28px' }}
|
||||
className="relative w-full h-full overflow-hidden bg-slate-950 rounded-[28px] sm:rounded-[36px] isolate [mask-image:radial-gradient(white,black)] [-webkit-mask-image:-webkit-radial-gradient(white,black)]"
|
||||
className="relative w-full h-full overflow-hidden bg-slate-950 rounded-[28px] sm:rounded-[36px] isolate"
|
||||
>
|
||||
<img
|
||||
src={item.imageUrl || item.afterUrl || item.beforeUrl || '/brand/og-default.png'}
|
||||
|
||||
@@ -230,7 +230,7 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string })
|
||||
style={{ left: `${splitPos}%`, transform: 'translateX(-50%)' }}
|
||||
>
|
||||
{/* Sleek handle pill */}
|
||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-5 h-5 sm:w-6 sm:h-6 rounded-full bg-white/95 backdrop-blur-sm text-slate-800 shadow-md flex items-center justify-center border border-slate-300">
|
||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-5 h-5 sm:w-6 sm:h-6 rounded-full bg-white text-slate-800 shadow-md flex items-center justify-center border border-slate-300">
|
||||
<div className="flex items-center gap-[2px]">
|
||||
<div className="w-0 h-0 border-y-[2.5px] sm:border-y-[3px] border-y-transparent border-r-[3px] sm:border-r-[4px] border-r-slate-700" />
|
||||
<div className="w-0 h-0 border-y-[2.5px] sm:border-y-[3px] border-y-transparent border-l-[3px] sm:border-l-[4px] border-l-slate-700" />
|
||||
@@ -238,14 +238,14 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Floating badges */}
|
||||
<span className="absolute bottom-2 sm:bottom-2.5 left-2 sm:left-2.5 bg-black/60 backdrop-blur-md text-[8px] sm:text-[9px] font-mono font-bold uppercase tracking-wider text-white px-1.5 sm:px-2 py-0.5 rounded-md border border-white/10 pointer-events-none shadow-sm">
|
||||
{/* Floating badges (Hardware-accelerated, 0% CPU blur overhead) */}
|
||||
<span className="absolute bottom-2 sm:bottom-2.5 left-2 sm:left-2.5 bg-black/80 text-[8px] sm:text-[9px] font-mono font-bold uppercase tracking-wider text-white px-1.5 sm:px-2 py-0.5 rounded-md border border-white/10 pointer-events-none shadow-sm">
|
||||
Before
|
||||
</span>
|
||||
<span className="absolute bottom-2 sm:bottom-2.5 right-2 sm:right-2.5 bg-blue-600/90 backdrop-blur-md text-[8px] sm:text-[9px] font-mono font-bold uppercase tracking-wider text-white px-1.5 sm:px-2 py-0.5 rounded-md border border-white/20 pointer-events-none shadow-sm">
|
||||
<span className="absolute bottom-2 sm:bottom-2.5 right-2 sm:right-2.5 bg-blue-600 text-[8px] sm:text-[9px] font-mono font-bold uppercase tracking-wider text-white px-1.5 sm:px-2 py-0.5 rounded-md border border-white/20 pointer-events-none shadow-sm">
|
||||
CRE AI
|
||||
</span>
|
||||
<span className="hidden sm:inline-block absolute top-2.5 right-2.5 bg-white/90 backdrop-blur-md text-[9.5px] font-mono font-bold text-slate-800 px-2.5 py-0.5 rounded-full border border-slate-200 pointer-events-none shadow-sm opacity-0 group-hover:opacity-100 transition-opacity duration-200">
|
||||
<span className="hidden sm:inline-block absolute top-2.5 right-2.5 bg-white text-[9.5px] font-mono font-bold text-slate-800 px-2.5 py-0.5 rounded-full border border-slate-200 pointer-events-none shadow-sm opacity-0 group-hover:opacity-100 transition-opacity duration-150">
|
||||
Try Tool ↗
|
||||
</span>
|
||||
</div>
|
||||
@@ -361,7 +361,7 @@ export function ToolGridSection({
|
||||
|
||||
{/* Persistent Sticky Search & Category Hub - Never disappears when scrolling */}
|
||||
{(showCategoryFilter || showSearch) && (
|
||||
<div className="sticky top-[52px] sm:top-[58px] z-30 -mx-4 sm:-mx-6 lg:-mx-8 px-4 sm:px-6 lg:px-8 py-2.5 sm:py-3 bg-[#FAF8F5]/95 backdrop-blur-md border-b border-slate-200/80 shadow-xs mb-8 sm:mb-12 transition-all">
|
||||
<div className="sticky top-[52px] sm:top-[58px] z-30 -mx-4 sm:-mx-6 lg:-mx-8 px-4 sm:px-6 lg:px-8 py-2.5 sm:py-3 bg-[#FAF8F5]/98 border-b border-slate-200/90 shadow-2xs mb-8 sm:mb-12 will-change-transform">
|
||||
<div className="max-w-7xl mx-auto flex flex-col md:flex-row items-center justify-between gap-2.5 sm:gap-4">
|
||||
{/* Category Navigation Pills */}
|
||||
{showCategoryFilter && (
|
||||
|
||||
Reference in New Issue
Block a user