/* ==========================================================================
   logbook 主题样式
   技术文档风 · 深色/浅色 · 双列布局
   ========================================================================== */

/* ---------- 字体 ---------- */
@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/jetbrains-mono-700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ---------- 变量 ---------- */
:root {
    --accent: #4f9cf9;
    --accent-2: #a371f7;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --wrap: 1200px;
    --gap: 40px;
    --head-h: 62px;

    --c-blue: #4f9cf9;
    --c-violet: #a371f7;
    --c-green: #3fb950;
    --c-orange: #e3852f;
    --c-pink: #ec6cb9;
    --c-cyan: #39c5cf;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;

    --ease: cubic-bezier(.22, .61, .36, 1);
    --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px -12px rgba(0, 0, 0, .18);
}

html[data-theme="dark"] {
    --bg: #0d1117;
    --bg-soft: #010409;
    --surface: #161b22;
    --surface-2: #1c2128;
    --code-bg: #0b0f16;
    --border: #21262d;
    --border-strong: #30363d;
    --text: #e6edf3;
    --text-soft: #9aa4b2;
    --text-dim: #6e7681;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .8);
    --hl-comment: #7d8590;
    --hl-keyword: #ff7b72;
    --hl-string: #a5d6ff;
    --hl-number: #79c0ff;
    --hl-title: #d2a8ff;
    --hl-attr: #7ee787;
    --hl-type: #ffa657;
    --hl-builtin: #ffa657;
    --hl-meta: #8b949e;
}

html[data-theme="light"] {
    --bg: #ffffff;
    --bg-soft: #f6f8fa;
    --surface: #ffffff;
    --surface-2: #f6f8fa;
    --code-bg: #f6f8fa;
    --border: #d8dee4;
    --border-strong: #b9c0c8;
    --text: #1f2328;
    --text-soft: #57606a;
    --text-dim: #8b949e;
    --shadow: 0 1px 2px rgba(31, 35, 40, .06), 0 8px 24px -14px rgba(31, 35, 40, .22);
    --hl-comment: #6e7781;
    --hl-keyword: #cf222e;
    --hl-string: #0a3069;
    --hl-number: #0550ae;
    --hl-title: #8250df;
    --hl-attr: #116329;
    --hl-type: #953800;
    --hl-builtin: #953800;
    --hl-meta: #57606a;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body.logbook {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    transition: background-color .25s var(--ease), color .25s var(--ease);
}

a { color: var(--accent); text-decoration: none; transition: color .18s var(--ease); }
a:hover { color: var(--accent-2); }

img { max-width: 100%; height: auto; }

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }

.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-dim); display: inline-block; vertical-align: middle; }

