/* ===== 现代化清新博客前端样式 ===== */

:root {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-soft: #64748b;
    --color-text-light: #94a3b8;
    --color-primary: #6366f1;
    --color-primary-light: #818cf8;
    --color-primary-soft: #eef2ff;
    --color-accent: #ec4899;
    --color-border: #e2e8f0;
    --color-border-soft: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --gradient-fresh: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --gradient-soft: linear-gradient(135deg, #eef2ff 0%, #fdf4ff 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--color-primary); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== 顶部导航 ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--color-border-soft);
}

.nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}

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

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gradient-fresh);
    color: #fff;
    border-radius: 10px;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.main-nav a {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--color-text-soft);
    font-weight: 500;
    transition: all 0.2s ease;
}

.main-nav a:hover {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.main-nav a.active {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.main-nav a.nav-admin {
    margin-left: 8px;
    padding-left: 18px;
    padding-right: 18px;
    background: var(--color-text);
    color: #fff;
}

.main-nav a.nav-admin:hover {
    background: var(--color-primary);
    color: #fff;
}

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

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: 0.3s;
}

/* ===== Hero ===== */
.hero {
    position: relative;
    padding: 80px 0 60px;
    background: var(--gradient-soft);
    overflow: hidden;
}

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

.hero-content {
    max-width: 640px;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 16px;
    background: var(--gradient-fresh);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--color-text-soft);
    margin-bottom: 24px;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-text-soft);
    font-size: 0.95rem;
}

.hero-meta strong {
    color: var(--color-text);
    font-size: 1.1rem;
}

.hero-meta .dot { color: var(--color-text-light); }

.hero-decoration {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    z-index: 1;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    animation: float 8s ease-in-out infinite;
}

.blob-1 {
    width: 300px; height: 300px;
    background: #a78bfa;
    top: -50px; right: 100px;
    animation-delay: 0s;
}
.blob-2 {
    width: 220px; height: 220px;
    background: #f0abfc;
    top: 100px; right: -50px;
    animation-delay: 2s;
}
.blob-3 {
    width: 180px; height: 180px;
    background: #93c5fd;
    bottom: -50px; right: 200px;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

/* ===== 主内容布局 ===== */
.main-content {
    padding: 56px 24px;
}

.content-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.back-link {
    color: var(--color-primary);
    font-size: 0.9rem;
}

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

.post-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-soft);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.post-cover {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--color-border-soft);
}

.post-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.post-cover-placeholder {
    background: var(--color-primary-soft);
}

.cover-pattern {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--hue, 250), 70%, 92%);
    color: hsl(var(--hue, 250), 50%, 45%);
    font-size: 3rem;
    font-weight: 800;
}

.post-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.post-category {
    color: var(--color-primary);
    font-weight: 600;
    background: var(--color-primary-soft);
    padding: 2px 10px;
    border-radius: 20px;
}

.post-date { color: var(--color-text-light); }

.post-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
}

.post-title a {
    color: var(--color-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card:hover .post-title a { color: var(--color-primary); }

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

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--color-text-light);
    padding-top: 14px;
    border-top: 1px solid var(--color-border-soft);
}

/* ===== 侧边栏 ===== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.widget {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-soft);
}

.widget-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-border-soft);
    position: relative;
}

.widget-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 40px;
    height: 2px;
    background: var(--gradient-fresh);
}

.search-form {
    display: flex;
    gap: 8px;
}

.search-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font-size: 0.9rem;
    background: var(--color-bg);
    transition: border 0.2s;
}

.search-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #fff;
}

.search-form button {
    background: var(--gradient-fresh);
    color: #fff;
    border: none;
    padding: 0 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
}

.category-list, .popular-list {
    list-style: none;
}

.category-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    color: var(--color-text-soft);
    font-size: 0.9rem;
}

.category-list li a:hover { color: var(--color-primary); }

.category-list .count {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.popular-list li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-soft);
}

.popular-list li:last-child { border-bottom: none; }

.popular-list .rank {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popular-list li:nth-child(1) .rank { background: var(--color-primary); color: #fff; }

.popular-list a {
    font-size: 0.88rem;
    color: var(--color-text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-list a:hover { color: var(--color-primary); }

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--color-border-soft);
    color: var(--color-text-soft);
    border-radius: 20px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.tag:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 48px;
}

.page-btn, .page-dots {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-soft);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.page-btn.active {
    background: var(--gradient-fresh);
    color: #fff;
    border-color: transparent;
}

.page-dots { border: none; background: none; }

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.7;
}

.empty-state h3 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--color-text-soft);
    margin-bottom: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
    color: #fff;
}

/* ===== 文章详情页 ===== */
.single-post {
    padding-bottom: 60px;
}

