/* 基础变量 */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
    --transition: all 0.2s ease;
}

/* 暗色模式 */
[data-theme="dark"] {
    --primary-color: #818cf8;
    --primary-hover: #6366f1;
    --bg-color: #0a0a0f;
    --surface-color: rgba(30, 30, 40, 0.6);
    --text-color: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4);
}

/* 深色模式背景纹理 */
[data-theme="dark"] body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(99, 102, 241, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(99, 102, 241, 0.03) 0%, transparent 50%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    background-size: 100% 100%, 100% 100%, 200px 200px;
}

[data-theme="dark"] body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(180deg, rgba(10, 10, 15, 0) 0%, rgba(10, 10, 15, 0.8) 100%),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 50px,
            rgba(255, 255, 255, 0.015) 50px,
            rgba(255, 255, 255, 0.015) 51px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 50px,
            rgba(255, 255, 255, 0.015) 50px,
            rgba(255, 255, 255, 0.015) 51px
        );
    pointer-events: none;
    z-index: -1;
}

/* 重置和基础 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* 头部 - 玻璃态 */
.header {
    background: rgba(20, 20, 30, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 0;
}

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

.theme-toggle {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

/* 主要内容 */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* Hero 区域 */
.hero {
    text-align: center;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.hero h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* 文章区域 */
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* 文章卡片 - 玻璃态效果 */
.post-card {
    background: rgba(30, 30, 40, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.post-card:hover {
    transform: translateY(-2px);
    background: rgba(40, 40, 50, 0.35);
    border-color: rgba(99, 102, 241, 0.15);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

.post-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    line-height: 1.4;
}

.post-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.95rem;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.post-tag {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* 页脚 - 玻璃态 */
.footer {
    background: rgba(20, 20, 30, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 2rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 文章内容页 - 玻璃态 */
.post-content {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(30, 30, 40, 0.25);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.post-content h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.post-content h2 {
    font-size: 1.35rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.post-content h3 {
    font-size: 1.15rem;
    margin: 1.25rem 0 0.5rem;
    color: var(--text-color);
}

.post-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.post-content code {
    background: var(--bg-color);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.post-content pre {
    background: #1e1e2e;
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1rem 0;
}

.post-content pre code {
    background: transparent;
    color: #a6e3a1;
}

.post-content ul, .post-content ol {
    margin: 1rem 0 1rem 1.5rem;
}

.post-content li {
    margin: 0.5rem 0;
}

.post-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.post-content a:hover {
    text-decoration: underline;
}

.post-content blockquote {
    border-left: 3px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
}

/* 按钮 */
button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

button:hover {
    background: var(--primary-hover);
}

/* 响应式 */
@media (max-width: 768px) {
    .hero h2 {
        font-size: 1.5rem;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .nav {
        gap: 1rem;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .post-content {
        padding: 1.5rem;
    }
}

/* 加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card {
    animation: fadeIn 0.3s ease forwards;
}
