/* ==========================================================================
   墨云阁 · 布局排版优化层  (ink-layout.css)
   作用：在不修改 style.css / ink.css / responsive.css 的前提下，覆盖排版细节
   加载：header.php 的最后一条 <link>（位于 ink-auth.css 之后）
   原则：
     1) 只使用 CSS 变量与相对单位，暗色（[data-theme="dark"]）自动适配
     2) 全部为覆盖规则，删除本文件即可完全还原
     3) 只作用于博客正文相关页面，不影响视频/音乐/解析等独立页面
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 版面留白：桌面更通栏、移动更紧凑
   -------------------------------------------------------------------------- */
@media (min-width: 1200px) {
    .container { padding: 1.75rem 1.5rem 2.5rem; }
}

@media (max-width: 768px) {
    .container { padding: 0.9rem 0.85rem 1.5rem; gap: 1rem; }
    .main-content > .post:first-child,
    .main-content > .post-card:first-child { margin-top: 0; }
}

/* --------------------------------------------------------------------------
   2. 首页文章卡片
   -------------------------------------------------------------------------- */
/* 桌面：缩略图收窄一点，正文更宽；标题限两行，卡片高度更齐 */
.post-card { align-items: stretch; }

.post-thumb-link { width: 200px; }

.post-body { padding: 1.15rem 1.35rem 1.05rem; }

.post-body .post-title { margin-bottom: 0.4rem; font-size: 17px; }

.post-body .post-title a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-excerpt {
    -webkit-line-clamp: 2;
    font-size: 13.5px;
    line-height: 1.7;
}

.post-footer { gap: 0.65rem; }

/* 移动端：图在上、文在下，缩略图统一 16:9，避免每张卡片高度参差 */
@media (max-width: 768px) {
    .post-card {
        flex-direction: column;
        margin-bottom: 1rem;
    }

    .post-thumb-link {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .post-thumb {
        aspect-ratio: 16 / 9;
        height: auto;
        min-height: 0;
    }

    .post-body { padding: 0.85rem 0.95rem 0.95rem; }

    .post-body .post-title {
        font-size: 16.5px;
        line-height: 1.45;
    }

    .post-body .post-meta { margin-bottom: 0.4rem; font-size: 0.75rem; }

    .post-excerpt {
        font-size: 13px;
        line-height: 1.65;
        margin-bottom: 0.55rem;
    }

    .read-more { font-size: 0.75rem; padding: 0.3rem 0.85rem; }
    .post-tags a { font-size: 0.7rem; }
}

/* --------------------------------------------------------------------------
   3. 文章内页：标题 / 元信息
   -------------------------------------------------------------------------- */
.single-post .post-title {
    font-size: clamp(1.375rem, 1.15rem + 1.05vw, 1.875rem);
    line-height: 1.38;
    letter-spacing: -0.01em;
    margin: 0 0 0.85rem;
}

.single-post .post-meta {
    font-size: 0.8125rem;
    gap: 0.85rem;
    padding-bottom: 0.95rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.35rem;
}

/* 移动端隐藏文章顶部的装饰线稿，把首屏空间留给正文 */
@media (max-width: 768px) {
    .ink-illus-wrap.ink-post-header { display: none; }

    .single-post .post-title { margin-bottom: 0.7rem; }
    .single-post .post-meta { margin-bottom: 1.1rem; font-size: 0.78rem; gap: 0.7rem; }
}

/* --------------------------------------------------------------------------
   4. 正文排版（中文长文可读性）
   -------------------------------------------------------------------------- */
.post-content {
    font-size: 16px;
    line-height: 1.9;
    letter-spacing: 0.01em;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* 宽屏才两端对齐（窄栏对齐会出现明显字距空隙） */
@media (min-width: 769px) {
    .post-content {
        text-align: justify;
        text-justify: inter-ideograph;
    }
}

.post-content p { margin: 0 0 1.15rem; }

/* 二级标题：左侧强调条（与文章大标题的红条呼应），去掉下划线 */
.post-content h2 {
    position: relative;
    font-size: 21px;
    line-height: 1.5;
    margin: 2.1rem 0 0.85rem;
    padding: 0 0 0 0.8rem;
    border-bottom: none;
    border-left: 4px solid var(--primary-color);
    border-radius: 2px;
}

.post-content h3 {
    font-size: 18px;
    line-height: 1.55;
    margin: 1.7rem 0 0.65rem;
}

.post-content h4 {
    font-size: 16.5px;
    margin: 1.35rem 0 0.55rem;
}

@media (max-width: 768px) {
    .post-content h2 { font-size: 19px; margin: 1.8rem 0 0.75rem; }
    .post-content h3 { font-size: 17px; margin: 1.5rem 0 0.6rem; }
    .post-content h4 { font-size: 16px; }
}

.post-content h2:first-child,
.post-content h3:first-child,
.post-content h4:first-child { margin-top: 0; }

/* 列表：缩进收紧、标记着色 */
.post-content ul,
.post-content ol {
    margin: 0 0 1.15rem;
    padding-left: 1.35rem;
}

.post-content li { margin-bottom: 0.4rem; }

.post-content li::marker { color: var(--primary-color); }

/* 引用块：轻底色 + 左侧色条 */
.post-content blockquote {
    margin: 1.5rem 0;
    padding: 0.9rem 1.1rem;
    background: var(--bg-secondary);
    border-left: 3px solid var(--primary-color);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.post-content blockquote p:last-child { margin-bottom: 0; }

/* 图片：居中、统一圆角、去掉悬停放大（避免抖动与发虚） */
.post-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.6rem auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: none;
    transition: box-shadow 0.25s ease;
}

.post-content img:hover {
    transform: none;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
}

/* 链接：更清晰的下划线位置 */
.post-content a {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--border-dark, var(--border-color));
}

.post-content a:hover { text-decoration-color: var(--primary-color); }

/* 行内代码与代码块 */
.post-content code { font-size: 0.875em; }

.post-content pre {
    font-size: 0.8125rem;
    line-height: 1.7;
    padding: 1rem 1.1rem;
}

/* 表格：窄屏可横向滚动 */
.post-content table { font-size: 0.875rem; }

@media (max-width: 768px) {
    .post-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .post-content th,
    .post-content td { padding: 0.45rem 0.6rem; }

    .post-content pre { font-size: 0.8125rem; padding: 0.85rem 0.95rem; }
}

/* 分隔线（Markdown 的 ---）更轻 */
.post-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* --------------------------------------------------------------------------
   5. 标签 / 上下篇 / 分页
   -------------------------------------------------------------------------- */
.post-tags {
    border-top: 1px solid var(--border-color);
    margin-top: 1.75rem;
    padding-top: 0.95rem;
}

.post-navigation {
    margin-top: 1.5rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--border-color);
    gap: 1rem;
}

