/*
Theme Name: Journal Pro Plus
Description: 优雅的极简日记主题，支持暗色模式、搜索、标签
Version: 2.1 美化升级版
Author: Your Name
*/

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f9fafb;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.06);
    --shadow-lg: rgba(0, 0, 0, 0.1);
    --radius: 14px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: #a5b4fc;
    --text: #f3f4f6;
    --text-light: #9ca3af;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.25);
    --shadow-lg: rgba(0, 0, 0, 0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    transition: var(--transition);
    min-height: 100vh;
    letter-spacing: 0.2px;
}

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

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    margin-bottom: 50px;
    box-shadow: 0 2px 10px var(--shadow);
}
[data-theme="dark"] .site-header {
    background: rgba(30, 41, 59, 0.85);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.site-brand a {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-brand span {
    color: var(--text);
}

.site-description {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 4px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 主题切换按钮 */
.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    transition: var(--transition);
    box-shadow: 0 2px 8px var(--shadow);
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: rotate(15deg) scale(1.05);
}

/* 搜索 */
.search-form {
    position: relative;
    width: 300px;
}

.search-form input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text);
    font-size: 14px;
    transition: var(--transition);
    box-shadow: 0 1px 3px var(--shadow);
}

.search-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: #fff;
}

.search-form::before {
    content: "🔍";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 14px;
}

/* 首页标题区 */
.hero {
    text-align: center;
    padding: 70px 0;
    margin-bottom: 50px;
}

.hero h1 {
    font-size: 52px;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 18px;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 30px;
}

/* 时间线文章列表 */
.post-timeline {
    position: relative;
    padding-left: 32px;
}

.post-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    margin-bottom: 44px;
    padding: 28px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: var(--transition);
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s ease forwards;
    box-shadow: 0 4px 12px var(--shadow);
}

.timeline-item:nth-child(2) { animation-delay: 0.1s; }
.timeline-item:nth-child(3) { animation-delay: 0.2s; }
.timeline-item:nth-child(4) { animation-delay: 0.3s; }
.timeline-item:nth-child(5) { animation-delay: 0.4s; }

.timeline-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px var(--shadow-lg);
    border-color: var(--primary-light);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -38px;
    top: 36px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--bg);
    z-index: 1;
}

.post-date {
    display: inline-block;
    font-size: 12px;
    color: var(--text-light);
    background: var(--bg);
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
}

.post-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 14px;
}

.post-title a {
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
}

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

.post-excerpt {
    color: var(--text-light);
    margin-bottom: 18px;
    line-height: 1.8;
}

.post-meta {
    display: flex;
    gap: 18px;
    font-size: 12px;
    color: var(--text-light);
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===================================== */
/* 文章详情页（核心美化）*/
/* ===================================== */
.single-post {
    animation: fadeIn 0.6s ease;
}

.entry-header {
    text-align: center;
    padding: 40px 0 50px;
}

.entry-categories {
    margin-bottom: 16px;
}
.category-link {
    display: inline-block;
    padding: 6px 14px;
    background: var(--primary);
    color: #fff !important;
    border-radius: 20px;
    font-size: 13px;
    text-decoration: none;
    margin: 0 4px;
}

.entry-title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 24px;
    color: var(--text);
}

.entry-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px 24px;
    font-size: 14px;
    color: var(--text-light);
    margin-top: 10px;
}
.entry-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* 文章封面图 */
.featured-image {
    margin: 0 auto 50px;
    max-width: 780px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 24px var(--shadow);
}
.post-thumbnail {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}

/* 文章内容 */
.entry-content {
    max-width: 740px;
    margin: 0 auto 60px;
    padding: 50px 55px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 6px 20px var(--shadow);
    line-height: 1.85;
    font-size: 17px;
}

.entry-content h1 { font-size: 32px; margin: 40px 0 20px; }
.entry-content h2 { font-size: 26px; margin: 36px 0 18px; }
.entry-content h3 { font-size: 22px; margin: 32px 0 16px; }
.entry-content h4 { font-size: 20px; margin: 28px 0 14px; }

