/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* 核心色板 - Deep Space Theme */
    --bg-primary: #0B0C15;
    --bg-secondary: #151621;
    --bg-tertiary: #1E1F2E;
    
    /* 文字颜色 */
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    /* 霓虹强调色 */
    --accent-blue: #6366F1;
    --accent-blue-glow: rgba(99, 102, 241, 0.5);
    --accent-purple: #8B5CF6;
    --accent-purple-glow: rgba(139, 92, 246, 0.5);
    --accent-cyan: #06B6D4;
    --accent-pink: #EC4899;
    
    /* 渐变系统 */
    --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --gradient-glow: radial-gradient(circle at center, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    
    /* 玻璃拟态 Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-hover: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-backdrop: blur(20px) saturate(180%);
    
    /* 阴影与发光 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.5);
    --glow-sm: 0 0 10px var(--accent-blue-glow);
    --glow-md: 0 0 20px var(--accent-blue-glow);
    
    /* 间距与尺寸 */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    --border-radius-sm: 8px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    
    /* 动画变量 */
    --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
    --ease-in-out: cubic-bezier(0.645, 0.045, 0.355, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 0.2s var(--ease-out);
    --transition-base: 0.3s var(--ease-out);
    --transition-slow: 0.5s var(--ease-out);
}

/* 字体系统 */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08), transparent 25%);
}

/* 玻璃拟态通用类 */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    -webkit-backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 3px;
    transition: background var(--transition-base);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 排版 */
h1, h2, h3, h4 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; margin-bottom: var(--spacing-lg); }
h2 { font-size: 2rem; margin-bottom: var(--spacing-md); }
h3 { font-size: 1.5rem; margin-bottom: var(--spacing-sm); }

/* Hero Title Global Support - REMOVED DUPLICATES */

p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

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

/* 布局容器 */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--spacing-xl);
    width: 100%;
    animation: fadeIn 0.8s var(--ease-out);
}

/* 组件：卡片 */
.card {
    position: relative;
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-blue);
    box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.3);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover::before {
    opacity: 1;
}

/* 组件：标签 Tag */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-blue);
    border: 1px solid rgba(99, 102, 241, 0.2);
    transition: var(--transition-base);
}

.tag:hover {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 0 10px var(--accent-blue-glow);
}

/* 组件：链接带箭头 */
.link-arrow {
    display: inline-flex;
    align-items: center;
    color: var(--accent-blue);
    font-weight: 600;
    margin-top: auto; /* Push to bottom in flex card */
    transition: var(--transition-base);
}

.link-arrow::after {
    content: '→';
    margin-left: 0.5rem;
    transition: transform 0.2s;
}

.link-arrow:hover {
    color: var(--accent-purple);
}

.link-arrow:hover::after {
    transform: translateX(4px);
}

/* 列表样式 (Tech/About) */
.icon-list {
    list-style: none;
}

.icon-list-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition-base);
}

.icon-list-item:hover {
    background: var(--glass-bg-hover);
    transform: translateX(5px);
}

.icon-list-icon {
    width: 24px;
    height: 24px;
    margin-right: 1rem;
    filter: var(--list-icon-filter, drop-shadow(0 0 5px rgba(255,255,255,0.1)));
    transition: var(--transition-base);
}

.icon-list-icon.colored {
    filter: var(--list-icon-colored-filter, none);
}

.icon-list-item:hover .icon-list-icon {
    transform: scale(1.2);
    filter: drop-shadow(0 0 8px var(--accent-blue));
}

/* 组件：按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    border: none;
    outline: none;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

.btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
    box-shadow: var(--glow-sm);
}

/* 标题装饰 */
.section-title {
    text-align: center;
    position: relative;
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-2xl);
}

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

/* 网格布局 */
.grid {
    display: grid;
    gap: var(--spacing-xl);
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* 骨架屏 Skeleton */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.03) 25%, 
        rgba(255,255,255,0.08) 50%, 
        rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: var(--border-radius);
}

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

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

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

/* --- INDEX.HTML 布局样式 --- */

.main-container {
    display: flex;
    height: 100vh;
    padding: var(--spacing-md);
    gap: var(--spacing-md);
    overflow: hidden;
    position: relative;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-xl) 0;
    border-radius: var(--border-radius-lg);
    z-index: 20;
    transition: transform var(--transition-base);
    flex-shrink: 0;
}

/* 个人资料 */
.profile-section {
    text-align: center;
    padding: 0 2rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    border: 3px solid var(--accent-blue);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    cursor: pointer;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

.profile-avatar:hover {
    transform: scale(1.05);
    border-color: var(--accent-purple);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--profile-name-color, var(--text-primary));
    letter-spacing: 0.025em;
}

