/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* ========================================
       COLOR SYSTEM
       ======================================== */

    /* Primary Brand Colors */
    --primary-color: #8b4513;        /* Saddle Brown */
    --primary-dark: #654321;         /* Dark Brown */
    --secondary-color: #a0522d;      /* Sienna */
    --accent-color: #ff6b35;         /* Vermillion Orange */

    /* Text Colors */
    --text-primary: #2d1810;         /* Dark Brown Text - WCAG AAA (11.42:1) */
    --text-secondary: #5d4037;       /* Medium Brown - WCAG AA (7.21:1) */
    --text-light: #8d6e63;           /* Light Brown - WCAG AA (4.52:1) */
    --text-white: #fef7ed;           /* Warm White */

    /* Background Colors */
    --bg-primary: #fefefe;           /* Off-white */
    --bg-secondary: #faf7f2;         /* Warm Light Beige */
    --bg-tertiary: #f5f0eb;          /* Light Beige */
    --bg-dark: #1a0e0a;              /* Very Dark Brown */

    /* Border Colors */
    --border-color: #d7c4b8;         /* Light Tan */
    --border-light: #e8ddd2;         /* Very Light Tan */
    --border-dark: #b8a89a;          /* Medium Tan */

    /* Accent Colors */
    --maroon-primary: #800020;       /* Maroon */
    --maroon-dark: #5c0015;          /* Dark Maroon */
    --orange-light: #ff8c42;         /* Light Orange */
    --brown-light: #d2b48c;          /* Tan */

    /* Semantic Colors */
    --success-light: #d1fae5;
    --success: #10b981;
    --success-dark: #065f46;
    --error-light: #fee2e2;
    --error: #ef4444;
    --error-dark: #991b1b;
    --info-light: #dbeafe;
    --info: #3b82f6;
    --info-dark: #1e40af;
    --warning-light: #fef3c7;
    --warning: #f59e0b;
    --warning-dark: #92400e;

    /* Additional Utility Colors */
    --gray-100: #f7fafc;
    --gray-200: #edf2f7;
    --gray-300: #e2e8f0;
    --gray-400: #cbd5e0;
    --gray-500: #a0aec0;
    --gray-600: #718096;
    --gray-700: #4a5568;
    --gray-800: #2d3748;
    --gray-900: #1a202c;

    /* Chart/Data Visualization Colors */
    --chart-1: #ffeaa7;
    --chart-2: #fdcb6e;
    --chart-3: #ff8c42;
    --chart-4: #ff6b35;
    --chart-5: #5a67d8;

    /* Gradient Accent Colors */
    --gradient-pink: #f093fb;
    --gradient-red: #f5576c;

    /* ========================================
       TYPOGRAPHY SCALE
       ======================================== */
    --font-size-xs: 0.75rem;         /* 12px */
    --font-size-sm: 0.875rem;        /* 14px */
    --font-size-base: 1rem;          /* 16px */
    --font-size-lg: 1.125rem;        /* 18px */
    --font-size-xl: 1.25rem;         /* 20px */
    --font-size-2xl: 1.5rem;         /* 24px */
    --font-size-3xl: 1.875rem;       /* 30px */
    --font-size-4xl: 2.25rem;        /* 36px */
    --font-size-5xl: 3rem;           /* 48px */
    --font-size-6xl: 3.75rem;        /* 60px */

    /* Line Heights */
    --line-height-tight: 1.2;
    --line-height-snug: 1.375;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;
    --line-height-loose: 1.75;

    /* Font Weights */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* ========================================
       SPACING SCALE (8px base)
       ======================================== */
    --space-0: 0;
    --space-1: 0.25rem;              /* 4px */
    --space-2: 0.5rem;               /* 8px */
    --space-3: 0.75rem;              /* 12px */
    --space-4: 1rem;                 /* 16px */
    --space-5: 1.25rem;              /* 20px */
    --space-6: 1.5rem;               /* 24px */
    --space-8: 2rem;                 /* 32px */
    --space-10: 2.5rem;              /* 40px */
    --space-12: 3rem;                /* 48px */
    --space-16: 4rem;                /* 64px */
    --space-20: 5rem;                /* 80px */
    --space-24: 6rem;                /* 96px */
    --space-32: 8rem;                /* 128px */

    /* ========================================
       BORDER RADIUS SCALE
       ======================================== */
    --radius-none: 0;
    --radius-sm: 0.25rem;            /* 4px */
    --radius-base: 0.5rem;           /* 8px */
    --radius-md: 0.75rem;            /* 12px */
    --radius-lg: 1rem;               /* 16px */
    --radius-xl: 1.5rem;             /* 24px */
    --radius-2xl: 2rem;              /* 32px */
    --radius-full: 9999px;           /* Pill shape */
    --radius-circle: 50%;            /* Circle */

    /* ========================================
       SHADOWS
       ======================================== */
    --shadow-sm: 0 1px 2px 0 rgb(45 24 16 / 0.05);
    --shadow-base: 0 2px 4px 0 rgb(45 24 16 / 0.08);
    --shadow-md: 0 4px 6px -1px rgb(45 24 16 / 0.1), 0 2px 4px -2px rgb(45 24 16 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(45 24 16 / 0.1), 0 4px 6px -4px rgb(45 24 16 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(45 24 16 / 0.1), 0 8px 10px -6px rgb(45 24 16 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(45 24 16 / 0.15);
    --shadow-inner: inset 0 2px 4px 0 rgb(45 24 16 / 0.06);

    /* Special Shadows */
    --shadow-glow-sm: 0 0 10px rgba(139, 69, 19, 0.3);
    --shadow-glow-md: 0 5px 20px rgba(245, 87, 108, 0.2);
    --shadow-glow-lg: 0 10px 30px rgba(245, 87, 108, 0.2);
    --shadow-focus: 0 0 0 3px rgba(139, 69, 19, 0.1);
    --shadow-focus-error: 0 0 0 3px rgba(239, 68, 68, 0.1);

    /* ========================================
       GRADIENTS
       ======================================== */
    --gradient-primary: linear-gradient(135deg, #8b4513 0%, #800020 100%);
    --gradient-accent: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    --gradient-hero: linear-gradient(135deg, #ff6b35 0%, #ffd700 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-error: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    --gradient-info: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    --gradient-cool-1: linear-gradient(135deg, #06b6d4 0%, #67e8f9 100%);
    --gradient-cool-2: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
    --gradient-warm-1: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --gradient-warm-2: linear-gradient(135deg, #ef4444 0%, #fb7185 100%);
    --gradient-data: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    /* ========================================
       Z-INDEX SCALE
       ======================================== */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;

    /* ========================================
       TRANSITIONS
       ======================================== */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    --transition-slower: 500ms ease;

    /* ========================================
       BREAKPOINTS (for reference in media queries)
       ======================================== */
    --breakpoint-sm: 480px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;

    /* ========================================
       CONTAINER WIDTHS
       ======================================== */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1200px;
    --container-2xl: 1400px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: var(--line-height-relaxed);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    font-size: var(--font-size-base);
}

.container {
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* Force hide modals by default - Critical Override */
#global-search-modal:not(.visible),
.global-search-modal:not(.visible),
#keyboard-help:not(.visible),
.keyboard-help:not(.visible) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(-100vh) !important;
    z-index: -1 !important;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: var(--z-fixed);
    transition: all var(--transition-base);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-md);
}

.nav-container {
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-base);
}

.nav-logo:hover {
    color: var(--primary-dark);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--space-8);
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: color var(--transition-base);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width var(--transition-base);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    margin: var(--space-1) 0;
    transition: var(--transition-base);
    border-radius: var(--radius-sm);
}

/* Scroll Progress Indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(139, 69, 19, 0.1);
    z-index: var(--z-tooltip);
    transition: opacity 0.3s ease;
}

.scroll-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.1s ease;
    box-shadow: var(--shadow-glow-sm);
}

/* Floating Table of Contents */
.floating-toc {
    position: fixed;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.floating-toc.visible {
    opacity: 1;
    visibility: visible;
}

.toc-toggle {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
    font-size: var(--font-size-lg);
}

.toc-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.toc-content {
    position: absolute;
    right: 60px;
    top: 0;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    min-width: 200px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px);
    transition: all var(--transition-base);
}

.toc-toggle[aria-expanded="true"] + .toc-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.toc-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.toc-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-links li {
    margin-bottom: var(--space-2);
}

.toc-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: color var(--transition-base);
    display: block;
    padding: 0.25rem 0;
}

.toc-links a:hover,
.toc-links a.active {
    color: var(--primary-color);
}

/* Keyboard Shortcuts Help */
.keyboard-help {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none;
    transition: all var(--transition-base);
    backdrop-filter: blur(5px);
}

.keyboard-help.visible {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: all;
}

.keyboard-help-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
}

.keyboard-help-content h3 {
    margin: 0 0 var(--space-6) 0;
    font-size: var(--font-size-2xl);
    color: var(--text-primary);
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-4);
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3);
    border-radius: var(--radius-base);
    background: var(--bg-secondary);
}

.shortcut-item kbd {
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-family: monospace;
    box-shadow: var(--shadow-base);
    min-width: 24px;
    text-align: center;
}

.shortcut-item span {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.keyboard-help-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-2xl);
    cursor: pointer;
    transition: color var(--transition-base);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyboard-help-close:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

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

/* Hero Section */
.hero,
section.hero,
#home.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: var(--gradient-primary) !important;
    background-image: var(--gradient-primary) !important;
    color: var(--text-white) !important;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="1" fill="white" opacity="0.05"/><circle cx="10" cy="60" r="1" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="1" fill="white" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.hero-container {
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 var(--space-4);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-16);
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero-content {
    color: var(--text-white);
}

.hero-title {
    font-size: var(--font-size-6xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-4);
    line-height: var(--line-height-tight);
    color: var(--text-white);
}

.highlight {
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-normal);
    margin-bottom: var(--space-6);
    opacity: 0.9;
}

.hero-description {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-8);
    opacity: 0.8;
}

.hero-buttons {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-12);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-8);
    border-radius: var(--radius-base);
    text-decoration: none;
    font-weight: var(--font-weight-semibold);
    transition: all var(--transition-base);
    border: 2px solid transparent;
    font-size: var(--font-size-base);
}

.btn-primary {
    background: rgba(139, 69, 19, 0.9);
    color: var(--text-white);
    border-color: var(--primary-color);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.hero-social {
    display: flex;
    gap: var(--space-4);
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: rgba(139, 69, 19, 0.8);
    color: var(--text-white);
    text-decoration: none;
    border-radius: 50%;
    transition: all var(--transition-base);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--primary-color);
}

.social-link:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.code-animation {
    width: 300px;
    height: 200px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    position: relative;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.code-line {
    height: 20px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4));
    margin-bottom: var(--space-4);
    border-radius: var(--radius-md);
    animation: codeTyping 3s ease-in-out infinite;
}

.code-line:nth-child(1) { width: 80%; animation-delay: 0s; }
.code-line:nth-child(2) { width: 60%; animation-delay: 0.5s; }
.code-line:nth-child(3) { width: 90%; animation-delay: 1s; }
.code-line:nth-child(4) { width: 70%; animation-delay: 1.5s; }

@keyframes codeTyping {
    0%, 100% { opacity: 0.4; transform: scaleX(0.8); }
    50% { opacity: 1; transform: scaleX(1); }
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
}

.scroll-arrow {
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-left: none;
    border-top: none;
    transform: rotate(45deg);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) rotate(45deg); }
    40% { transform: translateY(-10px) rotate(45deg); }
    60% { transform: translateY(-5px) rotate(45deg); }
}

/* Section Styles */
section {
    padding: var(--space-20) 0;
}

.section-title {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    text-align: center;
    margin-bottom: var(--space-12);
    color: var(--text-primary);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
}

/* About Section */
.about {
    background: var(--bg-secondary);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-text p {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-loose);
    margin-bottom: var(--space-6);
    color: var(--text-secondary);
}

.about-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-8);
    margin-top: var(--space-12);
}

.highlight-item {
    text-align: center;
    padding: var(--space-8);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.highlight-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.highlight-item i {
    font-size: var(--font-size-5xl);
    color: var(--primary-color);
    margin-bottom: var(--space-4);
}

.highlight-item h3 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.highlight-item p {
    color: var(--text-secondary);
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-8);
}

.skill-category {
    background: white;
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.skill-category:hover {
    transform: translateY(-5px);
}

.skill-category h3 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-6);
    color: var(--text-primary);
    text-align: center;
}

.skill-items {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.skill-item {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-4);
    border-radius: 2rem;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-base);
    border: 2px solid transparent;
}

.skill-item:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* GitHub Stats Section */
.github-stats {
    padding: var(--space-20) 0;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--primary-dark) 100%);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-16);
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    text-align: center;
    transition: all var(--transition-base);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow-lg);
}

.stat-card i {
    font-size: var(--font-size-4xl);
    color: var(--primary-color);
    margin-bottom: var(--space-4);
}

.stat-content h3 {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-2);
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-content p {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-sm);
}

.subsection-title {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-8);
    text-align: center;
    color: var(--text-color);
}

.contribution-section,
.language-stats-section {
    margin-top: var(--space-12);
}

.contribution-widget {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.contribution-widget img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

.language-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.language-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.language-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.language-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: var(--font-weight-semibold);
}

.language-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.language-percentage {
    color: rgba(255, 255, 255, 0.7);
    font-weight: var(--font-weight-semibold);
}

.language-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.language-bar-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 1s ease;
}

/* Recent Activity Section */
.recent-activity {
    padding: var(--space-20) 0;
    background: var(--dark-bg);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.activity-item {
    display: flex;
    gap: var(--space-6);
    padding: var(--space-6);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.activity-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.activity-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 87, 108, 0.2);
    border-radius: 50%;
    color: var(--primary-color);
}

.activity-content {
    flex: 1;
}

.activity-action {
    margin: 0 0 var(--space-2) 0;
    color: var(--text-color);
}

.activity-action strong {
    color: var(--primary-color);
}

.activity-time {
    color: rgba(255, 255, 255, 0.5);
    font-size: var(--font-size-sm);
}

