/*
  色板:
  - 主题蓝 (链接、高亮): #0A76F7
  - 背景灰蓝: #F4F7FC
  - 内容区/卡片白: #FFFFFF
  - 主文字黑: #333333
  - 辅助文字灰: #888888
  - 边框/分割线: #EAECEF
*/

/* 1. 全局与基础样式 */
:root {
    --theme-blue: #0A76F7;
    --bg-color: #F4F7FC;
    --card-bg: #FFFFFF;
    --text-primary: #333333;
    --text-secondary: #888888;
    --border-color: #EAECEF;
    --font-family-base: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    font-family: var(--font-family-base);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 16px;
    margin: 0;
}

a {
    color: var(--theme-blue);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: #085db8;
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 8px; /* 给图片统一的圆角 */
}

/* 移除旧布局的边框和阴影 */
#page.site {
    padding: 0;
    margin: 0;
    max-width: 100%;
    box-shadow: none;
    background-color: transparent;
}

.wrapper {
    max-width: 1200px; /* 定义内容区域最大宽度 */
    margin: 0 auto;
    padding: 20px;
    display: flex;
    gap: 24px; /* 主内容区和侧边栏的间距 */
}

/* === 2. 头部 (Header) 与导航栏 (Navigation) === */
#masthead.site-header {
    background-color: var(--card-bg);
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky; /* 导航栏吸顶 */
    top: 0;
    z-index: 1000;
    width: 100%;
    box-sizing: border-box;
}

.site-header .hgroup {
    display: none; /* 隐藏旧的标题和描述，我们将用更现代的方式呈现 */
}

#site-navigation.main-navigation {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between; /* Logo和菜单项两端对齐 */
    align-items: center;
    height: 64px;
}

/* 导航栏左侧的Logo */
.main-navigation .nav-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}
.main-navigation .nav-logo a {
    color: inherit;
    text-decoration: none;
}
.main-navigation .nav-logo a:hover {
    color: var(--theme-blue);
}

/* 导航菜单项 */
.main-navigation ul.nav-menu {
    display: flex !important; /* 强制显示菜单 */
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 20px;
}

.main-navigation li a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-transform: none; /* 移除大写 */
    line-height: 1.5;
}

.main-navigation li a:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
    text-decoration: none;
}

/* 当前激活的菜单项 */
.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a {
    background-color: var(--theme-blue);
    color: #fff;
}

/* 隐藏子菜单和旧的菜单切换按钮 */
.main-navigation .sub-menu,
.menu-toggle {
    display: none !important;
}

/* === 3. 主内容区 (Main Content) === */
#primary.site-content {
    flex: 1; /* 占据剩余空间 */
    width: 100%;
    margin: 0;
}

/* 文章列表项的卡片样式 */
.site-content article {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.site-content article:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.entry-header .entry-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.entry-header .entry-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.entry-header .entry-title a:hover {
    color: var(--theme-blue);
}

/* 文章摘要/内容 */
.entry-summary, .entry-content {
    color: #555;
    margin-bottom: 20px;
}

.entry-content p {
    margin-bottom: 1.5em;
}

/* "Read more" 链接 */
.entry-summary a.more-link, .read-more a {
    display: inline-block;
    font-weight: 600;
    margin-top: 10px;
}

/* 文章元信息 (作者、日期、分类、标签) */
footer.entry-meta {
    font-size: 14px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 16px;
}

footer.entry-meta a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: all 0.2s;
}

footer.entry-meta a:hover {
    color: var(--theme-blue);
    text-decoration-color: var(--theme-blue);
}

footer.entry-meta span {
    margin-right: 15px;
}

/* === 4. 侧边栏 (Sidebar) === */
.widget-area {
    width: 300px; /* 固定宽度 */
    flex-shrink: 0;
    margin: 0;
}

.widget-area .widget {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.widget-area .widget-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--theme-blue);
}

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

.widget-area .widget li {
    margin-bottom: 10px;
}

.widget-area .widget li a {
    color: #555;
    text-decoration: none;
    display: flex;
    justify-content: space-between;
}

.widget-area .widget li a:hover {
    color: var(--theme-blue);
}

/* 搜索框样式 */
#searchform #s {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box;
}

#searchform #searchsubmit {
    display: none;
}


/* === 5. 页脚 (Footer) === */
footer[role="contentinfo"] {
    background-color: #2c3e50; /* 深蓝灰色背景 */
    color: #bdc3c7; /* 浅灰色文字 */
    padding: 40px 20px;
    text-align: center;
    font-size: 14px;
    border-top: none;
    max-width: 100%;
}

footer[role="contentinfo"] a {
    color: #ecf0f1; /* 白色链接 */
}

footer[role="contentinfo"] a:hover {
    color: var(--theme-blue);
}

.site-info {
    margin-bottom: 10px;
}

