/* ============================================================
   Agentic Notes 主题样式
   结构：主题变量（日/夜）→ 基础 → 头部 → 首页工作台 → 卡片
        → 列表 → 文章排版 → 归档/分页 → 搜索 → 页脚
        → 响应式 → 减少动画
   ============================================================ */

/* ---------- 主题变量：日间（雾白纸面 · 深墨文字 · 电紫/青蓝信号） ---------- */
:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #edf1f8;
  --header-bg: rgba(245, 247, 251, .82);
  --ink: #16182b;
  --ink-soft: #3d4359;
  --muted: #687089;
  --line: rgba(22, 24, 43, .12);
  --line-strong: rgba(22, 24, 43, .22);
  --accent: #5b48e0;
  --accent-ink: #4a39c4;
  --accent-soft: #eeeaff;
  --cyan: #1e6ed2;
  --cyan-soft: #e7f0fe;
  --mint: #0c7d67;
  --mint-soft: #e0f5ee;
  --amber: #96560a;
  --amber-soft: #fcefd8;
  --focus-ring: 0 0 0 3px rgba(91, 72, 224, .30);
  --shadow-soft: 0 10px 34px rgba(23, 27, 51, .07);
  --shadow-lift: 0 22px 64px rgba(23, 27, 51, .13);
  --grid-line: rgba(22, 24, 43, .045);
  --code-bg: #0e1526;
  --code-ink: #dfe6f5;
  --code-muted: #7d8aa5;
  --code-line: rgba(223, 230, 245, .14);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --mono: ui-monospace, "SFMono-Regular", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* ---------- 主题变量：夜间（深蓝黑表面 · 冷白文字 · 克制辉光） ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f1e;
  --surface: #101830;
  --surface-soft: #0c1327;
  --header-bg: rgba(10, 15, 30, .82);
  --ink: #e9edf8;
  --ink-soft: #c5cbde;
  --muted: #8b93ad;
  --line: rgba(233, 237, 248, .14);
  --line-strong: rgba(233, 237, 248, .26);
  --accent: #9d8df7;
  --accent-ink: #b7abff;
  --accent-soft: rgba(157, 141, 247, .16);
  --cyan: #82b4ff;
  --cyan-soft: rgba(130, 180, 255, .14);
  --mint: #6fd4bb;
  --mint-soft: rgba(111, 212, 187, .13);
  --amber: #f0bd75;
  --amber-soft: rgba(240, 189, 117, .14);
  --focus-ring: 0 0 0 3px rgba(157, 141, 247, .42);
  --shadow-soft: 0 10px 34px rgba(3, 6, 16, .5);
  --shadow-lift: 0 22px 64px rgba(3, 6, 16, .62);
  --grid-line: rgba(157, 141, 247, .06);
}

/* 无脚本兜底：html 未被内联脚本改写时跟随系统偏好 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --bg: #0a0f1e;
    --surface: #101830;
    --surface-soft: #0c1327;
    --header-bg: rgba(10, 15, 30, .82);
    --ink: #e9edf8;
    --ink-soft: #c5cbde;
    --muted: #8b93ad;
    --line: rgba(233, 237, 248, .14);
    --line-strong: rgba(233, 237, 248, .26);
    --accent: #9d8df7;
    --accent-ink: #b7abff;
    --accent-soft: rgba(157, 141, 247, .16);
    --cyan: #82b4ff;
    --cyan-soft: rgba(130, 180, 255, .14);
    --mint: #6fd4bb;
    --mint-soft: rgba(111, 212, 187, .13);
    --amber: #f0bd75;
    --amber-soft: rgba(240, 189, 117, .14);
    --focus-ring: 0 0 0 3px rgba(157, 141, 247, .42);
    --shadow-soft: 0 10px 34px rgba(3, 6, 16, .5);
    --shadow-lift: 0 22px 64px rgba(3, 6, 16, .62);
    --grid-line: rgba(157, 141, 247, .06);
  }
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* 片段跳转偏移只由根滚动容器承担；若目标标题再设 scroll-margin 会与 scroll-padding 叠加，导致落点下移约一倍 */
html { scroll-behavior: smooth; scroll-padding-top: 110px; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 88% -6%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 32rem),
    radial-gradient(circle at -4% 26%, color-mix(in srgb, var(--cyan) 7%, transparent), transparent 27rem),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
