/* ==========================================================================
   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));
}

*:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

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.95);
    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(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
}

/* 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 {
    color: #f8fafc;
    background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
}

html:not(.dark) .text-gradient {
    color: #0f172a;
    background: linear-gradient(180deg, #0f172a 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
}

.neon-glow {
    box-shadow: 0 4px 14px 0 rgba(14, 165, 233, 0.25);
}

.neon-glow-hover:hover {
    box-shadow: 0 6px 20px 0 rgba(14, 165, 233, 0.35);
}

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */
@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; }
}

/* ==========================================================================
   Animation Utility Classes
   ========================================================================== */
.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: 2.5px;
    background: #38bdf8;
    z-index: 9999;
    transition: width 0.1s;
}

/* 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, #38bdf8, rgba(56, 189, 248, 0.1) 85%, transparent);
    transform: translateX(-50%);
}

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



/* Terminal Styling */
.terminal-window {
    background: #090d16;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
    color: #f8fafc;
}

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

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

.dark .terminal-window {
    background: #090d16;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.7);
}

.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 & Subtle Technical Elevation */
.project-card {
    transition: all 0.25s ease;
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(56, 189, 248, 0.08);
}

.dark .project-card:hover {
    border-color: rgba(56, 189, 248, 0.35);
    box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.4), 0 4px 12px -2px rgba(56, 189, 248, 0.06);
}

.project-glow {
    display: none !important;
}

/* 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;
}

/* 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;
    }
}