.entry-content p {
    margin-bottom: 26px;
    color: var(--text);
}

.entry-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    margin: 36px 0;
    background: rgba(99, 102, 241, 0.06);
    color: var(--text-light);
    font-style: italic;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
[data-theme="dark"] .entry-content blockquote {
    background: rgba(99, 102, 241, 0.1);
}

.entry-content pre {
    background: var(--bg);
    padding: 24px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 30px 0;
    border: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.6;
}

.entry-content code {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 15px;
    color: var(--primary);
}

.entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 20px 0;
    box-shadow: 0 2px 8px var(--shadow);
}

/* 分页 */
.page-links {
    margin: 40px 0;
    text-align: center;
}
.page-number {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* 标签 & 心情 */
.post-tags,
.post-moods {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.tags-title, .moods-title {
    font-weight: 600;
    color: var(--text);
    font-size: 15px;
}
.tags-list, .moods-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.tag-link, .mood-tag {
    padding: 7px 14px;
    background: var(--bg);
    color: var(--text-light);
    text-decoration: none;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.tag-link:hover, .mood-tag:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 上下篇文章 */
.post-navigation {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}
.nav-links {
    display: flex;
    gap: 30px;
    justify-content: space-between;
}
.nav-previous, .nav-next {
    flex: 1;
}
.nav-direction {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
    display: block;
}
.nav-links a {
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
}
.nav-links a:hover {
    color: var(--primary);
}
.nav-links h4 {
    font-size: 16px;
    margin: 0 0 6px;
    font-weight: 600;
}
.nav-date {
    font-size: 12px;
    color: var(--text-light);
}

/* 作者信息框 */
.author-bio {
    margin-top: 60px;
    padding: 30px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 12px var(--shadow);
}
.author-avatar img {
    border-radius: 50%;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}
.author-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}
.author-description {
    color: var(--text-light);
    margin-bottom: 10px;
    font-size: 15px;
}
.author-website {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

/* 相关文章 */
.related-posts {
    margin-top: 70px;
}
.related-title {
    font-size: 20px;
    margin-bottom: 25px;
    padding-left: 10px;
    border-left: 3px solid var(--primary);
}
.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.related-post {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.related-post:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px var(--shadow);
}
.related-thumbnail img {
    width: 100%;
    height: 110px;
    object-fit: cover;
}
.related-content {
    padding: 14px;
}
.related-post-title {
    font-size: 15px;
    margin-bottom: 6px;
}
.related-post-title a {
    color: var(--text);
    text-decoration: none;
}
.related-meta {
    font-size: 12px;
    color: var(--text-light);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 70px 0;
}
.pagination a,
.pagination span {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
    background: var(--card-bg);
}
.pagination a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.pagination .current {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 底部 */
.site-footer {
    margin-top: 100px;
    padding: 50px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}
.social-links {
    display: flex;
    gap: 20px;
}
.social-links a {
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition);
}
.social-links a:hover {
    color: var(--primary);
}

/* 404 */
.error-404 {
    text-align: center;
    padding: 120px 0;
}
.error-404 h1 {
    font-size: 120px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 20px;
}

/* 动画 */
@keyframes slideUp {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 移动端 */
@media (max-width: 768px) {
    .container { padding: 0 18px; }
    .header-inner { flex-direction: column; gap: 20px; }
    .nav-menu { width: 100%; justify-content: space-between; }
    .search-form { width: 100%; }
    .hero h1 { font-size: 36px; }
    .entry-title { font-size: 28px; }
    .entry-content { padding: 30px 24px; font-size: 16px; }
    .author-bio { flex-direction: column; text-align: center; }
    .related-posts-grid { grid-template-columns: 1fr; }
    .nav-links { flex-direction: column; gap: 20px; }
    .footer-content { flex-direction: column; gap: 20px; }
    .post-timeline { padding-left: 24px; }
    .timeline-item::before { left: -28px; }
}
