/*
 * Theme Name: Silent Sand (Diary Style)
 * Author: AI Assistant
 * Description: A minimalist single column theme inspired by yukieyun.net
 * Version: 1.0
 */

:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --secondary-text: #888888;
    --link-color: #111111;
    --border-color: #eeeeee;
    --max-width: 720px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #cccccc;
        --secondary-text: #777777;
        --link-color: #ffffff;
        --border-color: #333333;
    }
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: "LXGW WenKai Screen", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.8;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    text-align: justify;
}

a { color: var(--link-color); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.7; }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    /* 将顶部的 60px 缩小为 20px */
    padding: 20px 25px 60px 25px; 
}

.index-main {
    margin: 0;
    padding: 0;
}

/* Header */
/* Header 布局优化 */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 40px;
    position: relative;
}

.site-branding {
    flex: 1;
    text-align: center;
}

.site-title {
    font-size: 1.3rem; /* 稍微调小一点，确保在小屏幕不挤压两侧 */
    margin: 0;
    line-height: 1;
    letter-spacing: 1px;
}

/* 搜索全屏覆盖层样式 */
.search-overlay {
    position: fixed;
    top: -100%; /* 默认隐藏在上方 */
    left: 0;
    width: 100%;
    height: 100px;
    background: var(--bg-color);
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 0px solid var(--border-color);
}

.search-overlay.active {
    top: 0;
}

.search-overlay form {
    width: 80%;
    max-width: var(--max-width);
}

.search-overlay input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 0px solid var(--text-color);
    font-size: 1.5rem;
    padding: 10px 0;
    color: var(--text-color);
    outline: none;
    border-radius: 20px;
}

.close-search {
    position: absolute;
    right: 25px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--secondary-text);
}

/* 适配移动端 */
@media screen and (max-width: 600px) {
    .site-title { font-size: 1.1rem; }
    .header-search svg { width: 18px; height: 18px; }
}

.header-placeholder, .menu-toggle {
    flex: 0 0 40px; /* 确保两侧宽度一致，实现中间绝对居中 */
}

/* 汉堡包图标样式 */
/* 汉堡包按钮容器 */
.menu-toggle {
    flex: 0 0 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    border-radius: 50%; /* 增加圆形点击反馈区 */
    transition: background-color 0.3s ease;
}

.menu-toggle:hover {
    background-color: var(--border-color); /* 悬停时淡淡的灰色背景 */
}

/* 汉堡包盒子，固定尺寸确保旋转中心准确 */
.hamburger-box {
    width: 20px;
    height: 14px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 线条基础样式 */
.menu-toggle .line {
    display: block;
    height: 1.5px; /* 线条改细，更显精致 */
    width: 100%;
    background-color: var(--text-color);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s ease;
    border-radius: 1px;
}

/* 中间线条稍微短一点，增加设计感 */
.line-mid {
    width: 75%; 
}

/* 激活状态：变为 X */
.menu-toggle.open .line-top {
    transform: translateY(6px) rotate(45deg);
}

.menu-toggle.open .line-mid {
    opacity: 0;
    transform: translateX(-5px);
}

.menu-toggle.open .line-bottom {
    transform: translateY(-6px) rotate(-45deg);
}

/* 针对暗黑模式的细微调整 */
@media (prefers-color-scheme: dark) {
    .menu-toggle:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }
}

/* 移动端缩小点击区 */
@media screen and (max-width: 600px) {
    .menu-toggle {
        flex: 0 0 32px;
        height: 32px;
    }
    .hamburger-box {
        width: 18px;
        height: 12px;
    }
}

/* 侧边导航菜单 */
.nav-menu {
    position: fixed;
    top: 0;
    left: -280px; /* 初始隐藏在左侧 */
    width: 240px;
    height: 100%;
    background-color: var(--bg-color);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 80px 20px;
    display: flex;
    flex-direction: column;
}

.nav-menu.active {
    left: 0;
}

.nav-menu a {
    font-size: 1.1rem;
    color: var(--text-color);
    padding: 15px 0;
    border-bottom: 0px solid var(--border-color);
    display: block;
}

/* 遮罩层 */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    display: none;
    z-index: 999;
}

.menu-overlay.active {
    display: block;
}

@media screen and (max-width: 600px) {
        .container {
        /* 移动端顶部间距可以更紧凑 */
        padding: 15px 20px 40px 20px;
    }
    .site-header { margin-bottom: 30px; }
    .site-title { font-size: 1.2rem; }
}

/* 列表页布局优化 */
.post-item-flex {
    display: flex;
    margin-bottom: 60px;
    align-items: flex-start;
    /* 确保这里没有左外边距 */
}

/* 左侧日期样式 *//* 优化后的日期与分隔线间距 */
.post-date-side {
    flex: 0 0 45px; /* 从 65px 缩小到 45px，让日期区域更紧凑 */
    text-align: left;
    margin-top: 5px;
}

