2026-11-03 12:24:43 +05:30
|
|
|
'use client';
|
|
|
|
|
|
2026-11-03 15:29:36 +05:30
|
|
|
import React, { useState, useEffect, useRef } from 'react';
|
2026-11-03 12:24:43 +05:30
|
|
|
import Link from 'next/link';
|
|
|
|
|
import { usePathname } from 'next/navigation';
|
2026-11-03 14:30:31 +05:30
|
|
|
import { Menu, X, Smartphone, Layers, ArrowUpRight } from 'lucide-react';
|
2026-11-03 12:24:43 +05:30
|
|
|
import { SiteConfig, resolveLocalised } from '@/types';
|
2026-11-03 12:54:41 +05:30
|
|
|
import { BrandLogo } from './BrandLogo';
|
2026-11-03 12:24:43 +05:30
|
|
|
|
|
|
|
|
interface NavbarProps {
|
|
|
|
|
config: SiteConfig;
|
|
|
|
|
currentLocale: string;
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-03 12:31:06 +05:30
|
|
|
export function Navbar({ config, currentLocale }: NavbarProps) {
|
2026-11-03 12:24:43 +05:30
|
|
|
const [isScrolled, setIsScrolled] = useState(false);
|
|
|
|
|
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
2026-11-03 15:07:58 +05:30
|
|
|
const [mousePos, setMousePos] = useState({ x: 50, y: 50, active: false });
|
2026-11-03 12:24:43 +05:30
|
|
|
const pathname = usePathname();
|
2026-11-03 15:29:36 +05:30
|
|
|
const navRef = useRef<HTMLDivElement>(null);
|
|
|
|
|
const mirrorRef = useRef<HTMLDivElement>(null);
|
2026-11-03 12:24:43 +05:30
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const handleScroll = () => {
|
2026-11-03 12:54:41 +05:30
|
|
|
setIsScrolled(window.scrollY > 20);
|
2026-11-03 12:24:43 +05:30
|
|
|
};
|
2026-11-03 12:31:06 +05:30
|
|
|
window.addEventListener('scroll', handleScroll, { passive: true });
|
2026-11-03 12:24:43 +05:30
|
|
|
return () => window.removeEventListener('scroll', handleScroll);
|
|
|
|
|
}, []);
|
|
|
|
|
|
2026-11-03 15:46:35 +05:30
|
|
|
// Optical Inverted Liquid Glass Refraction Pipeline (120 FPS on all devices)
|
2026-11-03 15:29:36 +05:30
|
|
|
useEffect(() => {
|
|
|
|
|
let rafId: number;
|
|
|
|
|
|
2026-11-03 15:46:35 +05:30
|
|
|
const updateMirror = () => {
|
|
|
|
|
if (!mirrorRef.current || !navRef.current) return;
|
|
|
|
|
const navRect = navRef.current.getBoundingClientRect();
|
2026-11-03 15:29:36 +05:30
|
|
|
const lenis = (window as any).lenis;
|
|
|
|
|
const scrollY = lenis && typeof lenis.scroll === 'number' ? lenis.scroll : window.scrollY;
|
2026-11-03 15:46:35 +05:30
|
|
|
|
|
|
|
|
mirrorRef.current.style.left = `-${navRect.left}px`;
|
|
|
|
|
mirrorRef.current.style.transform = `translate3d(0, -${scrollY + navRect.top}px, 0)`;
|
2026-11-03 15:29:36 +05:30
|
|
|
};
|
|
|
|
|
|
2026-11-03 15:46:35 +05:30
|
|
|
// 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, and duplicated elements
|
|
|
|
|
clone.querySelectorAll('[id]').forEach((el) => el.removeAttribute('id'));
|
|
|
|
|
clone.querySelectorAll('canvas, script, noscript, iframe, video, audio').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);
|
|
|
|
|
updateMirror();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Allow DOM to settle on mount or route transition
|
|
|
|
|
const timer = setTimeout(setupMirror, 60);
|
|
|
|
|
|
2026-11-03 15:29:36 +05:30
|
|
|
const onScroll = () => {
|
|
|
|
|
cancelAnimationFrame(rafId);
|
2026-11-03 15:46:35 +05:30
|
|
|
rafId = requestAnimationFrame(updateMirror);
|
2026-11-03 15:29:36 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const lenis = (window as any).lenis;
|
|
|
|
|
if (lenis && typeof lenis.on === 'function') {
|
2026-11-03 15:46:35 +05:30
|
|
|
lenis.on('scroll', updateMirror);
|
2026-11-03 15:29:36 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.addEventListener('scroll', onScroll, { passive: true });
|
|
|
|
|
window.addEventListener('resize', onScroll, { passive: true });
|
|
|
|
|
|
|
|
|
|
return () => {
|
2026-11-03 15:46:35 +05:30
|
|
|
clearTimeout(timer);
|
2026-11-03 15:29:36 +05:30
|
|
|
if (lenis && typeof lenis.off === 'function') {
|
2026-11-03 15:46:35 +05:30
|
|
|
lenis.off('scroll', updateMirror);
|
2026-11-03 15:29:36 +05:30
|
|
|
}
|
|
|
|
|
window.removeEventListener('scroll', onScroll);
|
|
|
|
|
window.removeEventListener('resize', onScroll);
|
|
|
|
|
cancelAnimationFrame(rafId);
|
|
|
|
|
};
|
2026-11-03 15:46:35 +05:30
|
|
|
}, [pathname]);
|
2026-11-03 15:29:36 +05:30
|
|
|
|
2026-11-03 15:07:58 +05:30
|
|
|
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
|
|
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
|
|
|
const x = ((e.clientX - rect.left) / rect.width) * 100;
|
|
|
|
|
const y = ((e.clientY - rect.top) / rect.height) * 100;
|
|
|
|
|
setMousePos({ x, y, active: true });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleMouseLeave = () => {
|
|
|
|
|
setMousePos((prev) => ({ ...prev, active: false }));
|
|
|
|
|
};
|
|
|
|
|
|
2026-11-03 12:24:43 +05:30
|
|
|
return (
|
2026-11-03 14:30:31 +05:30
|
|
|
<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">
|
2026-11-03 15:51:34 +05:30
|
|
|
{/* 1D Pure Vertical Optical Liquid Glass Refraction Filter (Single Dimension Y-axis for 120 FPS Speed) */}
|
|
|
|
|
<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="0%" y="-10%" width="100%" height="120%" colorInterpolationFilters="sRGB">
|
|
|
|
|
{/* Pure vertical fluid turbulence: X frequency = 0, Y frequency = 0.032 */}
|
|
|
|
|
<feTurbulence type="turbulence" baseFrequency="0 0.032" numOctaves="1" result="vertWave" />
|
|
|
|
|
{/* Subtle vertical optical refraction displacement along Y-axis */}
|
|
|
|
|
<feDisplacementMap in="SourceGraphic" in2="vertWave" scale="7" xChannelSelector="R" yChannelSelector="R" result="displaced" />
|
|
|
|
|
</filter>
|
|
|
|
|
</defs>
|
|
|
|
|
</svg>
|
|
|
|
|
|
2026-11-03 14:30:31 +05:30
|
|
|
<div
|
2026-11-03 15:29:36 +05:30
|
|
|
ref={navRef}
|
2026-11-03 15:07:58 +05:30
|
|
|
onMouseMove={handleMouseMove}
|
|
|
|
|
onMouseLeave={handleMouseLeave}
|
|
|
|
|
className={`relative max-w-6xl mx-auto liquid-glass-nav rounded-2xl sm:rounded-[22px] px-3.5 sm:px-6 py-2.5 sm:py-3 flex items-center justify-between transition-all duration-300 pointer-events-auto ${
|
2026-11-03 15:36:22 +05:30
|
|
|
isScrolled ? 'nav-scrolled' : ''
|
2026-11-03 14:30:31 +05:30
|
|
|
}`}
|
|
|
|
|
>
|
2026-11-03 15:29:36 +05:30
|
|
|
{/* Optical Inverted Liquid Glass Refraction Chamber */}
|
|
|
|
|
<div className="liquid-refraction-chamber" aria-hidden="true">
|
2026-11-03 15:46:35 +05:30
|
|
|
<div ref={mirrorRef} className="liquid-refraction-mirror" />
|
|
|
|
|
<div className="liquid-caustic-refraction" />
|
2026-11-03 15:29:36 +05:30
|
|
|
</div>
|
|
|
|
|
|
2026-11-03 15:36:22 +05:30
|
|
|
{/* Dynamic Specular Caustic Glint - Crystal clear at rest, subtle gloss on cursor interaction */}
|
2026-11-03 15:07:58 +05:30
|
|
|
<div
|
|
|
|
|
className="absolute inset-0 pointer-events-none transition-opacity duration-300 z-[2]"
|
|
|
|
|
style={{
|
2026-11-03 15:36:22 +05:30
|
|
|
opacity: mousePos.active ? 0.7 : 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%)`,
|
2026-11-03 15:07:58 +05:30
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
2026-11-03 14:30:31 +05:30
|
|
|
{/* Brand Logo */}
|
2026-11-03 12:54:41 +05:30
|
|
|
<BrandLogo size="md" />
|
2026-11-03 12:24:43 +05:30
|
|
|
|
2026-11-03 14:30:31 +05:30
|
|
|
{/* Center Navigation Links - Floating Glass Track */}
|
2026-11-03 15:07:58 +05:30
|
|
|
<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">
|
2026-11-03 12:24:43 +05:30
|
|
|
{config.nav.header.map((item) => {
|
|
|
|
|
const active = pathname === item.href;
|
|
|
|
|
return (
|
|
|
|
|
<Link
|
|
|
|
|
key={item.href}
|
|
|
|
|
href={item.href}
|
2026-11-03 12:54:41 +05:30
|
|
|
className={`relative px-4 py-2 rounded-full text-xs font-semibold tracking-wide transition-all duration-200 ${
|
2026-11-03 12:24:43 +05:30
|
|
|
active
|
2026-11-03 14:30:31 +05:30
|
|
|
? 'text-blue-700 bg-white shadow-sm border border-slate-900/[0.06]'
|
|
|
|
|
: 'text-slate-700 hover:text-slate-950 hover:bg-white/60'
|
2026-11-03 12:24:43 +05:30
|
|
|
}`}
|
|
|
|
|
>
|
|
|
|
|
{resolveLocalised(item.label, currentLocale)}
|
|
|
|
|
</Link>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2026-11-03 14:30:31 +05:30
|
|
|
|
2026-11-03 13:16:16 +05:30
|
|
|
{/* Direct Anchor to Studio Suite */}
|
2026-11-03 12:54:41 +05:30
|
|
|
<Link
|
2026-11-03 13:16:16 +05:30
|
|
|
href="/#studio-suite"
|
2026-11-03 14:30:31 +05:30
|
|
|
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"
|
2026-11-03 12:54:41 +05:30
|
|
|
>
|
2026-11-03 13:16:16 +05:30
|
|
|
<Layers className="w-3.5 h-3.5 text-blue-600" />
|
|
|
|
|
<span>Creative Suite</span>
|
2026-11-03 12:54:41 +05:30
|
|
|
</Link>
|
2026-11-03 12:24:43 +05:30
|
|
|
</nav>
|
|
|
|
|
|
2026-11-03 14:30:31 +05:30
|
|
|
{/* Right CTA Button */}
|
2026-11-03 14:56:58 +05:30
|
|
|
<div className="hidden md:flex items-center space-x-3">
|
2026-11-03 12:24:43 +05:30
|
|
|
<Link
|
|
|
|
|
href={config.nav.cta.href}
|
2026-11-03 14:56:58 +05:30
|
|
|
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"
|
2026-11-03 12:24:43 +05:30
|
|
|
>
|
2026-11-03 14:56:58 +05:30
|
|
|
<Smartphone className="w-3.5 h-3.5 lg:w-4 lg:h-4 text-white group-hover:rotate-6 transition-transform" />
|
2026-11-03 12:24:43 +05:30
|
|
|
<span>{resolveLocalised(config.nav.cta.label, currentLocale)}</span>
|
2026-11-03 14:30:31 +05:30
|
|
|
<ArrowUpRight className="w-3.5 h-3.5 opacity-80 group-hover:translate-x-0.5 group-hover:-translate-y-0.5 transition-transform" />
|
2026-11-03 12:24:43 +05:30
|
|
|
</Link>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-11-03 14:30:31 +05:30
|
|
|
{/* Mobile Menu Trigger */}
|
2026-11-03 12:24:43 +05:30
|
|
|
<div className="flex md:hidden items-center space-x-2">
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
|
2026-11-03 14:30:31 +05:30
|
|
|
className="p-2 rounded-xl text-slate-800 bg-white/70 hover:bg-white border border-white/80 shadow-sm transition-colors"
|
2026-11-03 12:24:43 +05:30
|
|
|
aria-label="Open menu"
|
|
|
|
|
>
|
2026-11-03 13:16:16 +05:30
|
|
|
{mobileMenuOpen ? <X className="w-5 h-5 text-blue-600" /> : <Menu className="w-5 h-5" />}
|
2026-11-03 12:24:43 +05:30
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-11-03 14:30:31 +05:30
|
|
|
{/* Mobile Drawer (Matching Liquid Glass Card) */}
|
2026-11-03 12:24:43 +05:30
|
|
|
{mobileMenuOpen && (
|
2026-11-03 14:30:31 +05:30
|
|
|
<div className="max-w-6xl mx-auto md:hidden mt-2 rounded-2xl liquid-glass-dropdown p-5 space-y-3 pointer-events-auto shadow-2xl animate-in slide-in-from-top-3 duration-200">
|
2026-11-03 12:54:41 +05:30
|
|
|
<div className="space-y-1">
|
|
|
|
|
{config.nav.header.map((item) => {
|
|
|
|
|
const active = pathname === item.href;
|
|
|
|
|
return (
|
|
|
|
|
<Link
|
|
|
|
|
key={item.href}
|
|
|
|
|
href={item.href}
|
|
|
|
|
onClick={() => setMobileMenuOpen(false)}
|
|
|
|
|
className={`flex items-center justify-between px-4 py-3 rounded-xl text-sm font-semibold transition-colors ${
|
|
|
|
|
active
|
2026-11-03 14:30:31 +05:30
|
|
|
? 'text-blue-700 bg-white shadow-sm border border-slate-900/[0.06]'
|
|
|
|
|
: 'text-slate-800 hover:bg-white/60'
|
2026-11-03 12:54:41 +05:30
|
|
|
}`}
|
|
|
|
|
>
|
|
|
|
|
<span>{resolveLocalised(item.label, currentLocale)}</span>
|
|
|
|
|
</Link>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2026-11-03 14:30:31 +05:30
|
|
|
|
2026-11-03 12:54:41 +05:30
|
|
|
<Link
|
2026-11-03 13:16:16 +05:30
|
|
|
href="/#studio-suite"
|
2026-11-03 12:54:41 +05:30
|
|
|
onClick={() => setMobileMenuOpen(false)}
|
2026-11-03 14:30:31 +05:30
|
|
|
className="flex items-center justify-between px-4 py-3 rounded-xl text-sm font-semibold text-blue-700 bg-blue-50/70 hover:bg-blue-100/70"
|
2026-11-03 12:54:41 +05:30
|
|
|
>
|
|
|
|
|
<span className="flex items-center gap-2">
|
2026-11-03 13:16:16 +05:30
|
|
|
<Layers className="w-4 h-4 text-blue-600" />
|
|
|
|
|
Creative Suite
|
2026-11-03 12:54:41 +05:30
|
|
|
</span>
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-11-03 14:30:31 +05:30
|
|
|
<div className="pt-3 border-t border-slate-900/[0.06]">
|
2026-11-03 12:24:43 +05:30
|
|
|
<Link
|
|
|
|
|
href={config.nav.cta.href}
|
|
|
|
|
onClick={() => setMobileMenuOpen(false)}
|
2026-11-03 14:30:31 +05:30
|
|
|
className="flex items-center justify-center gap-2 w-full py-3.5 rounded-xl text-sm font-bold text-white bg-gradient-to-r from-blue-600 to-indigo-600 shadow-md shadow-blue-500/25"
|
2026-11-03 12:24:43 +05:30
|
|
|
>
|
|
|
|
|
<Smartphone className="w-4 h-4" />
|
|
|
|
|
<span>{resolveLocalised(config.nav.cta.label, currentLocale)}</span>
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</header>
|
|
|
|
|
);
|
|
|
|
|
}
|