/* ========================================
   GLOBAL PREMIUM STYLES & ANIMATIONS
   Centralized design system for portfolio
   ======================================== */

:root {
    /* Color Tokens - DEFAULT (LIGHT MODE) */
    --napier-red: #0ea5e9;
    /* Sky Blue 500 for Light Mode */
    --zinc-950: #ffffff;
    /* Pure White */
    --accent-red: #38bdf8;
    /* Sky 400 */
    --accent-emerald: #10b981;
    --accent-blue: #3b82f6;

    /* Light Mode Overrides */
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(15, 23, 42, 0.1);
    /* Slate 900 at 10% */
    --glass-blur: 30px;

    /* Animation Timings */
    --timing-fast: 200ms;
    --timing-base: 400ms;
    --timing-slow: 700ms;
    --timing-premium: cubic-bezier(0.19, 1, 0.22, 1);

    /* Shadows */
    --shadow-sm: 0 10px 30px -10px rgba(15, 23, 42, 0.1);
    --shadow-md: 0 20px 60px -15px rgba(15, 23, 42, 0.15);
    --shadow-lg: 0 40px 100px -20px rgba(15, 23, 42, 0.2);
    --shadow-glow-red: 0 0 30px rgba(14, 165, 233, 0.3);
    /* Blue glow */
}

/* Default Light Mode Body */
body {
    background-color: var(--zinc-950);
    /* zinc-900 */
}

/* Re-apply Light Mode Utilities as specific overrides for Tailwind classes that might be hardcoded */
.text-white {
    color: #18181b !important;
}

.text-zinc-300 {
    color: #52525b !important;
}

.text-zinc-400 {
    color: #71717a !important;
}

.text-zinc-500 {
    color: #52525b !important;
}

.bg-zinc-950 {
    background-color: #f4f4f5 !important;
}

.bg-zinc-900 {
    background-color: #e4e4e7 !important;
}

.border-zinc-800 {
    border-color: #d4d4d8 !important;
}

/* Light Mode Overlay Adjustments */
.fixed-bg {
    filter: brightness(1.2) saturate(0.8) opacity(0.3);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-image: url('background.jpg'), url('https://images.unsplash.com/photo-1558494949-ef010cbdcc51?q=80&w=2000');
    background-size: cover;
    background-position: center;
}

.hero-overlay {
    background: radial-gradient(circle at 20% 30%, rgba(227, 27, 35, 0.05), transparent 50%),
        linear-gradient(to bottom, transparent, #f4f4f5);
}

.nav-dock {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
}

.nav-dock:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(227, 27, 35, 0.5);
}

.glass-panel,
.id-card {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
}

.glass-panel:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.2);
}

/* ========================================
   DARK MODE - DEEP DESIGNER RED
   ======================================== */
.dark-mode {
    --napier-red: #E31B23;
    /* Restore Red in Dark Mode */
    --zinc-950: #0a0a0a;
    --glass-bg: rgba(20, 20, 20, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 20px 60px -15px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 40px 100px -20px rgba(0, 0, 0, 0.8);
    color: white;
}

.dark-mode body {
    background-color: #050505;
    /* Fallback */
    /* Deep Designer Red Gradient */
    background: linear-gradient(180deg, #1a0505 0%, #2b0505 40%, #000000 100%);
    background-attachment: fixed;
    color: white;
}

/* ========================================
   CINEMATIC BACKGROUNDS (Added Globally)
   ======================================== */
.texture-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    opacity: 0.15;
}

/* Gradient Orbs */
.gradient-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    pointer-events: none;
    z-index: -1;
    transition: all 0.3s ease;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--napier-red), transparent);
    opacity: 0.2;
    top: 10%;
    left: 5%;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--napier-red), transparent);
    opacity: 0.15;
    bottom: 20%;
    right: 10%;
}

/* HIDE BACKGROUND IMAGES IN LIGHT MODE - NUCLEAR OPTION */
/* LIGHT MODE - BLUE/WHITE AESTHETIC */
html:not(.dark-mode) body .fixed-bg {
    display: block !important;
    opacity: 0.4 !important;
    visibility: visible !important;
    /* Invert/Hue rotate to turn dark red circuit into white/blue tech */
    filter: brightness(1.8) hue-rotate(190deg) saturate(0.8) !important;
    mix-blend-mode: multiply;
}

