/* ==========================================================
   天青·水 —— 结合风格
   青瓷的文人气质（宋体标题 / 竖排日期书签 / 发丝线）
   + 清水的湖水青配色
   深浅色通过 <html data-theme="light|dark"> 切换
   ========================================================== */

/* ---------- 主题变量 ---------- */
:root {
    --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
    --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
    --bg: #ffffff;
    /* 纸：纯白 */
    --text: #1f2c2b;
    /* 墨：深蓝墨 */
    --muted: #7c8f8c;
    /* 黛：雾青灰 */
    --accent: #379a90;
    /* 青：湖水青主色 */
    --accent-soft: rgba(55, 154, 144, 0.10);
    --cinnabar: #e0825a;
    /* 朱：全站唯一暖色，仅左上角圆点 */
    --line: #e8eeee;
    /* 线：发丝线 */
    --line-strong: #d4dfdc;
    --code-bg: #f4f7f6;
    --ink-soft: #eef5f3;
    --card: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.86);
    --shadow: 0 1px 2px rgba(31, 44, 43, 0.05);
}

[data-theme="dark"] {
    --bg: #1b1b1f;
    /* 背景：DeepSeek Harness 暗色 */
    --text: #dfdfd6;
    /* 墨：DeepSeek Harness 主文字 */
    --muted: #98989f;
    /* 黛：DeepSeek Harness 次文字 */
    --accent: #57b4a6;
    --accent-soft: rgba(87, 180, 166, 0.12);
    --cinnabar: #e8926f;
    --line: #2b2b31;
    --line-strong: #3a3a42;
    --code-bg: #222226;
    --ink-soft: #222226;
    --card: #232327;
    --header-bg: rgba(27, 27, 31, 0.82);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.9;
    transition: background-color .3s ease, color .3s ease;
}

::selection {
    background: var(--accent);
    color: #fff;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent);
}

img {
    max-width: 100%;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 28px;
}

body.is-home .container {
    max-width: 920px;
}

.mono {
    font-family: var(--font-mono);
}

.muted {
    color: var(--muted);
}

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

/* ---------- 顶部导航 ---------- */
.site-header {
    border-bottom: 1px solid var(--line);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}

.site-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--text);
    white-space: nowrap;
    transition: color .2s;
}

.site-title:hover {
    color: var(--accent);
}

.site-title .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--cinnabar);
    /* 全站唯一的朱色 */
    flex-shrink: 0;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.site-nav {
    display: flex;
    gap: 2px;
    flex: 1;
    justify-content: flex-end;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
    display: none;
}

.site-nav a {
    position: relative;
    color: var(--muted);
    font-size: 14.5px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: color .2s;
}

.site-nav a::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 2px;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s ease;
}

.site-nav a:hover {
    color: var(--text);
}

.site-nav a.active {
    color: var(--accent);
}

.site-nav a.active::after {
    transform: scaleX(1);
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: color .2s, border-color .2s, transform .2s;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: rotate(15deg);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

/* ---------- 主内容 ---------- */
.main-content {
    padding-bottom: 80px;
    min-height: calc(100vh - 64px);
}

/* ---------- 首页题头 ---------- */
.masthead {
    padding: 64px 0 36px;
    border-bottom: 1px solid var(--line);
}

.drafts-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 8px 0 12px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .08em;
    flex-shrink: 0;
    transition: color .2s, border-color .2s, background .2s;
}

.drafts-toggle:hover,
.drafts-toggle[aria-pressed="true"] {
    color: var(--accent);
    border-color: var(--accent);
}

.drafts-toggle[aria-pressed="true"] {
    background: var(--accent-soft);
}

.drafts-toggle-track {
    position: relative;
    width: 28px;
    height: 16px;
    border-radius: 999px;
    background: var(--line-strong);
    transition: background .2s;
}

.drafts-toggle[aria-pressed="true"] .drafts-toggle-track {
    background: var(--accent);
}

