/* ===== 变量 ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
    --radius: 16px;
    --radius-sm: 8px;
    --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Noto Serif SC', Georgia, serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ===== 导航栏 ===== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.brand-icon { font-size: 1.3rem; }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-links a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    background: rgba(99,102,241,0.08);
}

/* ===== Hero ===== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 24px 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(40px, 40px); }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
}

.hero-avatar {
    width: 120px; height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 24px;
    border: 4px solid rgba(255,255,255,0.3);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

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

.hero-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 16px;
    font-weight: 300;
}

.hero-desc {
    font-size: 1rem;
    opacity: 0.75;
    margin-bottom: 32px;
    line-height: 1.8;
}

.hero-social {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.social-link {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.social-link:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-3px);
}

.hero-scroll {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.7;
    font-size: 0.85rem;
    animation: bounce 2s infinite;
}

.scroll-arrow {
    width: 20px; height: 20px;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(45deg);
}

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

/* ===== 主体内容 ===== */
.main-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 80px 24px;
}

.section {
    margin-bottom: 80px;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.section-icon { font-size: 1.5rem; }

.section-desc {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ===== 文章卡片 ===== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px;
}

.post-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--border);
}

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

.post-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: var(--transition);
}

.post-card:hover .post-cover {
    transform: scale(1.05);
}

.post-card-body {
    padding: 24px;
}

.post-card-date {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.post-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.4;
    color: var(--text);
}

.post-card-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.post-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(99,102,241,0.1);
    color: var(--primary);
    font-weight: 500;
}

.post-card-time {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ===== 标签云 ===== */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.tag-cloud-item {
    padding: 8px 20px;
    border-radius: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
    cursor: pointer;
}

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

/* ===== 文章详情页 ===== */
.post-article { padding-top: 64px; }

.post-hero {
    position: relative;
    height: 400px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.post-hero-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.6);
}

.post-hero-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px;
    width: 100%;
    color: white;
}

.post-meta {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 12px;
}

.post-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.post-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.post-tags .tag {
    background: rgba(255,255,255,0.2);
    color: white;
}

.post-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 24px;
}

.post-body {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    line-height: 2;
    color: var(--text);
}

.post-body h1,
.post-body h2,
.post-body h3 {
    font-family: var(--font-sans);
    margin: 40px 0 20px;
    font-weight: 700;
}

.post-body h2 {
    font-size: 1.6rem;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.post-body h3 { font-size: 1.3rem; }

.post-body p { margin-bottom: 20px; }

.post-body code {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.9em;
    color: #e11d48;
}

.post-body pre {
    background: #1e293b;
    padding: 20px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 24px 0;
}

.post-body pre code {
    background: none;
    color: #e2e8f0;
    padding: 0;
}

.post-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 20px;
    margin: 24px 0;
    color: var(--text-muted);
    font-style: italic;
}

.post-body ul,
.post-body ol {
    margin: 20px 0 20px 24px;
}

.post-body li { margin-bottom: 8px; }

.post-body img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 24px 0;
}

.post-body a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

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

.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.post-body thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.post-body th,
.post-body td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.post-body th {
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.post-body tbody tr {
    background: var(--bg-card);
    transition: var(--transition);
}

.post-body tbody tr:nth-child(even) {
    background: #f8fafc;
}

.post-body tbody tr:hover {
    background: rgba(99,102,241,0.05);
}

.post-body tbody tr:last-child td {
    border-bottom: none;
}

.post-nav {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px 60px;
    border-top: 1px solid var(--border);
    padding-top: 40px;
}

.post-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 500;
    transition: var(--transition);
}

.post-nav-link:hover { gap: 12px; }

/* ===== 关于页 ===== */
.about-page { padding-top: 100px; }

.about-card {
    text-align: center;
    padding: 60px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius);
    color: white;
    margin-bottom: 60px;
}

.about-avatar {
    width: 100px; height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 20px;
    border: 3px solid rgba(255,255,255,0.3);
}

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

.about-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.about-bio {
    font-size: 1rem;
    opacity: 0.85;
    margin-bottom: 24px;
}

.about-contact {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 24px;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 0.9rem;
    transition: var(--transition);
}

.contact-item:hover {
    background: rgba(255,255,255,0.3);
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.skill-item {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-weight: 500;
    color: var(--text);
    transition: var(--transition);
}

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

.about-blog {
    background: var(--bg-card);
    padding: 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    line-height: 2;
}

.about-blog p { margin-bottom: 12px; }

/* ===== 归档页 ===== */
.archive-header {
    text-align: center;
    padding: 100px 24px 60px;
}

.archive-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.archive-desc {
    color: var(--text-muted);
}

.archive-list {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

.archive-year {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 40px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
    color: var(--primary);
}

.archive-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.archive-item:hover {
    padding-left: 8px;
}

.archive-date {
    font-size: 0.85rem;
    color: var(--text-light);
    white-space: nowrap;
    min-width: 80px;
}

.archive-title-link {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text);
    transition: var(--transition);
}

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

.archive-tags {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

/* ===== 页脚 ===== */
.footer {
    background: var(--text);
    color: rgba(255,255,255,0.6);
    padding: 40px 24px;
    text-align: center;
}

.footer-content p { margin-bottom: 8px; }

.footer-quote {
    font-size: 0.85rem;
    opacity: 0.5;
}

/* ===== 加载 ===== */
.loading {
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 64px; left: 0; right: 0;
        background: var(--bg-card);
        flex-direction: column;
        padding: 16px;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid var(--border);
    }
    .nav-links.show { display: flex; }
    .nav-links a { padding: 12px 16px; }
    
    .hero-title { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-desc { font-size: 0.9rem; }
    
    .posts-grid { grid-template-columns: 1fr; }
    .section-title { font-size: 1.5rem; }
    
    .post-hero { height: 300px; }
    .post-title { font-size: 1.6rem; }
    .post-body { font-size: 1rem; }
    
    .about-contact { flex-direction: column; align-items: center; }
}

/* ===== 动画 ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card {
    animation: fadeInUp 0.6s ease-out forwards;
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.2s; }
.post-card:nth-child(3) { animation-delay: 0.3s; }
.post-card:nth-child(4) { animation-delay: 0.4s; }
.post-card:nth-child(5) { animation-delay: 0.5s; }
.post-card:nth-child(6) { animation-delay: 0.6s; }
