/* ==========================================================================
   dczyw · 文章 / 下载页样式
   ========================================================================== */

.article-wrap { padding-top: 4px; }

.article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.article-primary { min-width: 0; background: var(--surface); border-radius: var(--radius); padding: 24px 24px 26px; }
.article-aside { min-width: 0; }

/* ---------- 标题区 ---------- */

.article-head { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.article-category {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 12px;
    margin-bottom: 12px;
}
.article-category:hover { background: var(--brand); color: #fff; }
.article-head h1 { font-size: 26px; font-weight: 700; line-height: 1.5; word-break: break-word; }
.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 18px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
}
.meta-item { display: inline-flex; align-items: center; gap: 5px; }
.meta-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    object-fit: cover;
}

.article-cover { margin: 20px 0 0; border-radius: var(--radius); overflow: hidden; }
.article-cover img { width: 100%; height: auto; display: block; }

.article-body { margin-top: 22px; }
.article-body a { padding-bottom: 1px; box-shadow: 0 1px 0 rgba(0, 123, 245, .35); }

.article-toc-mobile { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.article-toc-mobile summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.article-toc-mobile summary span { color: var(--muted-light); font-weight: 400; font-size: 12px; margin-left: 4px; }
.article-toc-mobile nav { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; }
.article-toc-mobile a, .article-toc nav a {
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.6;
    display: block;
    padding: 3px 0;
}
.article-toc-mobile a:hover, .article-toc nav a:hover { color: var(--brand); }
.toc-l3 { padding-left: 14px !important; }
.toc-l4 { padding-left: 28px !important; }

/* ---------- 下载区 ---------- */

.download-box {
    margin-top: 26px;
    padding: 18px 20px 16px;
    border: 1px solid #e8f1fb;
    background: #f7fbff;
    border-radius: var(--radius);
}
.download-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid #e4eefa; }
.download-head h2 { font-size: 18px; font-weight: 700; }
.download-head span { font-size: 12px; color: var(--muted-light); }
.download-list { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; }
.download-list li { margin: 0; }
.download-list a {
    min-width: 112px;
    height: 38px;
    padding: 0 16px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid #e2ebf6;
    color: var(--text-soft);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.download-list a svg { transform: rotate(180deg); }
.download-list a:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.download-note { margin: 12px 0 0; font-size: 12px; color: var(--muted-light); }

.download-jump {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--brand);
    color: #fff;
    font-size: 14px;
    margin-bottom: 20px;
}
.download-jump:hover { background: var(--brand-dark); color: #fff; }
.download-jump svg { transform: rotate(180deg); }

/* ---------- 标签 / 免责 ---------- */

.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding: 12px 14px; background: var(--surface-alt); border-radius: var(--radius); }
.article-tags a { padding: 4px 12px; border-radius: var(--radius); background: #fff; color: var(--muted); font-size: 13px; border: 1px solid var(--border); }
.article-tags a:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

.disclaimer {
    margin-top: 20px;
    padding: 16px 18px;
    border: 1px solid #e6e6e6;
    border-radius: var(--radius);
    background: var(--surface-alt);
    color: #777;
    font-size: 12px;
    line-height: 1.9;
}
.disclaimer-title { font-size: 16px; font-weight: 700; color: var(--brand); text-align: center; letter-spacing: 6px; margin-bottom: 6px; }
.disclaimer p:last-child { margin-bottom: 0; text-align: justify; }

/* ---------- 上下篇 ---------- */

.post-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.post-nav-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 76px;
    transition: border-color .2s ease, transform .2s ease;
}
.post-nav-item:hover { border-color: var(--brand); transform: translateY(-2px); }
.post-nav-item span { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted-light); }
.post-nav-item strong { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.post-nav-next { text-align: right; align-items: flex-end; }
.post-nav-item.is-empty { border: 1px dashed #e8ecf2; background: transparent; }

/* ---------- 相关推荐 ---------- */

.related-box { margin-top: 24px; }
.related-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-top: 14px; }
.related-item { display: flex; flex-direction: column; gap: 8px; }
.related-thumb {
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    display: block;
    background: var(--surface-alt);
}
.related-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 22px; }
.related-title { font-size: 13px; line-height: 1.5; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.related-item:hover .related-title { color: var(--brand); }

/* ---------- 独立页面 ---------- */

.page-wrap { padding-top: 4px; }
.page-card { background: var(--surface); border-radius: var(--radius); padding: 26px 28px 30px; max-width: 1000px; margin: 0 auto; }
.page-head { border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: 24px; }

/* ---------- 404 ---------- */

.error-wrap { max-width: 620px; margin: 8vh auto 10vh; text-align: center; background: var(--surface); border-radius: var(--radius); padding: 48px 32px 44px; }
.error-code { font-size: 72px; font-weight: 800; line-height: 1; color: var(--brand); letter-spacing: 4px; margin: 0; }
.error-title { font-size: 24px; font-weight: 700; margin-top: 12px; }
.error-desc { margin: 10px 0 22px; color: var(--muted); }
.error-search { width: 100%; max-width: 460px; margin: 0 auto; display: flex; background: #eef2f7; padding: 6px; border-radius: 40px; }
.error-actions { display: flex; justify-content: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.error-tags { margin-top: 26px; justify-content: center; }

/* ---------- 侧栏目录 ---------- */

.article-toc nav { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.article-toc nav a { border-left: 2px solid transparent; padding-left: 8px; }
.article-toc nav a:hover { border-left-color: var(--brand); }
.article-toc .toc-l3 { padding-left: 20px !important; }

/* ---------- 响应式 ---------- */

@media (max-width: 1200px) {
    .article-grid { grid-template-columns: minmax(0, 1fr) 300px; }
    .article-head h1 { font-size: 23px; }
}

@media (max-width: 980px) {
    .article-grid { grid-template-columns: 1fr; }
    .article-aside { display: none; }
    .article-primary { padding: 18px 16px 20px; }
    .article-head h1 { font-size: 21px; }
    .related-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-card { padding: 18px 16px 22px; }
}

@media (max-width: 720px) {
    .download-list a { min-width: 0; flex: 1 1 46%; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav-next { text-align: left; align-items: flex-start; }
    .article-meta { gap: 6px 12px; }
    .error-wrap { padding: 34px 18px 32px; margin: 4vh auto 8vh; }
    .error-code { font-size: 56px; }
    .error-title { font-size: 20px; }
}

@media (max-width: 480px) {
    .related-list { grid-template-columns: 1fr; }
    .article-head h1 { font-size: 19px; }
}

/* ---------- 夜间 ---------- */

html.night .article-primary,
html.night .page-card,
html.night .error-wrap { background: #1b1e23; }
html.night .article-head h1,
html.night .article-head { border-color: #2a2f36; }
html.night .article-tags { background: #22262c; }
html.night .article-tags a { background: #191c21; border-color: #2a2f36; color: #a9b0b9; }
html.night .disclaimer { background: #22262c; border-color: #2a2f36; color: #8f97a1; }
html.night .download-box { background: #16212e; border-color: #24333f; }
html.night .download-head { border-color: #24333f; }
html.night .download-list a { background: #1d2937; border-color: #2a3a4a; color: #b9c6d2; }
html.night .post-nav-item { border-color: #2a2f36; }
html.night .post-nav-item strong { color: #dfe3e8; }
html.night .post-nav-item.is-empty { border-color: #262b33; }
html.night .related-thumb { background: #22262c; border-color: #2a2f36; }
html.night .article-toc-mobile { border-color: #2a2f36; }
