/* ==========================================================================
   CSS Custom Properties & Base Layer
   ========================================================================== */
:root {
    --background: 210 40% 98%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 221.2 83.2% 53.3%;
    --radius: 0.75rem;
}

.dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    --primary: 217.2 91.2% 59.8%;
    --primary-foreground: 222.2 47.4% 11.2%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 224.3 76.3% 48%;
}

* {
    border-color: hsl(var(--border));
}

body {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: 'Inter', sans-serif;
}

/* ==========================================================================
   Custom Glassmorphism & Neon Glow Utilities
   ========================================================================== */
.glass {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.dark .glass {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

/* Light/Dark Mode Surface & Contrast Adaptations */
.border-white\/10 {
    border-color: rgba(0, 0, 0, 0.08);
}

.dark .border-white\/10 {
    border-color: rgba(255, 255, 255, 0.1);
}

.border-white\/5 {
    border-color: rgba(0, 0, 0, 0.06);
}

.dark .border-white\/5 {
    border-color: rgba(255, 255, 255, 0.05);
}

#contact-form input,
#contact-form textarea {
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.12);
}

.dark #contact-form input,
.dark #contact-form textarea {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.bg-white\/5 {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}

.dark .bg-white\/5 {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
}

.hover\:bg-white\/10:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.dark .hover\:bg-white\/10:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

footer {
    border-top-color: rgba(0, 0, 0, 0.08);
}

.dark footer {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Enhanced text & badge contrast in light mode */
html:not(.dark) .text-blue-400 {
    color: #2563eb;
}

html:not(.dark) .text-cyan-400 {
    color: #0891b2;
}

html:not(.dark) .text-purple-400 {
    color: #7c3aed;
}

html:not(.dark) .text-emerald-400 {
    color: #059669;
}

html:not(.dark) .text-green-400 {
    color: #16a34a;
}

.text-gradient {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #22d3ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.neon-glow {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4), 0 0 40px rgba(147, 51, 234, 0.2);
}

.neon-glow-hover:hover {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.5), 0 0 60px rgba(147, 51, 234, 0.3);
}

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bounce-subtle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes terminal-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes pipeline-flow {
    0% { left: 0; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

/* ==========================================================================
   Animation Utility Classes
   ========================================================================== */
.animate-float { animation: float 6s ease-in-out infinite; }
.animate-float-delay-1 { animation: float 6s ease-in-out infinite 1s; }
.animate-float-delay-2 { animation: float 6s ease-in-out infinite 2s; }
.animate-float-delay-3 { animation: float 6s ease-in-out infinite 3s; }
.animate-pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }
.animate-bounce-subtle { animation: bounce-subtle 2s ease-in-out infinite; }
.animate-terminal-cursor { animation: terminal-cursor 1s step-end infinite; }

.slide-up-hidden { opacity: 0; transform: translateY(30px); }
.slide-up-visible { animation: slide-up 0.6s ease-out forwards; }

/* ==========================================================================
   Layout & Component Styling
   ========================================================================== */

/* Scroll Progress Bar */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06b6d4);
    z-index: 9999;
    transition: width 0.1s;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: hsl(var(--background));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Page Sections & Scroll Anchoring */
.page-section {
    display: block;
    scroll-margin-top: 5rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* Timeline */
.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #3b82f6, #8b5cf6, transparent);
    transform: translateX(-50%);
}

@media (max-width: 768px) {
    .timeline-line { left: 20px; }
}



/* Terminal Styling */
.terminal-window {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
    color: #f8fafc;
}

.terminal-window .text-foreground {
    color: #f8fafc !important;
}

.terminal-window .text-muted-foreground {
    color: #94a3b8 !important;
}

.dark .terminal-window {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.terminal-body {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.terminal-body::-webkit-scrollbar {
    height: 4px;
}

.terminal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.terminal-body::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 2px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}


/* Card Hover & Glow */
.project-card {
    transition: all 0.3s ease;
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 16px 32px -6px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(59, 130, 246, 0.08);
}

.dark .project-card:hover {
    box-shadow: none;
    border-color: rgba(59, 130, 246, 0.3);
}

.project-card:hover .project-glow {
    opacity: 0.15;
}

/* Certification Cards — Hover Refinement (Light & Dark) */
html:not(.dark) #certifications .project-card:hover,
html:not(.dark) #page-certifications .project-card:hover {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
}

html:not(.dark) #certifications .project-card .project-glow,
html:not(.dark) #page-certifications .project-card .project-glow {
    display: none;
}

.dark #certifications .project-card:hover,
.dark #page-certifications .project-card:hover {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.5), 0 4px 10px -2px rgba(0, 0, 0, 0.3);
}

.dark #certifications .project-card:hover .project-glow,
.dark #page-certifications .project-card:hover .project-glow,
.dark #certifications .group:hover .project-glow,
.dark #page-certifications .group:hover .project-glow {
    opacity: 0.15 !important;
}

/* Nav Active Indicators */
.nav-link {
    position: relative;
    transition: all 0.3s;
}

.nav-link.active {
    color: #60a5fa;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    inset: -4px -12px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    z-index: -1;
}

/* Mobile Menu */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

#mobile-menu.open {
    max-height: 500px;
}

/* Particles Canvas */
#particles-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 50;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

#back-to-top.visible {
    opacity: 1;
    transform: scale(1);
}


/* Hero Background Grid */
.hero-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 80%);
}

.dark .hero-grid {
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.05) 1px, transparent 1px);
}

/* ==========================================================================
   Accessibility: Reduced Motion Preference
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .slide-up-hidden {
        opacity: 1 !important;
        transform: none !important;
    }

    .slide-up-visible {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .page-section {
        animation: none !important;
    }
}