/* Achievements Section */
.achievements {
    padding: var(--space-20) 0;
    background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-8);
}

.badge-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    transition: all var(--transition-base);
}

.badge-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow-lg);
}

.badge-title {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-6);
    color: var(--text-color);
    text-align: center;
}

.badge-image {
    text-align: center;
}

.badge-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

.no-activity,
.error-message {
    text-align: center;
    padding: var(--space-8);
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

/* Projects Section */
.projects {
    background: var(--bg-secondary);
}

.pinned-repos-section,
.topics-section {
    margin-bottom: var(--space-12);
}

.pinned-repos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-12);
}

.pinned-repo-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    transition: all var(--transition-base);
}

.pinned-repo-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow-md);
}

.pinned-repo-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.pinned-repo-header i {
    color: rgba(255, 255, 255, 0.6);
}

.pinned-repo-name {
    color: var(--primary-color);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    font-size: var(--font-size-lg);
}

.pinned-repo-name:hover {
    text-decoration: underline;
}

.pinned-repo-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-4);
    line-height: var(--line-height-normal);
}

.pinned-repo-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pinned-repo-stats {
    display: flex;
    gap: var(--space-4);
    font-size: var(--font-size-sm);
}

.repo-language {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.repo-stat {
    color: rgba(255, 255, 255, 0.6);
}

.topics-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    justify-content: center;
    padding: var(--space-8);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
}

.topic-tag {
    background: rgba(245, 87, 108, 0.2);
    color: var(--primary-color);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(245, 87, 108, 0.3);
    transition: all var(--transition-base);
    cursor: default;
    font-weight: var(--font-weight-medium);
}

.topic-tag:hover {
    background: rgba(245, 87, 108, 0.3);
    transform: scale(1.05);
}

/* Enhanced Search and Filter Controls */
.projects-controls {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-filter-row,
.sort-view-row {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    flex-wrap: wrap;
}

.search-filter-row {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

/* Search Container */
.search-container {
    position: relative;
    flex: 1;
    min-width: 300px;
    max-width: 500px;
}

.search-input {
    width: 100%;
    padding: var(--space-3) var(--space-4) var(--space-3) var(--space-10);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-base);
    font-size: var(--font-size-base);
    background: var(--background-color);
    color: var(--text-color);
    transition: all var(--transition-base);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.clear-search {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.clear-search:hover {
    color: var(--text-color);
    background: var(--border-color);
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.filter-label,
.sort-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: var(--font-weight-medium);
}

.filter-select,
.sort-select {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-base);
    background: var(--background-color);
    color: var(--text-color);
    font-size: var(--font-size-sm);
    min-width: 120px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus,
.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

/* Sort and View Controls */
.sort-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.sort-direction {
    padding: var(--space-2);
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-base);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-direction:hover {
    color: var(--text-color);
    border-color: var(--primary-color);
}

.sort-direction.desc i {
    transform: rotate(180deg);
}

.view-controls {
    display: flex;
    gap: var(--space-1);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-base);
    overflow: hidden;
}

.view-btn {
    padding: var(--space-2) var(--space-3);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn.active,
.view-btn:hover {
    color: var(--primary-color);
    background: rgba(74, 144, 226, 0.1);
}

.results-info {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-left: auto;
}

#results-count {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
}

.reset-btn {
    padding: var(--space-2) var(--space-4);
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-base);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--font-size-sm);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.reset-btn:hover {
    color: var(--text-color);
    border-color: var(--primary-color);
}

/* List View Styles */
.projects-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.projects-grid.list-view .project-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    max-width: none;
}

.projects-grid.list-view .project-card .project-header {
    flex: 0 0 200px;
    margin-right: var(--space-6);
}

.projects-grid.list-view .project-card .project-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.projects-grid.list-view .project-card .project-description {
    flex: 1;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-snug);
    margin: 0;
}

.projects-grid.list-view .project-card .project-tech {
    flex: 0 0 auto;
    margin: 0;
}

.projects-grid.list-view .project-card .project-stats {
    flex: 0 0 auto;
    margin: 0;
}

/* No Results State */
.no-results {
    text-align: center;
    padding: var(--space-12) var(--space-8);
    color: var(--text-secondary);
}

.no-results i {
    font-size: var(--font-size-5xl);
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.no-results h3 {
    margin-bottom: var(--space-2);
    color: var(--text-color);
}

/* Loading States */
.search-loading .search-input {
    background-image: linear-gradient(90deg, transparent, rgba(74, 144, 226, 0.1), transparent);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Gists Section */
.gists-section {
    padding: var(--space-20) 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.gists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-8);
}

.gist-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    transition: all var(--transition-base);
}

.gist-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow-lg);
}

.gist-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.gist-header i {
    color: var(--primary-color);
}

.gist-title {
    color: var(--text-color);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    font-size: var(--font-size-base);
}

.gist-title:hover {
    color: var(--primary-color);
}

.gist-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-4);
    line-height: var(--line-height-normal);
}

.gist-footer {
    display: flex;
    gap: var(--space-4);
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.6);
    flex-wrap: wrap;
}

.gist-language {
    background: rgba(245, 87, 108, 0.2);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
}

/* GitHub Insights Section */
.github-insights {
    padding: var(--space-20) 0;
    background: var(--dark-bg);
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}

.insight-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    transition: all var(--transition-base);
}

.insight-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow-lg);
}

.insight-card h3 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-6);
    color: var(--text-color);
}

.insight-card img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

.additional-metrics {
    margin-top: var(--space-12);
}

.metrics-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    justify-content: center;
    padding: var(--space-8);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
}

.metrics-badges img {
    transition: transform 0.3s ease;
}

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

/* Projects Section */
.projects {
    background: var(--bg-secondary);
}

/* ===================================
   Project Controls: Search & Filters
   =================================== */

.project-controls {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    margin-bottom: var(--space-10);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.search-container {
    position: relative;
    margin-bottom: var(--space-6);
}

.search-icon {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    pointer-events: none;
}

.project-search-input {
    width: 100%;
    padding: var(--space-4) var(--space-6) var(--space-4) var(--space-12);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-base);
}

.project-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.clear-search-btn {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.clear-search-btn:hover {
    color: var(--danger-color);
    background: var(--bg-secondary);
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    align-items: flex-start;
    margin-bottom: var(--space-4);
}

.filter-group {
    flex: 1;
    min-width: 300px;
}

.sort-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.filter-label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.filter-btn {
    padding: var(--space-3) var(--space-5);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-btn i {
    font-size: var(--font-size-base);
}

.sort-select {
    padding: var(--space-3) var(--space-10) var(--space-3) var(--space-4);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
}

.sort-select:hover {
    border-color: var(--primary-color);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.results-info {
    padding: var(--space-3) 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

#results-count {
    font-weight: 500;
}

/* Project card filtering animations */
.project-card.filtered-out {
    display: none;
    opacity: 0;
    transform: scale(0.9);
}

.project-card.filtered-in {
    animation: projectFadeIn 0.4s ease forwards;
}

@keyframes projectFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Dark theme adjustments for project controls */
.dark-theme .project-search-input,
.dark-theme .filter-btn,
.dark-theme .sort-select {
    background: var(--bg-secondary);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-theme .filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.dark-theme .filter-btn:hover {
    background: rgba(59, 130, 246, 0.15);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-12);
}

.project-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    position: relative;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.project-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-color);
}

.project-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.project-description {
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-4);
}

.project-stats {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.project-stat {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

.project-stat i {
    font-size: var(--font-size-sm);
}

.project-languages {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.language-tag {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.project-links {
    padding: var(--space-6);
    display: flex;
    gap: var(--space-4);
}

.project-link {
    flex: 1;
    text-align: center;
    padding: var(--space-3);
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-base);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.project-link:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.project-link.secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.project-link.secondary:hover {
    background: var(--text-primary);
    color: white;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-12);
    color: var(--text-secondary);
}

.loading i {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-4);
    color: var(--primary-color);
}

.projects-cta {
    text-align: center;
}

/* Contact Section */
.contact {
    background: linear-gradient(135deg, rgba(249, 250, 251, 0.8) 0%, rgba(243, 244, 246, 0.6) 100%);
    position: relative;
}

.contact::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23f3f4f6' fill-opacity='0.4'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
    opacity: 0.3;
    z-index: 0;
}

.contact .container {
    position: relative;
    z-index: 1;
}

.contact-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.contact-description {
    font-size: var(--font-size-xl);
    line-height: var(--line-height-loose);
    color: var(--text-secondary);
    margin-bottom: var(--space-16);
    font-weight: var(--font-weight-normal);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.contact-method {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    padding: var(--space-6);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-base);
    border: 2px solid transparent;
}

.contact-method:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.contact-method i {
    font-size: var(--font-size-2xl);
    color: var(--primary-color);
}

/* Contact Form */
.contact-form {
    max-width: 800px;
    margin: 0 auto 4rem;
    text-align: left;
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem 3.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    position: relative;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.form-group {
    margin-bottom: var(--space-8);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-4);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    letter-spacing: 0.025em;
    text-transform: uppercase;
    opacity: 0.9;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1.25rem 1.5rem;
    border: 2px solid rgba(226, 232, 240, 0.6);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-lg);
    font-family: inherit;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    resize: vertical;
    box-sizing: border-box;
    line-height: var(--line-height-normal);
    min-height: 3.5rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-focus);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

.form-group input:hover,
.form-group textarea:hover {
    border-color: rgba(139, 69, 19, 0.3);
    background: rgba(255, 255, 255, 0.9);
}

.form-group input.error,
.form-group textarea.error {
    border-color: #ef4444;
    box-shadow: var(--shadow-focus-error);
    background: rgba(254, 242, 242, 0.8);
}

.error-message {
    display: block;
    margin-top: 0.75rem;
    font-size: var(--font-size-sm);
    color: #ef4444;
    font-weight: var(--font-weight-medium);
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-base);
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
}

.contact-form .btn {
    width: 100%;
    position: relative;
    overflow: hidden;
    padding: 1.25rem 2.5rem;
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-top: 1.5rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.95) 0%, rgba(160, 82, 45, 0.95) 100%);
    border: 2px solid transparent;
    color: var(--text-white);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}

.contact-form .btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(139, 69, 19, 1) 0%, rgba(160, 82, 45, 1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 69, 19, 0.3);
}

.contact-form .btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.contact-form .btn .submit-text,
.contact-form .btn .submit-icon {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.contact-form .btn.loading .submit-text,
.contact-form .btn.loading .submit-icon {
    transform: translateY(-100%);
    opacity: 0;
}

.contact-form .btn.loading .loading-spinner {
    display: block !important;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Enhanced form security and accessibility */
.honeypot {
    display: none !important;
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

.loading-spinner {
    display: none;
}

.recaptcha-container {
    margin: 1.5rem 0;
    display: flex;
    justify-content: center;
}

.form-status {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-base);
    border: 2px solid transparent;
    animation: slideInUp 0.3s ease;
}

.form-status.success {
    background: var(--gradient-success);
    color: #065f46;
    border-color: #10b981;
}

.form-status.error {
    background: var(--gradient-error);
    color: #991b1b;
    border-color: #ef4444;
}

.form-status.info {
    background: var(--gradient-info);
    color: #1e40af;
    border-color: #3b82f6;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Contact form responsive adjustments */
@media (max-width: 768px) {
    .project-controls {
        padding: var(--space-6);
        margin-bottom: var(--space-6);
    }
    
    .filter-controls {
        flex-direction: column;
        gap: var(--space-5);
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .filter-buttons {
        gap: var(--space-2);
    }
    
    .filter-btn {
        padding: var(--space-2) var(--space-4);
        font-size: 0.8rem;
    }
    
    .filter-btn i {
        font-size: 0.9rem;
    }
    
    .sort-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-2);
    }
    
    .sort-select {
        width: 100%;
    }
    
    .project-search-input {
        font-size: var(--font-size-sm);
    }
    
    .contact-form {
        padding: 2rem 1.5rem;
        margin: 0 1rem 3rem;
        max-width: calc(100% - 2rem);
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: var(--space-6);
        margin-bottom: var(--space-6);
    }
    
    .form-group {
        margin-bottom: var(--space-6);
    }
    
    .form-group input,
    .form-group textarea {
        padding: 1rem 1.25rem;
        font-size: var(--font-size-base);
        min-height: 3rem;
    }
    
    .contact-form .btn {
        padding: 1rem 2rem;
        font-size: var(--font-size-base);
        min-height: 3rem;
    }
}

/* Footer */
.footer {
    background: var(--bg-dark);
    color: white;
    text-align: center;
    padding: 2rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.98);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        width: 100%;
        text-align: center;
        transition: var(--transition-base);
        box-shadow: var(--shadow-lg);
        padding: 2rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        margin: 1rem 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: var(--space-8);
        text-align: center;
        padding: 2rem 1rem;
    }

    .hero-title {
        font-size: var(--font-size-4xl);
    }

    .hero-subtitle {
        font-size: var(--font-size-xl);
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-image {
        order: -1;
    }

    .code-animation {
        width: 250px;
        height: 150px;
    }

    .about-highlights {
        grid-template-columns: 1fr;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .badges-grid {
        grid-template-columns: 1fr;
    }

    .pinned-repos {
        grid-template-columns: 1fr;
    }

    .gists-grid {
        grid-template-columns: 1fr;
    }

    .insights-grid {
        grid-template-columns: 1fr;
    }

    .hero-buttons {
        flex-direction: column;
        gap: var(--space-4);
    }

    .contact-methods {
        gap: var(--space-4);
    }

    section {
        padding: 3rem 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }

    .hero-title {
        font-size: var(--font-size-3xl);
    }

    .section-title {
        font-size: var(--font-size-3xl);
    }

    .project-links {
        flex-direction: column;
    }
}
/* Enhanced Project Card Styles */
.project-category {
    display: inline-block;
    padding: 4px 12px;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-xl);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-long-description {
    margin: 15px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-base);
    border-left: 4px solid var(--primary-color);
}

.project-long-description summary {
    cursor: pointer;
    font-weight: var(--font-weight-semibold);
    color: var(--primary-color);
    padding: 5px;
    user-select: none;
    transition: color var(--transition-base);
}

.project-long-description summary:hover {
    color: var(--primary-dark);
}

.project-long-description p {
    margin-top: 10px;
    line-height: var(--line-height-loose);
    color: var(--text-primary);
}

.project-highlights {
    margin-top: 15px;
    padding-left: 20px;
}

.project-highlights li {
    margin: 8px 0;
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
}

.project-highlights li::marker {
    color: var(--primary-color);
}

.project-stat[title] {
    cursor: help;
}

.language-tag.primary {
    background: var(--primary-color);
    color: white;
    font-weight: var(--font-weight-semibold);
}

.status-badge {
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 5px;
}

.status-badge.active-development {
    background: var(--gradient-cool-1);
    color: #0f172a;
}

.status-badge.stable {
    background: var(--gradient-cool-2);
    color: #0f172a;
}

.status-badge.experimental {
    background: var(--gradient-warm-1);
    color: #0f172a;
}

.status-badge.new-project {
    background: var(--gradient-warm-2);
    color: #0f172a;
}

/* Featured Section for Top Projects */
.featured-project {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 2px solid var(--primary-color);
}

/* Improved grid layout for projects */
.projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-8);
}

