/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

/* CSS Variables */
:root {
    /* Light Theme Colors */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --success-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --secondary-color: #f093fb;
    --accent-color: #4facfe;
    --success-color: #43e97b;
    --warning-color: #fa709a;
    --error-color: #ff6b6b;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-inverse: #ffffff;
    
    --border-color: #e2e8f0;
    --border-light: #f7fafc;
    --border-dark: #cbd5e0;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);
    --shadow-2xl: 0 24px 64px rgba(0, 0, 0, 0.20);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-primary: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    --secondary-gradient: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    
    --primary-color: #7c3aed;
    --primary-dark: #6d28d9;
    --secondary-color: #ec4899;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-elevated: #1e293b;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    
    --border-color: #334155;
    --border-light: #475569;
    --border-dark: #1e293b;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-2xl: 0 24px 64px rgba(0, 0, 0, 0.7);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: var(--transition-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* Utility Classes */
.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* Container */
.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.hero-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header Navigation */
.header-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition-normal);
}

[data-theme="dark"] .header-nav {
    background: rgba(15, 23, 42, 0.95);
    border-bottom-color: var(--border-color);
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
    cursor: pointer;
}

.brand-link:hover {
    transform: scale(1.02);
    color: inherit;
}

.brand-link:hover .brand-logo {
    transform: rotate(5deg);
}

.brand-logo {
    width: 48px;
    height: 48px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--shadow-md);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.main-navigation {
    display: flex;
    align-items: center;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background: var(--bg-tertiary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-switcher {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-switcher:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition-fast);
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .main-navigation {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-primary);
        transition: var(--transition-normal);
        z-index: 1002;
        padding: 2rem 1.5rem;
        box-shadow: var(--shadow-2xl);
    }

    [data-theme="dark"] .main-navigation {
        background: var(--bg-primary);
    }

    .main-navigation.mobile-active {
        left: 0;
        transform: translateZ(0); /* 强制硬件加速 */
    }

    .nav-list {
        flex-direction: column;
        gap: 1rem;
        padding: 0;
        margin: 0;
        height: auto;
        overflow: visible;
    }

    .nav-link {
        padding: 1rem 1.25rem;
        border-radius: var(--radius-lg);
        margin-bottom: 0;
        justify-content: flex-start;
        font-size: 1rem;
        font-weight: 500;
        background: var(--bg-elevated);
        border: none;
        transition: var(--transition-normal);
        position: relative;
        color: var(--text-secondary);
        box-shadow: var(--shadow-sm);
        opacity: 0;
        transform: translateY(20px);
        animation: slideInUp 0.4s ease forwards;
    }

    .nav-link:nth-child(1) { animation-delay: 0.1s; }
    .nav-link:nth-child(2) { animation-delay: 0.15s; }
    .nav-link:nth-child(3) { animation-delay: 0.2s; }
    .nav-link:nth-child(4) { animation-delay: 0.25s; }
    .nav-link:nth-child(5) { animation-delay: 0.3s; }

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

    .nav-link:hover {
        background: var(--bg-tertiary);
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
        color: var(--text-primary);
    }

    .nav-link.active {
        background: var(--primary-gradient);
        color: white;
        box-shadow: var(--shadow-lg);
    }

    .nav-link.active::after {
        display: none;
    }

    .nav-link i {
        font-size: 1.2rem;
        margin-right: 0.75rem;
        min-width: 20px;
    }

    .mobile-menu-toggle {
        display: flex;
        z-index: 1003;
        background: var(--bg-elevated);
        border-radius: var(--radius-lg);
        padding: 0.75rem;
        border: 1px solid var(--border-color);
        transition: var(--transition-normal);
        position: relative;
        box-shadow: var(--shadow-sm);
    }

    .mobile-menu-toggle:hover {
        background: var(--primary-color);
        border-color: var(--primary-color);
    }

    .mobile-menu-toggle:hover .hamburger-line {
        background: white;
    }

    .mobile-menu-toggle.active {
        background: var(--primary-color);
        border-color: var(--primary-color);
    }

    .mobile-menu-toggle.active .hamburger-line {
        background: white;
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.active .hamburger-line:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .nav-wrapper {
        padding: 1rem 1.5rem;
    }

    .brand-title {
        font-size: 1.25rem;
    }

    .brand-subtitle {
        font-size: 0.75rem;
    }

    /* Mobile menu overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1001;
        opacity: 0;
        visibility: hidden;
        transition: var(--transition-normal);
    }

    /* .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    } */

    /* 移除菜单标题，保持简洁 */
}

/* Extra small screens */
@media (max-width: 480px) {
    .main-navigation {
        width: 100%;
        left: -100%;
        padding: 2rem 1rem;
    }

    .nav-wrapper {
        padding: 1rem;
    }

    .brand-title {
        font-size: 1.1rem;
    }

    .brand-subtitle {
        font-size: 0.7rem;
    }

    .nav-link {
        padding: 1rem;
        font-size: 0.95rem;
    }

    .nav-list {
        gap: 0.75rem;
    }
}

/* Hero Banner */
.hero-banner {
    padding: 8rem 0 6rem;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    position: relative;
    overflow: hidden;
}

.hero-banner::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="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23e2e8f0" stroke-width="0.5" opacity="0.3"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.5;
}

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

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-gradient);
    color: white;
    border-radius: var(--radius-xl);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.cta-button.primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-lg);
}

.cta-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.cta-button.secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.cta-button.secondary:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Hero Visual */
.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.code-preview {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--border-color);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.code-dots {
    display: flex;
    gap: 0.5rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27ca3f; }

.code-title {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.code-content {
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
}

.code-line {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.line-number {
    width: 2rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: right;
    margin-right: 1rem;
}

.code-text {
    flex: 1;
}

.selector { color: #e06c75; }
.property { color: #61afef; }
.value { color: #98c379; }
.bracket { color: var(--text-primary); }
.colon { color: var(--text-muted); }
.semicolon { color: var(--text-muted); }

/* Responsive Hero */
@media (max-width: 768px) {
    .hero-banner {
        padding: 6rem 0 4rem;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-description {
        font-size: 1.125rem;
    }

    .hero-actions {
        justify-content: center;
    }

    .cta-button {
        padding: 0.875rem 1.5rem;
        font-size: 0.875rem;
    }
}

/* Global Error Notification */
.global-error {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 3000;
    background: var(--error-color);
    color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: var(--transition-normal);
    max-width: 400px;
}

.global-error.show {
    transform: translateX(0);
}

.error-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
}

.error-content i:first-child {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.error-content span {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.4;
}

.error-content button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.error-content button:hover {
    background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .global-error {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}
