/*!
 * 新主题「N1 暗色玻璃」
 *
 * 结构：
 *   1. tokens
 *   2. 基础 / 布局
 *   3. 导航（玻璃顶栏 + 搜索）
 *   4. hero
 *   5. 卡片 / 列表
 *   6. 正文排版（.article-entry）
 *   7. render.js 产物（code-block / callout / mermaid / table-wrap）
 *   8. 目录
 *   9. 归档 / 标签 / 分类 / 项目
 *  10. 分页 / 评论 / 页脚
 *  11. 响应式
 */

/* ---------- 1. tokens ---------- */
:root {
    --bg: #08090c;
    --bg-soft: #0b0d12;
    --fg: #e9e9ee;
    --fg-dim: #c9cbd4;
    --muted: #8b8f9a;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .14);
    --card: rgba(255, 255, 255, .035);
    --card-hover: rgba(255, 255, 255, .06);
    --accent: #a78bfa;
    --accent2: #22d3ee;
    --grad: linear-gradient(100deg, #c4b5fd 10%, #67e8f9 55%, #f9a8d4 95%);
    --radius-lg: 22px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --max: 1180px;
    --shadow: 0 30px 60px -40px rgba(0, 0, 0, .9);
    --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---------- 2. 基础 / 布局 ---------- */
* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 400 16.5px/1.85 var(--font);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: -20% -10% auto -10%;
    height: 72vh;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(42% 55% at 18% 20%, rgba(124, 92, 255, .32), transparent 70%),
        radial-gradient(38% 50% at 78% 8%, rgba(34, 211, 238, .18), transparent 72%),
        radial-gradient(30% 40% at 55% 55%, rgba(236, 72, 153, .12), transparent 70%);
    filter: blur(20px);
}

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

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

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

.page {
    position: relative;
    z-index: 1;
    padding-bottom: 96px;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 268px;
    gap: 36px;
    align-items: start;
}

.layout--single { grid-template-columns: minmax(0, 1fr); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, var(--shadow);
    padding: 52px 56px;
}

/* 滚动进度 */
.progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 60;
    pointer-events: none;
}

.progress span {
    display: block;
    height: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transition: transform .12s linear;
}

/* ---------- 3. 导航 ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    background: rgba(8, 9, 12, .62);
    border-bottom: 1px solid var(--line);
}

.nav-in {
    max-width: var(--max);
    margin: 0 auto;
    padding: 13px 28px;
    display: flex;
    align-items: center;
    gap: 26px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #fff;
    font-weight: 650;
    font-size: 15px;
    letter-spacing: -.01em;
    flex: none;
}

.logo-mark {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    background: conic-gradient(from 210deg, #a78bfa, #22d3ee, #f472b6, #a78bfa);
    box-shadow: 0 0 18px rgba(167, 139, 250, .5);
}

.nav-links { display: flex; gap: 2px; }

.nav-links a {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13.5px;
    color: var(--muted);
    white-space: nowrap;
}

.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, .06); }

.nav-links a.is-active { color: #fff; background: rgba(255, 255, 255, .09); }

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

.search {
    position: relative;
    display: flex;
    align-items: center;
}

.search input {
    width: 168px;
    padding: 7px 12px 7px 30px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .04);
    color: var(--fg);
    font: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color .2s, background .2s, width .2s;
}

.search input::placeholder { color: #6f7381; }

.search input:focus {
    width: 220px;
    border-color: rgba(167, 139, 250, .55);
    background: rgba(255, 255, 255, .07);
}

.search::before {
    content: "";
    position: absolute;
    left: 11px;
    width: 11px;
    height: 11px;
    border: 1.6px solid #7e8290;
    border-radius: 50%;
    pointer-events: none;
}

.search::after {
    content: "";
    position: absolute;
    left: 20px;
    top: 19px;
    width: 5px;
    height: 1.6px;
    background: #7e8290;
    transform: rotate(45deg);
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-height: 360px;
    overflow: auto;
    background: #111318;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    box-shadow: 0 28px 60px -24px rgba(0, 0, 0, .9);
    padding: 8px;
    display: none;
    z-index: 70;
}

.search-results.is-open { display: block; }

.search-results a {
    display: block;
    padding: 9px 11px;
    border-radius: 9px;
    color: var(--fg-dim);
    font-size: 13.5px;
    line-height: 1.5;
}

.search-results a:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.search-results .empty { padding: 10px 11px; color: var(--muted); font-size: 13px; }

.nav-toggle {
    display: none;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .04);
    color: var(--fg);
    border-radius: 10px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 15px;
}

/* ---------- 4. hero ---------- */
.hero {
    position: relative;
    z-index: 1;
    padding: 88px 0 48px;
}