@media (min-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Animation for project cards on hover */
.project-card {
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.project-card:hover::before {
    left: 100%;
}

/* Skills matrix enhancements */
.skills-matrix {
    margin-top: var(--space-12);
}

.skill-level-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: 5px;
}

.skill-level-bar {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.skill-level-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    transition: width 0.3s ease;
}

/* ========================================
   THEME PICKER
   ======================================== */

.theme-picker-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
}

.theme-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: var(--font-size-2xl);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: var(--shadow-xl);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-picker-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    max-height: 0;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    border: 1px solid var(--border-color);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all var(--transition-base);
    pointer-events: none;
}

.theme-picker-menu.active {
    max-height: 600px;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.theme-picker-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
}

.theme-picker-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.theme-picker-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.theme-picker-close:hover {
    color: var(--error);
    background: var(--bg-tertiary);
}

.theme-options {
    padding: var(--space-4);
    max-height: 400px;
    overflow-y: auto;
}

.theme-option {
    width: 100%;
    padding: var(--space-4);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    margin-bottom: var(--space-3);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.theme-option:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
    transform: translateX(4px);
}

.theme-option.active {
    border-color: var(--primary-color);
    background: rgba(139, 69, 19, 0.05);
    box-shadow: var(--shadow-md);
}

.theme-preview {
    width: 100%;
    height: 50px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-preview .preview-bar {
    height: 15px;
    width: 100%;
}

.theme-preview .preview-content {
    flex: 1;
}

/* Theme preview colors */
.light-preview .preview-bar {
    background: linear-gradient(135deg, #8b4513, #a0522d);
}

.light-preview .preview-content {
    background: #fefefe;
}

.dark-preview .preview-bar {
    background: linear-gradient(135deg, #ff8c42, #ffab40);
}

.dark-preview .preview-content {
    background: #1a0e0a;
}

.high-contrast-preview .preview-bar {
    background: linear-gradient(135deg, #0000ff, #ff0000);
}

.high-contrast-preview .preview-content {
    background: #ffffff;
}

.colorblind-preview .preview-bar {
    background: linear-gradient(135deg, #0072b2, #d55e00);
}

.colorblind-preview .preview-content {
    background: #fefefe;
}

.solarized-preview .preview-bar {
    background: linear-gradient(135deg, #268bd2, #cb4b16);
}

.solarized-preview .preview-content {
    background: #fdf6e3;
}

.theme-name {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: var(--space-1);
}

.theme-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    display: block;
}

.theme-picker-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.theme-option-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.theme-option-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .theme-picker-container {
        bottom: 20px;
        right: 20px;
    }
    
    .theme-toggle {
        width: 48px;
        height: 48px;
        font-size: var(--font-size-xl);
    }
    
    .theme-picker-menu {
        width: calc(100vw - 40px);
        right: -10px;
    }
}

/* Dark theme support - Brown/Orange/Maroon palette */
body.dark-theme {
    --text-primary: #f4e6d3;          /* Warm cream text - WCAG AAA compliant on dark backgrounds */
    --text-secondary: #d2b48c;        /* Tan text - WCAG AA compliant */
    --text-light: #bc9a6a;            /* Darker tan - WCAG AA minimum */
    --text-white: #f4e6d3;            /* Warm cream for dark theme */

    --bg-primary: #1a0e0a;            /* Very dark brown */
    --bg-secondary: #2d1810;          /* Dark brown */
    --bg-tertiary: #3e2723;           /* Medium dark brown */

    --border-color: #3e2723;          /* Medium brown */
    --border-light: #544036;          /* Lighter brown */
    --border-dark: #2d1810;           /* Darker brown */

    --primary-color: #ff8c42;         /* Light orange for dark theme */
    --accent-color: #ffab40;          /* Brighter orange */
    --maroon-primary: #c62828;        /* Brighter maroon */

    /* Enhanced shadows for dark theme */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-base: 0 2px 4px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.6);
}

body.dark-theme .navbar {
    background: rgba(26, 14, 10, 0.95);
}

body.dark-theme .project-card,
body.dark-theme .stat-card,
body.dark-theme .skill-category {
    background: rgba(45, 24, 16, 0.8);
    border: 1px solid var(--border-color);
}

/* Dark theme contact form styles */
body.dark-theme .contact-form {
    background: rgba(26, 14, 10, 0.95);
    border: 2px solid var(--border-color);
    backdrop-filter: blur(20px) saturate(1.5);
    box-shadow: var(--shadow-2xl);
}

body.dark-theme .contact-form input,
body.dark-theme .contact-form textarea {
    background: rgba(45, 24, 16, 0.8);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-theme .contact-form input::placeholder,
body.dark-theme .contact-form textarea::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

body.dark-theme .contact-form input:focus,
body.dark-theme .contact-form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-focus);
}

body.dark-theme .contact-form .btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: var(--bg-primary);
    border: 2px solid transparent;
}

body.dark-theme .contact-form .btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--primary-color) 100%);
}

body.dark-theme .form-status.success {
    background: var(--gradient-success);
    color: var(--success-dark);
    border-color: var(--success);
}

body.dark-theme .form-status.error {
    background: var(--gradient-error);
    color: var(--error-dark);
    border-color: var(--error);
}

body.dark-theme .form-status.info {
    background: var(--gradient-info);
    color: var(--info-dark);
    border-color: var(--info);
}

/* ========================================
   HIGH CONTRAST THEME
   ======================================== */
body.high-contrast-theme {
    --text-primary: #000000;
    --text-secondary: #1a1a1a;
    --text-light: #333333;
    --text-white: #ffffff;

    --bg-primary: #ffffff;
    --bg-secondary: #f0f0f0;
    --bg-tertiary: #e0e0e0;
    --bg-dark: #000000;

    --border-color: #000000;
    --border-light: #333333;
    --border-dark: #000000;

    --primary-color: #0000ff;        /* Pure blue for maximum contrast */
    --secondary-color: #000080;      /* Navy blue */
    --accent-color: #ff0000;         /* Pure red */
    --maroon-primary: #800000;       /* Maroon */

    --success: #008000;              /* Pure green */
    --error: #ff0000;                /* Pure red */
    --info: #0000ff;                 /* Pure blue */
    --warning: #ff8c00;              /* Dark orange */

    /* High contrast shadows */
    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 8px 0 rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 16px 0 rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 12px 24px 0 rgba(0, 0, 0, 0.7);
}

body.high-contrast-theme .project-card,
body.high-contrast-theme .stat-card,
body.high-contrast-theme .skill-category {
    border: 2px solid #000000;
}

body.high-contrast-theme .btn {
    border: 2px solid #000000;
}

body.high-contrast-theme .navbar {
    border-bottom: 3px solid #000000;
}

/* ========================================
   COLORBLIND-FRIENDLY THEME (Deuteranopia/Protanopia optimized)
   ======================================== */
body.colorblind-theme {
    --text-primary: #2d1810;
    --text-secondary: #5d4037;
    --text-light: #8d6e63;
    --text-white: #fef7ed;

    --bg-primary: #fefefe;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #eeeeee;
    --bg-dark: #212121;

    --border-color: #9e9e9e;
    --border-light: #e0e0e0;
    --border-dark: #616161;

    /* Colorblind-safe palette: Blue/Orange/Yellow/Gray */
    --primary-color: #0072b2;        /* Safe blue */
    --secondary-color: #56b4e9;      /* Sky blue */
    --accent-color: #f0e442;         /* Yellow */
    --maroon-primary: #d55e00;       /* Vermillion (orange) */

    --success: #009e73;              /* Bluish green */
    --error: #d55e00;                /* Vermillion */
    --info: #56b4e9;                 /* Sky blue */
    --warning: #f0e442;              /* Yellow */
    
    --chart-1: #0072b2;
    --chart-2: #56b4e9;
    --chart-3: #009e73;
    --chart-4: #f0e442;
    --chart-5: #d55e00;
}

/* ========================================
   SOLARIZED THEME (Bonus - Popular developer theme)
   ======================================== */
body.solarized-theme {
    --text-primary: #657b83;         /* Base00 */
    --text-secondary: #839496;       /* Base0 */
    --text-light: #93a1a1;           /* Base1 */
    --text-white: #fdf6e3;           /* Base3 */

    --bg-primary: #fdf6e3;           /* Base3 - Light */
    --bg-secondary: #eee8d5;         /* Base2 */
    --bg-tertiary: #93a1a1;          /* Base1 */
    --bg-dark: #002b36;              /* Base03 */

    --border-color: #93a1a1;
    --border-light: #eee8d5;
    --border-dark: #657b83;

    --primary-color: #268bd2;        /* Blue */
    --secondary-color: #2aa198;      /* Cyan */
    --accent-color: #cb4b16;         /* Orange */
    --maroon-primary: #dc322f;       /* Red */

    --success: #859900;              /* Green */
    --error: #dc322f;                /* Red */
    --info: #268bd2;                 /* Blue */
    --warning: #b58900;              /* Yellow */
}

/* Print styles for resume */
@media print {
    .navbar,
    .theme-toggle,
    .scroll-indicator,
    .hero-buttons,
    .hero-social,
    footer {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .project-card,
    .stat-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    section {
        page-break-inside: avoid;
    }
}

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

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
details:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth loading animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* Responsive improvements for project cards on mobile */
@media (max-width: 768px) {
    .project-long-description {
        padding: 10px;
        font-size: var(--font-size-sm);
    }

    .project-highlights {
        padding-left: 15px;
        font-size: var(--font-size-sm);
    }

    .project-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-2);
    }

    .theme-toggle {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* Top Starred Projects Section */
.top-projects-highlight {
    margin-bottom: var(--space-12);
    padding: var(--space-8);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
}

.section-intro {
    text-align: center;
    max-width: 800px;
    margin: 1rem auto 2rem;
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-loose);
}

.top-projects-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-12);
    padding: var(--space-8);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.summary-stat {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.summary-stat i {
    font-size: var(--font-size-4xl);
    color: var(--primary-color);
}

.stat-info h4 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.top-projects-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.top-project-card {
    position: relative;
    background: white;
    border-radius: var(--radius-md);
    padding: var(--space-8);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
    border-left: 4px solid var(--primary-color);
}

.top-project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.rank-badge {
    position: absolute;
    top: -15px;
    left: 2rem;
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    box-shadow: var(--shadow-md);
}

.top-project-content {
    margin-top: 1rem;
}

.top-project-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.project-category-badge {
    padding: 6px 14px;
    background: var(--gradient-accent);
    color: white;
    border-radius: var(--radius-xl);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.top-project-title {
    font-size: var(--font-size-2xl);
    margin: 0;
}

.top-project-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-base);
}

.top-project-title a:hover {
    color: var(--primary-color);
}

.top-project-description {
    color: var(--text-secondary);
    line-height: var(--line-height-loose);
    margin: 1rem 0;
    font-size: var(--font-size-lg);
}

.top-project-highlights {
    margin: 1.5rem 0;
    padding: var(--space-4);
    background: rgba(102, 126, 234, 0.05);
    border-radius: var(--radius-base);
    border-left: 3px solid var(--primary-color);
}

.top-project-highlights strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: var(--space-2);
}

.top-project-highlights ul {
    margin: 0;
    padding-left: 1.5rem;
}

.top-project-highlights li {
    margin: 0.5rem 0;
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
}

.top-project-tech {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.top-project-tech strong {
    color: var(--text-primary);
}

.tech-badge {
    padding: 6px 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-base);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
}

.tech-badge:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.top-project-stats {
    display: flex;
    gap: var(--space-4);
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.stat-badge i {
    color: var(--primary-color);
}

.top-project-links {
    display: flex;
    gap: var(--space-4);
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 10px 20px;
    font-size: var(--font-size-sm);
}

/* Dark theme adjustments for top projects */
body.dark-theme .top-projects-highlight {
    background: rgba(30, 41, 59, 0.5);
    border-color: var(--border-color);
}

body.dark-theme .top-projects-summary,
body.dark-theme .top-project-card {
    background: rgba(30, 41, 59, 0.8);
}

body.dark-theme .tech-badge,
body.dark-theme .stat-badge {
    background: rgba(15, 23, 42, 0.8);
    border-color: var(--border-color);
}

body.dark-theme .top-project-highlights {
    background: rgba(102, 126, 234, 0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .top-projects-summary {
        grid-template-columns: 1fr;
        gap: var(--space-6);
        padding: var(--space-6);
    }
    
    .top-project-card {
        padding: var(--space-6);
    }
    
    .rank-badge {
        width: 40px;
        height: 40px;
        font-size: var(--font-size-base);
        top: -10px;
        left: 1rem;
    }
    
    .top-project-title {
        font-size: var(--font-size-xl);
    }
    
    .top-project-links {
        flex-direction: column;
    }
    
    .btn-sm {
        width: 100%;
        justify-content: center;
    }
}

/* Resume download button */
.resume-download {
    background: var(--gradient-primary) !important;
    color: white !important;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
}

.resume-download:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Skills Matrix */
.skills-matrix {
    margin-top: var(--space-12);
    padding-top: 3rem;
    border-top: 2px solid var(--border-color);
}

.skills-matrix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-6);
    margin-top: var(--space-8);
}