/* 滚动条 */
html[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #30363d; border-radius: 6px; border: 2px solid var(--bg); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ---------- 顶部阅读进度 ---------- */
.progress {
    position: fixed; inset: 0 auto auto 0; height: 2px; width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    z-index: 100; transition: width .1s linear;
}

/* ---------- 页头 ---------- */
.site-head {
    position: sticky; top: 0; z-index: 60;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-head-inner { display: flex; align-items: center; gap: 18px; height: var(--head-h); }

.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-logo { height: 28px; width: auto; }
.brand-mark { font-family: var(--font-mono); font-size: 15px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 3px 7px; border-radius: var(--radius-xs); }
.brand-text { font-size: 17px; }

.site-nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; flex: 1; min-width: 0; overflow: hidden; }
.nav-link {
    position: relative; padding: 6px 10px; border-radius: var(--radius-xs);
    color: var(--text-soft); font-size: 14.5px; white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.is-active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

.head-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.head-search input {
    width: 150px; padding: 7px 12px; font-size: 13.5px; font-family: inherit;
    color: var(--text); background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 999px;
    transition: width .25s var(--ease), border-color .2s var(--ease);
}
.head-search input:focus { width: 200px; border-color: var(--accent); outline: none; }
.head-search input::placeholder { color: var(--text-dim); }

.icon-btn {
    display: grid; place-items: center; width: 34px; height: 34px; flex: none;
    color: var(--text-soft); background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
    transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 1.9; }
.icon-btn .i-moon { display: none; }
html[data-theme="dark"] .icon-btn .i-sun { display: none; }
html[data-theme="dark"] .icon-btn .i-moon { display: block; }
.icon-btn .i-moon { fill: currentColor; stroke: none; }

.nav-toggle { display: none; }

/* ---------- 主区域布局 ---------- */
.site-main { min-height: 60vh; }

.layout {
    display: grid; grid-template-columns: minmax(0, 1fr) 300px;
    gap: var(--gap); align-items: start;
    padding-top: 34px; padding-bottom: 60px;
}
.layout:not(:has(.logbook-aside)) { grid-template-columns: minmax(0, 1fr); }
.col-main { min-width: 0; }

.logbook-aside { position: sticky; top: calc(var(--head-h) + 22px); display: flex; flex-direction: column; gap: 22px; max-height: calc(100vh - var(--head-h) - 44px); overflow: auto; }

/* ---------- 标题区 ---------- */
.page-head, .archive-head { margin-bottom: 26px; }
.page-title, .archive-title { margin: 0 0 8px; font-size: 30px; line-height: 1.3; letter-spacing: -.02em; }
.archive-title { font-size: 24px; }
.archive-title .hl { color: var(--accent); }
.page-desc, .archive-desc { margin: 0; color: var(--text-soft); font-size: 14.5px; }
.page-desc b, .archive-desc b { color: var(--text); }
.block-title { margin: 0 0 14px; font-size: 16px; font-family: var(--font-mono); font-weight: 700; letter-spacing: .02em; color: var(--text); }
.block { margin-top: 40px; }

/* ---------- 文章卡片 ---------- */
.card-list { display: flex; flex-direction: column; gap: 14px; }

.card {
    display: grid; grid-template-columns: minmax(0, 1fr);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .25s var(--ease);
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow); }
.card.has-cover { grid-template-columns: 232px minmax(0, 1fr); }

.card-cover { display: block; overflow: hidden; background: var(--surface-2); }
.card-cover img { width: 100%; height: 100%; min-height: 150px; object-fit: cover; transition: transform .4s var(--ease); }
.card:hover .card-cover img { transform: scale(1.04); }

.card-body { padding: 18px 20px; min-width: 0; }
.card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.card-title { margin: 0 0 8px; font-size: 19px; line-height: 1.45; letter-spacing: -.01em; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); }
.card-summary { margin: 0 0 12px; color: var(--text-soft); font-size: 14.5px; line-height: 1.7; }
.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; color: var(--text-dim); font-size: 13px; font-family: var(--font-mono); }
.card-meta a { color: var(--text-dim); }
.card-meta a:hover { color: var(--accent); }

/* ---------- 标签 / 分类 chips ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px; border-radius: 999px;
    font-size: 12px; font-family: var(--font-mono); line-height: 1.7;
    color: var(--tone, var(--accent));
    background: color-mix(in srgb, var(--tone, var(--accent)) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 30%, transparent);
    white-space: nowrap;
}
.chip.tiny { font-size: 11px; padding: 0 7px; }
.tone-blue { --tone: var(--c-blue); }
.tone-violet { --tone: var(--c-violet); }
.tone-green { --tone: var(--c-green); }
.tone-orange { --tone: var(--c-orange); }
.tone-pink { --tone: var(--c-pink); }
.tone-cyan { --tone: var(--c-cyan); }

/* ---------- 分页 ---------- */
/* 结构：<nav class="pager"><a class="prev">…</a><a>1</a><a class="current">2</a><span>…</span><a class="next">…</a></nav> */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 30px 0 0; padding: 0; list-style: none; }
.pager > a {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 11px;
    font-size: 13.5px; font-family: var(--font-mono); line-height: 1;
    color: var(--text-soft); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    transition: all .18s var(--ease);
}
.pager > a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.pager > a.current,
.pager > a.current:hover {
    color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 700; transform: none;
}
.pager > a.prev, .pager > a.next { font-family: var(--font-sans); }
.pager > span { padding: 0 4px; color: var(--text-dim); font-family: var(--font-mono); font-size: 13px; }