a { color: inherit; text-decoration: none; }
button, input { color: inherit; font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; height: auto; }
::selection { color: #fff; background: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.shell { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 200; top: 10px; left: 10px; padding: 9px 16px; border-radius: 10px; background: var(--accent); color: #fff; transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.site-main { min-height: calc(100vh - 240px); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--accent-ink); font-family: var(--mono); font-size: .74rem; font-weight: 700; letter-spacing: .1em; }
.eyebrow::before { content: ""; width: 18px; height: 1.5px; background: currentColor; }

/* ---------- 头部 ---------- */
.site-header { position: sticky; z-index: 50; top: 0; border-bottom: 1px solid transparent; background: var(--header-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); transition: border-color .2s, box-shadow .2s, background-color .25s; }
.site-header.is-scrolled { border-color: var(--line); box-shadow: var(--shadow-soft); }
.header-inner { min-height: 80px; display: flex; align-items: center; gap: 26px; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; color: var(--accent); }
.brand-mark svg { width: 34px; height: 34px; }
.brand-mark .bracket { stroke: var(--cyan); stroke-width: 2.6; stroke-linecap: round; }
.brand-mark .edge { stroke: currentColor; stroke-width: 1.7; opacity: .85; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: 1.04rem; letter-spacing: -.015em; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-family: var(--mono); font-size: .64rem; letter-spacing: .06em; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav > a { position: relative; padding: 8px 12px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.site-nav > a::after { content: ""; position: absolute; right: 12px; bottom: 3px; left: 12px; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); transition: transform .2s; }
.site-nav > a:hover, .site-nav > a.is-active { color: var(--ink); }
.site-nav > a.is-active::after { transform: scaleX(1); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color .2s, color .2s, transform .2s; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.nav-toggle { display: none; }
.nav-toggle span:not(.sr-only) { width: 17px; height: 1.6px; background: currentColor; transition: transform .2s; }

/* ---------- 首屏：文案 + 技术探索工作台 ---------- */
.hero { padding-block: 84px 96px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(400px, .95fr); align-items: center; gap: 64px; }
.hero-copy h1 { max-width: 760px; margin: 16px 0 22px; font-size: clamp(2.6rem, 5.6vw, 5.1rem); line-height: 1.04; letter-spacing: -.05em; }
.hero-copy p { max-width: 660px; margin: 0; color: var(--muted); font-size: clamp(1.02rem, 1.8vw, 1.18rem); line-height: 1.85; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: 0 22px; border: 1px solid var(--line); border-radius: 13px; font-size: .92rem; font-weight: 700; transition: transform .2s, box-shadow .2s, border-color .2s; }
.button:hover { transform: translateY(-2px); }
.button-primary { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 12px 30px color-mix(in srgb, var(--accent), transparent 72%); }
.button-primary:focus-visible { outline-color: #fff; }
.button-ghost { background: var(--surface); }

.hero-workbench { display: grid; gap: 16px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-soft); }
.panel-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 15px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.panel-tag { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); font-family: var(--mono); font-size: .72rem; font-weight: 700; letter-spacing: .05em; }
.panel-tag::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.panel-radar .panel-tag::before { background: var(--cyan); border-radius: 50%; }
.panel-status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-family: var(--mono); font-size: .64rem; }
.panel-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); animation: status-blink 2.4s ease-in-out infinite; }
.panel-canvas { padding: 10px 12px 12px; }
.panel-canvas svg { display: block; width: 100%; height: auto; }

