/* ========================================
   Justgelato — Premium Styles + Effects
   (Tailwind CDN handles utility classes)
   ======================================== */

/* ─── Design Tokens ───────────────────── */
:root {
    --clr-primary: #D62828;
    --clr-secondary: #F8F4E3;
    --clr-accent: #E9C46A;
    --clr-dark: #264653;
    --clr-mint: #E9F5F2;
    --clr-chocolate: #3D2B1F;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.dark-mode {
    --clr-secondary: #121418;
    --clr-dark: #F8F4E3;
    --clr-mint: #1a2b26;
    --clr-chocolate: #D62828;
}

body {
    transition: background-color 0.6s var(--ease-out-expo), color 0.6s var(--ease-out-expo);
}

/* ─── Dark Mode Tailwind Overrides ────── */
body.dark-mode .text-stone-900,
body.dark-mode .text-stone-800,
body.dark-mode .text-stone-700,
body.dark-mode .text-stone-600 {
    color: var(--clr-dark) !important;
}

body.dark-mode .text-stone-500,
body.dark-mode .text-stone-400 {
    color: rgba(255, 255, 255, 0.5) !important;
}

body.dark-mode .bg-white {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

body.dark-mode .border-stone-100,
body.dark-mode .border-stone-200 {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .bg-stone-50 {
    background-color: transparent !important;
}

body.dark-mode .text-\[var\(--clr-dark\)\] {
    color: var(--clr-dark) !important; 
}

/* ─── Base ────────────────────────────── */
body {
    font-family: 'Nunito', 'Poppins', sans-serif;
    background-color: var(--clr-secondary);
    color: var(--clr-dark);
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

::selection {
    background-color: rgba(214, 40, 40, 0.15);
    color: var(--clr-dark);
}

.font-brand {
    font-family: 'Fredoka One', 'Baloo 2', cursive;
}

.font-body {
    font-family: 'Poppins', 'Nunito', sans-serif;
}

.font-display {
    font-family: 'Space Grotesk', 'Poppins', sans-serif;
}

/* ─── Custom Cursor ───────────────────── */
.custom-cursor-active, .custom-cursor-active * {
    cursor: none !important;
}

#cursor-dot {
    position: fixed;
    top: -5px;
    left: -5px;
    width: 10px;
    height: 10px;
    background: var(--clr-primary);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    mix-blend-mode: difference;
    transition: width 0.3s var(--ease-out-expo), height 0.3s var(--ease-out-expo), background 0.3s;
    will-change: transform;
}

#cursor-ring {
    position: fixed;
    top: -24px;
    left: -24px;
    width: 48px;
    height: 48px;
    border: 1.5px solid rgba(214, 40, 40, 0.4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    transition: width 0.4s var(--ease-out-expo), height 0.4s var(--ease-out-expo), border-color 0.3s, top 0.4s var(--ease-out-expo), left 0.4s var(--ease-out-expo);
    will-change: transform;
}

#cursor-dot.cursor-hover {
    width: 40px;
    height: 40px;
    top: -20px;
    left: -20px;
    background: rgba(214, 40, 40, 0.15);
    mix-blend-mode: normal;
}

#cursor-ring.cursor-hover {
    width: 64px;
    height: 64px;
    top: -32px;
    left: -32px;
    border-color: var(--clr-primary);
}

#cursor-dot.cursor-click {
    transform: scale(0.6) !important;
}

#cursor-ring.cursor-click {
    width: 36px;
    height: 36px;
    top: -18px;
    left: -18px;
}

@media (pointer: coarse) {
    #cursor-dot, #cursor-ring { display: none !important; }
}

/* ─── Splash Screen ───────────────────── */
#splash-screen {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: var(--clr-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.splash-logo {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(2.5rem, 8vw, 5rem);
    color: white;
    letter-spacing: -0.02em;
}

.splash-logo span {
    color: var(--clr-primary);
}

.splash-tagline {
    font-family: 'Space Grotesk', sans-serif;
    color: rgba(255,255,255,0.4);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-weight: 500;
}

.splash-bar {
    width: 160px;
    height: 3px;
    background: rgba(255,255,255,0.08);
    border-radius: 99px;
    overflow: hidden;
    margin-top: 1rem;
}