.skill-matrix-item {
    padding: var(--space-6);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.skill-matrix-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.skill-matrix-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.skill-name {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-lg);
    color: var(--text-primary);
}

.skill-level-label {
    padding: 4px 10px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
}

.skill-experience {
    margin-top: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Project filters */
.project-filters {
    margin: 2rem 0;
    text-align: center;
}

.filter-buttons {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 24px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-secondary);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all var(--transition-base);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--gradient-primary);
    border-color: var(--primary-color);
    color: white;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-accent);
    border: none;
    color: white;
    font-size: var(--font-size-xl);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

/* Visit counter */
.visit-count {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: 1rem;
}

/* Enhanced loading states */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    color: var(--text-secondary);
}

.loading i {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-4);
    animation: spin 1s linear infinite;
}

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

.loading p {
    font-size: var(--font-size-base);
}

/* Error states */
.error-message,
.no-activity {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-secondary);
    font-style: italic;
}

/* Print styles enhancements */
@media print {
    @page {
        margin: 1cm;
    }
    
    .theme-toggle,
    .back-to-top,
    .filter-buttons,
    .scroll-indicator,
    .hero-buttons,
    .hero-social,
    .navbar,
    footer,
    .loading,
    .project-links,
    .contact-methods {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .hero {
        padding: 2rem 0 !important;
    }
    
    .hero-title {
        font-size: 2rem !important;
    }
    
    section {
        page-break-inside: avoid;
        padding: 1rem 0 !important;
    }
    
    .section-title {
        font-size: 1.5rem !important;
        border-bottom: 2px solid black;
        padding-bottom: 0.5rem;
    }
    
    .project-card,
    .stat-card,
    .skill-matrix-item {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        margin-bottom: var(--space-4);
    }
    
    a {
        text-decoration: none;
        color: black !important;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: var(--font-size-sm);
        color: #666;
    }
}

/* Dark theme adjustments for new features */
body.dark-theme .skill-matrix-item,
body.dark-theme .filter-btn {
    background: rgba(30, 41, 59, 0.8);
}

body.dark-theme .filter-btn.active {
    background: var(--gradient-primary);
}

body.dark-theme .visit-count {
    background: rgba(15, 23, 42, 0.8);
}

/* Accessibility - Focus visible improvements */
.filter-btn:focus-visible,
.back-to-top:focus-visible,
.theme-toggle:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}

/* Animation for elements entering viewport */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out forwards;
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out forwards;
}