/* 执行图谱 */
.stage-box { fill: var(--surface-soft); stroke: var(--line-strong); stroke-width: 1.2; }
.stage-box.stage-active { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.4; }
.stage-label { fill: var(--ink); font-family: var(--mono); font-size: 11.5px; font-weight: 700; text-anchor: middle; }
.flow-track { stroke: var(--line-strong); stroke-width: 1.6; }
.flow-line { stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 5 9; animation: flow-dash 1.15s linear infinite; }
.flow-arrow { stroke: var(--ink-soft); stroke-width: 1.4; fill: none; }
.feedback-track { stroke: var(--cyan); stroke-width: 1.3; opacity: .6; stroke-dasharray: 4 6; }
.feedback-node { fill: var(--cyan); }
.stage-note { fill: var(--muted); font-family: var(--mono); font-size: 10px; }
.edge { stroke: var(--line-strong); stroke-width: 1.2; }

/* 项目雷达 */
.radar-ring { stroke: var(--line-strong); stroke-width: 1.1; fill: none; }
.radar-axis { stroke: var(--line); stroke-width: 1; }
.radar-sweep { transform-box: view-box; transform-origin: 85px 86px; animation: sweep 7s linear infinite; }
.sweep-arc { fill: color-mix(in srgb, var(--cyan) 15%, transparent); stroke: none; }
.sweep-needle { stroke: var(--cyan); stroke-width: 1.3; }
.radar-dot, .legend-dot { stroke: none; }
.dot-violet { fill: var(--accent); }
.dot-blue { fill: var(--cyan); }
.dot-mint { fill: var(--mint); }
.dot-amber { fill: var(--amber); }
.radar-dot { animation: dot-pulse 3.4s ease-in-out infinite; }
.radar-dot.dot-blue { animation-delay: .9s; }
.radar-dot.dot-mint { animation-delay: 1.7s; }
.radar-dot.dot-amber { animation-delay: 2.5s; }
.legend-label { fill: var(--ink-soft); font-family: var(--mono); font-size: 11px; }

/* ---------- 四条主线卡片 ---------- */
.topics, .latest { padding-block: 40px 82px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 28px; }
.section-heading h2 { margin: 6px 0 0; font-size: clamp(1.6rem, 3vw, 2.3rem); letter-spacing: -.035em; }
.text-link { display: inline-flex; align-items: center; gap: 7px; color: var(--accent-ink); font-size: .88rem; font-weight: 700; }
.text-link span { transition: transform .2s; }
.text-link:hover span { transform: translateX(4px); }
.topic-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.topic-card { position: relative; min-height: 264px; display: flex; flex-direction: column; padding: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); transition: transform .22s, box-shadow .22s, border-color .22s; }
.topic-card::before { content: ""; position: absolute; width: 190px; height: 190px; right: -80px; bottom: -100px; border: 1px solid currentColor; border-radius: 50%; opacity: .14; }
.topic-card:hover { z-index: 2; transform: translateY(-5px); box-shadow: var(--shadow-lift); }
.topic-glyph { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 14px; border: 1px solid color-mix(in srgb, currentColor, transparent 72%); border-radius: 12px; }
.topic-glyph-svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.topic-card h3 { margin: auto 0 8px; font-size: 1.22rem; letter-spacing: -.025em; }
.topic-card p { margin: 0; color: color-mix(in srgb, currentColor, transparent 20%); font-size: .87rem; line-height: 1.65; }
.card-arrow { position: absolute; top: 18px; right: 20px; font-size: 1.1rem; opacity: .7; }
.topic-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 13px; }
.topic-chips span { padding: 3px 9px; border: 1px solid color-mix(in srgb, currentColor, transparent 68%); border-radius: 999px; font-family: var(--mono); font-size: .62rem; font-weight: 600; }
.tone-violet { background: var(--accent-soft); color: color-mix(in srgb, var(--accent), var(--ink) 36%); }
.tone-blue { background: var(--cyan-soft); color: color-mix(in srgb, var(--cyan), var(--ink) 34%); }
.tone-mint { background: var(--mint-soft); color: color-mix(in srgb, var(--mint), var(--ink) 30%); }
.tone-amber { background: var(--amber-soft); color: color-mix(in srgb, var(--amber), var(--ink) 30%); }