.drafts-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow);
    transition: transform .2s ease;
}

.drafts-toggle[aria-pressed="true"] .drafts-toggle-thumb {
    transform: translateX(12px);
}

.draft-badge {
    display: inline-block;
    margin-left: 2px;
    padding: 0 5px;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .06em;
    color: var(--muted);
    vertical-align: 1px;
}

/* HTML 参考文档标记:和「草稿」同一套位置语言,提示点开是独立整页文档 */
.doc-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 0 5px;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .06em;
    color: var(--muted);
    vertical-align: 2px;
    white-space: nowrap;
}

html:not([data-show-drafts]) [data-viewable="false"]:not(.is-current) {
    display: none;
}


html:not([data-show-drafts]) .archive-month:not(:has([data-viewable="true"])) {
    display: none;
}

.masthead-kicker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    font-size: 12px;
    letter-spacing: .32em;
    color: var(--accent);
    text-transform: uppercase;
}

.masthead-kicker::before {
    content: "";
    width: 26px;
    height: 1px;
    background: var(--accent);
}

.masthead-title {
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-size: clamp(28px, 5.5vw, 38px);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: .02em;
}

.masthead-sub {
    margin: 0 0 20px;
    font-size: 16px;
    color: var(--muted);
    max-width: 36em;
}

.masthead-meta {
    margin: 0;
    font-size: 12.5px;
    letter-spacing: .06em;
    color: var(--muted);
}

/* ---------- 首页封面 ---------- */
.cover-hero {
    margin-top: 36px;
    padding: 40px 44px 36px;
    background: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.cover-hero::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: var(--accent-soft);
    pointer-events: none;
}

.cover-kicker {
    margin: 0 0 14px;
    font-size: 11.5px;
    letter-spacing: .28em;
    color: var(--accent);
    position: relative;
}

.cover-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(32px, 5.4vw, 48px);
    font-weight: 600;
    line-height: 1.28;
    letter-spacing: .02em;
    position: relative;
}

.cover-excerpt {
    margin: 0;
    max-width: 34em;
    font-size: 16.5px;
    line-height: 1.8;
    color: var(--muted);
    position: relative;
}

.cover-sec {
    margin: 44px 0 0;
}

.cover-sec-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 0 18px;
}

.cover-sec-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
}

.cover-sec-head a {
    font-size: 13px;
    color: var(--muted);
}

.cover-sec-head a:hover { color: var(--accent); }

.cover-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.cover-card {
    padding: 22px 20px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    transition: border-color .2s, transform .2s;
}

.cover-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.cover-card .flag {
    margin: 0 0 10px;
    font-size: 11px;
    letter-spacing: .16em;
    color: var(--accent);
}

.cover-card h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.45;
}

.cover-card h3 a { color: var(--text); }
.cover-card h3 a:hover { color: var(--accent); }

.cover-card p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--muted);
}

.cover-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.cover-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    color: var(--text);
    transition: border-color .2s, transform .2s, background .2s;
}

.cover-col:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-2px);
}

.cover-col-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.cover-col-top strong {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.cover-col:hover .cover-col-top strong {
    color: var(--accent);
}

.cover-col .n {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--muted);
}

.cover-col-desc {
    font-size: 13px;
    line-height: 1.65;
    color: var(--muted);
}

/* ---------- 首页文章列表 ---------- */
.post-list {
    padding: 8px 0 0;
}

.post-item {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 20px;
    padding: 30px 0;
    border-bottom: 1px solid var(--line);
}

.post-item:last-child {
    border-bottom: none;
}

.post-gutter {
    position: relative;
}

/* 签名：竖排日期书签 */
.vdate {
    display: inline-block;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .22em;
    color: var(--muted);
    padding: 2px 0 2px 2px;
    border-left: 1px solid var(--line-strong);
    margin-left: 10px;
    transition: color .25s ease, border-color .25s ease;
}

