/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.8;
    color: #333;
    background-color: #fff;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
}

html.dark-mode body {
    background-color: #1a1a1a !important;
    color: #e0e0e0 !important;
}

/* 头部样式 */
header {
    padding: 100px 0 50px;
    text-align: center;
    animation: fadeInDown 0.6s ease;
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    letter-spacing: -0.5px;
}

header h1 a {
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header h1 a:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.tagline {
    font-size: 1rem;
    color: #888;
    margin-bottom: 35px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

nav {
    margin-top: 25px;
    padding: 15px 0;
    border-top: 1px solid #e8e8e8;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

nav a {
    display: inline-block;
    margin: 0;
    text-decoration: none;
    color: #666;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
}

nav a:hover {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.05);
    transform: translateY(-2px);
}

/* 主要内容样式 */
main {
    min-height: 50vh;
    padding: 30px 0;
}

/* 文章列表样式 */
.posts {
    margin-bottom: 80px;
}

.posts ul {
    list-style: none;
}

.posts li {
    margin-bottom: 60px;
    padding: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid #e8e8e8;
}

.posts li:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.posts li:last-child {
    margin-bottom: 0;
}

.posts a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.posts h3 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #222;
    line-height: 1.4;
}

.posts .date {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 15px;
    font-weight: 500;
}

.posts p {
    color: #555;
    line-height: 1.7;
    font-size: 0.95rem;
}

/* 文章页面样式 */
.post {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.back-link {
    display: inline-flex;
    align-items: center;
    margin-bottom: 30px;
    color: #667eea;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    background-color: rgba(102, 126, 234, 0.05);
}

.back-link:hover {
    background-color: rgba(102, 126, 234, 0.1);
    transform: translateX(-5px);
}

.post-meta {
    color: #888;
    margin-bottom: 35px;
    font-size: 0.9rem;
    padding: 15px 0;
    border-bottom: 1px solid #e8e8e8;
}

.post-meta p {
    margin-bottom: 5px;
}

.post-content {
    line-height: 1.9;
    color: #333;
    font-size: 1rem;
}

.post-content h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 50px 0 25px;
    color: #222;
    line-height: 1.3;
}

.post-content h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 40px 0 20px;
    color: #222;
    line-height: 1.3;
}

.post-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 30px 0 15px;
    color: #222;
    line-height: 1.3;
}

.post-content p {
    margin-bottom: 25px;
}

.post-content ul,
.post-content ol {
    margin-left: 25px;
    margin-bottom: 25px;
}

.post-content li {
    margin-bottom: 12px;
}

.post-content a {
    color: #0066cc;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.post-content a:hover {
    border-bottom-color: #0066cc;
}

.post-content pre {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 25px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.post-content code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85rem;
}

.post-content pre code {
    background-color: transparent;
    padding: 0;
}

.post-content blockquote {
    border-left: 3px solid #ddd;
    padding-left: 20px;
    margin: 25px 0;
    color: #666;
    font-style: italic;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 25px 0;
}

/* 关于页面样式 */
.about {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.about h2 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 30px;
    color: #222;
}

.about p {
    margin-bottom: 20px;
    color: #666;
    line-height: 1.8;
}

/* 页脚样式 */
footer {
    padding: 60px 0 40px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    margin-top: 80px;
}

footer p {
    color: #999;
    font-size: 0.85rem;
}

.social-links {
    margin-bottom: 20px;
}

.social-links a {
    display: inline-block;
    margin: 0 12px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: #333;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 0 15px;
    }

    header {
        padding: 60px 0 30px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .tagline {
        font-size: 0.9rem;
    }

    nav a {
        margin: 0 10px;
        font-size: 0.9rem;
    }

    .posts h3 {
        font-size: 1.1rem;
    }

    .posts p {
        font-size: 0.9rem;
    }

    .post-content h1 {
        font-size: 1.5rem;
    }

    .post-content h2 {
        font-size: 1.2rem;
    }

    .post-content h3 {
        font-size: 1.05rem;
    }

    footer {
        padding: 40px 0 30px;
        margin-top: 60px;
    }
}

/* 标签样式 */
.tags {
    margin-top: 10px;
}

.tag {
    display: inline-block;
    background-color: #f5f5f5;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    color: #666;
    margin-right: 8px;
    margin-bottom: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag:hover {
    background-color: #e8f4f8;
    color: #333;
}

.tag-count {
    font-size: 0.7rem;
    color: #999;
    margin-left: 5px;
}

/* 评论系统样式 */
.comments {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #f0f0f0;
}

.comments h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 30px;
    color: #333;
}

/* 主题切换按钮 */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    background-color: #f5f5f5;
}

/* 搜索框样式 */
.search-container {
    display: inline-block;
    position: relative;
}

.search-box {
    width: 180px;
    padding: 8px 16px;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    color: #666;
}

.search-box:focus {
    width: 250px;
    border-color: #667eea;
    background-color: #fff;
    color: #333;
}

.search-box::placeholder {
    color: #aaa;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    min-width: 300px;
    margin-top: 10px;
    text-align: left;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    padding: 15px 20px;
    border-radius: 0;
    background: #fff;
    margin-bottom: 0;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    box-shadow: none;
    transition: all 0.2s ease;
}