/* ---------- 分类详情页：主视觉 + 文章列表/空状态 + 分类切换 ---------- */
.category-page { padding-block: 64px 90px; }
.category-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(220px, .85fr); gap: 48px; align-items: center; padding: 40px 44px; overflow: hidden; border-radius: var(--radius-lg); }
.category-hero::after { content: ""; position: absolute; width: 300px; height: 300px; right: -110px; top: -150px; border: 1px solid currentColor; border-radius: 50%; opacity: .12; }
.category-hero .eyebrow { color: inherit; opacity: .92; }
.category-hero-copy h1 { margin: 14px 0 0; font-size: clamp(2.1rem, 4.6vw, 3.6rem); line-height: 1.1; letter-spacing: -.04em; }
.category-intro { max-width: 640px; margin: 16px 0 0; color: color-mix(in srgb, currentColor, transparent 16%); font-size: 1.02rem; line-height: 1.85; }
.category-status { display: inline-flex; align-items: center; gap: 8px; margin: 18px 0 0; font-family: var(--mono); font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.category-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.category-focus { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0 0; padding: 0; list-style: none; }
.category-focus li { padding: 4px 12px; border: 1px solid color-mix(in srgb, currentColor, transparent 62%); border-radius: 999px; font-family: var(--mono); font-size: .7rem; font-weight: 600; }
.category-focus-note { margin: 12px 0 0; color: color-mix(in srgb, currentColor, transparent 28%); font-size: .78rem; }
.category-hero-visual { position: relative; display: grid; place-items: center; min-height: 240px; }
.category-hero-visual .topic-glyph-svg { width: clamp(150px, 16vw, 200px); height: auto; stroke-width: .55; }
.category-body { margin-top: 56px; }
.category-empty { padding: 58px 28px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
.category-empty-heading { margin: 0 0 10px; color: var(--ink); font-size: 1.32rem; letter-spacing: -.02em; }
.category-empty-message { max-width: 540px; margin: 0 auto; color: var(--muted); font-size: .95rem; line-height: 1.85; }
.category-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 26px; }
.category-switch { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 58px; }
.category-switch-item { display: grid; gap: 5px; padding: 16px 18px; border: 1px solid color-mix(in srgb, currentColor, transparent 82%); border-radius: var(--radius-md); transition: transform .2s, box-shadow .2s; }
.category-switch-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.category-switch-item.is-current { border-color: currentColor; box-shadow: 0 0 0 1px currentColor; }
.category-switch-eyebrow { color: color-mix(in srgb, currentColor, transparent 22%); font-family: var(--mono); font-size: .62rem; font-weight: 700; letter-spacing: .09em; }
.category-switch-item strong { font-size: .95rem; letter-spacing: -.01em; }
.category-switch-count { color: color-mix(in srgb, currentColor, transparent 34%); font-size: .74rem; }

/* ---------- 研究日志式文章列表 ---------- */
.post-list { border-top: 1px solid var(--line); }
.post-card { display: grid; grid-template-columns: 150px minmax(220px, .9fr) minmax(280px, 1.2fr) 95px; align-items: start; gap: 28px; padding: 30px 0; border-bottom: 1px solid var(--line); }
.post-card-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; color: var(--muted); font-family: var(--mono); font-size: .7rem; }
.post-card-meta ul { margin: 0; padding: 0; list-style: none; }
.post-card-meta a { color: var(--accent-ink); }
.meta-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.post-card h2 { margin: -2px 0 0; font-size: 1.24rem; line-height: 1.4; letter-spacing: -.02em; }
.post-card h2 a:hover, .archive-item h2 a:hover { color: var(--accent); }
.post-card > p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.75; }
.post-card > .text-link { justify-self: end; white-space: nowrap; }
.empty-state { padding: 60px; color: var(--muted); text-align: center; }