/* ---------- 正文排版 ---------- */
.logbook-content { font-size: 16.5px; line-height: 1.85; word-wrap: break-word; }
.logbook-content > *:first-child { margin-top: 0; }
.logbook-content h2, .logbook-content h3, .logbook-content h4 { margin: 2em 0 .7em; line-height: 1.4; letter-spacing: -.01em; scroll-margin-top: calc(var(--head-h) + 20px); }
.logbook-content h2 { font-size: 23px; padding-bottom: .35em; border-bottom: 1px solid var(--border); }
.logbook-content h2::before { content: "# "; font-family: var(--font-mono); color: var(--accent); opacity: .85; font-weight: 400; }
.logbook-content h3 { font-size: 19px; }
.logbook-content h3::before { content: "## "; font-family: var(--font-mono); color: var(--accent-2); opacity: .7; font-size: 15px; font-weight: 400; }
.logbook-content h4 { font-size: 17px; }
.logbook-content p { margin: 0 0 1.1em; }
.logbook-content a { border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.logbook-content a:hover { border-bottom-color: var(--accent-2); }
.logbook-content strong { color: var(--text); font-weight: 700; }
.logbook-content em { color: var(--text-soft); }
.logbook-content ul, .logbook-content ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.logbook-content li { margin: .35em 0; }
.logbook-content li::marker { color: var(--accent); }
.logbook-content blockquote {
    margin: 1.4em 0; padding: 2px 18px; color: var(--text-soft);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.logbook-content blockquote p:last-child { margin-bottom: 0; }
.logbook-content hr { margin: 2.2em 0; border: 0; border-top: 1px dashed var(--border-strong); }
.logbook-content img { display: block; margin: 1.4em auto; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: zoom-in; }
.logbook-content figure { margin: 1.4em 0; }
.logbook-content figcaption { margin-top: .6em; text-align: center; font-size: 13px; color: var(--text-dim); }

.logbook-content code {
    font-family: var(--font-mono); font-size: .88em;
    padding: .15em .4em; border-radius: var(--radius-xs);
    background: var(--surface-2); color: var(--hl-keyword);
    border: 1px solid var(--border);
}
.logbook-content pre { margin: 1.4em 0; }
.logbook-content pre code { display: block; padding: 0; background: none; border: 0; color: var(--text); font-size: 13.5px; line-height: 1.7; }

.logbook-content table { width: 100%; margin: 1.4em 0; border-collapse: collapse; font-size: 14.5px; display: block; overflow-x: auto; }
.logbook-content th, .logbook-content td { padding: 9px 13px; border: 1px solid var(--border); text-align: left; }
.logbook-content th { background: var(--surface-2); font-weight: 700; white-space: nowrap; }
.logbook-content tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }

.logbook-content kbd {
    font-family: var(--font-mono); font-size: .82em; padding: .15em .45em;
    background: var(--surface-2); border: 1px solid var(--border-strong);
    border-bottom-width: 2px; border-radius: var(--radius-xs);
}
.logbook-content mark { background: color-mix(in srgb, var(--accent) 26%, transparent); color: inherit; padding: 0 .2em; border-radius: 3px; }

/* 代码块外壳（由 JS 生成） */
.code-block { margin: 1.4em 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--code-bg); }
.code-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 7px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border);
    font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); letter-spacing: .04em; text-transform: uppercase;
}
.code-copy {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px;
    font-family: var(--font-mono); font-size: 11.5px; text-transform: none;
    color: var(--text-soft); background: transparent;
    border: 1px solid var(--border); border-radius: var(--radius-xs); cursor: pointer;
    transition: all .18s var(--ease);
}
.code-copy:hover { color: var(--accent); border-color: var(--accent); }
.code-copy.is-done { color: var(--c-green); border-color: var(--c-green); }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.code-block pre code { background: none; border: 0; padding: 0; }