.splash-bar-inner {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--clr-primary), var(--clr-accent));
    border-radius: 99px;
}

/* ─── Page Transition ─────────────────── */
#page-transition {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--clr-dark);
    display: none;
    clip-path: circle(0% at 50% 50%);
}

/* ─── Noise Overlay ───────────────────── */
#noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 9990;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 128px 128px;
}

/* ─── Video Background ────────────────── */
.video-bg-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    overflow: hidden;
}

.video-bg-container iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw;
    min-height: 100vh;
    min-width: 177.77vh;
    transform: translate(-50%, -50%);
}

/* ─── Glass Card ──────────────────────── */
.glass-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: background 0.4s, border-color 0.4s;
}

body.dark-mode .glass-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ─── Shadows ─────────────────────────── */
.pizza-shadow {
    box-shadow: 0 20px 50px rgba(214, 40, 40, 0.12);
}

.icecream-shadow {
    box-shadow: 0 20px 50px rgba(233, 245, 242, 0.2);
}

/* ─── Scrollbar ───────────────────────── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--clr-secondary); }
::-webkit-scrollbar-thumb {
    background: rgba(214, 40, 40, 0.25);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--clr-primary); }

/* ─── Text Split Reveal ───────────────── */
.word-wrap {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    padding-bottom: 0.05em;
}

.word-inner {
    display: inline-block;
    will-change: transform;
}

/* ─── 3D Tilt Cards ───────────────────── */
.tilt-card {
    transition: transform 0.4s var(--ease-out-expo), box-shadow 0.4s var(--ease-out-expo);
    transform-style: preserve-3d;
    will-change: transform;
}

.tilt-card:hover {
    box-shadow: 0 30px 60px rgba(0,0,0,0.12), 0 10px 20px rgba(0,0,0,0.06);
}

.tilt-card .tilt-inner {
    transform: translateZ(30px);
}

/* ─── Magnetic Buttons ────────────────── */
.magnetic-btn {
    transition: transform 0.4s var(--ease-out-expo);
    will-change: transform;
    position: relative;
    overflow: hidden;
}

.magnetic-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,0.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.magnetic-btn:hover::after {
    opacity: 1;
}

/* ─── Glow Border Effect ──────────────── */
.glow-border {
    position: relative;
}

.glow-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent), var(--clr-primary));
    background-size: 300% 300%;
    animation: glow-shift 4s ease infinite;
    opacity: 0;
    transition: opacity 0.4s;
    z-index: -1;
}

.glow-border:hover::before,
.glow-border:focus-within::before {
    opacity: 1;
}

@keyframes glow-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ─── Marquee Strip ───────────────────── */
.marquee-strip {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.marquee-track {
    display: inline-flex;
    animation: marquee-scroll 30s linear infinite;
    will-change: transform;
}

.marquee-strip:hover .marquee-track {
    animation-play-state: paused;
}

.marquee-item {
    display: inline-flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0 2rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 2vw, 1.25rem);
}

.marquee-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--clr-primary);
    flex-shrink: 0;
}

@keyframes marquee-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.marquee-reverse .marquee-track {
    animation-direction: reverse;
}

/* ─── Gradient Blobs ──────────────────── */
.gradient-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: blob-float 12s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: -1;
    will-change: transform;
    transition: opacity 0.6s;
}

body.dark-mode .gradient-blob {
    opacity: 0.15;
}

.blob-1 { top: -10%; left: -10%; width: 40vw; height: 40vw; background: var(--clr-primary); }
.blob-2 { bottom: -20%; right: -10%; width: 50vw; height: 50vw; background: var(--clr-accent); animation-delay: -5s; }
.blob-3 { top: 40%; left: 30%; width: 30vw; height: 30vw; background: var(--clr-mint); animation-delay: -2s; }

@keyframes blob-float {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    33% { transform: translate(5vw, -5vh) scale(1.1) rotate(10deg); }
    66% { transform: translate(-3vw, 4vh) scale(0.9) rotate(-5deg); }
    100% { transform: translate(2vw, -2vh) scale(1.05) rotate(5deg); }
}

/* ─── Particle Canvas ────────────────── */
.particle-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* ─── Nav Link Animated Underline ─────── */
.nav-link-animated {
    position: relative;
    display: inline-block;
}