.post-date-side .day {
    display: block;
    font-size: 1.3rem; /* 稍微调小一点点，适配紧凑布局 */
    font-weight: 700;
    line-height: 1;
    color: var(--link-color);
}

.post-date-side .month {
    display: block;
    font-size: 0.75rem;
    color: var(--secondary-text);
    margin: 1px 0;
    text-transform: uppercase;
}

.post-date-side .year {
    display: block;
    font-size: 0.7rem;
    color: var(--secondary-text);
    opacity: 0.6;
}

/* 右侧内容及分隔线 */
.post-content-main {
    flex: 1;
    padding-left: 18px; /* 从 25px 缩小到 18px，使内容更贴近分隔线 */
    border-left: 1px solid var(--border-color);
    /* 解决长标题或链接可能溢出的问题 */
    word-break: break-word; 
}

.post-content-main .post-title {
    font-size: 1.4rem;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.post-content-main .post-category {
    font-size: 0.85rem;
    color: var(--secondary-text);
    margin-bottom: 15px;
}

.post-content-main .post-excerpt {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-color);
    opacity: 0.85;
}

/* 响应式适配：移动端减小间距 */
@media screen and (max-width: 600px) {
    .post-date-side {
        flex: 0 0 40px;
    }
    .post-content-main {
        padding-left: 15px;
    }
    .post-date-side .day {
        font-size: 1.2rem;
    }
    .post-content-main .post-title {
        font-size: 1.15rem;
    }
}

/* 分页容器布局 */
.pagination-container {
    margin-top: 60px;
    padding-left: 63px; /* 对应日期宽度 45px + 间距 18px，实现与内容对齐 */
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
}

.pagination {
    list-style: none;
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
    font-family: "Georgia", serif; /* 与日期字体保持一致 */
}

.pagination li {
    margin-right: 8px;
}

.pagination li a, 
.pagination li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 5px;
    font-size: 0.9rem;
    color: var(--secondary-text);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

/* 当前页样式 */
.pagination li.current span {
    color: var(--link-color);
    font-weight: 700;
    border-bottom: 2px solid var(--link-color); /* 极简下划线高亮 */
}

/* 悬停效果 */
.pagination li a:hover {
    color: var(--link-color);
    background-color: var(--border-color);
}

/* 省略号样式 */
.pagination li .space {
    color: var(--secondary-text);
    cursor: default;
}

/* 上一页/下一页图标对齐 */
.pagination li.prev a, 
.pagination li.next a {
    color: var(--link-color);
}

/* 移动端适配 */
@media screen and (max-width: 600px) {
    .pagination-container {
        padding-left: 58px; /* 适配移动端 40px + 18px */
    }
    .pagination li {
        margin-right: 4px;
    }
    .pagination li a, 
    .pagination li span {
        min-width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }
}
/* 文章正文全局排版 */
.post-content {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-color);
    text-align: justify;
}

.post-content p {
    margin-bottom: 1.5rem;
}

/* 引用区块 (Blockquote) - 极致简约 */
.post-content blockquote {
    margin: 2rem 0;
    padding: 0.5rem 1.5rem;
    border-left: 3px solid var(--text-color); /* 使用正文颜色作为强调线 */
    background-color: transparent; /* 保持透明，仅用线条区分 */
    color: var(--secondary-text);
    font-style: italic;
}

.post-content blockquote p {
    margin-bottom: 0; /* 消除引用内段落的多余边距 */
}

/* 行内代码 (Inline Code) */
.post-content :not(pre) > code {
    background-color: var(--border-color);
    color: #d63384; /* 稍微给一点区分色，或改用 var(--text-color) */
    padding: 2px 5px;
    border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.9em;
}

/* 代码块 (Code Block) */
.post-content pre {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #f8f9fa; /* 浅灰色背景 */
    border-radius: 4px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
    .post-content pre {
        background-color: #252525; /* 暗黑模式下的深色背景 */
    }
}

.post-content pre code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    color: var(--text-color);
    background: none;
    padding: 0;
}

/* 标题样式优化 */
.post-content h1, .post-content h2, .post-content h3 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--link-color);
}