/* Skeleton loading states */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-primary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive adjustments for new features */
@media (max-width: 768px) {
    .skills-matrix-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-buttons {
        gap: var(--space-2);
    }
    
    .filter-btn {
        padding: 8px 16px;
        font-size: var(--font-size-sm);
    }
    
    .back-to-top {
        bottom: 80px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .project-card,
    .stat-card,
    .skill-matrix-item {
        border: 2px solid currentColor;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus trap for modals (if added in future) */
.modal-open {
    overflow: hidden;
}

/* Advanced Analytics Dashboard */
.analytics-dashboard {
    padding: var(--space-20) 0;
    background: linear-gradient(135deg, var(--background-color) 0%, var(--card-background) 100%);
}

.analytics-nav {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: thin;
}

.analytics-tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    font-weight: var(--font-weight-medium);
}

.analytics-tab:hover {
    color: var(--text-color);
    background: rgba(74, 144, 226, 0.1);
}

.analytics-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(74, 144, 226, 0.1);
}

.analytics-tab i {
    font-size: var(--font-size-lg);
}

.analytics-content {
    position: relative;
}

.analytics-panel {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.analytics-panel.active {
    display: block;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.analytics-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.analytics-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.analytics-card.full-width {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
    background: linear-gradient(135deg, var(--primary-color), #5a67d8);
    color: white;
}

.card-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

.card-header i {
    font-size: var(--font-size-xl);
    opacity: 0.9;
}

.card-controls {
    display: flex;
    gap: var(--space-4);
}

.year-selector,
.period-selector {
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-base);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.year-selector option,
.period-selector option {
    background: var(--card-background);
    color: var(--text-color);
}

.card-content {
    padding: var(--space-6);
    min-height: 200px;
}

/* Chart Canvas Styles */
.chart-canvas {
    max-width: 100%;
    max-height: 300px;
}

/* Overview Stats */
.overview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-6);
}

.stat-item {
    text-align: center;
    padding: var(--space-4);
    background: var(--background-color);
    border-radius: var(--radius-base);
    border: 1px solid var(--border-color);
}

.stat-value {
    display: block;
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-change {
    font-size: var(--font-size-xs);
    margin-top: 0.25rem;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--error);
}

/* Contribution Heatmap */
.heatmap-container {
    overflow-x: auto;
    padding: 1rem 0;
}

.contribution-heatmap {
    display: grid;
    grid-template-columns: repeat(53, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: var(--space-1);
    min-width: 700px;
    margin: 1rem auto;
}

.heatmap-day {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.heatmap-day:hover {
    transform: scale(1.2);
    border-color: var(--primary-color);
}

.heatmap-day[data-level="0"] {
    background: var(--background-color);
}

.heatmap-day[data-level="1"] {
    background: var(--chart-1);
}

.heatmap-day[data-level="2"] {
    background: var(--chart-2);
}

.heatmap-day[data-level="3"] {
    background: var(--chart-3);
}

.heatmap-day[data-level="4"] {
    background: var(--chart-4);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: 1rem;
}

.legend-colors {
    display: flex;
    gap: var(--space-1);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.legend-color[data-level="0"] { background: var(--background-color); }
.legend-color[data-level="1"] { background: var(--chart-1); }
.legend-color[data-level="2"] { background: var(--chart-2); }
.legend-color[data-level="3"] { background: var(--chart-3); }
.legend-color[data-level="4"] { background: var(--chart-4); }

.legend-label {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
}

/* Contribution Stats */
.contribution-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-4);
}

.contrib-stat {
    text-align: center;
    padding: var(--space-4);
    background: var(--background-color);
    border-radius: var(--radius-base);
    border: 1px solid var(--border-color);
}

.contrib-stat .value {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--primary-color);
}

.contrib-stat .label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Language Stats */
.language-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.language-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3);
    background: var(--background-color);
    border-radius: var(--radius-base);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.language-item:hover {
    background: rgba(74, 144, 226, 0.05);
    border-color: var(--primary-color);
}

.language-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.language-name {
    font-weight: var(--font-weight-semibold);
    min-width: 100px;
}

.language-bar {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.language-bar-fill {
    height: 100%;
    background: var(--gradient-data);
    border-radius: var(--radius-sm);
    transition: width 0.8s ease;
}

.language-percentage {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    min-width: 45px;
    text-align: right;
}

/* Daily Activity Heatmap */
.activity-heatmap {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: var(--space-1);
    padding: var(--space-4);
    background: var(--background-color);
    border-radius: var(--radius-base);
}

.activity-hour {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.activity-hour:hover {
    transform: scale(1.1);
}

.activity-hour[data-intensity="0"] { background: var(--background-color); }
.activity-hour[data-intensity="1"] { background: #fef5e7; }
.activity-hour[data-intensity="2"] { background: #fed7aa; }
.activity-hour[data-intensity="3"] { background: #fb923c; }
.activity-hour[data-intensity="4"] { background: #ea580c; }

/* Top Repos Chart */
.top-repos-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.repo-bar {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.repo-name {
    min-width: 120px;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
}

.repo-bar-container {
    flex: 1;
    height: 24px;
    background: var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
}

.repo-bar-fill {
    height: 100%;
    background: var(--gradient-data);
    border-radius: var(--radius-md);
    transition: width 0.8s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
}

.repo-stars {
    color: white;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
}

/* Dark Theme Adjustments */
body.dark-theme .analytics-dashboard {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

body.dark-theme .heatmap-day[data-level="1"] { background: #654321; }
body.dark-theme .heatmap-day[data-level="2"] { background: #8b4513; }
body.dark-theme .heatmap-day[data-level="3"] { background: #a0522d; }
body.dark-theme .heatmap-day[data-level="4"] { background: var(--chart-4); }

body.dark-theme .legend-color[data-level="1"] { background: #654321; }
body.dark-theme .legend-color[data-level="2"] { background: #8b4513; }
body.dark-theme .legend-color[data-level="3"] { background: #a0522d; }
body.dark-theme .legend-color[data-level="4"] { background: var(--chart-4); }

body.dark-theme .activity-hour[data-intensity="1"] { background: #2d3748; }
body.dark-theme .activity-hour[data-intensity="2"] { background: #4a5568; }
body.dark-theme .activity-hour[data-intensity="3"] { background: #718096; }
body.dark-theme .activity-hour[data-intensity="4"] { background: #a0aec0; }

/* Loading Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.analytics-card .loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    color: var(--text-secondary);
}

.analytics-card .loading i {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-4);
    animation: spin 1s linear infinite;
}

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

/* Error States */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    color: var(--text-secondary);
    text-align: center;
}

.error-state i {
    font-size: var(--font-size-3xl);
    color: var(--error);
    margin-bottom: var(--space-4);
}

.retry-btn {
    margin-top: 1rem;
    padding: var(--space-2) var(--space-4);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-base);
    cursor: pointer;
    transition: all 0.2s ease;
}

.retry-btn:hover {
    background: #5a67d8;
}

/* Tooltip for heatmap and activity items */
.tooltip {
    position: absolute;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-base);
    padding: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--text-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: var(--z-dropdown);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip.visible {
    opacity: 1;
}

/* Chart placeholders styling */
canvas {
    border-radius: var(--radius-base);
    background: var(--background-color);
}

/* Fade-in animation for panels */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive Search Controls */
@media (max-width: 768px) {
    .projects-controls {
        padding: var(--space-4);
    }
    
    .search-filter-row,
    .sort-view-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }
    
    .filter-controls {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-1);
    }
    
    .sort-controls {
        justify-content: space-between;
    }
    
    .results-info {
        margin-left: 0;
        justify-content: space-between;
    }
    
    .search-container {
        min-width: auto;
        max-width: none;
    }
    
    /* List view adjustments for mobile */
    .projects-grid.list-view .project-card {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }
    
    .projects-grid.list-view .project-card .project-header {
        flex: none;
        margin-right: 0;
        margin-bottom: 0.75rem;
    }
    
    .projects-grid.list-view .project-card .project-content {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }
    
    /* Analytics Dashboard Mobile */
    .analytics-dashboard {
        padding: 3rem 0;
    }
    
    .analytics-nav {
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    
    .analytics-tab {
        padding: var(--space-3) var(--space-4);
        font-size: var(--font-size-sm);
    }
    
    .analytics-tab span {
        display: none;
    }
    
    .analytics-tab i {
        font-size: var(--font-size-xl);
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }
    
    .card-header {
        padding: var(--space-4);
    }
    
    .card-header h3 {
        font-size: var(--font-size-base);
    }
    
    .card-content {
        padding: var(--space-4);
        min-height: 150px;
    }
    
    .overview-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }
    
    .contribution-heatmap {
        grid-template-columns: repeat(26, 1fr);
        min-width: 350px;
    }
    
    .heatmap-day {
        width: 8px;
        height: 8px;
    }
    
    .language-item {
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    
    .language-name {
        min-width: 80px;
    }
    
    .activity-heatmap {
        grid-template-columns: repeat(12, 1fr);
        grid-template-rows: repeat(14, 1fr);
    }
    
    .repo-bar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-2);
    }
    
    .repo-name {
        min-width: auto;
        text-align: center;
    }
    
    .chart-canvas {
        max-height: 200px;
    }
}

/* Enhanced Navigation Mobile Styles */
@media (max-width: 768px) {
    .floating-toc {
        right: 1rem;
        bottom: 2rem;
        top: auto;
        transform: none;
    }
    
    .toc-content {
        right: 0;
        bottom: 60px;
        top: auto;
        max-width: 280px;
        width: calc(100vw - 2rem);
    }
    
    .keyboard-help-content {
        padding: var(--space-6);
        margin: 1rem;
    }
    
    .shortcut-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
    
    .shortcut-item {
        padding: var(--space-2);
    }
}

@media (max-width: 480px) {
    .scroll-progress {
        height: 3px;
    }
    
    .toc-toggle {
        width: 44px;
        height: 44px;
        font-size: var(--font-size-base);
    }
    
    .toc-content {
        width: calc(100vw - 1rem);
        right: -0.5rem;
    }
    
    .keyboard-help-content {
        margin: 0.5rem;
        padding: var(--space-4);
    }
    
    .shortcut-item kbd {
        font-size: var(--font-size-xs);
        padding: 0.1875rem 0.375rem;
    }
}

/* Dark Theme Support for Enhanced Navigation */
body.dark-theme .scroll-progress {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-theme .toc-content,
body.dark-theme .keyboard-help-content {
    background: #1f2937;
    border-color: #374151;
}

body.dark-theme .toc-title {
    color: #f9fafb;
}

body.dark-theme .toc-links a {
    color: #d1d5db;
}

body.dark-theme .toc-links a:hover,
body.dark-theme .toc-links a.active {
    color: var(--accent-color);
}

body.dark-theme .shortcut-item {
    background: #374151;
}

body.dark-theme .shortcut-item kbd {
    background: #f9fafb;
    color: #1f2937;
}

body.dark-theme .shortcut-item span {
    color: #d1d5db;
}

body.dark-theme .keyboard-help-close {
    color: #d1d5db;
}

body.dark-theme .keyboard-help-close:hover {
    color: #f9fafb;
    background: #374151;
}

/* Global Search Modal */
.global-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 10001;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none;
    transition: all var(--transition-base);
    backdrop-filter: blur(5px);
    padding-top: 10vh;
}

.global-search-modal.visible {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: all;
}

.global-search-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.global-search-modal.visible .global-search-content {
    transform: translateY(0);
}

.global-search-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-color);
}

.global-search-input-container {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: var(--space-4);
}

.global-search-icon {
    color: var(--text-secondary);
    font-size: var(--font-size-xl);
}

.global-search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: var(--font-size-lg);
    color: var(--text-primary);
    outline: none;
}

.global-search-input::placeholder {
    color: var(--text-light);
}

.global-search-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-base);
    transition: all var(--transition-base);
}

.global-search-close:hover {
    color: var(--text-primary);
    background: var(--bg-primary);
}

.search-categories {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.search-category {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.search-category:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.search-category.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.global-search-results {
    max-height: 50vh;
    overflow-y: auto;
}

.search-results-empty {
    text-align: center;
    padding: var(--space-12) var(--space-8);
    color: var(--text-secondary);
}

.search-results-empty i {
    font-size: var(--font-size-5xl);
    margin-bottom: var(--space-4);
    color: var(--text-light);
}

.search-results-empty h3 {
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.search-tips {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.search-tip {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-xs);
}

.search-tip kbd {
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
}

.search-results-content {
    padding: 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-base);
}

.search-result-item:hover,
.search-result-item.highlighted {
    background: var(--bg-secondary);
}

.search-result-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-base);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    font-size: var(--font-size-lg);
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: var(--font-size-base);
}

.search-result-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: var(--line-height-snug);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--text-light);
}

.search-result-category {
    background: var(--accent-color);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
}

/* Enhanced Projects Search Features */
.search-results-summary {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
    border: 1px solid var(--border-color);
}

.search-summary-content h3 {
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.search-query {
    background: var(--primary-color);
    color: white;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.search-metrics {
    display: flex;
    gap: var(--space-6);
    margin-top: 1rem;
    flex-wrap: wrap;
}

.metric {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.metric i {
    color: var(--accent-color);
}

.search-suggestions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.saved-searches, .related-projects {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-8);
}

.saved-searches-title, .related-title {
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--font-size-lg);
}

.saved-searches-list, .related-projects-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.saved-search-item, .related-project-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: var(--font-size-sm);
}

.saved-search-item:hover, .related-project-item:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.save-search-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-base);
    cursor: pointer;
    font-size: var(--font-size-sm);
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.save-search-btn:hover {
    background: var(--primary-color);
    transform: translateY(-1px);
}

/* Mobile Responsiveness for Content Discovery */
@media (max-width: 768px) {
    .global-search-modal {
        padding-top: 5vh;
    }
    
    .global-search-content {
        width: 95%;
        margin: 0 auto;
    }
    
    .global-search-header {
        padding: var(--space-4);
    }
    
    .search-categories {
        justify-content: center;
    }
    
    .search-result-item {
        padding: var(--space-3) var(--space-4);
    }
    
    .search-result-icon {
        width: 32px;
        height: 32px;
        font-size: var(--font-size-base);
    }
    
    .search-metrics {
        flex-direction: column;
        gap: var(--space-3);
    }
}

/* Dark Theme Support */
body.dark-theme .global-search-content {
    background: #1f2937;
}

body.dark-theme .global-search-input-container {
    background: #374151;
}

body.dark-theme .search-category {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
}

body.dark-theme .search-result-item:hover,
body.dark-theme .search-result-item.highlighted {
    background: #374151;
}

body.dark-theme .search-results-summary,
body.dark-theme .saved-searches,
body.dark-theme .related-projects {
    background: #374151;
    border-color: #4b5563;
}

body.dark-theme .saved-search-item,
body.dark-theme .related-project-item {
    background: #1f2937;
    border-color: #4b5563;
    color: #d1d5db;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-2); }
.mb-2 { margin-bottom: var(--space-4); }
.mb-3 { margin-bottom: var(--space-6); }
.mb-4 { margin-bottom: var(--space-8); }

.p-1 { padding: var(--space-2); }
.p-2 { padding: var(--space-4); }
.p-3 { padding: var(--space-6); }
.p-4 { padding: var(--space-8); }

/* Visual Enhancement Animations and Effects */

/* Enhanced Scroll Animations */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-50px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

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

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: 200px 0;
    }
}

/* Enhanced Button Micro-interactions */
.btn-enhanced {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
    z-index: 1;
    pointer-events: none;
}

.btn-enhanced:hover::before {
    left: 100%;
}

.btn-enhanced:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.btn-enhanced:active {
    transform: translateY(-1px);
    transition-duration: 0.1s;
}

/* Enhanced Card Animations */
.project-card,
.skill-category,
.stat-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.project-card::before,
.skill-category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.project-card:hover,
.skill-category:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.project-card:hover::before,
.skill-category:hover::before {
    opacity: 0.05;
}

/* Enhanced stats card hover removed - will enhance existing */

/* Enhanced Loading Skeleton - using existing .skeleton selector */

.skeleton-text {
    height: 1rem;
    margin-bottom: var(--space-2);
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: var(--space-4);
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius-lg);
}

/* Micro-interaction Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.hover-glow {
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 25px rgba(139, 69, 19, 0.3);
    transform: scale(1.02);
}

.pulse-on-hover:hover {
    animation: pulse 0.6s ease-in-out;
}

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

/* Enhanced Loading States */
.loading-dots {
    display: inline-flex;
    gap: var(--space-1);
    align-items: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: loading-bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Particle Effect Background */
.particles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: particle-float linear infinite;
}

@keyframes particle-float {
    0% {
        transform: translateY(100vh) translateX(0px);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) translateX(100px);
        opacity: 0;
    }
}

/* Enhanced Focus States */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.3);
    border-radius: var(--radius-sm);
}

/* Scroll-triggered Animations */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced slide animations - using existing selectors */

.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-in.revealed {
    opacity: 1;
    transform: scale(1);
}

/* Staggered Animations */
.stagger-container .stagger-item {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-container .stagger-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

.stagger-item:nth-child(1).revealed { transition-delay: 0.1s; }
.stagger-item:nth-child(2).revealed { transition-delay: 0.2s; }
.stagger-item:nth-child(3).revealed { transition-delay: 0.3s; }
.stagger-item:nth-child(4).revealed { transition-delay: 0.4s; }
.stagger-item:nth-child(5).revealed { transition-delay: 0.5s; }
.stagger-item:nth-child(6).revealed { transition-delay: 0.6s; }
.stagger-item:nth-child(7).revealed { transition-delay: 0.7s; }
.stagger-item:nth-child(8).revealed { transition-delay: 0.8s; }

/* Performance Optimizations */
.gpu-accelerated {
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-on-scroll,
    .reveal-on-scroll,
    .slide-in-left,
    .slide-in-right,
    .scale-in,
    .stagger-item {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Dark Theme Enhancements */
body.dark-theme .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
}

body.dark-theme .particle {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .hover-glow:hover {
    box-shadow: 0 0 25px rgba(255, 107, 53, 0.2);
}

/* Additional Animation Effects */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Keyboard Navigation Enhancement */
body.keyboard-navigation .focus-ring:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading State Enhancements */
.loaded {
    animation: loadComplete 0.5s ease-out;
}

@keyframes loadComplete {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Advanced Mobile Optimization & Touch Gestures */

/* Touch-Friendly Interactive Elements */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Enhanced Touch States */
.touch-feedback {
    transition: all 0.1s ease;
    position: relative;
    overflow: hidden;
}

.touch-feedback:active {
    transform: scale(0.98);
    background-color: rgba(139, 69, 19, 0.1);
}

.touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    pointer-events: none;
}

.touch-feedback.touched::after {
    width: 100px;
    height: 100px;
}

/* Swipe Navigation Container */
.swipe-container {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.swipe-wrapper {
    display: flex;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.swipe-slide {
    min-width: 100%;
    flex-shrink: 0;
}

/* Swipe Indicators */
.swipe-indicators {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    padding: 16px 0;
}

.swipe-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(139, 69, 19, 0.3);
    transition: all var(--transition-base);
    cursor: pointer;
}

.swipe-indicator.active {
    background: var(--primary-color);
    transform: scale(1.2);
}

/* Project Gallery Touch Enhancements */
.project-gallery {
    position: relative;
    touch-action: pan-y;
}

.project-cards-container {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 20px;
}

.project-cards-container::-webkit-scrollbar {
    display: none;
}

.project-cards-container .project-card {
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

/* Mobile-Optimized Project Card Layout */
@media (max-width: 768px) {
    .projects-grid {
        display: flex;
        overflow-x: auto;
        gap: var(--space-5);
        padding: 0 20px 20px 20px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    .project-card {
        min-width: 280px;
        max-width: 320px;
        scroll-snap-align: start;
        flex-shrink: 0;
    }
    
    .project-card:first-child {
        margin-left: 0;
    }
    
    .project-card:last-child {
        margin-right: 20px;
    }
}

/* Pull-to-Refresh Indicator */
.pull-to-refresh {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--primary-color);
    font-size: var(--font-size-sm);
    opacity: 0;
    transition: all var(--transition-base);
}

.pull-to-refresh.visible {
    opacity: 1;
    top: 20px;
}

.pull-to-refresh .icon {
    animation: spin 1s linear infinite;
}

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

/* Enhanced Mobile Navigation */
@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 280px;
        background: var(--bg-primary);
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 80px 20px 20px;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        z-index: 999;
        border-left: 1px solid var(--border-color);
        backdrop-filter: blur(20px);
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links li {
        width: 100%;
        margin: 0 0 20px 0;
    }
    
    .nav-links a {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 15px 20px;
        border-radius: var(--radius-md);
        font-size: var(--font-size-base);
        transition: all var(--transition-base);
    }
    
    .nav-links a:hover,
    .nav-links a.active {
        background: var(--primary-color);
        color: white;
        transform: translateX(5px);
    }
    
    /* Mobile Menu Overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
        z-index: 998;
        backdrop-filter: blur(2px);
    }
    
    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Touch-Optimized Button Styles */
.btn-touch {
    min-height: 48px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-touch:active {
    transform: scale(0.96);
}

/* Improved Touch Targets for Small Elements */
.skill-tag,
.tech-tag {
    min-height: 36px;
    padding: 8px 16px;
    touch-action: manipulation;
}

/* Swipe Gesture Visual Feedback */
.swipe-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    opacity: 0.7;
    animation: swipeHint 2s ease-in-out infinite;
}

@keyframes swipeHint {
    0%, 100% {
        transform: translateX(-50%);
    }
    50% {
        transform: translateX(-40%);
    }
}

/* Mobile-Specific Contact Form Enhancements */
@media (max-width: 768px) {
    .contact-form {
        padding: var(--space-5);
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-input,
    .form-textarea {
        min-height: 48px;
        font-size: var(--font-size-base); /* Prevents zoom on iOS */
        border-radius: var(--radius-md);
        padding: 15px 20px;
    }
    
    .form-textarea {
        min-height: 120px;
        resize: vertical;
    }
    
    .submit-button {
        width: 100%;
        min-height: 52px;
        font-size: var(--font-size-lg);
        border-radius: var(--radius-md);
        margin-top: 10px;
    }
}

/* Gesture Recognition Feedback */
.gesture-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    z-index: var(--z-tooltip);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gesture-feedback.show {
    opacity: 1;
}

/* Performance Optimizations for Touch */
.gpu-layer {
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Smooth Scroll for Mobile */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Enhanced Mobile Theme Switcher */
@media (max-width: 768px) {
    .theme-toggle {
        width: 60px;
        height: 32px;
        padding: 4px;
    }
    
    .theme-toggle::before {
        width: 24px;
        height: 24px;
    }
}

/* Mobile-Optimized Statistics Cards */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-4);
        padding: 0 15px;
    }
    
    .stat-card {
        padding: 20px 15px;
        min-height: 100px;
    }
    
    .stat-value {
        font-size: var(--font-size-2xl);
        line-height: var(--line-height-tight);
    }
    
    .stat-label {
        font-size: var(--font-size-xs);
        margin-top: 5px;
    }
}

/* Advanced Portfolio Analytics Dashboard Styles */

.live-analytics-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-5);
    margin-bottom: 30px;
    padding: var(--space-5);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.metric-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.metric-card h4 {
    color: var(--primary-color);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.metric-card h4::before {
    content: '📊';
    font-size: var(--font-size-lg);
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(var(--border-color-rgb), 0.3);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
}

.metric-value {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    font-family: 'Monaco', 'Menlo', monospace;
    background: rgba(var(--primary-color-rgb), 0.1);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

/* Events Log Styling */
.events-log {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-base);
    background: var(--bg-secondary);
}

.event-item {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(var(--border-color-rgb), 0.3);
    font-size: var(--font-size-xs);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    animation: slideInEvent 0.3s ease;
}

.event-item:last-child {
    border-bottom: none;
}

.event-time {
    color: var(--text-secondary);
    font-family: monospace;
    font-size: var(--font-size-xs);
    background: rgba(var(--text-secondary-rgb), 0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

.event-name {
    color: var(--primary-color);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xs);
}

.event-data {
    color: var(--text-secondary);
    font-family: monospace;
    font-size: var(--font-size-xs);
    background: rgba(var(--accent-color-rgb), 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes slideInEvent {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Real-time Metric Animations */
.metric-value.updated {
    background: rgba(var(--success-color-rgb), 0.2);
    transform: scale(1.05);
}

/* Performance Status Indicators */
.metric-value[id="lcp-metric"] {
    color: var(--success-color);
}

.metric-value[id="fid-metric"] {
    color: var(--success-color);
}

.metric-value[id="cls-metric"] {
    color: var(--success-color);
}

/* Performance warning states */
.metric-value.warning {
    color: var(--warning-color) !important;
    background: rgba(var(--warning-color-rgb), 0.1);
}

.metric-value.error {
    color: var(--error-color) !important;
    background: rgba(var(--error-color-rgb), 0.1);
}

/* Analytics Dashboard Mobile Responsiveness */
@media (max-width: 768px) {
    .live-analytics-metrics {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: var(--space-4);
    }
    
    .metric-card {
        padding: 15px;
    }
    
    .metric-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-1);
    }
    
    .metric-value {
        font-size: var(--font-size-xs);
        padding: 4px 8px;
    }
    
    .events-log {
        max-height: 150px;
    }
    
    .event-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 6px 10px;
    }
    
    .event-data {
        max-width: 100%;
    }
}

/* Analytics Export Button */
.analytics-export {
    margin-top: 20px;
    text-align: center;
}

.export-button {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-base);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.export-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.export-button::before {
    content: '📥';
}

/* Analytics Status Indicators */
.analytics-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-base);
    padding: 8px 12px;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    z-index: var(--z-dropdown);
    box-shadow: var(--shadow-md);
    display: none;
}

.analytics-status.active {
    display: block;
    animation: slideInRight 0.3s ease;
}

.analytics-status::before {
    content: '🟢';
    margin-right: 6px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Enhanced Dark Theme Support for Analytics */
body.dark-theme .live-analytics-metrics {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .metric-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .events-log {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .event-item {
    border-color: rgba(255, 255, 255, 0.05);
}

/* Cloudflare Analytics Integration Status */
.cf-analytics-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-xs);
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-base);
    border: 1px solid;
    cursor: help;
    transition: all 0.3s ease;
}

.cf-analytics-status .status-indicator {
    font-size: 10px;
    transition: color 0.3s ease;
}

.cf-analytics-status .status-indicator.loading {
    color: var(--warning-color);
    animation: pulse 2s infinite;
}

.cf-analytics-status .status-indicator.active {
    color: var(--success-color);
}

.cf-analytics-status .status-indicator.inactive {
    color: var(--error-color);
}

.cf-analytics-status .status-text {
    font-weight: 500;
}

/* Status-specific styling with fallbacks */
.cf-analytics-status.status-active {
    background: rgba(var(--success-color-rgb), 0.1);
    border-color: rgba(var(--success-color-rgb), 0.2);
    color: var(--success-color);
}

.cf-analytics-status.status-inactive {
    background: rgba(var(--error-color-rgb), 0.1);
    border-color: rgba(var(--error-color-rgb), 0.2);
    color: var(--error-color);
}

.cf-analytics-status.status-loading {
    background: rgba(var(--warning-color-rgb), 0.1);
    border-color: rgba(var(--warning-color-rgb), 0.2);
    color: var(--warning-color);
}

/* Modern browser support with :has() selector */
@supports selector(:has(*)) {
    .cf-analytics-status:has(.status-indicator.active) {
        background: rgba(var(--success-color-rgb), 0.1);
        border-color: rgba(var(--success-color-rgb), 0.2);
        color: var(--success-color);
    }

    .cf-analytics-status:has(.status-indicator.inactive) {
        background: rgba(var(--error-color-rgb), 0.1);
        border-color: rgba(var(--error-color-rgb), 0.2);
        color: var(--error-color);
    }

    .cf-analytics-status:has(.status-indicator.loading) {
        background: rgba(var(--warning-color-rgb), 0.1);
        border-color: rgba(var(--warning-color-rgb), 0.2);
        color: var(--warning-color);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   COMPREHENSIVE MOBILE OPTIMIZATION
   Optimized for modern iPhone and Android devices
   ============================================ */

/* Enhanced viewport handling with safe areas for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    .navbar {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
    }

    .hero-container,
    .container {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
    }
}

/* Fluid Typography for Mobile Devices */
@media (max-width: 768px) {
    :root {
        /* Fluid typography using clamp for better scaling */
        --font-size-xs: clamp(0.7rem, 2vw, 0.75rem);
        --font-size-sm: clamp(0.8rem, 2.5vw, 0.875rem);
        --font-size-base: clamp(0.9rem, 3vw, 1rem);
        --font-size-lg: clamp(1rem, 3.5vw, 1.125rem);
        --font-size-xl: clamp(1.1rem, 4vw, 1.25rem);
        --font-size-2xl: clamp(1.25rem, 5vw, 1.5rem);
        --font-size-3xl: clamp(1.5rem, 6vw, 1.875rem);
        --font-size-4xl: clamp(1.75rem, 7vw, 2.25rem);
        --font-size-5xl: clamp(2rem, 8vw, 3rem);
        --font-size-6xl: clamp(2.25rem, 9vw, 3.75rem);

        /* Adjust spacing for mobile */
        --space-8: 1.5rem;
        --space-10: 2rem;
        --space-12: 2.5rem;
        --space-16: 3rem;
        --space-20: 4rem;
        --space-24: 5rem;
    }

    /* Base mobile optimizations */
    html {
        -webkit-text-size-adjust: 100%;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    body {
        font-size: var(--font-size-base);
        line-height: 1.6;
        overflow-x: hidden;
    }

    /* Enhanced scrolling for mobile */
    * {
        -webkit-overflow-scrolling: touch;
    }

    /* Better container padding on mobile */
    .container {
        padding: 0 var(--space-4);
        max-width: 100%;
    }

    section {
        padding: var(--space-12) 0;
    }

    /* Enhanced section titles for mobile */
    .section-title {
        font-size: clamp(1.75rem, 6vw, 2.25rem);
        margin-bottom: var(--space-8);
        padding: 0 var(--space-2);
        word-break: break-word;
    }

    .section-title::after {
        width: 50px;
        height: 3px;
        bottom: -8px;
    }

    .subsection-title {
        font-size: clamp(1.25rem, 5vw, 1.75rem);
        margin-bottom: var(--space-6);
        padding: 0 var(--space-2);
    }

    .section-intro {
        font-size: var(--font-size-base);
        line-height: 1.7;
        padding: 0 var(--space-2);
        margin-bottom: var(--space-6);
    }
}

/* Mobile Navigation Enhancements */
@media (max-width: 768px) {
    .navbar {
        height: 60px;
        padding: 0 var(--space-3);
    }

    .nav-container {
        height: 60px;
        padding: 0 var(--space-2);
    }

    .nav-logo {
        font-size: var(--font-size-xl);
        z-index: var(--z-fixed);
    }

    /* Enhanced hamburger menu */
    .nav-toggle,
    .hamburger {
        display: flex;
        flex-direction: column;
        gap: 5px;
        cursor: pointer;
        padding: var(--space-2);
        border-radius: var(--radius-sm);
        transition: all var(--transition-base);
        z-index: var(--z-fixed);
        /* Ensure touch target is large enough */
        min-width: 44px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
    }

    .nav-toggle:active,
    .hamburger:active {
        background: rgba(139, 69, 19, 0.1);
    }

    .bar {
        width: 24px;
        height: 3px;
        background: var(--text-primary);
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Smooth hamburger animation */
    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }

    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Mobile menu overlay */
    .nav-menu {
        position: fixed;
        left: 0;
        top: 60px;
        width: 100%;
        height: calc(100vh - 60px);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: var(--space-8) var(--space-4);
        gap: 0;
        transform: translateX(-100%);
        opacity: 0;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        overflow-y: auto;
        z-index: calc(var(--z-fixed) - 1);
    }

    .nav-menu.active {
        transform: translateX(0);
        opacity: 1;
        box-shadow: var(--shadow-xl);
    }

    .nav-item {
        width: 100%;
        text-align: center;
        opacity: 0;
        transform: translateY(20px);
        animation: slideInNav 0.4s ease forwards;
    }

    .nav-menu.active .nav-item:nth-child(1) { animation-delay: 0.1s; }
    .nav-menu.active .nav-item:nth-child(2) { animation-delay: 0.15s; }
    .nav-menu.active .nav-item:nth-child(3) { animation-delay: 0.2s; }
    .nav-menu.active .nav-item:nth-child(4) { animation-delay: 0.25s; }
    .nav-menu.active .nav-item:nth-child(5) { animation-delay: 0.3s; }
    .nav-menu.active .nav-item:nth-child(6) { animation-delay: 0.35s; }
    .nav-menu.active .nav-item:nth-child(7) { animation-delay: 0.4s; }

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

    .nav-link {
        display: block;
        padding: var(--space-4) var(--space-6);
        font-size: var(--font-size-lg);
        font-weight: var(--font-weight-semibold);
        color: var(--text-primary);
        border-radius: var(--radius-base);
        transition: all var(--transition-base);
        /* Enhanced touch target */
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-link:active {
        background: rgba(139, 69, 19, 0.1);
        transform: scale(0.98);
    }

    .nav-link::after {
        display: none;
    }

    /* Prevent body scroll when menu is open */
    body.nav-open {
        overflow: hidden;
    }
}

/* Mobile Hero Section Optimization */
@media (max-width: 768px) {
    .hero,
    section.hero,
    #home.hero {
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
        padding-top: 60px;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: var(--space-8);
        text-align: center;
        padding: var(--space-8) var(--space-4);
        align-items: center;
        justify-content: center;
    }

    .hero-content {
        order: 2;
    }

    .hero-image {
        order: 1;
        margin-bottom: var(--space-4);
    }

    .hero-title {
        font-size: clamp(1.75rem, 8vw, 2.5rem);
        line-height: 1.2;
        margin-bottom: var(--space-4);
        word-break: break-word;
        hyphens: auto;
    }

    .hero-subtitle {
        font-size: clamp(1.1rem, 4.5vw, 1.5rem);
        margin-bottom: var(--space-5);
        line-height: 1.4;
    }

    .hero-description {
        font-size: clamp(0.95rem, 3.5vw, 1.1rem);
        line-height: 1.7;
        margin-bottom: var(--space-6);
        padding: 0 var(--space-2);
    }

    .hero-buttons {
        flex-direction: column;
        gap: var(--space-3);
        width: 100%;
        max-width: 320px;
        margin: 0 auto var(--space-8);
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: var(--space-4) var(--space-6);
        font-size: var(--font-size-base);
        font-weight: var(--font-weight-semibold);
        /* Enhanced touch target */
        min-height: 48px;
        border-radius: var(--radius-md);
    }

    .btn:active {
        transform: scale(0.98);
    }

    .hero-social {
        justify-content: center;
        gap: var(--space-4);
        margin-top: var(--space-6);
    }

    .social-link {
        width: 48px;
        height: 48px;
        font-size: var(--font-size-xl);
        /* Enhanced touch target */
        min-width: 48px;
        min-height: 48px;
    }

    .social-link:active {
        transform: scale(0.95);
    }

    .code-animation {
        width: 100%;
        max-width: 280px;
        height: 180px;
        margin: 0 auto;
    }

    .scroll-indicator {
        bottom: var(--space-6);
    }

    .scroll-arrow {
        width: 24px;
        height: 24px;
    }
}

/* Mobile-Optimized Touch Targets */
@media (max-width: 768px) {
    /* Ensure all interactive elements meet minimum touch target size */
    .touch-target,
    button,
    a.btn,
    input[type="submit"],
    input[type="button"],
    .project-link,
    .contact-method,
    .toc-toggle,
    .theme-toggle {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: var(--space-3) var(--space-4);
    }

    /* Enhanced button interactions */
    button:active,
    a.btn:active,
    .btn:active {
        transform: scale(0.97);
        transition: transform 0.1s ease;
    }

    /* Better link spacing for touch */
    a {
        padding: var(--space-1) 0;
    }
}

/* Mobile About Section */
@media (max-width: 768px) {
    .about {
        padding: var(--space-12) 0;
    }

    .about-content {
        padding: 0 var(--space-4);
    }

    .about-text p {
        font-size: clamp(0.95rem, 3.5vw, 1.1rem);
        line-height: 1.8;
        margin-bottom: var(--space-5);
    }

    .about-highlights {
        grid-template-columns: 1fr;
        gap: var(--space-6);
        margin-top: var(--space-8);
    }

    .highlight-item {
        padding: var(--space-6);
    }

    .highlight-item i {
        font-size: var(--font-size-4xl);
        margin-bottom: var(--space-3);
    }

    .highlight-item h3 {
        font-size: var(--font-size-xl);
        margin-bottom: var(--space-2);
    }

    .highlight-item p {
        font-size: var(--font-size-base);
        line-height: 1.6;
    }
}

/* Mobile Skills Section */
@media (max-width: 768px) {
    .skills {
        padding: var(--space-12) 0;
    }

    .skills-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .skill-category {
        padding: var(--space-6);
    }

    .skill-category h3 {
        font-size: var(--font-size-xl);
        margin-bottom: var(--space-4);
    }

    .skill-items {
        gap: var(--space-2);
        justify-content: center;
    }

    .skill-item {
        padding: var(--space-2) var(--space-4);
        font-size: var(--font-size-sm);
        /* Enhanced touch target */
        min-height: 36px;
        display: inline-flex;
        align-items: center;
    }

    .skill-item:active {
        transform: scale(0.97);
    }
}

/* Mobile Project Cards and Grid */
@media (max-width: 768px) {
    .projects {
        padding: var(--space-12) 0;
    }

    .projects-grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-6);
        padding: 0 var(--space-3);
    }

    .project-card {
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-md);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .project-card:active {
        transform: scale(0.99);
    }

    .project-header h3 {
        font-size: var(--font-size-xl);
        line-height: 1.3;
        word-break: break-word;
    }

    .project-description {
        font-size: var(--font-size-base);
        line-height: 1.7;
    }

    .project-tech {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .language-tag {
        font-size: var(--font-size-xs);
        padding: 4px 10px;
        white-space: nowrap;
    }

    .project-stats {
        flex-wrap: wrap;
        gap: var(--space-3);
        margin-top: var(--space-3);
    }

    .project-stat {
        font-size: var(--font-size-sm);
    }

    .project-links {
        flex-direction: row;
        gap: var(--space-3);
        margin-top: var(--space-4);
    }

    .project-link {
        flex: 1;
        justify-content: center;
        padding: var(--space-3) var(--space-4);
        font-size: var(--font-size-sm);
        /* Enhanced touch target */
        min-height: 44px;
    }

    .project-link:active {
        transform: scale(0.97);
    }

    /* Pinned repos mobile optimization */
    .pinned-repos {
        grid-template-columns: 1fr !important;
        gap: var(--space-5);
    }

    /* Top projects section */
    .top-projects-highlight {
        padding: 0 var(--space-3);
    }

    .top-projects-stats {
        grid-template-columns: 1fr !important;
        gap: var(--space-4);
    }
}

/* Mobile Search and Filter Controls */
@media (max-width: 768px) {
    .projects-controls {
        padding: var(--space-4) var(--space-3);
        margin-bottom: var(--space-6);
    }

    .search-filter-row {
        flex-direction: column;
        gap: var(--space-4);
    }

    .search-container {
        width: 100%;
    }

    .search-input {
        width: 100%;
        padding: var(--space-3) var(--space-10);
        font-size: var(--font-size-base);
        /* Enhanced touch target */
        min-height: 48px;
        border-radius: var(--radius-md);
    }

    .search-icon {
        left: var(--space-3);
        font-size: var(--font-size-lg);
    }

    .clear-search {
        right: var(--space-3);
        width: 32px;
        height: 32px;
        /* Enhanced touch target */
        min-width: 36px;
        min-height: 36px;
    }

    .filter-controls {
        flex-direction: column;
        gap: var(--space-3);
        width: 100%;
    }

    .filter-group {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .filter-select {
        width: 100%;
        padding: var(--space-3) var(--space-4);
        font-size: var(--font-size-base);
        /* Enhanced touch target */
        min-height: 48px;
        border-radius: var(--radius-md);
    }

    .sort-view-row {
        flex-direction: column;
        gap: var(--space-3);
        margin-top: var(--space-4);
    }

    .sort-controls,
    .view-controls,
    .results-info {
        width: 100%;
        justify-content: space-between;
    }

    .sort-select {
        flex: 1;
        padding: var(--space-3) var(--space-4);
        font-size: var(--font-size-base);
        /* Enhanced touch target */
        min-height: 48px;
    }

    .sort-direction,
    .view-btn {
        /* Enhanced touch target */
        min-width: 48px;
        min-height: 48px;
        padding: var(--space-3);
        font-size: var(--font-size-lg);
    }

    .reset-btn,
    .save-search-btn {
        padding: var(--space-3) var(--space-4);
        font-size: var(--font-size-sm);
        /* Enhanced touch target */
        min-height: 44px;
    }

    /* Search results summary mobile */
    .search-results-summary {
        margin: var(--space-4) var(--space-3);
        padding: var(--space-4);
    }

    .search-summary-stats {
        flex-direction: column;
        gap: var(--space-2);
        align-items: flex-start;
    }

    .search-metrics {
        flex-direction: column;
        gap: var(--space-2);
        width: 100%;
    }

    .metric {
        font-size: var(--font-size-sm);
    }
}

/* Mobile Analytics Dashboard */
@media (max-width: 768px) {
    .analytics-dashboard {
        padding: var(--space-12) 0;
    }

    .analytics-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: var(--space-2);
        padding: var(--space-2) var(--space-3);
        margin: 0 calc(var(--space-3) * -1) var(--space-6);
        scrollbar-width: none;
    }

    .analytics-nav::-webkit-scrollbar {
        display: none;
    }

    .analytics-tab {
        flex-shrink: 0;
        padding: var(--space-3) var(--space-4);
        font-size: var(--font-size-sm);
        white-space: nowrap;
        /* Enhanced touch target */
        min-height: 44px;
    }

    .analytics-tab i {
        font-size: var(--font-size-base);
    }

    .analytics-grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-5);
    }

    .analytics-card {
        border-radius: var(--radius-md);
    }

    .card-header h3 {
        font-size: var(--font-size-lg);
    }

    .card-content {
        padding: var(--space-4);
    }

    .chart-canvas {
        max-height: 250px !important;
    }

    /* Heatmap adjustments for mobile */
    .heatmap-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .year-selector,
    .period-selector {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-sm);
        /* Enhanced touch target */
        min-height: 40px;
    }
}

/* Mobile Contact Form Optimization */
@media (max-width: 768px) {
    .contact {
        padding: var(--space-12) 0;
    }

    .contact-content {
        padding: 0 var(--space-3);
    }

    .contact-description {
        font-size: var(--font-size-base);
        line-height: 1.7;
        margin-bottom: var(--space-8);
        padding: 0 var(--space-2);
    }

    .contact-form {
        padding: var(--space-6);
        margin: 0 0 var(--space-8);
        border-radius: var(--radius-lg);
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-group {
        margin-bottom: var(--space-5);
    }

    .form-group label {
        font-size: var(--font-size-base);
        margin-bottom: var(--space-2);
        font-weight: var(--font-weight-semibold);
    }

    .form-input,
    .form-textarea {
        width: 100%;
        padding: var(--space-4);
        font-size: var(--font-size-base);
        border-radius: var(--radius-md);
        /* Enhanced touch target */
        min-height: 52px;
        border: 2px solid var(--border-color);
        transition: all var(--transition-base);
    }

    .form-input:focus,
    .form-textarea:focus {
        border-color: var(--primary-color);
        outline: none;
        box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
    }

    .form-textarea {
        min-height: 150px;
        resize: vertical;
    }

    .submit-button {
        width: 100%;
        padding: var(--space-4);
        font-size: var(--font-size-lg);
        font-weight: var(--font-weight-semibold);
        /* Enhanced touch target */
        min-height: 56px;
        border-radius: var(--radius-md);
        cursor: pointer;
        transition: all var(--transition-base);
    }

    .submit-button:active {
        transform: scale(0.98);
    }

    .contact-methods {
        display: flex;
        flex-direction: column;
        gap: var(--space-4);
        margin-top: var(--space-8);
    }

    .contact-method {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-4);
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
        text-decoration: none;
        color: var(--text-primary);
        /* Enhanced touch target */
        min-height: 60px;
        transition: all var(--transition-base);
    }

    .contact-method:active {
        transform: scale(0.98);
        background: var(--bg-tertiary);
    }

    .contact-method i {
        font-size: var(--font-size-2xl);
        color: var(--primary-color);
    }

    .contact-method span {
        font-size: var(--font-size-base);
        font-weight: var(--font-weight-medium);
    }
}

/* Mobile GitHub Stats Section */
@media (max-width: 768px) {
    .github-stats {
        padding: var(--space-12) 0;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-5);
        padding: 0 var(--space-3);
    }

    .stat-card {
        padding: var(--space-6);
        border-radius: var(--radius-lg);
    }

    .stat-card i {
        font-size: var(--font-size-3xl);
        margin-bottom: var(--space-3);
    }

    .stat-content h3 {
        font-size: var(--font-size-3xl);
        margin-bottom: var(--space-2);
    }

    .stat-content p {
        font-size: var(--font-size-base);
    }

    /* Contribution graph mobile */
    .contribution-section {
        margin-top: var(--space-8);
        padding: 0 var(--space-3);
    }

    .contribution-graph {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--space-4);
    }

    .contribution-graph img,
    .contribution-graph svg {
        min-width: 600px;
        width: 100%;
        height: auto;
    }

    /* Language stats mobile */
    .language-stats-section {
        margin-top: var(--space-8);
        padding: 0 var(--space-3);
    }

    .language-stats {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .language-bars {
        gap: var(--space-4);
    }

    .language-item {
        padding: var(--space-4);
        min-width: 280px;
    }

    .language-info {
        margin-bottom: var(--space-2);
    }

    .language-name {
        font-size: var(--font-size-base);
    }

    .language-percentage {
        font-size: var(--font-size-sm);
    }
}

/* Mobile GitHub Insights and Gists */
@media (max-width: 768px) {
    .github-insights,
    .gists-section {
        padding: var(--space-12) 0;
    }

    .insights-grid,
    .gists-grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-6);
        padding: 0 var(--space-3);
    }

    .insight-card,
    .gist-card {
        padding: var(--space-5);
        border-radius: var(--radius-lg);
    }

    .insight-card h3 {
        font-size: var(--font-size-lg);
        margin-bottom: var(--space-4);
    }

    /* Performance charts mobile */
    .performance-chart {
        width: 100% !important;
        height: auto !important;
        max-width: 100%;
        border-radius: var(--radius-md);
    }

    /* Metric badges mobile */
    .metrics-badges {
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--space-3);
        padding: 0 var(--space-3);
    }

    .metric-badge {
        width: 100%;
        height: auto;
    }

    /* Badges grid mobile */
    .badges-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: var(--space-4);
        padding: 0 var(--space-3);
    }
}