/* ---------- 独立页面与文章 ---------- */
.page, .archive, .article { padding-block: 68px 100px; }
.page-header { max-width: 820px; margin-bottom: 48px; }
.page-header.compact { margin-bottom: 42px; }
.page-header h1, .article-header h1 { margin: 12px 0 16px; font-size: clamp(2.2rem, 4.8vw, 4.2rem); line-height: 1.1; letter-spacing: -.045em; }
.page-header p { max-width: 680px; margin: 0; color: var(--muted); font-size: 1.06rem; }
.page-body { max-width: 820px; }

.article-header { max-width: 920px; margin: 0 auto 54px; text-align: center; }
.article-kicker, .article-kicker ul { display: flex; justify-content: center; margin: 0; padding: 0; list-style: none; gap: 8px; color: var(--accent-ink); font-family: var(--mono); font-size: .74rem; font-weight: 700; letter-spacing: .06em; }
.article-kicker a:hover { text-decoration: underline; }
.article-deck { max-width: 760px; margin: 0 auto; color: var(--muted); font-size: clamp(1.02rem, 2vw, 1.2rem); }
.article-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 10px; margin-top: 24px; color: var(--muted); font-family: var(--mono); font-size: .71rem; }
.article-meta span { position: relative; }
.article-meta span + span::before { content: "·"; position: absolute; left: -9px; color: var(--muted); }
.reading-progress { position: fixed; z-index: 120; top: 0; left: 0; width: 100%; height: 3px; background: transparent; pointer-events: none; }
.reading-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--accent), var(--cyan)); }
.article-layout { max-width: 820px; margin: 0 auto; }
.article-layout.has-toc { max-width: 1080px; display: grid; grid-template-columns: minmax(0, 820px) 200px; gap: 60px; }
.toc-panel { position: sticky; top: 115px; align-self: start; max-height: calc(100vh - 145px); overflow: auto; border-left: 2px solid var(--line); padding-left: 18px; color: var(--muted); font-size: .78rem; }
.toc-panel strong { color: var(--ink); font-size: .76rem; }
.toc-panel ol { margin: 12px 0 0; padding-left: 0; list-style: none; }
.toc-panel ol ol { padding-left: 13px; }
.toc-panel a { display: block; padding: 4px 0; line-height: 1.45; }
.toc-panel a:hover, .toc-panel a.is-current { color: var(--accent); }

/* ---------- 正文排版 ---------- */
.prose { font-size: 1.04rem; line-height: 1.95; }
.prose > *:first-child { margin-top: 0; }
.prose h2, .prose h3, .prose h4 { line-height: 1.35; letter-spacing: -.03em; }
.prose h2 { margin: 2.6em 0 .75em; padding-bottom: .42em; border-bottom: 1px solid var(--line); font-size: 1.68rem; }
.prose h3 { margin: 2.1em 0 .65em; font-size: 1.32rem; }
.prose h4 { margin: 1.8em 0 .5em; font-size: 1.08rem; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 1.2em 0; }
.prose a { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose strong { font-weight: 750; }
.prose blockquote { padding: 16px 22px; border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0; background: var(--surface-soft); color: var(--ink-soft); }
.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose :not(pre) > code { padding: .18em .42em; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); color: var(--accent-ink); font-family: var(--mono); font-size: .86em; }