.post-item:hover .vdate {
    color: var(--accent);
    border-color: var(--accent);
}

.post-body {
    min-width: 0;
}

.post-flag {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
    font-size: 11.5px;
    letter-spacing: .18em;
    color: var(--muted);
}

.post-flag .flag-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.post-title {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: .01em;
}

.post-title a {
    color: var(--text);
    background-image: linear-gradient(var(--accent), var(--accent));
    background-repeat: no-repeat;
    background-size: 0 1px;
    background-position: 0 100%;
    transition: color .2s, background-size .25s ease;
}

.post-item:hover .post-title a,
.post-title a:hover {
    color: var(--accent);
    background-size: 100% 1px;
}

.post-excerpt {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.75;
    color: var(--muted);
}

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 40px 0 8px;
    font-size: 14px;
}

.pagination a {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 18px;
    color: var(--text);
    transition: border-color .2s, color .2s;
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

/* ---------- 页面 / 文章 ---------- */
.page,
.post {
    padding: 56px 0 16px;
}

/* 普通文章：中间栏位置与「两侧目录都打开」时一致 */
.post-shell {
    --col-left-width: 260px;
    --col-right-width: 248px;
    width: 100%;
    display: grid;
    grid-template-columns: var(--col-left-width) minmax(0, 1fr) var(--col-right-width);
    gap: 0;
    align-items: start;
}

.post-shell .post {
    grid-column: 2;
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 48px 28px 0;
    box-sizing: border-box;
}

.post-shell .col-right {
    grid-column: 3;
    display: none;
}

.post-shell.show-right .col-right {
    display: block;
}

.page-title {
    margin: 0 0 16px;
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: .02em;
}

.post-header {
    margin-bottom: 36px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.post-header .post-title {
    margin: 0 0 14px;
    font-size: clamp(26px, 4.5vw, 34px);
    line-height: 1.4;
}

.post-meta {
    margin: 0;
    font-size: 12.5px;
    letter-spacing: .04em;
    color: var(--muted);
}

.post-meta a {
    color: var(--muted);
}

.post-meta a:hover {
    color: var(--accent);
}

.post-meta .sep {
    margin: 0 8px;
    color: var(--line-strong);
}

/* ---------- 正文排版 ---------- */
.post-content,
.page-content {
    font-size: 16px;
    line-height: 1.95;
}

.post-content h2,
.page-content h2 {
    margin: 2.2em 0 .9em;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: .02em;
    padding-bottom: .5em;
    border-bottom: 1px solid var(--line);
}

.post-content h3,
.page-content h3 {
    margin: 1.9em 0 .6em;
    font-size: 16.5px;
    font-weight: 700;
}

.post-content h4,
.page-content h4 {
    margin: 1.6em 0 .5em;
    font-size: 15px;
    font-weight: 700;
}

.post-content p,
.page-content p {
    margin: 0 0 1.3em;
}

.post-content ul,
.post-content ol,
.page-content ul,
.page-content ol {
    padding-left: 1.4em;
    margin: 0 0 1.4em;
}

.post-content li,
.page-content li {
    margin: .35em 0;
}

.post-content li::marker,
.page-content li::marker {
    color: var(--accent);
}

.post-content img,
.page-content img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--line);
    cursor: zoom-in;
}

.post-content blockquote,
.page-content blockquote {
    margin: 1.8em 0;
    padding: 14px 22px;
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 8px 8px 0;
    color: var(--text);
}

.post-content blockquote p,
.page-content blockquote p {
    margin: 0;
}

.post-content table,
.page-content table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin: 1.5em 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    font-size: 14.5px;
}

.post-content th,
.post-content td,
.page-content th,
.page-content td {
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: 10px 14px;
    text-align: left;
}

.post-content th,
.page-content th {
    background: var(--code-bg);
    font-weight: 600;
}

.post-content tr:last-child td,
.page-content tr:last-child td {
    border-bottom: none;
}