/* Mobile Recent Activity */
@media (max-width: 768px) {
    .recent-activity {
        padding: var(--space-12) 0;
    }

    .activity-feed {
        padding: 0 var(--space-3);
    }

    .activity-item {
        padding: var(--space-4);
        margin-bottom: var(--space-4);
        border-radius: var(--radius-md);
    }

    .activity-item h4 {
        font-size: var(--font-size-base);
        margin-bottom: var(--space-2);
    }

    .activity-item p {
        font-size: var(--font-size-sm);
        line-height: 1.6;
    }

    .activity-time {
        font-size: var(--font-size-xs);
        margin-top: var(--space-2);
    }
}

/* Mobile Topics Cloud */
@media (max-width: 768px) {
    .topics-section {
        padding: var(--space-8) var(--space-3);
    }

    .topics-cloud {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
        justify-content: center;
    }

    .topic-tag {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-sm);
        border-radius: var(--radius-md);
        /* Enhanced touch target */
        min-height: 36px;
        display: inline-flex;
        align-items: center;
    }

    .topic-tag:active {
        transform: scale(0.97);
    }
}

/* Mobile Global Search Modal */
@media (max-width: 768px) {
    .global-search-modal {
        padding: 0;
    }

    .global-search-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        margin: 0;
    }

    .global-search-header {
        padding: var(--space-4) var(--space-3);
        border-bottom: 1px solid var(--border-color);
    }

    .global-search-input-container {
        margin-bottom: var(--space-3);
    }

    .global-search-input {
        width: 100%;
        padding: var(--space-4) var(--space-10);
        font-size: var(--font-size-lg);
        /* Enhanced touch target */
        min-height: 52px;
        border-radius: var(--radius-lg);
    }

    .global-search-icon {
        left: var(--space-4);
        font-size: var(--font-size-xl);
    }

    .global-search-close {
        right: var(--space-4);
        /* Enhanced touch target */
        min-width: 44px;
        min-height: 44px;
        font-size: var(--font-size-xl);
    }

    .search-categories {
        display: flex;
        gap: var(--space-2);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--space-2);
        scrollbar-width: none;
    }

    .search-categories::-webkit-scrollbar {
        display: none;
    }

    .search-category {
        flex-shrink: 0;
        padding: var(--space-2) var(--space-4);
        font-size: var(--font-size-sm);
        /* Enhanced touch target */
        min-height: 40px;
        white-space: nowrap;
    }

    .global-search-results {
        padding: var(--space-4) var(--space-3);
        max-height: calc(100vh - 180px);
        max-height: calc(100dvh - 180px);
        overflow-y: auto;
    }

    .search-result-item {
        padding: var(--space-4);
        margin-bottom: var(--space-3);
        border-radius: var(--radius-md);
        /* Enhanced touch target */
        min-height: 60px;
    }

    .search-result-item:active {
        transform: scale(0.99);
    }

    .search-result-title {
        font-size: var(--font-size-base);
        margin-bottom: var(--space-1);
    }

    .search-result-description {
        font-size: var(--font-size-sm);
        line-height: 1.6;
    }
}