.hero--article { padding: 76px 0 40px; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #c9c6f8;
    border: 1px solid rgba(167, 139, 250, .35);
    background: rgba(167, 139, 250, .10);
    padding: 6px 12px;
    border-radius: 999px;
}

.eyebrow .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent2);
    box-shadow: 0 0 10px var(--accent2);
}

.hero h1 {
    margin: 22px 0 16px;
    font-size: clamp(34px, 4.6vw, 58px);
    line-height: 1.08;
    letter-spacing: -.033em;
    font-weight: 700;
    color: #fff;
}

.hero h1 em {
    font-style: normal;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero .sub {
    max-width: 48ch;
    margin: 0 0 26px;
    color: #b6b9c4;
    font-size: 17px;
    line-height: 1.75;
}

.hero--article .sub { color: var(--muted); font-size: 16px; }

.byline {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--muted);
    font-size: 13.5px;
    flex-wrap: wrap;
}

.byline b { display: block; color: var(--fg); font-weight: 600; font-size: 14px; }
.byline i { display: block; font-style: normal; font-size: 12.5px; }

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #0b0d12;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    flex: none;
}

.avatar--lg { width: 38px; height: 38px; font-size: 14px; }

.chip {
    font-size: 11.5px;
    color: #cfd0d8;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .04);
    padding: 3px 10px;
    border-radius: 999px;
}

.chip:hover { color: #fff; border-color: var(--line-strong); background: rgba(255, 255, 255, .08); }

/* ---------- 5. 卡片 / 列表 ---------- */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 20px;
}

.section-head h2 {
    margin: 0;
    font-size: 15px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #9ba0ad;
    font-weight: 600;
}

.section-head a { font-size: 13px; color: var(--muted); }
.section-head a:hover { color: #fff; }

.post-list { display: flex; flex-direction: column; gap: 18px; }

.post-card {
    position: relative;
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    transition: transform .25s cubic-bezier(.2, .7, .2, 1), background .25s, border-color .25s;
}

.post-card:hover {
    transform: translateY(-3px);
    background: var(--card-hover);
    border-color: var(--line-strong);
}

.post-card h3 {
    margin: 0 0 10px;
    font-size: 22px;
    line-height: 1.4;
    letter-spacing: -.015em;
    font-weight: 650;
    color: #fff;
}

.post-card .card-link { color: inherit; }

.post-card .card-link::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: 1;
}