html:not(.dark-mode) body .hero-overlay {
    display: block !important;
    background: radial-gradient(circle at 20% 30%, rgba(14, 165, 233, 0.1), transparent 50%),
        linear-gradient(to bottom, transparent, #ffffff) !important;
}

html:not(.dark-mode) body .texture-overlay,
html:not(.dark-mode) body .grid-overlay,
html:not(.dark-mode) body .gradient-orb,
html:not(.dark-mode) body #particle-canvas {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

html:not(.dark-mode) body .texture-overlay {
    opacity: 0.05 !important;
    filter: invert(1);
    /* Invert noise for light mode */
}

/* Force White Background in Light Mode */
html:not(.dark-mode) body {
    background-color: #ffffff !important;
    background-image: none !important;
}

/* Ensure Dark Mode background wins */
.dark-mode body {
    background-color: #050505 !important;
    /* Deep Designer Red Gradient */
    background: linear-gradient(180deg, #1a0505 0%, #2b0505 40%, #000000 100%) !important;
    background-attachment: fixed !important;
    color: white !important;
}

/* Reset Tailwind Overrides for Dark Mode */
.dark-mode .text-white {
    color: white !important;
}

.dark-mode .text-zinc-300 {
    color: #d4d4d8 !important;
}

.dark-mode .text-zinc-400 {
    color: #a1a1aa !important;
}

.dark-mode .text-zinc-500 {
    color: #71717a !important;
}

.dark-mode .bg-zinc-950 {
    background-color: #09090b !important;
}

.dark-mode .bg-zinc-900 {
    background-color: #18181b !important;
}

.dark-mode .border-zinc-800 {
    border-color: #27272a !important;
}

/* Dark Mode Overlays */
.dark-mode .intro-bg,
.dark-mode .fixed-bg {
    /* Show the image backgrounds in dark mode */
    display: block;
    filter: brightness(0.2) sepia(0.5) hue-rotate(320deg) saturate(1.5);
    /* Red tint on image */
}

.dark-mode .hero-overlay {
    background: radial-gradient(circle at 50% 30%, rgba(227, 27, 35, 0.15), transparent 70%);
}

.dark-mode .nav-dock {
    background: rgba(20, 20, 20, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .nav-dock:hover {
    background: rgba(20, 20, 20, 0.7);
    border-color: rgba(227, 27, 35, 0.3);
}

.dark-mode .glass-panel,
.dark-mode .id-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 40px 100px -15px rgba(0, 0, 0, 0.9);
}

.dark-mode .glass-panel:hover {
    background: rgba(20, 20, 20, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Nav Link Colors in Light vs Dark */
.nav-dock a.text-zinc-500 {
    color: #52525b;
}

/* Light mode default */
.nav-dock a.text-zinc-500:hover {
    color: #18181b;
}

/* Light mode hover */

.dark-mode .nav-dock a.text-zinc-500 {
    color: #71717a !important;
}

.dark-mode .nav-dock a.text-zinc-500:hover {
    color: white !important;
}

/* ========================================
   SCROLL PROGRESS INDICATOR
   ======================================== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--napier-red), var(--accent-red));
    z-index: 9999;
    transition: width 0.1s ease-out;
    box-shadow: 0 0 10px rgba(227, 27, 35, 0.5);
}

/* ========================================
   CUSTOM CURSOR
   ======================================== */
.custom-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(227, 27, 35, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transition: transform 0.15s ease-out, border-color 0.3s ease;
    transform: translate(-50%, -50%);
}

.custom-cursor.hover {
    transform: translate(-50%, -50%) scale(1.5);
    border-color: var(--napier-red);
    background: rgba(227, 27, 35, 0.1);
}

.custom-cursor-follower {
    position: fixed;
    width: 8px;
    height: 8px;
    background: var(--napier-red);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9997;
    transition: transform 0.2s ease-out;
    transform: translate(-50%, -50%);
    box-shadow: var(--shadow-glow-red);
}

/* ========================================
   PARTICLE CANVAS
   ======================================== */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* ========================================
   PREMIUM ANIMATIONS
   ======================================== */

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Left */
@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade In Right */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pulse */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Glow */
@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(227, 27, 35, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(227, 27, 35, 0.6), 0 0 30px rgba(227, 27, 35, 0.4);
    }
}

/* Float */
@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Shimmer */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

/* Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Animation Utilities */
.animate-fade-in-up {
    animation: fadeInUp 0.8s var(--timing-premium) forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.8s var(--timing-premium) forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.8s var(--timing-premium) forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s var(--timing-premium) forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

/* Delay Utilities */
.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

.delay-400 {
    animation-delay: 400ms;
}

.delay-500 {
    animation-delay: 500ms;
}

.delay-600 {
    animation-delay: 600ms;
}

/* Opacity initial state for animations */
.animate-on-scroll {
    opacity: 0;
}

.animate-on-scroll.visible {
    opacity: 1;
}

/* ========================================
   PREMIUM HOVER EFFECTS
   ======================================== */

.hover-lift {
    transition: transform var(--timing-base) var(--timing-premium),
        box-shadow var(--timing-base) var(--timing-premium);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.hover-glow {
    transition: box-shadow var(--timing-base) ease;
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow-red);
}

.hover-scale {
    transition: transform var(--timing-base) var(--timing-premium);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* ========================================
   CARD EFFECTS
   ======================================== */

.magnetic-card {
    transition: transform 0.1s ease-out;
    transform-style: preserve-3d;
}

.flip-card {
    perspective: 1000px;
    position: relative;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* ========================================
   GLASS MORPHISM VARIANTS
   ======================================== */

.glass-premium {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-md);
}

.glass-intense {
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ========================================
   LOADING & TRANSITIONS
   ======================================== */

.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--zinc-950);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.page-transition.active {
    opacity: 1;
    pointer-events: all;
}

.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--zinc-950);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: opacity 0.5s ease;
}

.preloader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-ring {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--napier-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   NOTIFICATION SYSTEM
   ======================================== */

.notification {
    position: fixed;
    top: 100px;
    right: 30px;
    padding: 20px 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    color: white;
    z-index: 9999;
    transform: translateX(400px);
    transition: transform 0.5s var(--timing-premium);
    box-shadow: var(--shadow-lg);
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid var(--accent-emerald);
}

.notification.error {
    border-left: 4px solid var(--napier-red);
}

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

@media (max-width: 768px) {

    .custom-cursor,
    .custom-cursor-follower {
        display: none;
    }

    .magnetic-card {
        transform: none !important;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {

    .glass-premium,
    .glass-intense {
        border-width: 2px;
    }
}

/* ========================================
   LIGHT MODE
   ======================================== */
.light-mode {
    --zinc-950: #f4f4f5;
    /* zinc-100 */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
    color: #18181b;
    /* zinc-900 */
}

.light-mode body {
    background-color: var(--zinc-950);
    color: #18181b;
}

/* Force override Tailwind classes for Light Mode */
.light-mode .text-white {
    color: #18181b !important;
}

/* LIGHT MODE - Strong Enforcements using :not(.dark-mode) */
html:not(.dark-mode) {
    --zinc-950: #f4f4f5;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
    color: #18181b;
}

html:not(.dark-mode) .text-white {
    color: #18181b !important;
}

html:not(.dark-mode) .text-zinc-300,
html:not(.dark-mode) .text-zinc-400,
html:not(.dark-mode) .text-zinc-500 {
    color: #52525b !important;
}

html:not(.dark-mode) .bg-zinc-950 {
    background-color: #f4f4f5 !important;
}

html:not(.dark-mode) .bg-zinc-900 {
    background-color: #e4e4e7 !important;
    border-color: #d4d4d8 !important;
}

html:not(.dark-mode) .border-zinc-800 {
    border-color: #d4d4d8 !important;
}

html:not(.dark-mode) .nav-dock {
    background: rgba(255, 255, 255, 0.8) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

html:not(.dark-mode) .glass-panel,
html:not(.dark-mode) .id-card {
    background: rgba(255, 255, 255, 0.6) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

html:not(.dark-mode) .nav-dock a.text-zinc-500 {
    color: #52525b !important;
}

/* Theme-Aware Section Backgrounds */
.results-bg {
    background-color: rgba(24, 24, 27, 0.5);
    /* zinc-900/50 */
}

html:not(.dark-mode) .results-bg {
    background-color: rgba(255, 255, 255, 0.5);
    /* White/50 */
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.light-mode .nav-dock a.text-zinc-500:hover {
    color: #18181b !important;
}