/* Mobile Floating TOC */
@media (max-width: 768px) {
    .floating-toc {
        right: var(--space-3);
        bottom: var(--space-20);
        top: auto;
        transform: none;
    }

    .toc-toggle {
        width: 52px;
        height: 52px;
        box-shadow: var(--shadow-xl);
    }

    .toc-content {
        position: fixed;
        right: var(--space-3);
        bottom: calc(var(--space-20) + 60px);
        top: auto;
        max-width: calc(100vw - var(--space-6));
        width: 280px;
        max-height: 50vh;
        overflow-y: auto;
    }

    .toc-links a {
        padding: var(--space-2) 0;
        font-size: var(--font-size-sm);
        /* Enhanced touch target */
        min-height: 36px;
        display: flex;
        align-items: center;
    }
}

/* Mobile Theme Toggle */
@media (max-width: 768px) {
    .theme-toggle {
        position: fixed;
        bottom: var(--space-6);
        right: var(--space-3);
        width: 52px;
        height: 52px;
        border-radius: 50%;
        box-shadow: var(--shadow-xl);
        z-index: var(--z-dropdown);
        /* Enhanced touch target */
        min-width: 52px;
        min-height: 52px;
        font-size: var(--font-size-xl);
    }

    .theme-toggle:active {
        transform: scale(0.95);
    }
}

/* Mobile Keyboard Help Modal */
@media (max-width: 768px) {
    .keyboard-help-content {
        width: 95%;
        max-width: none;
        max-height: 90vh;
        max-height: 90dvh;
        padding: var(--space-6);
        border-radius: var(--radius-xl);
    }

    .keyboard-help-content h3 {
        font-size: var(--font-size-xl);
        margin-bottom: var(--space-5);
    }

    .shortcut-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    .shortcut-item {
        padding: var(--space-3);
    }

    .shortcut-item kbd {
        padding: var(--space-1) var(--space-2);
        font-size: var(--font-size-xs);
        min-width: 28px;
    }

    .shortcut-item span {
        font-size: var(--font-size-sm);
    }

    .keyboard-help-close {
        top: var(--space-3);
        right: var(--space-3);
        width: 40px;
        height: 40px;
        /* Enhanced touch target */
        min-width: 44px;
        min-height: 44px;
        font-size: var(--font-size-2xl);
    }
}

/* Mobile Footer */
@media (max-width: 768px) {
    .footer {
        padding: var(--space-8) var(--space-4);
        text-align: center;
    }

    .footer p {
        font-size: var(--font-size-sm);
        line-height: 1.6;
    }
}

/* Mobile Scroll Progress Bar */
@media (max-width: 768px) {
    .scroll-progress {
        height: 3px;
        top: 60px;
    }

    .scroll-progress-bar {
        height: 100%;
    }
}