.page-navigator { margin: 1.5rem 0 0.25rem; }

/* --------------------------------------------------------------------------
   6. 侧边栏
   -------------------------------------------------------------------------- */
@media (min-width: 769px) {
    .sidebar { top: 80px; }
}

.widget-title { letter-spacing: 0.01em; }

.widget li a,
.widget .widget-list a { line-height: 1.9; }

/* --------------------------------------------------------------------------
   7. 页脚
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .site-footer { padding-top: 1.5rem; }
    .ink-illus-wrap.ink-footer-illo { padding-top: 1rem; }
}

/* --------------------------------------------------------------------------
   8. 暗色模式下的少量修正（其余自动跟随变量）
   -------------------------------------------------------------------------- */
[data-theme="dark"] .post-content img {
    border-color: rgba(148, 163, 184, 0.28);
}

[data-theme="dark"] .post-content img:hover {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .post-content blockquote {
    background: rgba(148, 163, 184, 0.1);
}

/* --------------------------------------------------------------------------
   9. 归档页 / 搜索结果 / 独立页面列表
   （这些页面用 article.post，而不是首页的 .post-card，需单独调字号与间距）
   -------------------------------------------------------------------------- */
.archive-header { margin-bottom: 1.35rem; }

.archive-title {
    font-size: 22px;
    line-height: 1.4;
    margin: 0 0 0.5rem;
}

.archive-description {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-muted);
}

.archive-post,
.search-result {
    padding: 1.35rem 1.5rem;
    margin-bottom: 1rem;
}

.archive-post .post-title,
.search-result .post-title {
    font-size: 18px;
    line-height: 1.45;
    margin: 0 0 0.45rem;
}

/* 列表页里的 .post-content 只是摘要：收回正文字号、取消对齐、限两行 */
.archive-post .post-content,
.search-result .post-content {
    font-size: 14px;
    line-height: 1.75;
    text-align: left;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.search-form-archive { margin: 0.75rem 0 1rem; }

@media (max-width: 768px) {
    .archive-title { font-size: 19px; }

    .archive-post,
    .search-result { padding: 1rem 1.1rem; margin-bottom: 0.85rem; }

    .archive-post .post-title,
    .search-result .post-title { font-size: 16.5px; }

    .archive-post .post-content,
    .search-result .post-content { font-size: 13.5px; }
}

/* --------------------------------------------------------------------------
   10. 正文图片点击放大（灯箱）
   -------------------------------------------------------------------------- */
.post-content img { cursor: zoom-in; }

.ink-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh 2vw;
    background: rgba(15, 23, 42, 0.93);
    cursor: zoom-out;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.ink-lightbox img {
    max-width: 100%;
    max-height: 96vh;
    width: auto;
    height: auto;
    margin: 0;
    border: none;
    border-radius: 6px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
    transform: none;
}

@media (max-width: 768px) {
    .ink-lightbox { padding: 0; align-items: flex-start; }
    .ink-lightbox img { width: 100%; max-height: none; border-radius: 0; }
}

/* --------------------------------------------------------------------------
   11. 品牌 logo：尺寸 + 亮色/暗色双版本切换
   -------------------------------------------------------------------------- */
.site-logo {
    height: 40px;
    width: 40px;
    object-fit: contain;
}

/* 品牌组合：标 + 站名 */
.site-logo-link {
    gap: 0.5rem;
}

.site-logo-link .site-title-text {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
    margin: 0;
}

.logo-for-dark { display: none; }

[data-theme="dark"] .logo-for-light { display: none; }
[data-theme="dark"] .logo-for-dark { display: block; }

@media (max-width: 768px) {
    .site-logo { height: 34px; width: 34px; }
    .site-branding { gap: 0.5rem; }
    .site-logo-link { gap: 0.4rem; }
    .site-logo-link .site-title-text { font-size: 1.08rem; }
}

/* 分享图相关：正文里的品牌图不做悬停放大的“发光”效果 */
.post-content img[src*="/brand/"]:hover { box-shadow: none; }
