:root {
    --primary: #0ea5e9;
    --secondary: #8b5cf6;
    --accent: #22d3ee;
    --dark: #020617;
    --bg: #020617;
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
    --card-bg: #111827;
}

body.light-mode {
    --bg: #f8fafc;
    --text: #0f172a;
    --text-muted: rgba(15, 23, 42, 0.6);
    --glass-bg: rgba(15, 23, 42, 0.03);
    --glass-border: rgba(15, 23, 42, 0.08);
    --card-bg: #ffffff;
}

html.lenis {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto;
}

.lenis.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

.lenis.lenis-scrolling iframe {
    pointer-events: none;
}

body {
    background-color: var(--bg);
    font-family: 'Inter', sans-serif;
    color: var(--text);
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Light Mode Overrides for Tailwind Utilities */
body.light-mode .text-white,
body.light-mode .text-white\/10,
body.light-mode .text-white\/20,
body.light-mode .text-white\/30,
body.light-mode .text-white\/40, 
body.light-mode .text-white\/50, 
body.light-mode .text-white\/60,
body.light-mode .text-white\/70,
body.light-mode .text-white\/80,
body.light-mode .text-white\/90 {
    color: var(--text) !important;
}

body.light-mode .opacity-40,
body.light-mode .opacity-60 {
    opacity: 0.7;
}

body.light-mode .bg-white {
    background-color: var(--text);
    color: var(--bg);
}

body.light-mode.bg-dark,
body.light-mode .bg-dark,
body.light-mode .bg-\[\#03081a\],
body.light-mode .bg-\[\#111827\],
body.light-mode .bg-\[\#0f172a\],
body.light-mode .bg-\[\#1e1b4b\] {
    background-color: var(--bg) !important;
}

body.light-mode .border-white\/5,
body.light-mode .border-white\/10,
body.light-mode .border-white\/20 {
    border-color: var(--glass-border);
}

body.light-mode .bg-dark\/50,
body.light-mode .bg-white\/5,
body.light-mode .bg-white\/10 {
    background-color: var(--glass-bg) !important;
}

body.light-mode input,
body.light-mode select,
body.light-mode textarea {
    background-color: var(--glass-bg);
    color: var(--text);
    border-color: var(--glass-border);
}

body.light-mode .project-card-sticky {
    background-color: var(--card-bg) !important;
    border-color: var(--glass-border);
}

h1, h2, h3, h4, .font-display {
    font-family: 'Outfit', sans-serif;
}

/* Glassmorphism */
.bg-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

/* Section Snap Styling */
/* Note: We will handle snap logic in JS for better control with GSAP, 
   but basic scroll snap can be a fallback. */

section {
    position: relative;
    width: 100%;
}

.snap-section {
    min-height: 100vh;
}

/* Navbar blur on scroll */
nav.scrolled {
    background: var(--bg);
    opacity: 0.95;
    backdrop-filter: blur(10px);
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

/* Nav links underline effect */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Hide scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--dark);
}

::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Horizontal Scroll Container */
.horizontal-container {
    height: 100vh;
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
}

.horizontal-slide {
    flex-shrink: 0;
    width: 100vw;
}

/* Custom Gradients */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Preloader animation */
#loader h2 {
    letter-spacing: 0.5em;
    animation: pulseLetter 2s ease-in-out infinite;
}

@keyframes pulseLetter {
    0%, 100% { opacity: 0.3; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Card Hover Effects */
.service-card {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:hover {
    box-shadow: 0 20px 40px -20px rgba(14, 165, 233, 0.3);
}

.team-card img {
    filter: grayscale(1) contrast(1.2);
}

.team-card:hover img {
    filter: grayscale(0) contrast(1);
}

/* Project Sticky Stacking */
.project-card-sticky {
    transform-origin: center top;
    transition: transform 0.3s ease-out, filter 0.3s ease-out;
    box-shadow: 0 -20px 40px -15px rgba(0, 0, 0, 0.5);
}

.project-card-sticky::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

.project-card-sticky a {
    position: relative;
    z-index: 20; /* Ensure links stay above overlays */
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Lazy Loading Styles */
.lazy-image {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    transition: opacity 1.2s cubic-bezier(0.23, 1, 0.32, 1), 
                transform 1.2s cubic-bezier(0.23, 1, 0.32, 1);
    filter: blur(10px);
}

.lazy-image.loaded {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

/* Skeleton loader effect */
.img-skeleton {
    position: relative;
    overflow: hidden;
    background: var(--glass-bg);
}

.img-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, 
                transparent, 
                rgba(255, 255, 255, 0.05), 
                transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Responsive utility for slow horizontal scroll on mobile */
@media (max-width: 768px) {
    .horizontal-section {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
