/* ============================================================
   单片机实训平台 · 公共样式
   1) 基础与变量   2) 顶栏与下拉菜单   3) 文档三栏骨架
   4) 左侧边栏     5) 正文与 Markdown   6) 右侧工具条与面板
   7) 首页         8) 响应式
   ============================================================ */

/* ---------- 1) 基础与变量 ---------- */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #1f2937;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --ink-4: #9ca3af;
  --line: #e5e7eb;
  --line-2: #eef1f4;
  --navy: #1e293b;
  --blue: #2563eb;
  --blue-ink: #1d4ed8;
  --blue-bg: #eff6ff;
  --green: #0f766e;
  --green-bg: #f0fdfa;
  --amber-bg: #fffbeb;
  --amber: #b45309;
  --code-bg: #1b2432;
  --radius: 12px;
  --topbar-h: 60px;
  --side-w: 274px;
  --tool-w: 64px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }
.wrap { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 760px; }
.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;
}
main { flex: 1; }
[hidden] { display: none !important; }

/* ---------- 2) 顶栏与下拉菜单 ---------- */
header.topbar {
  position: sticky; top: 0; z-index: 60;
  background: #fff;
  border-bottom: 1px solid var(--line);
  height: var(--topbar-h);
}
header.topbar.on-dark { background: var(--navy); border-bottom-color: #334155; }
.topbar-inner {
  height: 100%; max-width: 1440px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 22px;
}
.brand { display: flex; align-items: baseline; gap: 9px; text-decoration: none; flex: 0 0 auto; }
.brand b { font-size: 17px; font-weight: 700; letter-spacing: 0.2px; color: var(--navy); }
.brand span { font-size: 11.5px; color: var(--ink-4); }
header.topbar.on-dark .brand b { color: #fff; }
header.topbar.on-dark .brand span { color: #94a3b8; }

/* align-self:stretch 让导航条撑满顶栏高度，一级分类的可触发区从「一行字」变成「整根 60px」，
   鼠标在顶栏任意高度都能命中，不必精确压在那行字上。 */
nav.navmenu { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; min-width: 0; align-self: stretch; }
.navitem { position: relative; display: flex; align-items: center; align-self: stretch; }
.navitem > a, .navitem > span {
  display: flex; align-items: center; gap: 4px;
  flex: 1 1 auto;   /* .navitem 是 flex 容器，不写这条 span 会收缩成内容宽 —— 窄屏抽屉里箭头就靠不了右 */
  padding: 8px 12px; border-radius: 7px;
  font-size: 13.5px; color: var(--ink-2); text-decoration: none;
  cursor: pointer; white-space: nowrap;
}
.navitem > a:hover, .navitem > span:hover { background: var(--blue-bg); color: var(--blue); }
.navitem.is-active > a, .navitem.is-active > span { color: var(--blue); font-weight: 600; }
header.topbar.on-dark .navitem > a,
header.topbar.on-dark .navitem > span { color: #cbd5e1; }
header.topbar.on-dark .navitem > a:hover,
header.topbar.on-dark .navitem > span:hover { background: #334155; color: #fff; }
.caret { width: 9px; height: 9px; flex: 0 0 auto; opacity: 0.55; }

.mega {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 520px; max-width: 84vw;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.14);
  display: none; gap: 26px;
}
/* ⚠️ 别删这个伪元素：面板是绝对定位盒子，被 top:calc(100% + 6px) 推到了 .navitem 之外，
   那 6px 空隙不属于任何元素。鼠标从一级分类往下移进面板时必须穿过它，
   浏览器在那一瞬间判定 mouseleave → 面板闪退，二级分类/文章根本点不到。
   这里用一个透明伪元素把空隙的命中区接上：只补可点区域，不改变面板的视觉位置。
   改间隙数值（上面的 6px）时，这里的 top / height 要跟着调。 */
.mega::before { content: ""; position: absolute; left: -1px; right: -1px; top: -9px; height: 10px; }
.mega[data-cols="3"] { grid-template-columns: repeat(3, minmax(196px, 1fr)); }
.mega[data-cols="2"] { grid-template-columns: repeat(2, minmax(216px, 1fr)); }
.mega[data-cols="1"] { grid-template-columns: minmax(230px, 1fr); }
.navitem.open .mega { display: grid; }
.mega-col { min-width: 0; }
.mega-col h5 {
  margin: 0 0 8px; font-size: 12.5px; font-weight: 700;
  color: var(--navy); padding-bottom: 7px; border-bottom: 1px solid var(--line-2);
}
.mega-col ul { list-style: none; margin: 0; padding: 0; }
.mega-col li { margin: 0; }
.mega-col a {
  display: block; padding: 5px 8px; margin: 0 -8px;
  font-size: 13px; color: var(--ink-2); text-decoration: none;
  border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mega-col a:hover { background: var(--blue-bg); color: var(--blue); }
.mega-col a.cur { color: var(--blue); font-weight: 600; background: var(--blue-bg); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.topbar-right a {
  font-size: 12.5px; color: var(--ink-3); text-decoration: none;
  padding: 6px 10px; border-radius: 7px; display: inline-flex; align-items: center; gap: 5px;
}
.topbar-right a:hover { background: var(--blue-bg); color: var(--blue); }
header.topbar.on-dark .topbar-right a { color: #cbd5e1; }
header.topbar.on-dark .topbar-right a:hover { background: #334155; color: #fff; }
.nav-toggle {
  display: none; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 11px; font-size: 13px; font-family: inherit;
  color: var(--ink-2); cursor: pointer;
}

/* ---------- 3) 文档三栏骨架 ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--tool-w);
  align-items: start;
  max-width: 1440px; margin: 0 auto; width: 100%;
}
/* 三块各自钉死列号：**不要依赖网格的自动排列**。
   自动排列是按「在流中的顺序」逐格填的，一旦有子项 display:none（收起左栏就是这种），
   它后面的项就会整体前移一列 —— 正文被塞进 0 宽的列、工具条顶到正文的位置，
   看起来就像「页面只剩顶部和工具条」。钉死列号后，谁消失都不影响其余两块。 */
.shell > .side { grid-column: 1; }
.shell > .doc { grid-column: 2; }
.shell > .toolbar { grid-column: 3; }

.shell[data-side="off"] { grid-template-columns: 0 minmax(0, 1fr) var(--tool-w); }
.shell[data-side="off"] > .side { display: none; }

/* ---------- 4) 左侧边栏 ---------- */
aside.side {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  padding: 18px 12px 40px 16px;
  scrollbar-width: thin;
}
aside.side::-webkit-scrollbar { width: 7px; }
aside.side::-webkit-scrollbar-thumb { background: #d7dbe0; border-radius: 99px; }
aside.side::-webkit-scrollbar-thumb:hover { background: #bfc5cc; }
.side-search {
  width: 100%; font-size: 13px; font-family: inherit;
  padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); outline: none; margin-bottom: 16px;
}
.side-search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.side-group { margin-bottom: 20px; }
.side-group > .side-gtitle {
  display: flex; align-items: center; gap: 7px;
  margin: 0 0 5px; padding: 0 8px;
  font-size: 12.5px; font-weight: 700; color: var(--navy);
  letter-spacing: 0.2px; cursor: pointer; user-select: none;
}
.side-group > .side-gtitle:hover { color: var(--blue); }
.side-cnt {
  margin-left: auto; font-style: normal; font-size: 10.5px; font-weight: 400;
  color: var(--ink-4); background: var(--line-2);
  padding: 0 6px; border-radius: 999px; line-height: 16px;
}
.side-group > .side-gtitle:hover .side-cnt { background: #dbeafe; color: var(--blue); }
.side-tag {
  font-size: 10px; color: var(--green); background: var(--green-bg);
  padding: 0 5px; border-radius: 999px; margin-left: 6px;
  flex: 0 0 auto; vertical-align: 1px;
}
.side-gtitle .chev { width: 10px; height: 10px; flex: 0 0 auto; transition: transform 0.16s; opacity: 0.5; }
.side-group.collapsed .chev { transform: rotate(-90deg); }
.side-group.collapsed ul { display: none; }
.side-group ul { list-style: none; margin: 0; padding: 0; }
.side-link {
  display: flex; align-items: center;
  text-decoration: none;
  font-size: 13px; color: var(--ink-2);
  padding: 6px 9px 6px 16px; margin-bottom: 1px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
}
.side-link .side-t { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link:hover { background: var(--blue-bg); color: var(--blue); }
.side-link.cur { background: var(--blue-bg); color: var(--blue); border-left-color: var(--blue); font-weight: 600; }
.side-link .dot {
  flex: 0 0 auto; width: 5px; height: 5px; border-radius: 99px;
  background: #cbd5e1; margin-right: 7px;
}
.side-link.cur .dot { background: var(--blue); }
.side-empty { font-size: 12.5px; color: var(--ink-4); padding: 4px 9px; }

/* ---------- 5) 正文与 Markdown ---------- */
.doc { min-width: 0; padding: 26px 40px 80px 44px; }
.doc-inner { max-width: 830px; }
/* 演示页要放交互面板，比文章正文宽一档（文章页仍用 830 的阅读宽度） */
.doc-inner.wide { max-width: 1120px; }
.crumb { font-size: 12.5px; color: var(--ink-4); margin: 0 0 14px; }
.crumb a { text-decoration: none; color: var(--ink-3); }
.crumb a:hover { color: var(--blue); }
.crumb i { font-style: normal; margin: 0 6px; opacity: 0.6; }

.doc h1, .article-h1 {
  margin: 0 0 12px; font-size: 28px; line-height: 1.4;
  font-weight: 700; letter-spacing: -0.3px; color: var(--navy);
}
.byline {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink-4);
  padding-bottom: 16px; margin-bottom: 26px; border-bottom: 1px solid var(--line);
}
.byline .tag { font-size: 11.5px; }

.prose { font-size: 15px; line-height: 1.85; color: #374151; word-wrap: break-word; }
.prose > *:first-child { margin-top: 0; }
.prose h2 {
  margin: 36px 0 14px; font-size: 20px; font-weight: 700; color: var(--navy);
  padding-left: 11px; border-left: 4px solid var(--blue); scroll-margin-top: 76px;
}
.prose h3 { margin: 26px 0 10px; font-size: 16.5px; font-weight: 700; color: #334155; scroll-margin-top: 76px; }
.prose h4 { margin: 20px 0 8px; font-size: 15px; font-weight: 700; color: #334155; scroll-margin-top: 76px; }
.prose p { margin: 0 0 16px; }
.prose a { color: var(--blue-ink); text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 16px; }
.prose li { margin-bottom: 7px; }
.prose li > ul, .prose li > ol { margin: 7px 0 0; }
.prose code {
  font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 13.5px;
  background: #eef2f7; padding: 2px 6px; border-radius: 4px; color: #0f172a;
}
.prose pre {
  background: var(--code-bg); color: #dfe6f0; padding: 16px 18px; border-radius: 10px;
  overflow-x: auto; font-size: 13.5px; line-height: 1.7; margin: 0 0 18px; position: relative;
}
.prose pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.prose pre .lang {
  position: absolute; top: 7px; right: 12px;
  font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 0.6px;
}
.prose blockquote {
  margin: 0 0 18px; padding: 13px 18px; background: var(--blue-bg);
  border-left: 4px solid #93c5fd; border-radius: 0 8px 8px 0;
  font-size: 14px; color: #1e40af;
}
.prose blockquote p:last-child { margin: 0; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; display: block; margin: 0 0 18px; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 13.5px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 9px 12px; border: 1px solid var(--line); text-align: left; }
.prose th { background: #f8fafc; font-weight: 700; color: var(--navy); white-space: nowrap; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 34px 0; }
.prose kbd {
  font-family: inherit; font-size: 12px; background: #fff;
  border: 1px solid #cbd5e1; border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; color: var(--ink-2);
}

/* 代码高亮（highlight.js 令牌配色，配深色代码块） */
.hljs-comment, .hljs-quote { color: #7c8ea6; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type { color: #c792ea; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #a5e075; }
.hljs-number, .hljs-symbol, .hljs-bullet { color: #f78c6c; }
.hljs-title, .hljs-section, .hljs-name { color: #82aaff; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: #ffcb6b; }
.hljs-built_in, .hljs-class .hljs-title { color: #89ddff; }
.hljs-meta { color: #64748b; }
.hljs-deletion { color: #ff8a80; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

.callout {
  background: var(--amber-bg); border: 1px solid #fde68a; border-radius: var(--radius);
  padding: 14px 16px; font-size: 13px; color: #78350f; margin: 0 0 26px;
}
.callout a { color: var(--amber); font-weight: 600; }
.callout.blue { background: var(--blue-bg); border-color: #bfdbfe; color: #1e40af; }
.callout.blue a { color: var(--blue-ink); }

.pager { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line); }
.pager a {
  flex: 1; min-width: 210px; text-decoration: none; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 13px 16px; transition: all 0.14s;
}
.pager a:hover { border-color: #bfdbfe; box-shadow: 0 6px 16px rgba(15, 23, 42, 0.07); }
.pager span { display: block; font-size: 11.5px; color: var(--ink-4); margin-bottom: 3px; }
.pager b { font-size: 13.5px; font-weight: 600; color: var(--navy); }
.pager .k {
  display: inline-block; font-style: normal; font-size: 10.5px;
  background: var(--green-bg); color: var(--green);
  padding: 1px 6px; border-radius: 999px; margin-left: 6px; vertical-align: 1px;
}

/* ---------- 6) 右侧工具条与面板 ---------- */
/* 工具条是**第三栏里独立的一小块浮卡**，和左侧栏一样自成一块：
   高度由内部按钮撑出来（height:auto），不再从顶栏一路拉满到视口底部。
   注意不要改回 height: calc(100vh - var(--topbar-h))，那会变回一条通高的空白色带。 */
aside.toolbar {
  position: sticky; top: calc(var(--topbar-h) + 14px);
  align-self: start;
  height: auto;
  max-height: calc(100vh - var(--topbar-h) - 28px);
  margin: 14px 6px 40px 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.07);
  display: flex; flex-direction: column; align-items: center;
  padding: 7px 0; gap: 2px;
  overflow-y: auto; overflow-x: hidden; scrollbar-width: thin;
}
/* 窗口特别矮（<520px）时卡片会在内部滚动，给一条细滚动条，别把内容藏起来 */
aside.toolbar::-webkit-scrollbar { width: 5px; }
aside.toolbar::-webkit-scrollbar-track { background: transparent; }
aside.toolbar::-webkit-scrollbar-thumb { background: #d7dbe0; border-radius: 99px; }
.tool {
  width: 52px; padding: 7px 3px 6px; border: 0; background: none;
  border-radius: 9px; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink-3); transition: all 0.14s; text-decoration: none; position: relative;
}
.tool:hover { background: var(--blue-bg); color: var(--blue); }
.tool.on { background: var(--blue-bg); color: var(--blue); }
.tool svg { width: 19px; height: 19px; flex: 0 0 auto; }
.tool em { font-size: 10.5px; font-style: normal; line-height: 1.2; white-space: nowrap; }
.tool .badge-dot {
  position: absolute; top: 4px; right: 6px; width: 6px; height: 6px;
  border-radius: 99px; background: #f97316;
}

/* 弹出面板贴在工具条卡的左侧，留 6px 空隙（工具条卡左沿 = var(--tool-w)） */
.panel-pop {
  position: fixed; right: calc(var(--tool-w) + 6px); top: calc(var(--topbar-h) + 14px);
  width: 312px; max-height: calc(100vh - var(--topbar-h) - 28px);
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: -10px 0 34px rgba(15, 23, 42, 0.13);
  z-index: 55; display: none; flex-direction: column; overflow: hidden;
}
.panel-pop.open { display: flex; }
.panel-pop header {
  padding: 13px 16px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
}
.panel-pop header h4 { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--navy); }
.panel-pop header .x {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  color: var(--ink-4); font-size: 17px; line-height: 1; padding: 2px 5px; border-radius: 5px;
}
.panel-pop header .x:hover { background: var(--line-2); color: var(--ink); }
.panel-pop .body { padding: 12px 10px 16px; overflow-y: auto; }

.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { margin: 0; }
.toc-list a {
  display: block; text-decoration: none; font-size: 13px; color: var(--ink-2);
  padding: 5px 10px; border-radius: 6px; border-left: 2px solid transparent;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.toc-list a:hover { background: var(--blue-bg); color: var(--blue); }
.toc-list a.cur { color: var(--blue); font-weight: 600; border-left-color: var(--blue); background: var(--blue-bg); }
.toc-list .lv3 a { padding-left: 26px; font-size: 12.5px; color: var(--ink-3); }
.toc-list .lv3 a.cur { color: var(--blue); }
.toc-empty { font-size: 12.5px; color: var(--ink-4); padding: 8px 10px; }

.qrbox { text-align: center; padding: 8px 6px 4px; }
.qrbox .qr-img {
  width: 190px; height: 190px; margin: 0 auto 10px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.qrbox .qr-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.qrbox .qr-img canvas { width: 100% !important; height: 100% !important; }
.qrbox p { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }
.qrbox small { font-size: 11.5px; color: var(--ink-4); display: block; line-height: 1.6; }
.qrbox .fallback { font-size: 12px; color: var(--ink-4); text-align: center; line-height: 1.7; padding: 0 12px; }
.qrbox .fallback code {
  font-size: 11.5px; background: #f1f5f9; padding: 2px 6px; border-radius: 4px;
  display: inline-block; margin-top: 6px; word-break: break-all;
}

.sm-group { margin-bottom: 16px; }
.sm-group:last-child { margin-bottom: 0; }
.sm-group h6 {
  margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.sm-group ul { list-style: none; margin: 0; padding: 0; }
.sm-group a {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--ink-2); text-decoration: none;
  padding: 5px 9px; border-radius: 6px;
}
.sm-group a:hover { background: var(--blue-bg); color: var(--blue); }
.sm-group a .ext { width: 11px; height: 11px; opacity: 0.4; margin-left: auto; flex: 0 0 auto; }

.scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 50; display: none; }
.scrim.open { display: block; }

.doc-fsbar { display: none; }

/* ---------- 6.5) 交互演示页嵌入舞台 ----------
   演示本体在 <dir>/demo.html（原样保留的独立整页），这里用 iframe 装进壳里。
   演示页自带的样式/脚本/Tailwind 全留在自己的文档中，不会污染本站骨架。 */
.demo-lead { margin: 0 0 18px; font-size: 14px; line-height: 1.8; color: var(--ink-3); }
/* 舞台可以宽，但连续文字仍守在阅读宽度上（985px 一行要 65 个汉字，太长了） */
.doc-inner.wide .demo-lead { max-width: 830px; }
.demo-hint { margin: 12px 0 0; font-size: 12px; color: var(--ink-4); }
.demo-hint a { color: var(--ink-3); }
.demo-hint a:hover { color: var(--blue); }
.demo-stage { margin: 0 0 6px; }
.demo-stage > iframe {
  display: block; width: 100%; border: 0; background: transparent;
  /* auto 模式的高度由 site.js 按内层内容量出来后写在 style 上 */
  height: 240px;
}
/* fill 模式：给演示一个「视口高的舞台」，让它内部自己滚（opcode-anim 那种全屏 app 布局） */
.demo-stage.is-fill { height: calc(100vh - var(--topbar-h) - 190px); min-height: 420px; }
.demo-stage.is-fill > iframe { height: 100%; }

/* ---------- 7) 首页（与文章页同壳，正文区是分类清单） ---------- */
/* 通用小标签：文章页 byline 与首页清单共用 */
.tag { font-size: 11.5px; background: var(--blue-bg); color: var(--blue); padding: 2px 8px; border-radius: 999px; }

.prose ul.home-list { list-style: none; padding-left: 0; margin: 0 0 30px; }
.prose li.home-item { padding: 14px 0; margin-bottom: 0; border-bottom: 1px solid var(--line-2); }
.prose li.home-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.home-head { display: flex; align-items: baseline; gap: 8px; }
.home-a { font-size: 15.5px; font-weight: 600; color: var(--navy); text-decoration: none; }
.home-a:hover { color: var(--blue); }
.home-kind {
  flex: 0 0 auto; font-size: 11px; line-height: 17px; padding: 0 7px;
  border-radius: 999px; background: var(--blue-bg); color: var(--blue); white-space: nowrap;
}
.home-kind.is-demo { background: var(--green-bg); color: var(--green); }
.home-date { margin-left: auto; flex: 0 0 auto; font-size: 12px; color: var(--ink-4); }
.home-sum { margin: 6px 0 9px; font-size: 13px; line-height: 1.7; color: var(--ink-3); }
.home-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.home-cat { margin-left: auto; font-size: 11.5px; color: var(--ink-4); }
.home-empty { color: var(--ink-4); }

/* ---------- 阅读量（assets/pv.js 填充；未拿到数据时整块隐藏） ---------- */
.pv {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; color: var(--ink-4); white-space: nowrap;
}
.pv svg { width: 13px; height: 13px; opacity: 0.7; }
.pv i { font-style: normal; }
.pv b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.pv.is-local { opacity: 0.8; }
.pv[hidden] { display: none !important; }
.home-head .pv { flex: 0 0 auto; }

/* ---------- 页脚 ---------- */
footer.site-footer {
  border-top: 1px solid var(--line); text-align: center;
  font-size: 12px; color: var(--ink-4); padding: 22px 16px 30px;
}
footer.site-footer a { color: var(--ink-3); }
footer.site-footer a:hover { color: var(--blue); }

/* ---------- 8) 响应式 ---------- */
@media (max-width: 1180px) {
  /* 工具条先收掉，只剩「左栏 + 正文」两列；收起左栏时第一列压成 0，正文仍留在第 2 列 */
  .shell { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .shell[data-side="off"] { grid-template-columns: 0 minmax(0, 1fr); }
  aside.toolbar { display: none; }
  .panel-pop { right: 12px; }
  .doc { padding: 26px 26px 70px 30px; }
}
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .topbar-inner { gap: 12px; }
  nav.navmenu {
    position: fixed; top: var(--topbar-h); left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px; max-height: calc(100vh - var(--topbar-h)); overflow-y: auto;
    display: none;
  }
  nav.navmenu.open { display: flex; }
  .navitem > a, .navitem > span { justify-content: space-between; }
  .mega {
    position: static; min-width: 0; max-width: none; border: 0;
    box-shadow: none; padding: 4px 8px 10px; border-radius: 0;
  }
  .mega[data-cols="1"], .mega[data-cols="2"], .mega[data-cols="3"] { grid-template-columns: 1fr; }
  /* 窄屏 mega 是 position:static 的普通块，不靠悬停触发，补空隙的伪元素在这里只会变成多余热区 */
  .mega::before { display: none; }
  .navitem.open .mega { display: grid; }

  .shell, .shell[data-side="off"] { grid-template-columns: minmax(0, 1fr); }
  /* 单列：正文回到唯一那一列（上面钉死的 grid-column:2 在此要复位，否则会多出隐式列） */
  .shell > .doc { grid-column: 1; }
  aside.side {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
    width: var(--side-w); max-width: 84vw; background: #fff;
    z-index: 52; height: auto; transform: translateX(-102%);
    transition: transform 0.2s; box-shadow: 6px 0 26px rgba(15, 23, 42, 0.12);
    display: block !important;
  }
  aside.side.open { transform: none; }
  .doc { padding: 20px 18px 60px; }
  .doc h1, .article-h1 { font-size: 23px; }
  .prose { font-size: 14.5px; }
  .panel-pop { width: min(340px, 92vw); }
}