/* hljs 配色（跟随深浅色变量） */
.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag, .hljs-name { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute { color: var(--hl-string); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-link { color: var(--hl-number); }
.hljs-title, .hljs-section, .hljs-title.class_, .hljs-title.function_ { color: var(--hl-title); font-weight: 700; }
.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-selector-attr, .hljs-selector-pseudo { color: var(--hl-attr); }
.hljs-type, .hljs-class .hljs-title, .hljs-params, .hljs-property { color: var(--hl-type); }
.hljs-built_in, .hljs-builtin-name { color: var(--hl-builtin); }
.hljs-meta, .hljs-comment .hljs-doctag { color: var(--hl-meta); }
.hljs-deletion { color: var(--hl-keyword); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* ---------- 单页文章 ---------- */
.post-head { margin-bottom: 22px; }
.post-title { margin: 0 0 14px; font-size: 33px; line-height: 1.32; letter-spacing: -.025em; }
.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; color: var(--text-dim); font-size: 13px; font-family: var(--font-mono); }
.post-meta a { color: var(--text-soft); }
.post-meta a:hover { color: var(--accent); }

.post-cover { margin: 0 0 26px; }
.post-cover img { width: 100%; max-height: 400px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }

.post-foot {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
    margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--border);
}
.post-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.post-tags a {
    display: inline-flex; align-items: center; padding: 3px 11px; font-size: 12.5px; font-family: var(--font-mono);
    color: var(--text-soft); background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 999px;
    transition: all .18s var(--ease);
}
.post-tags a::before { content: "#"; color: var(--accent); margin-right: 2px; }
.post-tags a:hover { color: var(--accent); border-color: var(--accent); }

.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 15px;
    font-size: 13.5px; font-family: var(--font-sans); font-weight: 500;
    color: var(--text); background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius-xs); cursor: pointer;
    transition: all .18s var(--ease);
}
.btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { color: #fff; background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn.ghost { background: transparent; }

.post-near { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.post-near a {
    display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: all .2s var(--ease);
}
.post-near a:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-near a:nth-child(2) { text-align: right; align-items: flex-end; }
.near-label { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.near-title { color: var(--text); font-size: 14.5px; line-height: 1.55; }
.post-near a:hover .near-title { color: var(--accent); }
.near-none { color: var(--text-dim); }

.related-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.related-list li { display: flex; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.related-list li:last-child { border-bottom: 0; }
.related-list a { flex: 1; min-width: 0; color: var(--text); font-size: 15px; }
.related-list a:hover { color: var(--accent); }
.related-list time { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); white-space: nowrap; }

/* ---------- 目录 TOC ---------- */
.toc {
    padding: 16px 18px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.toc .widget-title { margin: 0 0 10px; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); counter-reset: toc; }
.toc-list ol { list-style: none; margin: 0; padding-left: 12px; border-left: 1px solid var(--border); }
.toc-list a {
    display: block; padding: 5px 0 5px 12px; margin-left: -1px;
    color: var(--text-soft); font-size: 13.5px; line-height: 1.5;
    border-left: 2px solid transparent;
    transition: all .18s var(--ease);
}
.toc-list a:hover { color: var(--text); border-left-color: var(--border-strong); }
.toc-list a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.toc-list .lvl-3 a { padding-left: 24px; font-size: 13px; }

/* ---------- 侧边栏模块 ---------- */
.widget { padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

/* 个人简介卡片 */
.profile-card { text-align: center; padding: 22px 18px 18px; }
.profile-avatar {
    display: block; width: 84px; height: 84px; margin: 0 auto 14px;
    border-radius: 50%; object-fit: cover;
    border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border);
    background: var(--surface-2);
}
.profile-avatar-letter {
    display: grid; place-items: center;
    font-family: var(--font-mono); font-size: 32px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: 0; box-shadow: none;
}
.profile-name { margin: 0 0 8px; font-size: 17px; letter-spacing: -.01em; }
.profile-bio { margin: 0 0 14px; font-size: 13.5px; line-height: 1.75; color: var(--text-soft); }
.profile-links { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 9px; }
.profile-links a {
    display: grid; place-items: center; width: 32px; height: 32px;
    color: var(--text-soft); background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 50%;
    transition: all .18s var(--ease);
}
.profile-links a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.profile-links svg { display: block; }
.widget-title {
    margin: 0 0 12px; font-family: var(--font-mono); font-size: 12px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim);
}
.widget-list { list-style: none; margin: 0; padding: 0; }
.widget-list li { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.widget-list li:last-child { border-bottom: 0; }
.widget-list a { flex: 1; min-width: 0; color: var(--text-soft); font-size: 14px; line-height: 1.6; }
.widget-list a:hover { color: var(--accent); }
.widget-list .count, .widget-list time { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.widget-posts li { align-items: flex-start; }
.widget-stats li { justify-content: space-between; }
.widget-stats span { color: var(--text-soft); font-size: 14px; }
.widget-stats b { font-family: var(--font-mono); color: var(--text); }
.widget-empty { margin: 0; color: var(--text-dim); font-size: 13px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
    font-size: 12.5px; font-family: var(--font-mono);
    color: var(--tone, var(--accent));
    background: color-mix(in srgb, var(--tone, var(--accent)) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 26%, transparent);
    border-radius: var(--radius-xs);
    transition: all .18s var(--ease);
}
.tag-chip span { color: var(--text-dim); font-size: 11px; }
.tag-chip:hover { transform: translateY(-1px); border-color: var(--tone, var(--accent)); }

/* ---------- 评论 ---------- */
.comments { margin-top: 44px; }
.comments-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.comments-head .block-title { margin: 0; }
.comments-feed { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-family: var(--font-mono); color: var(--text-dim); }
.comments-feed:hover { color: var(--accent); }

.comment-list, .c-children { list-style: none; margin: 0; padding: 0; }
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.c-children { margin-top: 12px; padding-left: 18px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.c-item { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.c-by-author { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.c-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.c-avatar img { display: block; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); }
.c-avatar-letter {
    display: grid; place-items: center; width: 38px; height: 38px;
    font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 50%;
}
.c-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.c-author { font-style: normal; font-weight: 700; color: var(--text); }
.c-author a { color: var(--text); }
.c-badge { padding: 0 7px; font-size: 11px; font-family: var(--font-mono); color: #fff; background: var(--accent); border-radius: 999px; }
.c-time { color: var(--text-dim); font-family: var(--font-mono); font-size: 12px; }
.c-body { color: var(--text-soft); font-size: 14.8px; line-height: 1.8; }
.c-body p { margin: 0 0 .7em; }
.c-body p:last-child { margin-bottom: 0; }
.c-body a { border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.c-pending { margin: 8px 0 0; font-size: 12.5px; color: var(--c-orange); }
.c-actions { margin-top: 8px; font-size: 13px; }
.c-actions a { color: var(--text-dim); font-family: var(--font-mono); font-size: 12.5px; }
.c-actions a:hover { color: var(--accent); }

.respond { margin-top: 26px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.respond-title { margin: 0 0 16px; font-size: 16px; font-family: var(--font-mono); }
.cancel-reply { margin-bottom: 8px; font-size: 13px; }
.cancel-reply a { color: var(--text-dim); }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-label { font-size: 12.5px; font-family: var(--font-mono); color: var(--text-dim); letter-spacing: .03em; }
.form-label i { color: var(--c-orange); font-style: normal; }
.form-field input, .form-field textarea {
    width: 100%; padding: 10px 13px; font-family: inherit; font-size: 14.5px;
    color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.form-field textarea { resize: vertical; min-height: 120px; font-family: var(--font-sans); line-height: 1.75; }
.form-field input:focus, .form-field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--text-dim); }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.form-hint { font-size: 12.5px; color: var(--text-dim); }
/* XCaptcha 验证码（评论表单）：与 form-field 视觉保持一致 */
.captcha-field altcha-widget { --altcha-max-width: 100%; margin-top: 2px; }
.captcha-field .check-label { max-width: 100%; }
.form-login { margin: 0 0 14px; font-size: 14px; color: var(--text-soft); }
.form-logout { margin-left: 10px; font-size: 12.5px; }
.comments-closed { padding: 16px; color: var(--text-dim); background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); text-align: center; }

/* ---------- 归档页 ---------- */
.archive-intro { margin-bottom: 30px; color: var(--text-soft); }
.archive-years { display: flex; flex-direction: column; gap: 30px; }
.archive-year-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.year-num { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--accent); }
.year-count { font-size: 12.5px; font-family: var(--font-mono); color: var(--text-dim); }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.archive-list li:last-child { border-bottom: 0; }
.archive-list time { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); flex: none; }
.archive-link { flex: 1; min-width: 0; color: var(--text); font-size: 15px; }
.archive-link:hover { color: var(--accent); }
.archive-comments { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }

/* ---------- 友链页 ---------- */
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; margin-top: 20px; }
.link-card {
    display: flex; align-items: center; gap: 12px; padding: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: all .2s var(--ease);
}
.link-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.link-avatar {
    display: grid; place-items: center; width: 40px; height: 40px; flex: none;
    color: #fff; font-weight: 700; font-size: 17px;
    background: var(--tone, var(--accent)); border-radius: 10px;
}
.link-info { min-width: 0; display: flex; flex-direction: column; }
.link-name { color: var(--text); font-size: 15px; }
.link-desc { color: var(--text-dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 关于页 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.stat-item { padding: 14px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.stat-item b { display: block; font-family: var(--font-mono); font-size: 22px; color: var(--accent); }
.stat-item span { font-size: 12.5px; color: var(--text-dim); }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 14.5px; }
.contact-list li:last-child { border-bottom: 0; }
.contact-list span { width: 70px; flex: none; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); }

/* ---------- 404 / 空状态 ---------- */
.notfound { padding: 40px 0 20px; }
.notfound-code { margin: 0 0 10px; font-family: var(--font-mono); font-size: 46px; font-weight: 700; color: var(--accent); letter-spacing: -.02em; }
.notfound-code span { font-size: 14px; color: var(--text-dim); letter-spacing: .12em; vertical-align: middle; margin-left: 8px; }
.notfound-title { margin: 0 0 10px; font-size: 26px; }
.notfound-desc { margin: 0 0 22px; color: var(--text-soft); }
.notfound-links { display: flex; gap: 10px; margin-top: 18px; }

.empty { padding: 46px 20px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); }
.empty-code { margin: 0 0 8px; font-family: var(--font-mono); font-size: 16px; color: var(--text-dim); }
.empty-code span { color: var(--accent); }
.empty-text { margin: 0 0 18px; color: var(--text-soft); font-size: 14.5px; }
.empty-search { display: flex; gap: 8px; max-width: 430px; margin: 0 auto; }
.empty-search input {
    flex: 1; padding: 10px 14px; font-family: inherit; font-size: 14.5px;
    color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-xs);
}
.empty-search input:focus { border-color: var(--accent); outline: none; }
.empty-search button { padding: 10px 18px; font-family: inherit; font-size: 14.5px; color: #fff; background: var(--accent); border: 0; border-radius: var(--radius-xs); cursor: pointer; }
.empty-search button:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }

/* ---------- 灯箱 ---------- */
.logbook-lightbox {
    padding: 0; border: 0; background: transparent; max-width: 94vw; max-height: 92vh;
}
.logbook-lightbox::backdrop { background: rgba(0, 0, 0, .82); backdrop-filter: blur(3px); }
.logbook-lightbox img { display: block; max-width: 94vw; max-height: 88vh; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); }
.logbook-lightbox-close {
    position: fixed; top: 18px; right: 20px; width: 38px; height: 38px;
    display: grid; place-items: center; font-size: 20px; line-height: 1;
    color: #fff; background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .28); border-radius: 50%; cursor: pointer;
}
.logbook-lightbox-close:hover { background: rgba(255, 255, 255, .24); }

/* ---------- 回到顶部 ---------- */
.to-top {
    position: fixed; right: 22px; bottom: 26px; z-index: 55;
    width: 40px; height: 40px; display: grid; place-items: center;
    color: var(--text-soft); background: var(--surface);
    border: 1px solid var(--border); border-radius: 50%; cursor: pointer;
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: all .25s var(--ease);
    box-shadow: var(--shadow);
}
.to-top.is-on { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- 复制提示 ---------- */
.logbook-toast {
    position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 12px);
    padding: 9px 18px; font-size: 13.5px; font-family: var(--font-mono);
    color: #fff; background: rgba(28, 33, 40, .95);
    border: 1px solid var(--border-strong); border-radius: 999px;
    opacity: 0; pointer-events: none; transition: all .25s var(--ease); z-index: 200;
}
.logbook-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 页脚 ---------- */
.site-foot { margin-top: 40px; padding: 30px 0 26px; background: var(--bg-soft); border-top: 1px solid var(--border); }
.site-foot-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.foot-main p { margin: 0 0 6px; color: var(--text-soft); font-size: 14px; }
.foot-icp a { color: var(--text-dim); font-size: 13px; }
.foot-side { display: flex; gap: 10px; }
.foot-link { display: grid; place-items: center; width: 34px; height: 34px; color: var(--text-soft); background: var(--surface); border: 1px solid var(--border); border-radius: 50%; }
.foot-link svg { fill: currentColor; }
.foot-link:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.foot-powered { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); color: var(--text-dim); font-size: 12.5px; font-family: var(--font-mono); }
.foot-powered b { color: var(--text-soft); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
    .layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    .logbook-aside { position: static; max-height: none; }
    .is-single .logbook-aside { order: -1; }
    .toc-list { max-height: 260px; overflow: auto; }
}

@media (max-width: 860px) {
    .site-nav {
        position: fixed; inset: var(--head-h) 0 auto 0;
        flex-direction: column; align-items: stretch; gap: 2px;
        padding: 12px 18px 18px; margin: 0;
        background: var(--bg); border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        transform: translateY(-8px); opacity: 0; visibility: hidden;
        transition: all .22s var(--ease);
        max-height: calc(100vh - var(--head-h)); overflow: auto;
    }
    .site-nav.is-open { transform: none; opacity: 1; visibility: visible; }
    .nav-link { padding: 11px 12px; font-size: 15.5px; }
    .nav-toggle {
        display: flex; flex-direction: column; justify-content: center; gap: 4px;
        order: 3; width: 34px; height: 34px; padding: 0 8px;
        background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-xs); cursor: pointer;
    }
    .nav-toggle span { display: block; height: 1.6px; background: var(--text-soft); border-radius: 2px; transition: all .2s var(--ease); }
    .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.6px) rotate(45deg); }
    .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
    .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.6px) rotate(-45deg); }
    /* 只让第一项吃 auto 边距，主题切换与菜单按钮才会靠在一起贴右 */
    .head-tools { order: 2; margin-left: auto; }
    .site-head-inner { gap: 10px; }
    .head-search { display: none; }

    .card.has-cover { grid-template-columns: minmax(0, 1fr); }
    .card-cover img { min-height: 0; height: 190px; }

    .post-title { font-size: 26px; }
    .page-title { font-size: 25px; }
    .form-grid { grid-template-columns: 1fr; }
    .post-near { grid-template-columns: 1fr; }
    .post-near a:nth-child(2) { text-align: left; align-items: flex-start; }
    .logbook-content { font-size: 16px; }
    .c-children { padding-left: 10px; }
}

@media (max-width: 520px) {
    .wrap { padding: 0 16px; }
    .card-body { padding: 15px 16px; }
    .notfound-code { font-size: 38px; }
    .to-top { right: 14px; bottom: 18px; }
}

/* ---------- 打印 ---------- */
@media print {
    .site-head, .site-foot, .logbook-aside, .comments, .post-near, .progress, .to-top, .code-copy { display: none !important; }
    body.logbook { background: #fff; color: #000; }
    .layout { grid-template-columns: 1fr; }
    .card, .post-cover img { border-color: #ccc; }
}

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
    html { scroll-behavior: auto; }
}