.nav-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--clr-primary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s var(--ease-out-expo);
}

.nav-link-animated:hover .nav-underline {
    transform: scaleX(1);
    transform-origin: left;
}

/* ─── Shimmer Effect ──────────────────── */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transform: translateX(-200%);
    animation: shimmer-slide 3s ease-in-out infinite;
    will-change: transform;
}

@keyframes shimmer-slide {
    0% { transform: translateX(-200%); }
    100% { transform: translateX(200%); }
}

/* ─── Image Reveal ────────────────────── */
.img-reveal {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 1s var(--ease-out-expo);
}

.img-reveal.revealed {
    clip-path: inset(0 0% 0 0);
}

/* ─── Horizontal Scroll ───────────────── */
.horizontal-scroll-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    cursor: grab;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.horizontal-scroll-wrapper::-webkit-scrollbar {
    display: none;
}

.horizontal-scroll-wrapper:active {
    cursor: grabbing;
}

.horizontal-scroll-track {
    display: flex;
    gap: 1.5rem;
    width: max-content;
    padding: 1.5rem 0;
}

.horizontal-scroll-card {
    width: 280px;
    flex-shrink: 0;
    scroll-snap-align: start;
}

@media (max-width: 768px) {
    .horizontal-scroll-track {
        padding: 1rem;
        gap: 1rem;
    }
    .horizontal-scroll-card {
        width: 240px;
    }
}

/* ─── Premium Input Styles ────────────── */
.input-glow {
    transition: box-shadow 0.4s var(--ease-out-expo), border-color 0.3s;
}

.input-glow:focus {
    box-shadow: 0 0 0 4px rgba(214, 40, 40, 0.12), 0 0 30px rgba(214, 40, 40, 0.08);
    border-color: var(--clr-primary) !important;
}

/* ─── Stagger Grid Animation ──────────── */
.stagger-grid > * {
    opacity: 0;
    transform: translateY(30px);
}

.stagger-grid.animated > * {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

/* ─── Floating Badge Pulse ────────────── */
@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.8); opacity: 0; }
}

.pulse-badge::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--clr-primary);
    animation: pulse-ring 2s ease-out infinite;
    z-index: -1;
}

/* ─── Hero Gradient Overlay Animation ─── */
@keyframes gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animated-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 6s ease infinite;
}

/* ─── Section Divider ─────────────────── */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(214,40,40,0.15), var(--clr-accent), rgba(214,40,40,0.15), transparent);
}

/* ─── Tag Pill Enhanced ───────────────── */
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 99px;
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--clr-dark);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: background 0.4s, color 0.4s, border-color 0.4s;
}

body.dark-mode .tag-pill {
    background: rgba(255,255,255,0.1);
    color: var(--clr-secondary);
    border-color: rgba(255,255,255,0.05);
}

/* ─── Dynamic Navbar Colors ───────────── */
.dynamic-nav-text {
    color: var(--clr-dark);
}
.dynamic-nav-text:hover {
    color: var(--clr-primary);
}
.bg-dark-hero .dynamic-nav-text {
    color: rgba(255,255,255,0.7);
}
.bg-dark-hero .dynamic-nav-text:hover {
    color: white;
}
.nav-is-scrolled .dynamic-nav-text {
    color: rgba(255,255,255,0.7) !important;
}
.nav-is-scrolled .dynamic-nav-text:hover {
    color: white !important;
}

.dynamic-nav-logo {
    color: var(--clr-dark);
}
.bg-dark-hero .dynamic-nav-logo {
    color: white;
}
.nav-is-scrolled .dynamic-nav-logo {
    color: white !important;
}

body.dark-mode .dynamic-nav-text, body.dark-mode .dynamic-nav-logo {
    color: var(--clr-secondary);
}

/* ─── Responsive utilities ────────────── */
@media (max-width: 768px) {
    .horizontal-scroll-wrapper {
        overflow-x: auto;
    }
}

/* ─── Smooth page entry ───────────────── */
@keyframes page-enter {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-enter {
    animation: page-enter 0.6s var(--ease-out-expo) forwards;
}

/* ─── Footer marquee special ──────────── */
.footer-marquee {
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}