/* Mobile Animations - Reduced motion support */
@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
    /* Smooth scroll reveal animations */
    .animate-on-scroll {
        opacity: 0;
        transform: translateY(20px);
        transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .animate-on-scroll.animate-in {
        opacity: 1;
        transform: translateY(0);
    }

    /* Stagger animations for lists */
    .nav-menu.active .nav-item,
    .projects-grid .project-card,
    .skills-grid .skill-category {
        animation: slideUpFade 0.4s ease-out forwards;
    }

    @keyframes slideUpFade {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Disable animations for reduced motion preference */
@media (max-width: 768px) and (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;
    }

    .nav-item {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Small Mobile Devices (iPhone SE, small Android) */
@media (max-width: 375px) {
    :root {
        --space-4: 0.75rem;
        --space-6: 1rem;
        --space-8: 1.25rem;
    }

    .container {
        padding: 0 var(--space-3);
    }

    .hero-title {
        font-size: clamp(1.5rem, 7vw, 2rem);
    }

    .hero-subtitle {
        font-size: clamp(1rem, 4vw, 1.25rem);
    }

    .section-title {
        font-size: clamp(1.5rem, 5.5vw, 2rem);
    }

    .nav-logo {
        font-size: var(--font-size-lg);
    }

    .btn {
        padding: var(--space-3) var(--space-5);
        font-size: var(--font-size-sm);
    }

    .project-card {
        padding: var(--space-4);
    }

    .contact-form {
        padding: var(--space-4);
    }

    .form-input,
    .form-textarea {
        padding: var(--space-3);
        font-size: var(--font-size-sm);
    }
}

/* Large Mobile Devices and Tablets Portrait */
@media (min-width: 480px) and (max-width: 768px) {
    .about-highlights,
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .projects-grid {
        grid-template-columns: 1fr !important;
    }

    .insights-grid {
        grid-template-columns: 1fr;
    }

    .search-categories {
        justify-content: center;
    }

    .contact-methods {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }
}

/* Landscape Mode Optimization for Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero,
    section.hero,
    #home.hero {
        min-height: auto;
        padding: var(--space-12) 0;
    }

    .hero-container {
        padding: var(--space-6) var(--space-4);
    }

    .nav-menu {
        height: 100vh;
        height: 100dvh;
        padding: var(--space-6) var(--space-4);
    }

    .nav-link {
        padding: var(--space-2) var(--space-4);
        font-size: var(--font-size-base);
    }

    .global-search-content {
        height: 100vh;
        height: 100dvh;
    }
}

/* High DPI Displays (Retina) */
@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2),
       (max-width: 768px) and (min-resolution: 192dpi) {
    /* Optimize for high-resolution displays */
    .section-title::after {
        height: 4px;
    }

    .scroll-progress {
        height: 4px;
    }

    .border,
    .btn {
        border-width: 1.5px;
    }
}

/* Dark Mode Mobile Optimizations */
@media (max-width: 768px) {
    body.dark-theme {
        background: var(--bg-dark);
        color: var(--text-white);
    }

    body.dark-theme .navbar {
        background: rgba(26, 14, 10, 0.95);
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    body.dark-theme .nav-menu {
        background: rgba(26, 14, 10, 0.98);
    }

    body.dark-theme .nav-link:active {
        background: rgba(255, 255, 255, 0.1);
    }

    body.dark-theme .form-input,
    body.dark-theme .form-textarea {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
        color: var(--text-white);
    }

    body.dark-theme .contact-method {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    body.dark-theme .skill-item {
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-white);
    }

    body.dark-theme .project-card {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Performance Optimization for Mobile */
@media (max-width: 768px) {
    /* Use GPU acceleration for smooth animations */
    .nav-menu,
    .project-card,
    .btn,
    .social-link,
    .nav-toggle,
    .theme-toggle {
        will-change: transform;
        transform: translateZ(0);
        backface-visibility: hidden;
    }

    /* Optimize images for mobile */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    /* Improve scrolling performance */
    .container,
    .nav-menu,
    .global-search-results,
    .analytics-nav,
    .search-categories {
        scroll-behavior: smooth;
        scrollbar-width: thin;
    }
}

/* iPhone X and newer with notch */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .navbar {
            padding-top: max(0.5rem, env(safe-area-inset-top));
        }

        .footer {
            padding-bottom: max(var(--space-8), env(safe-area-inset-bottom));
        }

        .theme-toggle,
        .floating-toc {
            bottom: max(var(--space-6), calc(env(safe-area-inset-bottom) + var(--space-3)));
        }

        .nav-menu {
            padding-bottom: max(var(--space-8), env(safe-area-inset-bottom));
        }
    }
}

/* ============================================================================
   PWA Install & Update Notifications
   ============================================================================ */

/* Base notification/banner styles */
.update-notification,
.install-banner {
    position: fixed;
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border: 2px solid var(--primary-color);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 20px;
    max-width: 500px;
    width: 90%;
    z-index: 10000;
    transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    backdrop-filter: blur(10px);
}

.update-notification.show,
.install-banner.show {
    bottom: 24px;
}

/* Content layout */
.update-content,
.install-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Icons */
.update-icon,
.install-icon {
    font-size: 2rem;
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Text content */
.update-text,
.install-text {
    flex: 1;
}

.update-text strong,
.install-text strong {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.update-text p,
.install-text p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Action buttons */
.update-button,
.install-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.update-button:hover,
.install-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.update-button:active,
.install-button:active {
    transform: translateY(0);
}

/* Dismiss buttons */
.update-dismiss,
.install-dismiss {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.update-dismiss:hover,
.install-dismiss:hover {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .update-notification,
    .install-banner {
        width: 95%;
        padding: 16px;
    }
    
    .update-content,
    .install-content {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .update-icon,
    .install-icon {
        font-size: 1.5rem;
    }
    
    .update-text,
    .install-text {
        flex-basis: 100%;
    }
    
    .update-button,
    .install-button,
    .update-dismiss,
    .install-dismiss {
        flex: 1;
        padding: 8px 12px;
        font-size: 0.813rem;
    }
}

/* Dark theme adjustments */
[data-theme="dark"] .update-notification,
[data-theme="dark"] .install-banner {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

/* High contrast theme */
[data-theme="high-contrast"] .update-notification,
[data-theme="high-contrast"] .install-banner {
    border-width: 3px;
    border-color: var(--accent-color);
}

[data-theme="high-contrast"] .update-button,
[data-theme="high-contrast"] .install-button {
    font-weight: 700;
    border: 2px solid white;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .update-notification,
    .install-banner {
        transition: bottom 0.2s ease;
    }
    
    .update-icon,
    .install-icon {
        animation: none;
    }
    
    .update-button:hover,
    .install-button:hover {
        transform: none;
    }
}

/* PWA display mode detection */
@media (display-mode: standalone) {
    /* Hide install banner when already installed */
    .install-banner {
        display: none !important;
    }
    
    /* Adjust navigation for standalone mode */
    .navbar {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
}

/* iOS Safari specific adjustments */
@supports (-webkit-touch-callout: none) {
    .update-notification,
    .install-banner {
        bottom: max(24px, env(safe-area-inset-bottom));
    }
    
    .update-notification.show,
    .install-banner.show {
        bottom: max(24px, calc(env(safe-area-inset-bottom) + 24px));
    }
}

/* ============================================================================
   Blog Section Styles
   ============================================================================ */

.blog {
    padding: var(--space-16) 0;
    background: var(--bg-primary);
}

.section-description {
    text-align: center;
    max-width: 700px;
    margin: 0 auto var(--space-8);
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
}

/* Blog Filters */
.blog-filters {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
    flex-wrap: wrap;
}

.filter-btn {
    padding: var(--space-2) var(--space-4);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Blog Posts Grid */
.blog-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--space-6);
    margin-top: var(--space-8);
}

.loading-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-12);
    color: var(--text-secondary);
}

.no-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-12);
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
}

/* Blog Post Card */
.blog-post-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.blog-post-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.2);
}

.post-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-3);
}

.featured-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-meta {
    display: flex;
    gap: var(--space-3);
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
    flex-wrap: wrap;
}

.post-meta time,
.post-meta .reading-time,
.post-meta .post-author {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.post-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: var(--line-height-tight);
}

.post-excerpt {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    margin: 0;
    flex-grow: 1;
}

.post-tags {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.post-tag {
    background: var(--bg-tertiary);
    color: var(--primary-color);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--primary-color);
    font-weight: 600;
    font-size: var(--font-size-base);
    text-decoration: none;
    transition: all 0.3s ease;
}

.read-more:hover {
    gap: var(--space-3);
    color: var(--accent-color);
}

/* Single Blog Post View */
.blog-post-section {
    padding: var(--space-16) 0;
    background: var(--bg-primary);
    min-height: 100vh;
}

.blog-post-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.back-to-posts {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: var(--space-8);
}

.back-to-posts:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
    transform: translateX(-5px);
}

.blog-post-content {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    margin-bottom: var(--space-8);
}

.post-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: var(--space-6);
    margin-bottom: var(--space-8);
}

.post-header .post-title {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--space-4);
}

.post-header .post-meta {
    margin-bottom: var(--space-4);
    font-size: var(--font-size-base);
}

.post-header .post-tags {
    margin-top: var(--space-4);
}

/* Post Body Typography */
.post-body {
    color: var(--text-primary);
    font-size: var(--font-size-lg);
    line-height: var(--line-height-loose);
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
    color: var(--text-primary);
    font-weight: 700;
    margin: var(--space-8) 0 var(--space-4);
    line-height: var(--line-height-tight);
}

.post-body h1 {
    font-size: var(--font-size-3xl);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: var(--space-3);
}

.post-body h2 {
    font-size: var(--font-size-2xl);
}

.post-body h3 {
    font-size: var(--font-size-xl);
    color: var(--primary-color);
}

.post-body h4 {
    font-size: var(--font-size-lg);
}

.post-body p {
    margin: var(--space-4) 0;
    line-height: var(--line-height-loose);
}

.post-body ul,
.post-body ol {
    margin: var(--space-4) 0;
    padding-left: var(--space-8);
}

.post-body li {
    margin: var(--space-2) 0;
}

.post-body a {
    color: var(--primary-color);
    text-decoration: underline;
    transition: color 0.3s ease;
}

.post-body a:hover {
    color: var(--accent-color);
}

.post-body strong {
    color: var(--text-primary);
    font-weight: 700;
}

.post-body em {
    color: var(--text-secondary);
    font-style: italic;
}

.post-body code {
    background: var(--bg-tertiary);
    color: var(--accent-color);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.post-body pre {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    overflow-x: auto;
    margin: var(--space-6) 0;
}

.post-body pre code {
    background: none;
    color: var(--text-primary);
    padding: 0;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);
}

.post-body hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: var(--space-8) 0;
}

.post-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: var(--space-4);
    margin: var(--space-6) 0;
    color: var(--text-secondary);
    font-style: italic;
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: var(--space-6) 0;
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-6) 0;
}

.post-body th,
.post-body td {
    border: 1px solid var(--border-color);
    padding: var(--space-3);
    text-align: left;
}

.post-body th {
    background: var(--bg-tertiary);
    font-weight: 700;
    color: var(--text-primary);
}

/* Post Footer */
.post-footer {
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 2px solid var(--border-color);
}

.share-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.share-buttons h4 {
    font-size: var(--font-size-lg);
    color: var(--text-primary);
    margin: 0;
}

.share-btn {
    padding: var(--space-3) var(--space-6);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.share-btn.twitter:hover {
    background: #1DA1F2;
    border-color: #1DA1F2;
    color: white;
}

.share-btn.linkedin:hover {
    background: #0077B5;
    border-color: #0077B5;
    color: white;
}

.share-btn.facebook:hover {
    background: #1877F2;
    border-color: #1877F2;
    color: white;
}

.share-btn.copy:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Reading Progress Indicator */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    z-index: 9999;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.1s ease;
}

/* Comments Section */
#blog-comments {
    margin-top: var(--space-8);
    padding: var(--space-6);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
}

#blog-comments h3 {
    font-size: var(--font-size-xl);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.giscus, .giscus-frame {
    width: 100%;
}

/* Comments placeholder */
.comments-placeholder {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-secondary);
}

.comments-placeholder p {
    margin-bottom: var(--space-4);
    font-size: var(--font-size-base);
}

.enable-comments-btn {
    padding: var(--space-3) var(--space-6);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.enable-comments-btn:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .blog-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-filters {
        gap: var(--space-2);
    }
    
    .filter-btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-sm);
    }
    
    .post-header .post-title {
        font-size: var(--font-size-3xl);
    }
    
    .blog-post-content {
        padding: var(--space-4);
    }
    
    .post-body {
        font-size: var(--font-size-base);
    }
    
    .post-body h1 {
        font-size: var(--font-size-2xl);
    }
    
    .post-body h2 {
        font-size: var(--font-size-xl);
    }
    
    .post-body h3 {
        font-size: var(--font-size-lg);
    }
    
    .post-body pre {
        padding: var(--space-3);
        font-size: var(--font-size-xs);
    }
    
    .share-buttons {
        gap: var(--space-2);
    }
    
    .share-btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--font-size-sm);
    }
}

/* Dark Theme Adjustments */
[data-theme="dark"] .blog-post-card {
    background: #1a1a1a;
    border-color: #333;
}

[data-theme="dark"] .blog-post-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

[data-theme="dark"] .post-body pre {
    background: #0a0a0a;
    border-color: #333;
}

[data-theme="dark"] .post-body code {
    background: #0a0a0a;
}

/* Animation for post cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.blog-post-card {
    animation: fadeInUp 0.6s ease-out;
}

.blog-post-card:nth-child(1) { animation-delay: 0.1s; }
.blog-post-card:nth-child(2) { animation-delay: 0.2s; }
.blog-post-card:nth-child(3) { animation-delay: 0.3s; }
.blog-post-card:nth-child(4) { animation-delay: 0.4s; }
.blog-post-card:nth-child(5) { animation-delay: 0.5s; }
.blog-post-card:nth-child(6) { animation-delay: 0.6s; }

/* Accessibility improvements */
.blog-post-card:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.filter-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.back-to-posts:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.share-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