.post-hero-image {
    width: 100%;
    max-height: 480px;
    overflow: hidden;
    margin-bottom: -60px;
    position: relative;
}

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

.post-hero-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, var(--color-bg));
}

.post-container {
    max-width: 760px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.post-header {
    background: var(--color-surface);
    padding: 40px 44px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-md);
    margin-top: 80px;
}

.post-category-badge {
    display: inline-block;
    padding: 4px 14px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.post-title-large {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.post-info { margin-top: 8px; }

.author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-fresh);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.author-name { font-weight: 600; font-size: 0.95rem; }

.post-meta-info {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-top: 2px;
}

.post-meta-info .dot { margin: 0 6px; }

.post-content {
    background: var(--color-surface);
    padding: 40px 44px;
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid var(--color-border-soft);
}

/* Markdown 内容样式 */
.markdown-body {
    font-size: 1.02rem;
    line-height: 1.85;
    color: var(--color-text);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin-top: 1.8em;
    margin-bottom: 0.8em;
    font-weight: 700;
    line-height: 1.3;
}

.markdown-body h1 { font-size: 1.8rem; }
.markdown-body h2 {
    font-size: 1.5rem;
    padding-bottom: 0.3em;
    border-bottom: 2px solid var(--color-border-soft);
}
.markdown-body h3 { font-size: 1.25rem; }
.markdown-body h4 { font-size: 1.1rem; }

.markdown-body p { margin-bottom: 1.2em; }

.markdown-body a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-color: var(--color-primary-light);
    text-underline-offset: 2px;
}

.markdown-body strong { font-weight: 700; color: var(--color-text); }
.markdown-body em { font-style: italic; }

.markdown-body ul, .markdown-body ol {
    margin: 1em 0;
    padding-left: 1.6em;
}

.markdown-body li { margin-bottom: 0.5em; }

.markdown-body blockquote {
    margin: 1.5em 0;
    padding: 12px 20px;
    background: var(--gradient-soft);
    border-left: 4px solid var(--color-primary);
    border-radius: 0 10px 10px 0;
    color: var(--color-text-soft);
}

.markdown-body blockquote p { margin: 0; }

.markdown-body pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 18px 22px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 1.5em 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.markdown-body code {
    font-family: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, Monaco, monospace;
}

.markdown-body :not(pre) > code {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.88em;
}

.markdown-body img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: 1.5em 0;
}

.markdown-body hr {
    border: none;
    height: 1px;
    background: var(--color-border);
    margin: 2.5em 0;
}

.post-tags {
    background: var(--color-surface);
    padding: 24px 44px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-tag {
    color: var(--color-primary);
    background: var(--color-primary-soft);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* 上下篇导航 */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 32px;
}

.nav-card {
    background: var(--color-surface);
    padding: 20px 22px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-soft);
    transition: all 0.2s;
}

.nav-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-card.nav-empty {
    background: transparent;
    box-shadow: none;
    border: 1px dashed var(--color-border);
}

.nav-card.nav-next { text-align: right; }

.nav-label {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-bottom: 6px;
}

.nav-title {
    display: block;
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.back-to-home {
    text-align: center;
    margin-top: 36px;
}

.back-to-home a {
    color: var(--color-primary);
    font-weight: 500;
}

/* ===== 页脚 ===== */
.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border-soft);
    padding: 36px 0;
    text-align: center;
    color: var(--color-text-soft);
    font-size: 0.88rem;
}

.footer-sub {
    color: var(--color-text-light);
    font-size: 0.8rem;
    margin-top: 6px;
}

/* ===== 响应式 ===== */
@media (max-width: 960px) {
    .content-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        order: -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .container { padding: 0 18px; }
    .main-nav { display: none; }
    .menu-toggle { display: flex; }
    .main-nav.open {
        display: flex;
        position: absolute;
        top: 68px;
        left: 0;
        right: 0;
        background: var(--color-surface);
        flex-direction: column;
        padding: 16px;
        gap: 4px;
        box-shadow: var(--shadow-md);
        border-bottom: 1px solid var(--color-border);
    }
    .main-nav.open a { width: 100%; }
    .hero { padding: 60px 0 40px; }
    .hero-title { font-size: 2.2rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-decoration { display: none; }
    .posts-grid { grid-template-columns: 1fr; }
    .sidebar { grid-template-columns: 1fr; }
    .post-header, .post-content, .post-tags { padding: 28px 22px; }
    .post-title-large { font-size: 1.6rem; }
    .post-navigation { grid-template-columns: 1fr; }
    .nav-card.nav-next { text-align: left; }
    .main-content { padding: 36px 18px; }
}