/* 代码区：日夜统一的终端式深底 */
.prose .highlight, .prose pre { position: relative; overflow: auto; border: 1px solid var(--code-line); border-radius: 14px; background: var(--code-bg); color: var(--code-ink); font-family: var(--mono); font-size: .83rem; line-height: 1.65; }
.prose .highlight { padding: 12px 0; }
.prose .highlight table { width: 100%; margin: 0; border: 0; border-collapse: collapse; }
.prose .highlight td { padding: 0; border: 0; }
.prose .highlight .gutter { width: 44px; padding-right: 12px; color: var(--code-muted); text-align: right; user-select: none; }
.prose .highlight .code { padding-right: 18px; }
.prose .highlight pre { margin: 0; padding: 0; overflow: visible; border: 0; border-radius: 0; background: transparent; }
.prose > pre { padding: 20px; }
.prose figure figcaption { padding: 0 16px 8px; color: var(--code-muted); font-size: .72rem; }
.code-copy { position: absolute; z-index: 5; top: 8px; right: 10px; padding: 4px 11px; border: 1px solid var(--code-line); border-radius: 8px; background: rgba(10, 15, 30, .66); color: #c7d1e6; font-family: var(--mono); font-size: .68rem; font-weight: 600; backdrop-filter: blur(4px); transition: border-color .2s, color .2s; }
.code-copy:hover { border-color: var(--cyan); color: #fff; }
.code-copy.is-copied { border-color: rgba(111, 212, 187, .55); color: #6fd4bb; }
.code-copy.is-failed { border-color: rgba(240, 189, 117, .55); color: #f0bd75; }

/* 语法高亮 token：Hexo 以 hljs: false 输出无前缀 class；代码区日夜统一深底，
   故沿用夜间主题色板写死颜色，不随日间变量变化 */
.prose .highlight .comment, .prose .highlight .quote { color: #7d8aa5; font-style: italic; }
.prose .highlight .keyword, .prose .highlight .selector-tag, .prose .highlight .literal, .prose .highlight .section, .prose .highlight .doctag { color: #b7abff; }
.prose .highlight .string, .prose .highlight .regexp, .prose .highlight .addition { color: #8fd6b8; }
.prose .highlight .number, .prose .highlight .symbol, .prose .highlight .bullet { color: #f0bd75; }
.prose .highlight .attr, .prose .highlight .attribute, .prose .highlight .variable, .prose .highlight .template-variable, .prose .highlight .tag, .prose .highlight .name { color: #82b4ff; }
.prose .highlight .type, .prose .highlight .built_in, .prose .highlight .class, .prose .highlight .title { color: #7fd9d9; }
.prose .highlight .punctuation, .prose .highlight .operator, .prose .highlight .meta, .prose .highlight .params { color: #aab6cf; }
.prose img { margin: 1.8em auto; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-soft); }
.prose hr { margin: 3em 0; border: 0; border-top: 1px solid var(--line); }
.prose table:not(.highlight table) { width: 100%; display: block; overflow-x: auto; border-collapse: collapse; font-size: .92rem; }
.prose table:not(.highlight table) th, .prose table:not(.highlight table) td { padding: 10px 14px; border: 1px solid var(--line); text-align: left; }
.prose table:not(.highlight table) th { background: var(--surface-soft); }
.prose .video-container { position: relative; padding-top: 56.25%; }
.prose .video-container iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.article-actions { display: flex; justify-content: center; margin-top: 26px; }
.article-copy { display: inline-flex; align-items: center; padding: 7px 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--muted); font-family: var(--mono); font-size: .72rem; font-weight: 600; transition: border-color .2s, color .2s; }
.article-copy[hidden] { display: none; }
.article-copy:hover { border-color: var(--accent); color: var(--accent); }
.article-copy.is-copied { border-color: var(--mint); color: var(--mint); }
.article-copy.is-failed { border-color: var(--amber); color: var(--amber); }
.article-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 52px; padding-top: 24px; border-top: 1px solid var(--line); }
.article-tags > span { margin-right: 5px; color: var(--muted); font-family: var(--mono); font-size: .7rem; }
.article-tags ul { display: contents; list-style: none; }
.article-tags a { padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .75rem; }
.article-tags a:hover { border-color: var(--accent); color: var(--accent); }
.post-nav { max-width: 1080px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 68px auto 0; padding-top: 24px; border-top: 1px solid var(--line); }
.post-nav a { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.post-nav a:hover { border-color: var(--accent); box-shadow: var(--shadow-soft); }
.post-nav a.next { text-align: right; }
.post-nav small { display: block; margin-bottom: 5px; color: var(--muted); font-size: .72rem; }
.post-nav strong { font-size: .9rem; }

/* ---------- 归档与分页 ---------- */
.archive-list { border-top: 1px solid var(--line); }
.archive-item { display: grid; grid-template-columns: 130px minmax(0, 1fr) 40px; gap: 26px; align-items: start; padding: 26px 0; border-bottom: 1px solid var(--line); }
.archive-item time { color: var(--muted); font-family: var(--mono); font-size: .72rem; }
.archive-item h2 { margin: -5px 0 6px; font-size: 1.22rem; letter-spacing: -.02em; }
.archive-item p { margin: 0; color: var(--muted); font-size: .88rem; }
.archive-arrow { justify-self: end; color: var(--accent); font-size: 1.15rem; }
.pagination { margin-top: 35px; text-align: center; }
.pagination .page-number, .pagination .extend { min-width: 38px; height: 38px; display: inline-grid; place-items: center; margin: 3px; padding-inline: 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: .8rem; }
.pagination .current, .pagination a:hover { border-color: var(--accent); background: var(--accent); color: #fff; }

/* ---------- 搜索弹层 ---------- */
.search-dialog { position: fixed; z-index: 100; inset: 0; display: grid; place-items: start center; padding: max(8vh, 50px) 20px 20px; }
.search-dialog[hidden] { display: none; }
.search-backdrop { position: absolute; inset: 0; border: 0; background: rgba(5, 8, 17, .64); backdrop-filter: blur(8px); }
.search-panel { position: relative; width: min(720px, 100%); max-height: 82vh; overflow: auto; padding: 26px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lift); }
.search-heading { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.search-heading h2 { margin: 6px 0 18px; font-size: 1.4rem; letter-spacing: -.03em; }
.close-button { font-size: 1.4rem; line-height: 1; }
.search-field { height: 54px; display: flex; align-items: center; gap: 11px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.search-field:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.search-field svg { width: 19px; height: 19px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; }
.search-field input:focus-visible { outline: none; }
kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-family: var(--mono); font-size: .65rem; }
.search-status { margin: 14px 2px 7px; color: var(--muted); font-size: .76rem; }
.search-result { display: block; padding: 15px 4px; border-top: 1px solid var(--line); }
.search-result:first-child { border-top: 0; }
.search-result:hover h3 { color: var(--accent); }
.search-result h3 { margin: 0 0 4px; font-size: 1rem; }
.search-result p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.search-result mark { border-radius: 3px; background: var(--amber-soft); color: var(--amber); }
body.search-open { overflow: hidden; }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { min-height: 150px; display: flex; align-items: center; justify-content: space-between; gap: 35px; color: var(--muted); font-size: .76rem; }
.footer-brand strong { color: var(--ink); font-size: .95rem; }
.footer-brand p { margin: 4px 0 0; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--muted); font-weight: 600; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { margin: 0; }

/* ---------- 联系方式：关于页卡片与微信二维码面板 ---------- */
.contact-card { max-width: 820px; margin-top: 52px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-soft); }
.contact-card h2 { margin: 6px 0 16px; font-size: 1.34rem; letter-spacing: -.03em; }
.contact-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.contact-list li { display: grid; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.contact-list li:last-child { padding-bottom: 0; border-bottom: 0; }
.contact-link { color: var(--accent-ink); font-weight: 700; }
.contact-link:hover { color: var(--accent); }
.contact-list p { margin: 0; color: var(--muted); font-size: .85rem; }

.wechat-dialog:not([open]) { display: none; }
.wechat-dialog { width: min(420px, calc(100vw - 40px)); padding: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift); }
.wechat-dialog::backdrop { background: rgba(5, 8, 17, .64); backdrop-filter: blur(8px); }
.wechat-panel { display: grid; justify-items: center; gap: 4px; padding: 26px; }
.wechat-heading { width: 100%; display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.wechat-heading h2 { margin: 6px 0 0; font-size: 1.34rem; letter-spacing: -.03em; }
.wechat-note { margin: 14px 0 8px; padding: 8px 14px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-size: .84rem; font-weight: 600; }
.wechat-qr { width: 248px; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 14px; }
.wechat-open-image { margin-top: 12px; }
body.wechat-open { overflow: hidden; }

/* ---------- 动画 ---------- */
@keyframes flow-dash { to { stroke-dashoffset: -14; } }
@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes dot-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes status-blink { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* ---------- 无脚本降级：隐藏依赖脚本的控件、平铺导航 ---------- */
:root[data-theme="auto"] .theme-toggle,
:root[data-theme="auto"] .search-trigger,
:root[data-theme="auto"] .nav-toggle { display: none; }
:root[data-theme="auto"] .site-nav { display: flex; flex-wrap: wrap; position: static; padding: 0; border: 0; background: transparent; box-shadow: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: 1fr; gap: 52px; }
  .hero-workbench { max-width: 620px; }
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
  .article-layout.has-toc { display: block; max-width: 820px; }
  .toc-panel { display: none; }
  .category-hero { grid-template-columns: 1fr; gap: 18px; }
  .category-hero-visual { order: -1; min-height: 0; }
  .category-hero-visual .topic-glyph-svg { width: clamp(96px, 20vw, 140px); }
  .category-switch { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .site-nav { position: absolute; top: 68px; right: 16px; left: 16px; display: none; align-items: stretch; flex-direction: column; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-lift); }
  .site-nav.is-open { display: flex; }
  .site-nav > a { padding: 10px 12px; border-radius: 9px; }
  .site-nav > a::after { display: none; }
  .site-nav > a.is-active { background: var(--accent-soft); }
  .header-actions { margin-left: auto; }
  .nav-toggle { display: grid; gap: 5px; }
  .nav-toggle[aria-expanded="true"] span:nth-last-child(2) { transform: translateY(3.3px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.3px) rotate(-45deg); }
  .brand-copy small { display: none; }
}

@media (max-width: 700px) {
  .shell { width: min(100% - 32px, 1180px); }
  .header-inner { min-height: 68px; gap: 14px; }
  .hero { padding-block: 52px 70px; }
  .hero-copy h1 { font-size: clamp(2.3rem, 12vw, 3.6rem); }
  .topic-grid { grid-template-columns: 1fr; }
  .topic-card { min-height: 0; }
  .section-heading { align-items: start; flex-direction: column; gap: 12px; }
  .topics, .latest { padding-block: 22px 60px; }
  .post-card { grid-template-columns: 1fr; gap: 12px; }
  .post-card-meta { flex-direction: row; align-items: center; gap: 10px; }
  .post-card > .text-link { justify-self: start; }
  .page, .archive, .article { padding-block: 50px 72px; }
  .page-header h1, .article-header h1 { font-size: clamp(2rem, 11vw, 3.2rem); }
  .article-header { margin-bottom: 36px; text-align: left; }
  .article-kicker, .article-kicker ul, .article-meta { justify-content: flex-start; }
  .article-meta span + span::before { display: none; }
  .prose { font-size: 1rem; }
  .code-copy { top: 6px; right: 8px; }
  .archive-item { grid-template-columns: 1fr 30px; gap: 8px; }
  .archive-item time { grid-column: 1 / -1; }
  .archive-arrow { grid-column: 2; grid-row: 2; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav a.next { text-align: left; }
  .category-page { padding-block: 44px 64px; }
  .category-hero { padding: 26px 22px; }
  .category-body { margin-top: 40px; }
  .category-empty { padding: 44px 20px; }
  .category-switch { grid-template-columns: 1fr; margin-top: 44px; }
  .search-dialog { padding: 12px; }
  .search-panel { max-height: calc(100vh - 24px); padding: 20px; border-radius: 18px; }
  .wechat-panel { padding: 20px; }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; gap: 18px; padding-block: 34px; }
}

/* ---------- 减少动画 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .flow-line { stroke-dasharray: none; }
  .radar-sweep { display: none; }
}
