feat(ui): remove upside-down rendering clone pipeline and implement ultra-fast pure liquid glass navbar

This commit is contained in:
2026-11-03 16:23:21 +05:30
parent 5f4b03964c
commit 4c5dad6019
2 changed files with 99 additions and 227 deletions
+39 -55
View File
@@ -75,87 +75,70 @@
border: 1px solid rgba(15, 23, 42, 0.06); border: 1px solid rgba(15, 23, 42, 0.06);
} }
/* Authentic True Liquid Glass Capsule with High Refraction & Real Specular Gloss */ /* Authentic True Liquid Glass Capsule with High Refraction & Specular Gloss */
.liquid-glass-nav { .liquid-glass-nav {
position: relative; position: relative;
/* Crystal transparent optical liquid baseline - zero edge fog/smog */ background: linear-gradient(
background: rgba(255, 255, 255, 0.12); 180deg,
backdrop-filter: blur(14px) saturate(210%) contrast(108%) brightness(1.08); rgba(255, 255, 255, 0.72) 0%,
-webkit-backdrop-filter: blur(14px) saturate(210%) contrast(108%) brightness(1.08); rgba(250, 248, 245, 0.58) 50%,
border: 1px solid rgba(255, 255, 255, 0.55); rgba(255, 255, 255, 0.68) 100%
);
backdrop-filter: blur(20px) saturate(190%) contrast(105%) brightness(1.05);
-webkit-backdrop-filter: blur(20px) saturate(190%) contrast(105%) brightness(1.05);
border: 1px solid rgba(255, 255, 255, 0.85);
box-shadow: box-shadow:
/* Razor-sharp 1px top specular ridge */ /* Razor-sharp 1px top specular ridge */
inset 0 1px 0 0 rgba(255, 255, 255, 0.85), inset 0 1px 0 0 rgba(255, 255, 255, 0.95),
/* Crisp 1px bottom reflection */ /* Crisp 1px bottom reflection */
inset 0 -1px 0 0 rgba(255, 255, 255, 0.25), inset 0 -1px 0 0 rgba(255, 255, 255, 0.3),
/* Refractive drop shadows with subtle caustic tint */ /* Soft volumetric ambient shadows */
0 20px 45px -10px rgba(15, 23, 42, 0.12), 0 20px 45px -10px rgba(15, 23, 42, 0.1),
0 8px 16px -4px rgba(15, 23, 42, 0.05); 0 8px 16px -4px rgba(15, 23, 42, 0.04);
overflow: hidden; overflow: hidden;
} }
.liquid-glass-nav.nav-scrolled { .liquid-glass-nav.nav-scrolled {
background: linear-gradient(
180deg,
rgba(255, 255, 255, 0.82) 0%,
rgba(250, 248, 245, 0.72) 50%,
rgba(255, 255, 255, 0.80) 100%
);
box-shadow: box-shadow:
inset 0 1px 0 0 rgba(255, 255, 255, 0.9), inset 0 1px 0 0 rgba(255, 255, 255, 1),
inset 0 -1px 0 0 rgba(255, 255, 255, 0.25), inset 0 -1px 0 0 rgba(255, 255, 255, 0.3),
0 24px 50px -12px rgba(15, 23, 42, 0.14), 0 24px 50px -12px rgba(15, 23, 42, 0.12),
0 10px 20px -5px rgba(15, 23, 42, 0.06); 0 10px 20px -5px rgba(15, 23, 42, 0.05);
} }
/* Ensure inner contents sit crisply above liquid reflection layers */ /* Ensure foreground elements sit crisply */
.liquid-glass-nav > * { .liquid-glass-nav > * {
position: relative; position: relative;
z-index: 10; z-index: 10;
} }
/* Prismatic Chromatic Caustic Highlight Line */ /* Abbe Chromatic Dispersion Highlight Line (Physical Prismatic Spectral Edge) */
.liquid-glass-nav::after { .liquid-glass-nav::after {
content: ""; content: "";
position: absolute; position: absolute;
top: 0; top: 0;
left: 8%; left: 6%;
right: 8%; right: 6%;
height: 1px; height: 1px;
background: linear-gradient( background: linear-gradient(
90deg, 90deg,
transparent 0%, transparent 0%,
rgba(56, 189, 248, 0.6) 20%, rgba(56, 189, 248, 0.55) 20%,
rgba(255, 255, 255, 0.95) 50%, rgba(255, 255, 255, 0.95) 50%,
rgba(168, 85, 247, 0.5) 80%, rgba(168, 85, 247, 0.5) 80%,
transparent 100% transparent 100%
); );
pointer-events: none; pointer-events: none;
z-index: 3; z-index: 5;
} }
/* Inverted Optical Liquid Glass Refraction Chamber with Dynamic Fluid Wobble */ /* Cylindrical Lens Caustic Bands & Longitudinal Focal Concentration Overlay */
.liquid-refraction-chamber {
position: absolute;
inset: 0;
border-radius: inherit;
overflow: hidden;
pointer-events: none;
z-index: 1;
/* Exact 1:1 speed matching inversion with 3D perspective */
transform: perspective(380px) rotateX(6deg) scaleY(-1);
transform-origin: center center;
opacity: 0.78;
mix-blend-mode: normal;
filter: url("#liquid-glass-vertical-refraction") blur(0.2px) contrast(124%) saturate(210%) brightness(1.05);
contain: strict;
will-change: transform;
}
.liquid-refraction-mirror {
position: absolute;
top: 0;
left: 0;
width: 100vw;
pointer-events: none;
will-change: transform;
}
/* Prismatic Liquid Caustic Refraction Overlay - Vertical Cylindrical Lens Bands */
.liquid-caustic-refraction { .liquid-caustic-refraction {
position: absolute; position: absolute;
inset: 0; inset: 0;
@@ -163,14 +146,15 @@
background: background:
linear-gradient( linear-gradient(
180deg, 180deg,
rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0.3) 0%,
transparent 22%, rgba(255, 255, 255, 0.08) 16%,
transparent 28%,
rgba(255, 255, 255, 0.03) 50%, rgba(255, 255, 255, 0.03) 50%,
transparent 78%, transparent 72%,
rgba(255, 255, 255, 0.15) 100% rgba(255, 255, 255, 0.08) 84%,
rgba(255, 255, 255, 0.2) 100%
), ),
radial-gradient(ellipse 70% 45% at 30% 35%, rgba(56, 189, 248, 0.15) 0%, transparent 60%), radial-gradient(ellipse 70% 50% at 50% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 75%);
radial-gradient(ellipse 70% 45% at 70% 65%, rgba(168, 85, 247, 0.13) 0%, transparent 60%);
mix-blend-mode: overlay; mix-blend-mode: overlay;
z-index: 2; z-index: 2;
} }
+59 -171
View File
@@ -18,8 +18,6 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
const [mousePos, setMousePos] = useState({ x: 50, y: 50, active: false }); const [mousePos, setMousePos] = useState({ x: 50, y: 50, active: false });
const pathname = usePathname(); const pathname = usePathname();
const navRef = useRef<HTMLDivElement>(null); const navRef = useRef<HTMLDivElement>(null);
const mirrorRef = useRef<HTMLDivElement>(null);
const chamberRef = useRef<HTMLDivElement>(null);
useEffect(() => { useEffect(() => {
const handleScroll = () => { const handleScroll = () => {
@@ -29,106 +27,6 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
return () => window.removeEventListener('scroll', handleScroll); return () => window.removeEventListener('scroll', handleScroll);
}, []); }, []);
// Hardware-Accelerated Liquid Glass Spring Physics Wobble & Reflection Pipeline (120 FPS on all devices)
useEffect(() => {
let rafId: number;
let lastY = window.scrollY || 0;
let wobbleSkew = 0;
let wobbleVel = 0;
let navTop = 20;
let navLeft = 0;
// Cache navbar rect outside of scroll handler to avoid synchronous layout reflows
const measureNav = () => {
if (navRef.current) {
const rect = navRef.current.getBoundingClientRect();
navTop = rect.top;
navLeft = rect.left;
}
};
measureNav();
const updateMirror = () => {
if (!mirrorRef.current) return;
// Direct instantaneous hardware scroll position
const scrollY = window.scrollY || window.pageYOffset || document.documentElement.scrollTop;
const delta = scrollY - lastY;
lastY = scrollY;
// Spring-damper liquid oscillator physics (organic jelly wobble that intensifies smoothly with scroll)
const impulse = Math.min(Math.max(delta * 0.08, -2.5), 2.5);
const force = -0.25 * wobbleSkew - 0.35 * wobbleVel + impulse;
wobbleVel += force;
wobbleSkew = Math.min(Math.max(wobbleSkew + wobbleVel, -6), 6);
// 100% exact 1:1 speed matching parity with hardware GPU translate3d (0ms latency)
mirrorRef.current.style.left = `-${navLeft}px`;
mirrorRef.current.style.transform = `translate3d(0, -${scrollY + navTop}px, 0)`;
// Dynamic liquid squash & stretch and fluid S-skew (100% GPU compositor matrix)
const bounce = 1 + Math.min(Math.abs(wobbleSkew) * 0.015, 0.09);
if (chamberRef.current) {
chamberRef.current.style.transform = `perspective(380px) rotateX(6deg) scaleY(-${bounce.toFixed(3)}) skewX(${wobbleSkew.toFixed(2)}deg)`;
}
// Smooth oscillation settling loop
if (Math.abs(wobbleVel) > 0.02 || Math.abs(wobbleSkew) > 0.05) {
cancelAnimationFrame(rafId);
rafId = requestAnimationFrame(updateMirror);
}
};
// Populate inverted reflection mirror with a lightweight visual clone of <main>
const setupMirror = () => {
const mainEl = document.querySelector('main');
if (mainEl && mirrorRef.current) {
mirrorRef.current.innerHTML = '';
const clone = mainEl.cloneNode(true) as HTMLElement;
// Strip heavy non-visual, interactive, SVG, and duplicated elements
clone.querySelectorAll('[id]').forEach((el) => el.removeAttribute('id'));
clone.querySelectorAll('canvas, script, noscript, iframe, video, audio, svg').forEach((el) => el.remove());
clone.querySelectorAll('a, button, input, select, textarea').forEach((el) => {
el.setAttribute('tabindex', '-1');
(el as HTMLElement).style.pointerEvents = 'none';
});
mirrorRef.current.appendChild(clone);
measureNav();
updateMirror();
}
};
// Allow DOM to settle on mount or route transition
const timer = setTimeout(setupMirror, 60);
const onScroll = () => {
cancelAnimationFrame(rafId);
rafId = requestAnimationFrame(updateMirror);
};
const lenis = (window as any).lenis;
if (lenis && typeof lenis.on === 'function') {
lenis.on('scroll', onScroll);
}
window.addEventListener('scroll', onScroll, { passive: true });
window.addEventListener('touchmove', onScroll, { passive: true });
window.addEventListener('resize', () => {
measureNav();
onScroll();
}, { passive: true });
return () => {
clearTimeout(timer);
if (lenis && typeof lenis.off === 'function') {
lenis.off('scroll', onScroll);
}
window.removeEventListener('scroll', onScroll);
window.removeEventListener('touchmove', onScroll);
window.removeEventListener('resize', onScroll);
cancelAnimationFrame(rafId);
};
}, [pathname]);
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => { const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
const rect = e.currentTarget.getBoundingClientRect(); const rect = e.currentTarget.getBoundingClientRect();
const x = ((e.clientX - rect.left) / rect.width) * 100; const x = ((e.clientX - rect.left) / rect.width) * 100;
@@ -142,18 +40,6 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
return ( return (
<header className="fixed top-3 sm:top-5 left-0 right-0 z-50 px-3 sm:px-6 lg:px-8 pointer-events-none transition-all duration-300"> <header className="fixed top-3 sm:top-5 left-0 right-0 z-50 px-3 sm:px-6 lg:px-8 pointer-events-none transition-all duration-300">
{/* Static Hardware-Compiled Organic Liquid Wave Refraction (Zero Re-rasterization Latency) */}
<svg className="absolute w-0 h-0 pointer-events-none overflow-hidden" aria-hidden="true" focusable="false">
<defs>
<filter id="liquid-glass-vertical-refraction" x="-5%" y="-10%" width="110%" height="120%" colorInterpolationFilters="sRGB">
{/* Broad organic fluid liquid wave turbulence */}
<feTurbulence type="turbulence" baseFrequency="0.015 0.038" numOctaves="1" result="wobbleNoise" />
{/* Deep organic liquid displacement */}
<feDisplacementMap in="SourceGraphic" in2="wobbleNoise" scale="22" xChannelSelector="R" yChannelSelector="G" result="displaced" />
</filter>
</defs>
</svg>
<div <div
ref={navRef} ref={navRef}
onMouseMove={handleMouseMove} onMouseMove={handleMouseMove}
@@ -162,74 +48,76 @@ export function Navbar({ config, currentLocale }: NavbarProps) {
isScrolled ? 'nav-scrolled' : '' isScrolled ? 'nav-scrolled' : ''
}`} }`}
> >
{/* Optical Inverted Liquid Glass Refraction Chamber */} {/* Optical Glass Caustic Reflection Sheen */}
<div ref={chamberRef} className="liquid-refraction-chamber" aria-hidden="true"> <div className="liquid-caustic-refraction" aria-hidden="true" />
<div ref={mirrorRef} className="liquid-refraction-mirror" />
<div className="liquid-caustic-refraction" />
</div>
{/* Dynamic Specular Caustic Glint - Crystal clear at rest, subtle gloss on cursor interaction */} {/* Dynamic Specular Caustic Glint - Subtle gloss on cursor interaction */}
<div <div
className="absolute inset-0 pointer-events-none transition-opacity duration-300 z-[2]" className="absolute inset-0 pointer-events-none transition-opacity duration-300 z-[2]"
style={{ style={{
opacity: mousePos.active ? 0.7 : 0, opacity: mousePos.active ? 0.6 : 0,
background: `radial-gradient(ellipse 260px 80px at ${mousePos.x}% ${mousePos.y}%, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.1) 40%, transparent 70%)`, background: `radial-gradient(ellipse 260px 80px at ${mousePos.x}% ${mousePos.y}%, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.08) 40%, transparent 70%)`,
}} }}
/> />
{/* Brand Logo */} {/* Foreground Content: 100% Crisp, High-Contrast, Rock-Solid Static (Zero Wobble) */}
<BrandLogo size="md" /> <div className="relative z-20 flex items-center justify-between w-full">
{/* Brand Logo */}
<div className="relative z-20">
<BrandLogo size="md" />
</div>
{/* Center Navigation Links - Floating Glass Track */} {/* Center Navigation Links - Protected Optical Floating Pill */}
<nav className="hidden md:flex items-center gap-1 px-1.5 py-1 rounded-full bg-white/40 backdrop-blur-sm border border-white/80 shadow-inner"> <nav className="hidden md:flex items-center gap-1 px-2 py-1 rounded-full bg-white/85 backdrop-blur-md border border-white/90 shadow-sm relative z-20">
{config.nav.header.map((item) => { {config.nav.header.map((item) => {
const active = pathname === item.href; const active = pathname === item.href;
return ( return (
<Link <Link
key={item.href} key={item.href}
href={item.href} href={item.href}
className={`relative px-4 py-2 rounded-full text-xs font-semibold tracking-wide transition-all duration-200 ${ className={`relative px-4 py-2 rounded-full text-xs font-bold tracking-wide transition-all duration-200 ${
active active
? 'text-blue-700 bg-white shadow-sm border border-slate-900/[0.06]' ? 'text-blue-700 bg-white shadow-sm border border-slate-900/[0.06]'
: 'text-slate-700 hover:text-slate-950 hover:bg-white/60' : 'text-slate-800 hover:text-slate-950 hover:bg-white/70'
}`} }`}
> >
{resolveLocalised(item.label, currentLocale)} {resolveLocalised(item.label, currentLocale)}
</Link> </Link>
); );
})} })}
{/* Direct Anchor to Studio Suite */} {/* Direct Anchor to Studio Suite */}
<Link <Link
href="/#studio-suite" href="/#studio-suite"
className="flex items-center gap-1.5 px-4 py-2 rounded-full text-xs font-semibold tracking-wide text-blue-700 hover:text-blue-900 hover:bg-blue-50/80 transition-colors" className="flex items-center gap-1.5 px-4 py-2 rounded-full text-xs font-bold tracking-wide text-blue-700 hover:text-blue-900 hover:bg-blue-50/90 transition-colors"
> >
<Layers className="w-3.5 h-3.5 text-blue-600" /> <Layers className="w-3.5 h-3.5 text-blue-600" />
<span>Creative Suite</span> <span>Creative Suite</span>
</Link> </Link>
</nav> </nav>
{/* Right CTA Button */} {/* Right CTA Button */}
<div className="hidden md:flex items-center space-x-3"> <div className="hidden md:flex items-center space-x-3 relative z-20">
<Link <Link
href={config.nav.cta.href} href={config.nav.cta.href}
className="group relative inline-flex items-center gap-1.5 lg:gap-2 px-3.5 py-2 lg:px-5 lg:py-2.5 rounded-full text-xs font-bold text-white bg-gradient-to-r from-blue-600 via-indigo-600 to-blue-600 hover:from-blue-700 hover:to-indigo-700 shadow-md shadow-blue-500/25 hover:shadow-lg hover:shadow-blue-500/35 transition-all duration-300 hover:scale-105 active:scale-95" className="group relative inline-flex items-center gap-1.5 lg:gap-2 px-3.5 py-2 lg:px-5 lg:py-2.5 rounded-full text-xs font-bold text-white bg-gradient-to-r from-blue-600 via-indigo-600 to-blue-600 hover:from-blue-700 hover:to-indigo-700 shadow-md shadow-blue-500/25 hover:shadow-lg hover:shadow-blue-500/35 transition-all duration-300 hover:scale-105 active:scale-95"
> >
<Smartphone className="w-3.5 h-3.5 lg:w-4 lg:h-4 text-white group-hover:rotate-6 transition-transform" /> <Smartphone className="w-3.5 h-3.5 lg:w-4 lg:h-4 text-white group-hover:rotate-6 transition-transform" />
<span>{resolveLocalised(config.nav.cta.label, currentLocale)}</span> <span>{resolveLocalised(config.nav.cta.label, currentLocale)}</span>
<ArrowUpRight className="w-3.5 h-3.5 opacity-80 group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform" /> <ArrowUpRight className="w-3.5 h-3.5 opacity-80 group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform" />
</Link> </Link>
</div> </div>
{/* Mobile Menu Trigger */} {/* Mobile Menu Trigger */}
<div className="flex md:hidden items-center space-x-2"> <div className="flex md:hidden items-center space-x-2 relative z-20">
<button <button
onClick={() => setMobileMenuOpen(!mobileMenuOpen)} onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
className="p-2 rounded-xl text-slate-800 bg-white/70 hover:bg-white border border-white/80 shadow-sm transition-colors" className="p-2 rounded-xl text-slate-800 bg-white/80 hover:bg-white border border-white/90 shadow-sm transition-colors"
aria-label="Open menu" aria-label="Open menu"
> >
{mobileMenuOpen ? <X className="w-5 h-5 text-blue-600" /> : <Menu className="w-5 h-5" />} {mobileMenuOpen ? <X className="w-5 h-5 text-blue-600" /> : <Menu className="w-5 h-5" />}
</button> </button>
</div>
</div> </div>
</div> </div>