.post-content h2 { font-size: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.post-content h3 { font-size: 1.25rem; }

/* 列表样式 */
.post-content ul, .post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

/* 文章内图片全局控制 */
.post-content img {
    max-width: 100%;    /* 核心：确保图片宽度永远不会超过父容器 */
    height: auto;       /* 核心：高度等比缩放，防止拉伸变形 */
    display: block;     /* 消除图片底部的微小空隙 */
    margin: 2rem auto;  /* 上下留白，左右居中 */
    border-radius: 4px; /* 轻微圆角，增加精致感 */
    transition: opacity 0.3s ease;
    border: 1px solid var(--border-color); /* 添加极细边框 */
    /* 或者使用淡淡的投影 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* 如果图片带有标题 (Typecho 默认使用 p 标签包裹图片) */
.post-content p:has(img) {
    text-align: center; /* 确保包裹图片的段落居中 */
    margin-bottom: 2rem;
}

/* 图片下方的说明文字 (Caption) 样式优化 */
/* 通常用户会手动在图片下写一行文字，或者通过 HTML 标签实现 */
.post-content .image-caption, 
.post-content figcaption {
    display: block;
    font-size: 0.85rem;
    color: var(--secondary-text);
    margin-top: -1.5rem; /* 紧贴图片下方 */
    margin-bottom: 2rem;
    text-align: center;
    font-style: italic;
}

/* 鼠标悬停效果 - 极简风的轻微互动 */
.post-content img:hover {
    opacity: 0.95;
}

/* 针对大图的特殊处理：如果图片非常宽，确保它在移动端表现良好 */
@media screen and (max-width: 600px) {
    .post-content img {
        margin: 1.5rem auto;
        border-radius: 2px; /* 移动端圆角减小 */
        box-shadow: none; /* 暗黑模式下关闭投影，避免发光感 */
        border: 1px solid #333; 
    }
}

/* 整合底部容器 */
.post-footer {
    margin-top: 40px; /* 缩小与正文的距离 */
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* 标签样式优化 */
.post-tags {
    font-size: 0.85rem;
    margin-bottom: 30px; /* 标签与导航的间距 */
}

.post-tags a {
    color: var(--secondary-text);
    margin-right: 12px;
    opacity: 0.8;
}

.post-tags a:hover {
    color: var(--link-color);
    opacity: 1;
}

.tags-label {
    color: var(--secondary-text);
    margin-right: 5px;
    font-weight: bold;
}

/* 上下篇导航紧凑化 */
.post-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.nav-link {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nav-link.next {
    text-align: right;
}

.nav-dir {
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--secondary-text);
    margin-bottom: 4px; /* 极小的间距 */
    font-family: "Georgia", serif;
}

.nav-item-title {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--link-color);
    display: -webkit-box;
    -webkit-line-clamp: 1; /* 标题过长时显示省略号，保持一行 */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 移动端处理 */
@media screen and (max-width: 600px) {
    .post-navigation {
        gap: 10px;
    }
    .nav-item-title {
        font-size: 0.85rem;
    }
}



/* Footer */
/* 页脚样式 */
.site-footer {
    margin-top: 80px;
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-text);
    font-size: 0.8rem;
    line-height: 1.6;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.site-footer a {
    color: var(--secondary-text);
    border-bottom: 1px solid transparent;
}

.site-footer a:hover {
    color: var(--link-color);
    border-bottom: 1px solid var(--border-color);
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    right: 40px;
    bottom: 40px;
    width: 40px;
    height: 40px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99;
    border-radius: 2px; /* 极简方正风 */
}

.back-to-top.visible {
    opacity: 0.6;
    visibility: visible;
}

.back-to-top:hover {
    opacity: 1;
    background-color: var(--border-color);
}

/* 移动端适配 */
@media screen and (max-width: 600px) {
    .footer-container {
        flex-direction: column;
        gap: 10px;
    }
    .back-to-top {
        right: 20px;
        bottom: 20px;
        width: 35px;
        height: 35px;
    }
}

/* Archive Page */
/* 归档页面容器 */
.archive-container {
    padding-left: 0;
}

.archive-content {
    margin-top: 40px;
}

/* 年份层级 */
.archive-year {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 40px 0 20px 0;
    font-family: "Georgia", serif;
    color: var(--link-color);
}

/* 年份文章数上标 */
.archive-count {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--secondary-text);
    margin-left: 5px;
    vertical-align: super;
}

/* 月份层级 - 增加缩进 */
.archive-month {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 25px 0 15px 30px; /* 左缩进 30px */
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 文章条目层级 - 进一步缩进 */
.archive-entry {
    display: flex;
    align-items: baseline;
    margin-bottom: 12px;
    padding-left: 60px; /* 左缩进 60px */
    font-size: 0.95rem;
}

.archive-date {
    flex: 0 0 50px;
    font-size: 0.85rem;
    color: var(--secondary-text);
    font-family: monospace;
}

.archive-link {
    color: var(--text-color);
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.archive-link:hover {
    color: var(--link-color);
    border-bottom: 1px solid var(--border-color);
}

/* 移动端适配 */
@media screen and (max-width: 600px) {
    .archive-month { margin-left: 15px; }
    .archive-entry { padding-left: 30px; }
    .archive-year { font-size: 1.5rem; }
}

@media screen and (max-width: 600px) {
    .container { padding: 40px 20px; }
    header { margin-bottom: 40px; }
    .post-item .post-title { font-size: 1.2rem; }
}