.post-content th:last-child,
.post-content td:last-child,
.page-content th:last-child,
.page-content td:last-child {
    border-right: none;
}

.post-content hr,
.page-content hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 2.6em 0;
}

.post-content a,
.page-content a {
    background-image: linear-gradient(var(--accent), var(--accent));
    background-repeat: no-repeat;
    background-size: 100% 1px;
    background-position: 0 100%;
    padding-bottom: 1px;
}

.post-content a:hover,
.page-content a:hover {
    color: var(--accent);
}

/* ---------- 代码 ---------- */
.post-content pre,
.post-content code,
.page-content pre,
.page-content code {
    font-family: var(--font-mono);
    font-size: 13.5px;
}

.post-content code,
.page-content code {
    background: var(--code-bg);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: .14em .4em;
    font-size: .86em;
}

.post-content pre,
.page-content pre {
    background: var(--code-bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px 22px;
    overflow-x: auto;
    margin: 1.8em 0;
    line-height: 1.7;
    box-shadow: var(--shadow);
}

.post-content pre code,
.page-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 13.5px;
}

/* rouge 语法高亮（浅色） */
.highlight .k,
.highlight .kd {
    color: #cf222e;
    font-weight: 600;
}

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sr {
    color: #0a3069;
}

.highlight .c,
.highlight .c1,
.highlight .cm {
    color: #6e7781;
    font-style: italic;
}

.highlight .nf,
.highlight .nb {
    color: #8250df;
}

.highlight .o {
    color: #57606a;
}

.highlight .m,
.highlight .mi,
.highlight .mf {
    color: #0550ae;
}

.highlight .nc,
.highlight .nt {
    color: #953800;
}

.highlight .p,
.highlight .w {
    color: #24292f;
}

[data-theme="dark"] .highlight .k,
[data-theme="dark"] .highlight .kd {
    color: #ff7b72;
}

[data-theme="dark"] .highlight .s,
[data-theme="dark"] .highlight .s1,
[data-theme="dark"] .highlight .s2,
[data-theme="dark"] .highlight .sr {
    color: #a5d6ff;
}

[data-theme="dark"] .highlight .c,
[data-theme="dark"] .highlight .c1,
[data-theme="dark"] .highlight .cm {
    color: #8b949e;
}

[data-theme="dark"] .highlight .nf,
[data-theme="dark"] .highlight .nb {
    color: #d2a8ff;
}

[data-theme="dark"] .highlight .o {
    color: #dfdfd6;
}

[data-theme="dark"] .highlight .m,
[data-theme="dark"] .highlight .mi,
[data-theme="dark"] .highlight .mf {
    color: #79c0ff;
}

[data-theme="dark"] .highlight .nc,
[data-theme="dark"] .highlight .nt {
    color: #ffa657;
}

[data-theme="dark"] .highlight .p,
[data-theme="dark"] .highlight .w {
    color: #dfdfd6;
}

/* ---------- 专栏布局（左侧文章列表 + 内容） ---------- */
.column-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    align-items: start;
    padding-top: 56px;
}

.column-sidebar {
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 108px);
    overflow-y: auto;
    padding: 4px 0;
}

.column-sidebar-title {
    margin: 0 0 2px;
    font-size: 17px;
    font-weight: 600;
    font-family: var(--font-display);
}

.column-sidebar-title a {
    color: var(--text);
}

.column-sidebar-title a:hover {
    color: var(--accent);
    text-decoration: none;
}

.column-sidebar .muted {
    font-size: 13px;
    margin: 0 0 12px;
}

.column-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.column-sidebar-list li {
    border-radius: 6px;
}

.column-sidebar-list a {
    display: block;
    padding: 8px 10px;
    color: var(--muted);
    font-size: 14px;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .2s, background .2s;
}

.column-sidebar-list a::before {
    content: "▸";
    margin-right: 6px;
    color: var(--line-strong);
    font-size: 11px;
    transition: color .2s;
}