.post-card:hover .card-link {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.post-card .excerpt {
    margin: 0 0 16px;
    color: #a9adba;
    font-size: 15px;
    line-height: 1.8;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    color: #7e8290;
    font-size: 12.5px;
}

.post-meta .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: #4b5060; }

.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.post-tags a {
    position: relative;
    z-index: 2;
    font-size: 11.5px;
    color: #9ba0ad;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 9px;
}

.post-tags a:hover { color: #fff; border-color: var(--line-strong); }

/* 侧栏 */
.side { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; }

.side-card {
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
}

.side-title {
    font-size: 11.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #7e8290;
    margin-bottom: 10px;
}

.side-list { display: flex; flex-wrap: wrap; gap: 6px; }

.side-list a {
    font-size: 12.5px;
    color: #9ba0ad;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 10px;
    transition: all .2s;
}

.side-list a:hover { color: #0a0a0f; background: linear-gradient(135deg, #c4b5fd, #67e8f9); border-color: transparent; }

.side-note {
    background: rgba(255, 255, 255, .02);
    border: 1px dashed rgba(255, 255, 255, .12);
    border-radius: 16px;
    padding: 14px 16px;
    color: #8b8f9a;
    font-size: 12.5px;
    line-height: 1.7;
}

.side-note b {
    display: block;
    color: var(--fg-dim);
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

/* ---------- 6. 正文 ---------- */
.article-entry { color: var(--fg-dim); }

.article-entry > *:first-child { margin-top: 0; }

.article-entry h1 { font-size: 30px; line-height: 1.3; margin: 2.2em 0 .6em; color: #fff; letter-spacing: -.02em; }
.article-entry h2 { font-size: 27px; line-height: 1.35; letter-spacing: -.02em; font-weight: 650; margin: 2.4em 0 .7em; color: #fff; }
.article-entry h3 { font-size: 19.5px; font-weight: 640; margin: 2em 0 .5em; color: #f2f2f6; }
.article-entry h4 { font-size: 16.5px; font-weight: 640; margin: 1.6em 0 .4em; color: #f2f2f6; }

.article-entry p { margin: 0 0 1.2em; }

.article-entry strong { color: #fff; font-weight: 640; }
.article-entry em { color: #e4e4ea; }

.article-entry ul,
.article-entry ol { padding-left: 1.25em; margin: 0 0 1.2em; }

.article-entry li { margin: .4em 0; }
.article-entry li::marker { color: #6c7080; }

.article-entry blockquote {
    margin: 1.8em 0;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    color: #b9bcc7;
}

.article-entry blockquote p { margin: 0; }

.article-entry code {
    font-family: var(--mono);
    font-size: .87em;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 6px;
    padding: .12em .4em;
    color: #e4e4ea;
}

.article-entry pre {
    background: #0b0d11;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    overflow: auto;
    margin: 1.6em 0;
}

.article-entry pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: 13.5px;
    line-height: 1.75;
    color: #cfd3df;
}

.article-entry table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.6em 0;
    font-size: 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.article-entry th,
.article-entry td {
    text-align: left;
    padding: 11px 16px;
    border-bottom: 1px solid var(--line);
}

.article-entry tr:last-child td { border-bottom: 0; }

.article-entry th {
    font-size: 11.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    background: rgba(255, 255, 255, .04);
    font-weight: 500;
}

.article-entry tbody tr:hover td { background: rgba(255, 255, 255, .025); }

.article-entry hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

.article-entry img { border-radius: var(--radius-md); margin: 1.4em 0; }

.article-entry a { text-decoration: underline; text-decoration-color: rgba(167, 139, 250, .35); text-underline-offset: 3px; }
.article-entry a:hover { text-decoration-color: var(--accent); }

/* ---------- 7. render.js 产物 ---------- */
.code-block { position: relative; margin: 1.6em 0; }
.code-block pre { margin: 0; }

.code-lang {
    position: absolute;
    top: 10px;
    right: 64px;
    font-size: 10.5px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #6f7482;
}

.code-copy {
    position: absolute;
    top: 8px;
    right: 9px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--line);
    color: #b9bcc7;
    border-radius: 8px;
    font-size: 11px;
    padding: 3px 9px;
    cursor: pointer;
    font-family: inherit;
    backdrop-filter: blur(6px);
}

.code-copy:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.code-copy.is-copied { color: #0a0a0f; background: linear-gradient(135deg, #c4b5fd, #67e8f9); border-color: transparent; }

.table-wrap { overflow: auto; }

.callout {
    margin: 1.8em 0;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: rgba(124, 92, 255, .12);
    border: 1px solid rgba(124, 92, 255, .32);
    color: #d7d3f7;
}

.callout-title {
    margin: 0 0 5px;
    font-size: 11.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #c4b5fd;
}

.callout p { margin: 0; }

.heading-anchor { margin-left: 8px; color: #4a4e5c; font-size: .7em; opacity: 0; }
h2:hover .heading-anchor, h3:hover .heading-anchor { opacity: 1; }

.mermaid-diagram {
    margin: 1.8em 0;
    padding: 18px;
    border-radius: var(--radius-md);
    background: #f7f7fa;
    border: 1px solid rgba(255, 255, 255, .1);
    text-align: center;
}

.mermaid-diagram svg { max-width: 100%; height: auto; }

.mermaid-error {
    margin: 1.6em 0;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(248, 113, 113, .35);
    background: rgba(248, 113, 113, .1);
    color: #fca5a5;
    font-size: 13px;
}

/* 灯箱 */
.rh-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(5, 6, 8, .92);
    display: grid;
    place-items: center;
    padding: 40px;
}

.rh-lightbox img { max-width: 92vw; max-height: 86vh; border-radius: var(--radius-md); }
.rh-lightbox-caption { position: absolute; bottom: 26px; color: var(--muted); font-size: 12.5px; }
.rh-lightbox-close {
    position: absolute;
    top: 22px;
    right: 26px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .06);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
}
.rh-lightbox-open { overflow: hidden; }
.rh-zoomable { cursor: zoom-in; }

/* ---------- 8. 目录 ---------- */
.toc-wrapper {
    max-height: calc(100vh - 210px);
    overflow: auto;
    scrollbar-width: thin;
}

.toc-wrapper::-webkit-scrollbar { width: 6px; }
.toc-wrapper::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 3px; }

.toc-card {
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px 18px 14px;
}

.toc-title {
    font-size: 11.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #7e8290;
    margin-bottom: 10px;
}

.toc, .toc-child { list-style: none; margin: 0; padding: 0; }
.toc-child { padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line); }
.toc-item { margin: 1px 0; }

.toc-link {
    display: block;
    padding: 5px 10px;
    border-radius: 9px;
    color: #9a9eaa;
    font-size: 13px;
    line-height: 1.5;
}

.toc-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }

.toc-link.active { color: #0a0a0f; background: linear-gradient(135deg, #c4b5fd, #67e8f9); font-weight: 600; }

.toc-level-3 .toc-link { font-size: 12.5px; }

/* ---------- 9. 归档 / 标签 / 分类 / 项目 ---------- */
.archive-year {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 34px 0 14px;
    color: #9ba0ad;
    font-size: 13px;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.archive-year::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.archive-year:first-child { margin-top: 0; }

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

.archive-list li { border-bottom: 1px solid rgba(255, 255, 255, .05); }

.archive-list li:last-child { border-bottom: 0; }

.archive-list a {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 12px 4px;
    color: var(--fg-dim);
    transition: color .2s, padding .2s;
}

.archive-list a:hover { color: #fff; padding-left: 10px; }

.archive-list time {
    flex: none;
    width: 46px;
    color: #6c7080;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.archive-list .title { font-size: 15.5px; line-height: 1.5; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .03);
    color: var(--fg-dim);
    transition: all .22s;
}

.tile:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    background: var(--card-hover);
    color: #fff;
}

.tile .count { color: #6c7080; font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* 项目卡 */
.project-card { display: flex; flex-direction: column; gap: 10px; }

.project-card .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-card h3 { margin: 0; font-size: 20px; color: #fff; font-weight: 650; letter-spacing: -.01em; }

.project-card .desc {
    color: #a9adba;
    font-size: 14.5px;
    line-height: 1.8;
    max-height: 11em;
    overflow: hidden;
    mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
}

/* 项目描述里常带 # 标题和列表，这里统一压平，避免比卡片标题还大 */
.project-card .desc h1,
.project-card .desc h2,
.project-card .desc h3,
.project-card .desc h4 {
    font-size: 15px;
    line-height: 1.5;
    margin: .7em 0 .3em;
    color: var(--fg-dim);
    letter-spacing: 0;
}

.project-card .desc p { margin: 0 0 .5em; }

.project-card .desc ul,
.project-card .desc ol { margin: 0 0 .5em; padding-left: 1.1em; }

.project-card .desc li { margin: .15em 0; }

.project-card .desc pre,
.project-card .desc table,
.project-card .desc img { display: none; }

/* ---------- 10. 分页 / 评论 / 页脚 ---------- */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 40px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.pager a, .pager span.pager-current {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .03);
    color: var(--fg-dim);
    font-size: 13px;
}

.pager a:hover { background: rgba(255, 255, 255, .08); color: #fff; border-color: var(--line-strong); }

.comments { margin-top: 22px; }
.comments .card { padding: 28px 32px; }
.comments h4 { margin: 0 0 16px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: #9ba0ad; }

/* gitalk 暗色适配 */
.gt-container { color: var(--fg-dim); }
.gt-container .gt-header-textarea,
.gt-container .gt-header-preview { background: rgba(255, 255, 255, .04) !important; color: var(--fg) !important; border-color: var(--line) !important; }
.gt-container .gt-svg svg { fill: var(--muted); }
.gt-container .gt-comment-content { background: rgba(255, 255, 255, .03) !important; box-shadow: none !important; }
.gt-container .gt-comment-body { color: var(--fg-dim) !important; }
.gt-container .gt-btn { background: rgba(255, 255, 255, .08) !important; border-color: var(--line) !important; color: var(--fg) !important; }

.foot {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--line);
    padding: 30px 0 52px;
}

.foot-in {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: #5f6373;
    font-size: 12.5px;
    flex-wrap: wrap;
}

.foot-in a { color: #7e8290; }
.foot-in a:hover { color: #fff; }

.empty-state {
    padding: 60px 0;
    text-align: center;
    color: #6c7080;
    font-size: 14px;
}

/* ---------- 11. 响应式 ---------- */
@media (max-width: 1080px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .side { position: static; order: 2; }
    .card { padding: 30px 22px; border-radius: 18px; }
    .hero { padding: 60px 0 32px; }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .search input { width: 140px; }
}

@media (max-width: 720px) {
    .wrap, .nav-in, .foot-in { padding-left: 18px; padding-right: 18px; }
    .nav-links { display: none; }
    .nav-toggle { display: inline-grid; place-items: center; }
    .nav.is-open .nav-links {
        display: flex;
        position: absolute;
        top: 100%;
        left: 12px;
        right: 12px;
        flex-direction: column;
        gap: 2px;
        padding: 8px;
        border-radius: 14px;
        background: #111318;
        border: 1px solid var(--line-strong);
        box-shadow: 0 28px 60px -24px rgba(0, 0, 0, .9);
    }
    .search { display: none; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .post-card { padding: 20px; border-radius: 16px; }
    .post-card h3 { font-size: 18px; }
    .hero h1 { font-size: clamp(28px, 8vw, 40px); }
    .article-entry h2 { font-size: 22px; }
    .article-entry h3 { font-size: 17.5px; }
    .archive-list .title { font-size: 14.5px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 12. 落地页 ---------- */
.home {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 65px);
    display: flex;
    align-items: center;
    padding: 72px 0 64px;
    overflow: hidden;
}

.home-glow {
    position: absolute;
    inset: -30% -10% auto -10%;
    height: 620px;
    pointer-events: none;
    background:
        radial-gradient(36% 52% at 26% 30%, rgba(124, 92, 255, .34), transparent 70%),
        radial-gradient(30% 46% at 72% 22%, rgba(34, 211, 238, .20), transparent 72%),
        radial-gradient(26% 40% at 52% 62%, rgba(236, 72, 153, .14), transparent 70%);
    filter: blur(26px);
}

.home-in {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.home-avatar {
    position: relative;
    width: 104px;
    height: 104px;
    border-radius: 30px;
    padding: 2px;
    margin-bottom: 26px;
    background: conic-gradient(from 210deg, #a78bfa, #22d3ee, #f472b6, #a78bfa);
    box-shadow: 0 24px 60px -28px rgba(167, 139, 250, .75);
}

.home-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 28px;
    object-fit: cover;
    display: block;
    background: #12141a;
}

.home .eyebrow { margin-bottom: 18px; }

.home-title {
    margin: 0 0 16px;
    max-width: 22ch;
    font-size: clamp(30px, 4.4vw, 54px);
    line-height: 1.1;
    letter-spacing: -.035em;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(96deg, #ffffff 25%, #c4b5fd 65%, #67e8f9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.home-sub {
    max-width: 44ch;
    margin: 0 0 20px;
    color: #a9adba;
    font-size: 16.5px;
    line-height: 1.75;
}

.home-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 44px; }

.entry-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    width: 100%;
    max-width: 720px;
}

.entry-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .04);
    color: var(--fg);
    text-align: left;
    transition: transform .25s cubic-bezier(.2, .7, .2, 1), background .25s, border-color .25s;
}

.entry-card:hover {
    transform: translateY(-3px);
    border-color: rgba(167, 139, 250, .45);
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.entry-icon {
    width: 38px;
    height: 38px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 16px;
    color: #c4b5fd;
    background: rgba(167, 139, 250, .14);
    border: 1px solid rgba(167, 139, 250, .22);
}

.entry-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.entry-body b { font-size: 15.5px; font-weight: 650; color: #fff; letter-spacing: -.01em; }
.entry-body i { font-style: normal; font-size: 12.5px; color: #8b8f9a; }

.entry-arrow { margin-left: auto; color: #5f6373; font-size: 15px; transition: transform .2s, color .2s; }
.entry-card:hover .entry-arrow { transform: translateX(3px); color: #c4b5fd; }

.home-recent {
    width: 100%;
    max-width: 720px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
    text-align: left;
}

.home-recent-label {
    font-size: 11.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #7e8290;
    margin-bottom: 12px;
}

.home-recent ul { list-style: none; margin: 0; padding: 0; }

.home-recent a {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 8px 0;
    color: var(--fg-dim);
    font-size: 14.5px;
    border-bottom: 1px solid rgba(255, 255, 255, .04);
}

.home-recent li:last-child a { border-bottom: 0; }
.home-recent a:hover { color: #fff; }
.home-recent time { flex: none; width: 78px; color: #6c7080; font-size: 12.5px; font-variant-numeric: tabular-nums; }

.home-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: 44px;
    font-size: 13px;
}

.home-links a { color: #8b8f9a; }
.home-links a:hover { color: #fff; }

@media (max-width: 720px) {
    .home { padding: 44px 0 40px; min-height: auto; }
    .home-avatar { width: 84px; height: 84px; border-radius: 24px; margin-bottom: 20px; }
    .home-avatar img { border-radius: 22px; }
    .entry-grid { grid-template-columns: minmax(0, 1fr); max-width: 100%; }
    .home-recent { max-width: 100%; }
    .home-links { margin-top: 32px; }
}

/* ---------- 13. 亮色主题 ---------- */
html[data-theme="light"] {
    --bg: #f6f7f9;
    --bg-soft: #ffffff;
    --fg: #14161a;
    --fg-dim: #3f444c;
    --muted: #6b7280;
    --line: rgba(16, 24, 40, .10);
    --line-strong: rgba(16, 24, 40, .18);
    --card: #ffffff;
    --card-hover: #ffffff;
    --accent: #6d4aff;
    --accent2: #0891b2;
    --grad: linear-gradient(100deg, #7c5cff 8%, #0891b2 55%, #db2777 96%);
    --shadow: 0 24px 48px -32px rgba(16, 24, 40, .35);
}

html[data-theme="light"] body { background: var(--bg); color: var(--fg); }

html[data-theme="light"] body::before {
    background:
        radial-gradient(42% 55% at 18% 20%, rgba(124, 92, 255, .16), transparent 70%),
        radial-gradient(38% 50% at 78% 8%, rgba(8, 145, 178, .12), transparent 72%),
        radial-gradient(30% 40% at 55% 55%, rgba(236, 72, 153, .08), transparent 70%);
}

html[data-theme="light"] .nav {
    background: rgba(255, 255, 255, .74);
    border-bottom-color: var(--line);
}

html[data-theme="light"] .logo { color: var(--fg); }
html[data-theme="light"] .nav-links a:hover { color: var(--fg); background: rgba(16, 24, 40, .05); }
html[data-theme="light"] .nav-links a.is-active { color: var(--fg); background: rgba(16, 24, 40, .07); }

html[data-theme="light"] .search input {
    background: #fff;
    border-color: var(--line);
    color: var(--fg);
}

html[data-theme="light"] .search input::placeholder { color: #9aa0aa; }
html[data-theme="light"] .search::before { border-color: #9aa0aa; }
html[data-theme="light"] .search::after { background: #9aa0aa; }

html[data-theme="light"] .search-results {
    background: #fff;
    border-color: var(--line);
    box-shadow: 0 28px 60px -24px rgba(16, 24, 40, .25);
}

html[data-theme="light"] .search-results a { color: var(--fg-dim); }
html[data-theme="light"] .search-results a:hover { background: #f2f3f5; color: var(--fg); }

html[data-theme="light"] .hero h1 { color: var(--fg); }
html[data-theme="light"] .hero .sub { color: var(--muted); }
html[data-theme="light"] .byline { color: var(--muted); }
html[data-theme="light"] .byline b { color: var(--fg); }

html[data-theme="light"] .chip {
    color: var(--fg-dim);
    background: #fff;
    border-color: var(--line);
}

html[data-theme="light"] .chip:hover { color: var(--fg); border-color: var(--line-strong); }

html[data-theme="light"] .post-card,
html[data-theme="light"] .side-card,
html[data-theme="light"] .toc-card,
html[data-theme="light"] .tile,
html[data-theme="light"] .entry-card {
    background: #fff;
    border-color: var(--line);
}

html[data-theme="light"] .post-card:hover,
html[data-theme="light"] .tile:hover,
html[data-theme="light"] .entry-card:hover {
    background: #fff;
    border-color: rgba(109, 74, 255, .35);
    box-shadow: 0 18px 40px -28px rgba(16, 24, 40, .45);
}

html[data-theme="light"] .post-card h3,
html[data-theme="light"] .project-card h3,
html[data-theme="light"] .entry-body b { color: var(--fg); }

html[data-theme="light"] .post-card .excerpt,
html[data-theme="light"] .project-card .desc { color: #4b5563; }

html[data-theme="light"] .post-meta { color: #6b7280; }
html[data-theme="light"] .post-meta .dot-sep { background: #c7ccd4; }

html[data-theme="light"] .post-tags a,
html[data-theme="light"] .side-list a,
html[data-theme="light"] .archive-list a,
html[data-theme="light"] .home-recent a { color: #4b5563; border-color: var(--line); }

html[data-theme="light"] .post-tags a:hover,
html[data-theme="light"] .side-list a:hover {
    color: #fff;
    background: linear-gradient(135deg, #7c5cff, #0891b2);
    border-color: transparent;
}

html[data-theme="light"] .section-head h2 { color: #6b7280; }
html[data-theme="light"] .side-title,
html[data-theme="light"] .toc-title { color: #8a909a; }

html[data-theme="light"] .side-note {
    background: #fff;
    border-color: var(--line);
    color: #6b7280;
}

html[data-theme="light"] .side-note b { color: var(--fg-dim); }

html[data-theme="light"] .article-entry { color: var(--fg-dim); }
html[data-theme="light"] .article-entry h1,
html[data-theme="light"] .article-entry h2,
html[data-theme="light"] .article-entry h3,
html[data-theme="light"] .article-entry h4 { color: #111318; }

html[data-theme="light"] .article-entry strong { color: #111318; }
html[data-theme="light"] .article-entry em { color: #1f2328; }

html[data-theme="light"] .article-entry code {
    background: #eef0f3;
    border-color: #e2e5ea;
    color: #1f2328;
}

html[data-theme="light"] .article-entry blockquote {
    background: #f2f3f6;
    border-color: var(--line);
    color: #4b5563;
}

html[data-theme="light"] .article-entry th {
    background: #f6f7f9;
    color: #6b7280;
}

html[data-theme="light"] .article-entry th,
html[data-theme="light"] .article-entry td { border-color: var(--line); }

html[data-theme="light"] .article-entry tbody tr:hover td { background: #fafbfc; }

html[data-theme="light"] .article-entry a { text-decoration-color: rgba(109, 74, 255, .35); }

html[data-theme="light"] .toc-link { color: #5b6270; }
html[data-theme="light"] .toc-link:hover { color: var(--fg); background: #f2f3f5; }
html[data-theme="light"] .toc-link.active {
    color: #fff;
    background: linear-gradient(135deg, #7c5cff, #0891b2);
}

html[data-theme="light"] .archive-year { color: #8a909a; }
html[data-theme="light"] .archive-year::after { background: var(--line); }
html[data-theme="light"] .archive-list li { border-bottom-color: rgba(16, 24, 40, .06); }
html[data-theme="light"] .archive-list time { color: #9aa0aa; }
html[data-theme="light"] .archive-list a:hover { color: var(--fg); }

html[data-theme="light"] .tile .count { color: #9aa0aa; }

html[data-theme="light"] .callout {
    background: #f4f2ff;
    border-color: rgba(109, 74, 255, .22);
    color: #3f3a63;
}

html[data-theme="light"] .callout-title { color: #6d4aff; }
html[data-theme="light"] .callout p { color: #3f3a63; }

html[data-theme="light"] .pager a,
html[data-theme="light"] .pager span.pager-current {
    background: #fff;
    border-color: var(--line);
    color: var(--fg-dim);
}

html[data-theme="light"] .pager a:hover { background: #f2f3f5; color: var(--fg); }

html[data-theme="light"] .foot { border-top-color: var(--line); }
html[data-theme="light"] .foot-in { color: #8a909a; }
html[data-theme="light"] .foot-in a { color: #6b7280; }
html[data-theme="light"] .foot-in a:hover { color: var(--fg); }

html[data-theme="light"] .home-title {
    background: linear-gradient(96deg, #14161a 20%, #6d4aff 68%, #0891b2 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

html[data-theme="light"] .home-sub { color: #5b6270; }
html[data-theme="light"] .home-glow {
    background:
        radial-gradient(36% 52% at 26% 30%, rgba(124, 92, 255, .20), transparent 70%),
        radial-gradient(30% 46% at 72% 22%, rgba(8, 145, 178, .14), transparent 72%),
        radial-gradient(26% 40% at 52% 62%, rgba(236, 72, 153, .10), transparent 70%);
}

html[data-theme="light"] .entry-icon {
    color: #6d4aff;
    background: rgba(109, 74, 255, .10);
    border-color: rgba(109, 74, 255, .18);
}

html[data-theme="light"] .entry-body i,
html[data-theme="light"] .entry-arrow { color: #8a909a; }
html[data-theme="light"] .home-recent { border-top-color: var(--line); }
html[data-theme="light"] .home-recent a { border-bottom-color: rgba(16, 24, 40, .06); }
html[data-theme="light"] .home-recent a:hover { color: var(--fg); }
html[data-theme="light"] .home-recent time { color: #9aa0aa; }
html[data-theme="light"] .home-links a { color: #6b7280; }
html[data-theme="light"] .home-links a:hover { color: var(--fg); }
html[data-theme="light"] .home-recent-label { color: #8a909a; }

/* Gitalk 在亮色下恢复默认配色 */
html[data-theme="light"] .gt-container .gt-header-textarea,
html[data-theme="light"] .gt-container .gt-header-preview {
    background: #fff !important;
    color: #1f2328 !important;
    border-color: #e2e5ea !important;
}

html[data-theme="light"] .gt-container .gt-comment-content { background: #fff !important; box-shadow: 0 1px 2px rgba(16,24,40,.06) !important; }
html[data-theme="light"] .gt-container .gt-comment-body { color: #333 !important; }
html[data-theme="light"] .gt-container .gt-btn { background: #f5f6f8 !important; border-color: #e2e5ea !important; color: #1f2328 !important; }

/* ---------- 14. 主题切换按钮 ---------- */
.theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .04);
    color: var(--fg-dim);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}

.theme-toggle:hover { background: rgba(255, 255, 255, .1); color: #fff; border-color: var(--line-strong); }

html[data-theme="light"] .theme-toggle { background: #fff; color: #4b5563; }
html[data-theme="light"] .theme-toggle:hover { background: #f2f3f5; color: #111318; }

/* ---------- 15. 加载更多 ---------- */
.load-more {
    display: flex;
    justify-content: center;
    margin: 30px 0 0;
}

.load-more-btn {
    min-width: 160px;
    padding: 11px 22px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .04);
    color: var(--fg-dim);
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s, transform .2s;
}

.load-more-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; border-color: var(--line-strong); transform: translateY(-1px); }
.load-more-btn[disabled] { opacity: .6; cursor: default; transform: none; }

html[data-theme="light"] .load-more-btn { background: #fff; color: var(--fg-dim); }
html[data-theme="light"] .load-more-btn:hover { background: #f2f3f5; color: var(--fg); }

.load-more.is-done { display: none; }

/* ---------- 16. 错误页 ---------- */
.error-page {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 65px - 120px);
    display: flex;
    align-items: center;
    padding: 72px 0 88px;
    text-align: center;
}

.error-in { display: flex; flex-direction: column; align-items: center; }

.error-code {
    font-size: clamp(72px, 12vw, 148px);
    line-height: 1;
    font-weight: 800;
    letter-spacing: -.05em;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 18px;
}

.error-page h1 {
    margin: 0 0 12px;
    font-size: clamp(24px, 3.2vw, 36px);
    letter-spacing: -.02em;
    color: var(--fg);
}

.error-page h1 em { font-style: normal; color: var(--accent); }
.error-page .sub { margin: 0 0 30px; color: var(--muted); font-size: 15px; }

.error-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.btn-primary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 13.5px;
    border: 1px solid transparent;
    transition: transform .2s, background .2s, border-color .2s, color .2s;
}

.btn-primary {
    color: #0a0a0f;
    background: linear-gradient(135deg, #c4b5fd, #67e8f9);
    font-weight: 600;
}

.btn-primary:hover { transform: translateY(-1px); color: #0a0a0f; }

.btn-ghost { border-color: var(--line); color: var(--fg-dim); background: transparent; }
.btn-ghost:hover { background: rgba(255, 255, 255, .06); color: #fff; border-color: var(--line-strong); }

html[data-theme="light"] .btn-ghost { background: #fff; color: var(--fg-dim); border-color: var(--line); }
html[data-theme="light"] .btn-ghost:hover { background: #f2f3f5; color: var(--fg); }

/* 亮色下的 eyebrow 提高对比度 */
html[data-theme="light"] .eyebrow {
    color: #5b4bd6;
    background: #f1eeff;
    border-color: rgba(109, 74, 255, .22);
}

html[data-theme="light"] .eyebrow .dot {
    background: #0891b2;
    box-shadow: none;
}