/* === 6. 文章详情页特定样式 === */
.entry-content h1, .entry-content h2, .entry-content h3 {
    font-weight: 700;
    margin-top: 2em;
    margin-bottom: 1em;
}
.entry-content h1 { font-size: 2em; }
.entry-content h2 { font-size: 1.5em; border-bottom: 1px solid var(--border-color); padding-bottom: .3em;}
.entry-content h3 { font-size: 1.25em; }

.entry-content blockquote {
    border-left: 4px solid var(--theme-blue);
    background-color: var(--bg-color);
    padding: 15px 20px;
    margin: 20px 0;
    font-style: italic;
    color: #666;
}

/* 代码块样式 */
.entry-content pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    border: none;
}
.entry-content code {
    background-color: #e8e8e8;
    padding: .2em .4em;
    margin: 0;
    font-size: 85%;
    border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}
.entry-content pre code {
    background: none;
    padding: 0;
}

/* === 7. 分页导航 === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 40px 0;
    list-style: none;
}
.pagination .page-item a, .pagination .page-item span {
    display: block;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--card-bg);
    color: var(--text-secondary);
    transition: all 0.2s;
}
.pagination .page-item a:hover {
    border-color: var(--theme-blue);
    color: var(--theme-blue);
    text-decoration: none;
}
.pagination .page-item.active span {
    background-color: var(--theme-blue);
    border-color: var(--theme-blue);
    color: #fff;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .wrapper {
        flex-direction: column;
    }
    .widget-area {
        width: 100%;
    }
    .main-navigation .nav-menu {
        display: none !important;
    }
}

/* === 8. 文章导航 (上一篇/下一篇) 卡片化 === */
.nav-single {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 40px 0;
    border-top: none;
}

.nav-single .nav-previous,
.nav-single .nav-next {
    width: 100%;
    text-align: left;
}

.nav-single a {
    display: block;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--card-bg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    height: 100%; /* 保证两张卡片等高 */
    box-sizing: border-box;
}

.nav-single a:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: var(--theme-blue);
    text-decoration: none;
}

/* 导航卡片内的标题和提示文字 */
.nav-single .meta-nav {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.nav-single .nav-next {
    text-align: right; /* 下一篇卡片内容右对齐 */
}

.nav-single .nav-next a {
    text-align: right;
}

/* === 9. 评论区 UI 优化 === */

/* 评论区整体容器 */
.comments-area {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    margin-top: 40px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* 评论区标题，如“发表评论” */
.comments-area .comments-title,
.comments-area #reply-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* 评论列表 */
.commentlist {
    list-style: none;
    padding: 0;
}

.commentlist .comment {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
}
.commentlist .comment:last-child {
    border-bottom: none;
}

/* 评论头部：头像、作者、时间 */
.commentlist .comment-author .avatar {
    float: left;
    margin-right: 15px;
    border-radius: 50%; /* 圆形头像 */
    box-shadow: none;
}
.commentlist .fn { /* 评论作者 */
    font-weight: 600;
    color: var(--text-primary);
}
.commentlist .comment-meta a { /* 评论时间 */
    font-size: 14px;
    color: var(--text-secondary);
}

/* 评论内容 */
.comment-content {
    padding-top: 10px;
    clear: both;
}

/* 评论回复按钮 */
.reply a {
    font-size: 14px;
    font-weight: 600;
}

/* 评论表单 */
#respond form {
    margin-top: 20px;
}

#respond textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 120px;
    font-family: var(--font-family-base);
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

#respond textarea:focus {
    outline: none;
    border-color: var(--theme-blue);
    box-shadow: 0 0 0 3px rgba(10, 118, 247, 0.2);
}

/* 发表评论按钮 */
#respond .form-submit input[type="submit"] {
    background-color: var(--theme-blue);
    color: #fff;
    border: none;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: none;
}

#respond .form-submit input[type="submit"]:hover {
    background-color: #085db8;
}

/* “支持markdown”提示文字 */
#respond .comment-notes {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 10px;
}

/* 登录后才能评论的提示 */
.comments-area .comment-meta {
    font-size: 16px;
    font-weight: 500;
}

/* =====================
   夜间模式 (Dark Mode)
   ===================== */
[data-theme="dark"] {
    --theme-blue: #3d8bfd; /* 稍微亮一点的蓝 */
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: #333333;
}

[data-theme="dark"] img {
    filter: brightness(0.9); /* 图片稍微压暗一点，护眼 */
}

/* 评论区代码块在深色模式下的微调 */
[data-theme="dark"] .entry-content pre {
    background-color: #111;
    border: 1px solid #333;
}

[data-theme="dark"] .ai-chat-window {
    background: #1e1e1e;
    border-color: #333;
}

[data-theme="dark"] .ai-input-area {
    background: #1e1e1e;
    border-color: #333;
}
[data-theme="dark"] .ai-input-area input {
    background: #2d2d2d;
    color: #fff;
    border-color: #444;
}
[data-theme="dark"] .message.ai {
    background: #2d2d2d;
    color: #eee;
    border-color: #444;
}