.column-sidebar-list a:hover {
    color: var(--accent);
    background: var(--accent-soft);
    text-decoration: none;
}

.column-sidebar-list a:hover::before {
    color: var(--accent);
}

.column-sidebar .back-link {
    display: block;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 13px;
}

.column-main {
    min-width: 0;
}

/* ---------- 归档 / 分类标签列表 ---------- */
.archive-list {
    padding-left: 1.2em;
}

.archive-list li {
    margin: 8px 0;
}

.archive-list time {
    font-family: var(--font-mono);
    font-size: 13px;
}

/* ---------- 专栏总览页（清单式） ---------- */
.page-head {
    padding: 56px 0 40px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}

.page-kicker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    font-size: 12px;
    letter-spacing: .32em;
    color: var(--accent);
    text-transform: uppercase;
}

.page-kicker::before {
    content: "";
    width: 26px;
    height: 1px;
    background: var(--accent);
}

.page-head .page-title {
    margin: 0 0 12px;
    font-size: clamp(28px, 5vw, 38px);
}

.page-sub {
    margin: 0 0 20px;
    font-size: 16px;
    color: var(--muted);
    max-width: 36em;
}

.page-meta {
    margin: 0;
    font-size: 12.5px;
    letter-spacing: .06em;
    color: var(--muted);
}

.page-meta em {
    font-style: normal;
    color: var(--accent);
}

/* ---------- 专栏总览：双列卡片 ---------- */
.cols-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding-top: 20px;
}

a.cols-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
    color: var(--text);
    transition: border-color .2s, transform .2s, background .2s;
}

a.cols-card:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-2px);
    color: var(--text);
}

.cols-card-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.cols-card-top h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

a.cols-card:hover .cols-card-top h2 {
    color: var(--accent);
}

.cols-card-top .n {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--muted);
}

a.cols-card p {
    margin: 0;
    font-size: 13px;
    line-height: 1.65;
    color: var(--muted);
}

/* ---------- 全站搜索 ---------- */
.search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: color .2s, border-color .2s;
}