.search-result-item:hover {
    transform: none;
    background-color: #f8f9fa;
    box-shadow: none;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item a {
    text-decoration: none;
    color: inherit;
}

.search-result-item h4 {
    font-size: 1.15rem;
    margin-bottom: 8px;
    color: #222;
    font-weight: 600;
}

.search-result-item p {
    font-size: 0.9rem;
    color: #666;
}

/* RSS 订阅链接 */
.rss-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.rss-link:hover {
    color: #ff6600;
}

/* 深色模式样式 */
html.dark-mode header h1 a {
    background: linear-gradient(135deg, #a78bfa 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

html.dark-mode nav {
    border-top-color: #333;
    border-bottom-color: #333;
}

html.dark-mode nav a {
    color: #999;
}

html.dark-mode nav a:hover {
    color: #a78bfa;
    background-color: rgba(167, 139, 250, 0.1);
}

html.dark-mode .posts li {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border-color: #333;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

html.dark-mode .posts li:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

html.dark-mode .posts h3 {
    color: #e0e0e0;
}

html.dark-mode .posts p {
    color: #999;
}

html.dark-mode .post {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border-color: #333;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

html.dark-mode .back-link {
    color: #a78bfa;
    background-color: rgba(167, 139, 250, 0.1);
}

html.dark-mode .back-link:hover {
    background-color: rgba(167, 139, 250, 0.2);
}

html.dark-mode .post-meta {
    border-bottom-color: #333;
}

html.dark-mode .post-content {
    color: #e0e0e0;
}

html.dark-mode .post-content h1,
html.dark-mode .post-content h2,
html.dark-mode .post-content h3 {
    color: #e0e0e0;
}

html.dark-mode .post-content a {
    color: #66b3ff;
}

html.dark-mode .search-box {
    background-color: #2a2a2a;
    border-color: #333;
    color: #e0e0e0;
}

html.dark-mode .search-box:focus {
    border-color: #a78bfa;
    background-color: #333;
    color: #fff;
}

html.dark-mode .search-results {
    background: #2a2a2a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

html.dark-mode .search-result-item {
    background: #2a2a2a;
    border-bottom-color: #333;
}

html.dark-mode .search-result-item:hover {
    background-color: #333;
}

html.dark-mode .search-result-item h4 {
    color: #e0e0e0;
}

html.dark-mode .post-content a:hover {
    border-bottom-color: #66b3ff;
}

html.dark-mode .post-content pre {
    background-color: #2d2d2d;
}

html.dark-mode .post-content code {
    background-color: #2d2d2d;
}

html.dark-mode .post-content blockquote {
    border-left-color: #444;
    color: #999;
}

html.dark-mode .tag {
    background-color: #333;
    color: #999;
}

html.dark-mode .tag:hover {
    background-color: #444;
    color: #e0e0e0;
}

html.dark-mode footer {
    border-top-color: #333;
}

html.dark-mode .social-links a {
    color: #999;
}

html.dark-mode .social-links a:hover {
    color: #e0e0e0;
}

html.dark-mode .theme-toggle {
    border-color: #444;
    color: #e0e0e0;
}

html.dark-mode .theme-toggle:hover {
    background-color: #333;
}

html.dark-mode .comments {
    border-top-color: #333;
}

html.dark-mode .comments h3 {
    color: #e0e0e0;
}

html.dark-mode .about h2 {
    color: #e0e0e0;
}

html.dark-mode .about p {
    color: #999;
}

html.dark-mode .back-link {
    color: #999;
}

html.dark-mode .back-link:hover {
    color: #e0e0e0;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 选中文字样式 */
::selection {
    background-color: #e8f4f8;
    color: #333;
}

/* 阅读进度条 */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #0066cc, #00a8ff);
    z-index: 10000;
    transition: width 0.1s ease;
}

/* 文章目录样式 */
.toc {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px 25px;
    margin: 30px 0;
    border-left: 4px solid #0066cc;
}

.toc h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #333;
}

.toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc li {
    margin-bottom: 8px;
}

.toc a {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.toc a:hover {
    color: #0066cc;
}

.toc .toc-h2 {
    padding-left: 0;
}

.toc .toc-h3 {
    padding-left: 20px;
}

/* 代码块样式优化 */
.code-block {
    position: relative;
    margin: 25px 0;
}

.code-block pre {
    margin: 0;
    padding-top: 45px;
}

.code-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background-color: #e9ecef;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
}

.code-lang {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
}

.copy-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 0.8rem;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background-color: #fff;
    border-color: #999;
}

.copy-btn.copied {
    background-color: #28a745;
    border-color: #28a745;
    color: #fff;
}

/* 代码高亮 */
.post-content pre code {
    display: block;
    color: #333;
}

/* 关键字高亮 */
.code-keyword { color: #d73a49; font-weight: bold; }
.code-string { color: #032f62; }
.code-comment { color: #6a737d; font-style: italic; }
.code-function { color: #6f42c1; }
.code-number { color: #005cc5; }

/* 深色模式下的代码高亮 */
html.dark-mode .code-header {
    background-color: #3d3d3d;
}

html.dark-mode .code-lang {
    color: #999;
}

html.dark-mode .copy-btn {
    border-color: #555;
    color: #999;
}

html.dark-mode .copy-btn:hover {
    background-color: #444;
    border-color: #666;
}

html.dark-mode .toc {
    background-color: #2d2d2d;
    border-left-color: #66b3ff;
}

html.dark-mode .toc h3 {
    color: #e0e0e0;
}

html.dark-mode .toc a {
    color: #999;
}

html.dark-mode .toc a:hover {
    color: #66b3ff;
}

html.dark-mode .code-keyword { color: #ff7b72; }
html.dark-mode .code-string { color: #a5d6ff; }
html.dark-mode .code-comment { color: #8b949e; }
html.dark-mode .code-function { color: #d2a8ff; }
html.dark-mode .code-number { color: #79c0ff; }

html.dark-mode .post-content pre {
    background-color: #2d2d2d;
}