/* 导航菜单 */
.nav-menu {
    flex: 1;
    list-style: none;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 2rem;
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    transition: background 0.3s ease, color 0.3s ease; /* Smooth bg transition */
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin-right: var(--spacing-xs);
    cursor: pointer;
    user-select: none;
}

.nav-link:hover {
    color: var(--text-primary);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), transparent);
}

.nav-link.active {
    color: var(--accent-blue);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), transparent);
    border-right: 3px solid var(--accent-blue);
}

.nav-icon-wrapper {
    width: 24px;
    height: 24px;
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon {
    width: 20px;
    height: 20px;
    filter: var(--nav-icon-filter, grayscale(1) brightness(0.7));
    transition: var(--transition-base);
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    filter: var(--nav-icon-active-filter, grayscale(0) brightness(1) drop-shadow(0 0 5px var(--accent-blue)));
    transform: scale(1.1);
}

/* 视图窗口 & 滑块容器 */
.viewport {
    flex: 1;
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    perspective: 1000px;
}

#page-slider {
    display: flex;
    width: 100%;
    height: 100%;
    will-change: transform;
    transform-style: preserve-3d;
    transform: translate3d(0, 0, 0);
}

/* 页面容器 */
.page-frame {
    min-width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-secondary);
}

/* 骨架屏 - Index Specific */
.skeleton-screen {
    position: absolute;
    inset: 0;
    padding: var(--spacing-xl);
    background: var(--bg-secondary);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.skeleton-screen.hidden {
    opacity: 0;
}

.skeleton-header {
    height: 60px;
    width: 40%;
    margin-bottom: var(--spacing-lg);
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    flex: 1;
}

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

/* 浮动文字 */
.floating-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    z-index: 100;
}
.floating-text.show { opacity: 1; animation: floatUp 1s ease-out; }

@keyframes floatUp {
    0% { transform: translate(-50%, -50%); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(-50%, -100%); opacity: 0; }
}

/* --- HOME.HTML 样式 --- */

/* Hero Section */
.hero {
    min-height: 60vh;
    display: flex;
    align-items: center;
    position: relative;
}

.hero-content {
    z-index: 2;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    background: var(--hero-text-gradient, linear-gradient(to right, #fff, #94a3b8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--spacing-md);
}

.hero p.tagline {
    font-size: 1.25rem;
    color: var(--accent-blue);
    font-weight: 500;
    margin-bottom: var(--spacing-xl);
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Avatar Wrapper with Glow */
.avatar-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto;
    border-radius: 50%;
    padding: 5px;
    background: var(--gradient-primary);
    box-shadow: 0 0 50px rgba(99, 102, 241, 0.3);
    animation: float 6s ease-in-out infinite;
}

.avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 4px solid var(--bg-primary);
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.stat-item {
    text-align: center;
    padding: var(--spacing-md);
}

.stat-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--stat-color, #fff);
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Skills Grid Override */
.skill-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--spacing-lg);
}

.skill-icon {
    width: 48px;
    height: 48px;
    margin-bottom: var(--spacing-md);
    filter: var(--skill-icon-filter, drop-shadow(0 0 10px rgba(99, 102, 241, 0.3)));
}

/* --- 汉堡菜单 & 移动端 --- */

.hamburger-btn {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 100;
    width: 44px;
    height: 44px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: none; /* 默认隐藏 */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.hamburger-btn:hover {
    background: var(--glass-bg-hover);
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: currentColor;
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    transform-origin: center;
}

.hamburger-btn.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.hamburger-btn.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* 侧边栏遮罩 */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 19;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* 响应式调整 (整合版) */
@media (max-width: 768px) {
    :root {
        --spacing-xl: 1.5rem;
        --spacing-2xl: 2rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    .container {
        padding: var(--spacing-md);
    }
    
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    /* Index Mobile Layout */
    .main-container { padding: 0; gap: 0; }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%); /* 初始隐藏 */
        background: var(--bg-secondary); /* Dynamic background */
        backdrop-filter: blur(20px);
        border-right: 1px solid var(--glass-border);
        box-shadow: none;
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0,0,0,0.5);
    }
    
    .viewport { border-radius: 0; border: none; }
    
    .hamburger-btn { display: flex; }

    /* Home Mobile Layout */
    .hero {
        flex-direction: column-reverse;
        text-align: center;
        padding-top: 4rem;
        min-height: auto;
    }
    
    .hero-content {
        margin-top: 2rem;
    }
    
    .avatar-wrapper {
        width: 200px;
        height: 200px;
    }
    
    .stats-grid {
        gap: var(--spacing-sm);
    }
    
    .stat-num {
        font-size: 1.5rem;
    }
}