.search-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.search-btn svg {
    width: 15px;
    height: 15px;
}

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 12vh 24px 24px;
    background: rgba(27, 27, 31, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.search-overlay[hidden] {
    display: none;
}

.search-panel {
    width: 100%;
    max-width: 680px;
    max-height: 76vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.search-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.search-ic {
    width: 18px;
    height: 18px;
    stroke: var(--muted);
    flex-shrink: 0;
}

.search-input-row input {
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    color: var(--text);
    font-size: 18px;
    font-family: var(--font-display);
    outline: none;
}

.search-input-row input::placeholder {
    color: var(--line-strong);
}

.search-close {
    border: none;
    background: none;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
}

.search-close:hover {
    color: var(--accent);
}

.search-results {
    overflow-y: auto;
    padding: 6px 18px 18px;
}

.search-result {
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.search-result:last-child {
    border-bottom: none;
}

.search-result .post-flag {
    margin: 0 0 4px;
}

.search-title {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.45;
}

.search-title a {
    color: var(--text);
}

.search-title a:hover {
    color: var(--accent);
}

.search-snippet {
    margin: 0;
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.7;
}

.search-result mark {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0 2px;
    border-radius: 2px;
}

.search-empty {
    margin: 0;
    padding: 24px 18px;
    font-size: 14px;
    color: var(--muted);
}

/* ---------- 页脚 ---------- */
.site-footer {
    margin-top: 64px;
    padding: 28px 0;
    border-top: 1px solid var(--line);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .08em;
    color: var(--muted);
}

body.is-home .main-content {
    min-height: 0;
    padding-bottom: 8px;
}

body.is-home .site-footer {
    margin-top: 96px;
    padding: 24px 0;
}

.site-footer .dot {
    color: var(--cinnabar);
}

/* ---------- 专栏 / 文章阅读：目录贴视口两侧，中间最宽 1340px ---------- */
.main-content.wide {
    max-width: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.column-shell {
    --col-left-width: 260px;
    --col-right-width: 248px;
    width: 100%;
    display: grid;
    grid-template-columns: var(--col-left-width) minmax(0, 1fr) var(--col-right-width);
    gap: 0;
    align-items: start;
}

.column-shell .col-left {
    grid-column: 1;
}

.column-shell .col-main {
    grid-column: 2;
}

.column-shell .col-right {
    grid-column: 3;
}

.column-shell .col-left,
.column-shell .col-right {
    display: none;
}

.column-shell.show-left .col-left,
.column-shell.show-right .col-right {
    display: block;
}

.col-left,
.col-right {
    position: sticky;
    top: 64px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    min-width: 0;
    padding: 52px 18px 36px 20px;
    background: var(--bg);
}

.col-left {
    border-right: 1px solid var(--line);
}

.col-right {
    padding-left: 20px;
    padding-right: 18px;
}

.col-main {
    width: 100%;
    max-width: none;
    padding: 48px 28px 0;
    min-width: 0;
    box-sizing: border-box;
}

/* 侧栏滚动容器：隐藏滚动条（保持滚轮可滚动），与顶部导航一致 */
.column-sidebar,
.col-left,
.col-right {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.column-sidebar::-webkit-scrollbar,
.col-left::-webkit-scrollbar,
.col-right::-webkit-scrollbar {
    display: none;
}

.col-left-title {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.45;
}

.col-left-title a {
    color: var(--text);
}

.col-left-title a:hover {
    color: var(--accent);
    text-decoration: none;
}

.col-left-count {
    font-size: 12.5px;
    letter-spacing: .05em;
    margin: 0 0 14px;
}

.col-left-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
}

.col-left-list a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 11px 0 11px 12px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
    border-bottom: 1px solid var(--line);
    transition: color .2s, background .2s, padding-left .2s;
}

/* 左栏文章名：超长单行截断，悬浮 title 显示全部 */
.col-left-list .col-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-left-list .draft-badge {
    flex: none;
}

.col-left-list a:hover {
    color: var(--accent);
    background: var(--accent-soft);
    padding-left: 16px;
}

.col-left-list a.current {
    color: var(--accent);
    background: var(--accent-soft);
    border-left: 2px solid var(--accent);
    padding-left: 10px;
}

/* 左栏：按专栏文件夹分组，可折叠 */
.col-group {
    list-style: none;
}

.col-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 11px 12px 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: none;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: color .2s, background .2s;
}

.col-group-head:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.col-group-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-group-meta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: none;
    color: var(--muted);
}

.col-group-cnt {
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: .04em;
}

.col-group-arrow {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .2s;
}

.col-group.collapsed .col-group-arrow {
    transform: rotate(-90deg);
}

.col-group-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.col-group-list a {
    padding-left: 24px;
    font-size: 13.5px;
}

.col-group-list a:hover {
    padding-left: 28px;
}

.col-group-list a.current {
    padding-left: 22px;
}

.col-group.collapsed>.col-group-list {
    display: none;
}

.toc-source h2,
.toc-source h3,
.toc-source h4 {
    scroll-margin-top: 96px;
}

.toc-end-spacer {
    pointer-events: none;
}

/* 右栏：本文目录 */
.col-toc-label {
    margin: 0 0 12px;
    font-size: 11.5px;
    letter-spacing: .24em;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.col-toc-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.col-toc {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 13.5px;
    line-height: 1.5;
}

.col-toc a {
    display: block;
    padding: 6px 10px;
    color: var(--muted);
    border-left: 2px solid var(--line);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .2s, border-color .2s, background .2s;
}

.col-toc a:hover {
    color: var(--accent);
}

.col-toc a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-soft);
}

.col-toc li.sub a {
    padding-left: 22px;
    font-size: 13px;
}

.col-toc .toc-empty {
    padding: 6px 10px;
    color: var(--muted);
}

/* 贴边图标按钮：平时只露一条边，悬停滑出 */
.col-rail-btn {
    position: fixed;
    top: 64px;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-top: none;
    background: var(--card);
    color: var(--muted);
    cursor: pointer;
    transition: transform .22s ease, color .2s, border-color .2s, background .2s;
}

.col-rail-btn::after {
    content: "";
    position: absolute;
    top: -8px;
    bottom: -8px;
    width: 18px;
}

.col-rail-btn--left {
    left: 0;
    border-left: none;
    border-radius: 0 0 10px 0;
    transform: translateX(calc(-100% + 6px));
}

.col-rail-btn--left::after {
    left: 100%;
}

.col-rail-btn--right {
    right: 0;
    border-right: none;
    border-radius: 0 0 0 10px;
    transform: translateX(calc(100% - 6px));
}

.col-rail-btn--right::after {
    right: 100%;
}

.col-rail-btn svg {
    width: 15px;
    height: 15px;
}

.col-rail-btn:hover,
.col-rail-btn:focus-visible {
    transform: translateX(0);
    color: var(--accent);
    border-color: var(--accent);
}

.col-rail-btn[aria-expanded="true"] {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* 窄屏：三栏 / 文章双栏折叠为单栏 */
@media (max-width: 960px) {
    .main-content.wide {
        max-width: 100%;
    }

    .column-shell,
    .post-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .column-shell .col-left,
    .column-shell .col-main,
    .column-shell .col-right,
    .post-shell .post,
    .post-shell .col-right {
        grid-column: auto;
    }

    .column-shell.show-left .col-left,
    .column-shell.show-right .col-right,
    .post-shell.show-right .col-right {
        display: block;
        position: static;
        max-height: none;
    }

    .column-shell.show-right .col-right,
    .post-shell.show-right .col-right {
        border-top: 1px solid var(--line);
        padding-top: 16px;
    }
}

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
    .container {
        padding: 0 20px;
    }

    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 0;
        gap: 6px 16px;
    }

    .site-nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
    }

    .cover-hero { padding: 28px 22px; }
    .cover-grid { grid-template-columns: 1fr; }
    .cover-cols { grid-template-columns: 1fr; }

    .masthead {
        padding: 44px 0 28px;
    }

    .masthead-sub {
        font-size: 15px;
    }

    .post-item {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 24px 0;
    }

    /* 竖排日期在移动端改为横排小字 */
    .vdate {
        writing-mode: horizontal-tb;
        letter-spacing: .14em;
        border-left: none;
        border-top: 1px solid var(--line-strong);
        padding: 6px 0 0;
        margin: 0 0 2px;
    }

    .post-title {
        font-size: 19px;
    }

    .page,
    .post {
        padding: 36px 0 12px;
    }

    .page-title {
        font-size: 24px;
    }

    .column-layout {
        grid-template-columns: 1fr;
        gap: 16px;
        padding-top: 36px;
    }

    .column-sidebar {
        position: static;
        max-height: none;
    }

    .post-content,
    .page-content {
        font-size: 15.5px;
        line-height: 1.9;
    }

    .page-head {
        padding: 36px 0 28px;
    }

    .cols-cards {
        grid-template-columns: 1fr;
    }
}

/* ---------- mermaid 图表（构建时服务端渲染，见 _plugins/mermaid.rb） ---------- */
.mermaid-svg {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 28px auto;
    cursor: zoom-in;
}

/* ---------- 图片放大浮层 ---------- */
.img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(27, 27, 31, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: zoom-out;
}

.img-lightbox[hidden] {
    display: none;
}

.img-lightbox img {
    max-width: min(96vw, 1400px);
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--bg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    cursor: default;
}

/* ---------- 无障碍 ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        transition: none !important;
    }
}