/* ==========================================================================
   DevNotes —— 简约技术博客样式
   设计原则：大量留白 · 单一强调色 · 细边框代替重阴影 · 正文阅读优先
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-elev: #ffffff;
  --text: #16181d;
  --text-2: #4a5160;
  --text-3: #8a91a0;
  --border: #e8eaef;
  --border-strong: #d6dae2;
  --accent: #2f6fed;
  --accent-soft: #eef3ff;
  --accent-text: #2058cc;
  --code-bg: #f6f8fa;
  --code-border: #e8eaef;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lift: 0 6px 20px -8px rgba(16, 24, 40, .16);

  --radius: 12px;
  --radius-sm: 8px;
  --max: 1120px;
  --read: 720px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", "JetBrains Mono", "Courier New", monospace;
}

[data-theme="dark"] {
  --bg: #0f1115;
  --bg-soft: #14171d;
  --bg-elev: #171b22;
  --text: #e9ecf2;
  --text-2: #a7b0c0;
  --text-3: #6d7688;
  --border: #242a33;
  --border-strong: #333a45;
  --accent: #6494ff;
  --accent-soft: #17203a;
  --accent-text: #8db0ff;
  --code-bg: #171b22;
  --code-border: #262c36;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lift: 0 8px 24px -10px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

/* 作者样式里的 display 会盖掉浏览器默认的 [hidden]{display:none}，
   这里显式兜底，保证 hidden 属性在任何元素上都生效 */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

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

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 8px 14px; z-index: 100;
}
.skip:focus { left: 8px; top: 8px; }

/* ------------------------------- 顶部导航 ------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg); /* 降级：不支持 color-mix 的浏览器用纯色 */
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; height: 62px;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.brand:hover { color: var(--text); }

.brand-mark {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  color: #fff; background: var(--accent);
  padding: 5px 7px; border-radius: 7px; letter-spacing: -.5px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15.5px; letter-spacing: -.2px; }
.brand-text em { font-style: normal; font-size: 11.5px; color: var(--text-3); letter-spacing: .6px; }

.site-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }

.site-nav > a {
  padding: 7px 11px; border-radius: var(--radius-sm);
  font-size: 14.5px; color: var(--text-2); white-space: nowrap;
  transition: background .15s, color .15s;
}
.site-nav > a:hover { background: var(--bg-soft); color: var(--text); }
.site-nav > a.active { color: var(--accent-text); background: var(--accent-soft); font-weight: 500; }

.icon-btn {
  width: 32px; height: 32px; margin-left: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg); color: var(--text-2);
  font-size: 15px; cursor: pointer; line-height: 1;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); border-color: var(--border-strong); }

.nav-toggle {
  display: none; width: 36px; height: 36px;
  flex-direction: column; justify-content: center; align-items: center; gap: 4px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg); cursor: pointer;
}
.nav-toggle span { display: block; width: 16px; height: 1.5px; background: var(--text-2); border-radius: 2px; }

/* ------------------------------- 搜索弹层 ------------------------------- */

.search-modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16, 24, 40, .38);
  backdrop-filter: blur(3px);
  display: flex; justify-content: center;
  padding: 12vh 20px 20px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.search-box {
  width: 100%; max-width: 620px; height: fit-content;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lift); overflow: hidden;
}

.search-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.search-ico { color: var(--text-3); font-size: 17px; }
.search-input-row input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--font); font-size: 16px; color: var(--text);
}
.search-input-row input::placeholder { color: var(--text-3); }

.search-close {
  border: 1px solid var(--border); background: var(--bg-soft);
  color: var(--text-3); font-size: 11px; font-family: var(--mono);
  padding: 3px 7px; border-radius: 6px; cursor: pointer;
}

.search-results { max-height: 52vh; overflow-y: auto; padding: 8px; }
.search-hint { color: var(--text-3); font-size: 14px; text-align: center; padding: 26px 0; margin: 0; }

.sr-item {
  display: block; padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text); border-bottom: 1px solid transparent;
}
.sr-item:hover, .sr-item.active { background: var(--accent-soft); color: var(--text); }
.sr-title { font-size: 15px; font-weight: 500; margin-bottom: 3px; }
.sr-title mark { background: #ffe9a8; color: inherit; border-radius: 3px; padding: 0 2px; }
[data-theme="dark"] .sr-title mark { background: #4a3a00; color: #ffe9a8; }
.sr-meta { font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; }
.sr-text { font-size: 13px; color: var(--text-2); margin-top: 4px; line-height: 1.6; }

/* --------------------------------- 首页 --------------------------------- */

.hero { padding: 76px 0 56px; border-bottom: 1px solid var(--border); }
.hero-title {
  font-size: clamp(28px, 4.4vw, 42px); line-height: 1.25;
  letter-spacing: -1px; margin: 0 0 18px; font-weight: 700;
}
.hero-intro { font-size: 16.5px; color: var(--text-2); max-width: 660px; margin: 0 0 26px; line-height: 1.85; }

.hero-stats { display: flex; gap: 24px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-3); }
.hero-stats strong { color: var(--text); font-weight: 600; }

.section { padding: 54px 24px; }
.section-title { font-size: 18px; font-weight: 600; margin: 0 0 20px; letter-spacing: -.2px; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.section-head .section-title { margin: 0; }

.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--border); background: var(--bg); color: var(--text-2);
  font-family: var(--font); font-size: 13.5px;
  padding: 5px 13px; border-radius: 999px; cursor: pointer;
  transition: all .15s;
}
.pill:hover { border-color: var(--border-strong); color: var(--text); }
.pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ------------------------------ 分类卡片 ------------------------------ */

.cat-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
}

.cat-card {
  display: flex; align-items: center; gap: 13px;
  padding: 17px 18px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-elev);
  color: var(--text); transition: border-color .18s, transform .18s, box-shadow .18s;
}
.cat-card:hover {
  color: var(--text); border-color: var(--border-strong);
  transform: translateY(-2px); box-shadow: var(--shadow-lift);
}
.cat-card-icon { font-size: 13px; color: var(--accent); flex-shrink: 0; }
.cat-card-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.cat-card-body strong { font-size: 15px; font-weight: 600; }
.cat-card-body em {
  font-style: normal; font-size: 12.5px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cat-card-num {
  font-family: var(--mono); font-size: 12px; color: var(--text-3);
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 999px;
}

/* ------------------------------- 文章卡片 ------------------------------- */

.post-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.card {
  display: flex; flex-direction: column;
  padding: 20px 20px 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-lift); }

.card-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 11px;
}
.card-top time { font-family: var(--mono); font-size: 12px; color: var(--text-3); }

.cat {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-2);
}
.cat:hover { color: var(--accent-text); border-color: var(--accent); }
.cat-icon { font-size: 9px; color: var(--accent); }

/* 页面标题里的分类图标跟随标题字号缩放（覆盖 .cat-icon 的 9px） */
.page-title .cat-icon { font-size: .56em; }

.card-title { margin: 0 0 9px; font-size: 17px; line-height: 1.45; font-weight: 600; letter-spacing: -.2px; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); }

.card-excerpt {
  margin: 0 0 16px; font-size: 14px; color: var(--text-2); line-height: 1.75;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  flex: 1;
}

.card-bot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.tag {
  font-size: 12px; color: var(--text-3);
  background: var(--bg-soft); padding: 2px 8px; border-radius: 5px;
  border: 1px solid transparent;
}
.tag:hover { color: var(--accent-text); border-color: var(--border); }
.tag-repo { color: var(--accent-text); background: var(--accent-soft); }
.card-read { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

.empty {
  text-align: center; padding: 60px 20px; color: var(--text-3);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty p { margin: 0 0 8px; }
.empty-sub { font-size: 13.5px; }
.empty code { font-family: var(--mono); font-size: 12.5px; background: var(--bg-soft); padding: 2px 6px; border-radius: 4px; }
.filter-empty { text-align: center; color: var(--text-3); padding: 40px 0; }

/* ------------------------------ 页面头部 ------------------------------ */

.page-head { padding: 44px 24px 26px; border-bottom: 1px solid var(--border); }
.crumb { font-size: 13px; color: var(--text-3); display: flex; gap: 7px; align-items: center; margin-bottom: 14px; }
.crumb a { color: var(--text-3); }
.crumb a:hover { color: var(--accent); }
.page-title {
  font-size: clamp(23px, 3.4vw, 31px); font-weight: 700; letter-spacing: -.6px;
  margin: 0 0 10px; line-height: 1.35; display: flex; align-items: center; gap: 10px;
}
.page-desc { color: var(--text-2); font-size: 15.5px; margin: 0 0 10px; max-width: 680px; line-height: 1.8; }
.page-count { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); margin: 0; }

/* -------------------------------- 归档 -------------------------------- */

.archive-year { margin-bottom: 42px; }
.archive-year-title {
  font-size: 15px; font-weight: 600; color: var(--text-2);
  margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 10px;
}
.archive-year-title span { font-family: var(--mono); font-size: 12px; color: var(--text-3); font-weight: 400; }
.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li {
  display: flex; align-items: baseline; gap: 14px;
  padding: 9px 0; border-bottom: 1px dashed var(--border);
}
.archive-list time { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); flex-shrink: 0; }
.archive-list a { font-size: 15px; color: var(--text); flex: 1; }
.archive-list a:hover { color: var(--accent); }
.archive-cat {
  font-size: 12px; color: var(--text-3); background: var(--bg-soft);
  padding: 2px 8px; border-radius: 5px; flex-shrink: 0;
}

/* ------------------------------- 文章详情 ------------------------------- */

.post-layout {
  display: grid; grid-template-columns: minmax(0, var(--read)) 220px;
  gap: 48px; justify-content: center;
  padding-top: 44px; padding-bottom: 72px;
}
/* 没有目录的文章收成单栏，避免右侧留一条空白 */
.post-layout.no-toc { grid-template-columns: minmax(0, var(--read)); }

.post-head { margin-bottom: 26px; }
.post-title {
  font-size: clamp(25px, 3.8vw, 34px); line-height: 1.32; font-weight: 700;
  letter-spacing: -.8px; margin: 0 0 14px;
}
.post-summary {
  font-size: 15.5px; color: var(--text-2); line-height: 1.8;
  margin: 0 0 16px; padding-left: 13px; border-left: 3px solid var(--border-strong);
}
.post-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-3);
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.post-meta .dot { color: var(--border-strong); }
.post-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 14px; }

.post-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font); font-size: 13.5px;
  padding: 7px 14px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text-2);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--bg-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-text); border-color: var(--accent-text); color: #fff; }
.btn.done { color: #17864a; border-color: #a8ddc0; background: #f0fbf5; }
[data-theme="dark"] .btn.done { color: #6ee7a4; border-color: #2a5a41; background: #14261d; }

.wechat-tip {
  margin: 14px 0 0; padding: 13px 16px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text-2); line-height: 1.7;
}
.wechat-tip strong { display: block; color: var(--accent-text); font-size: 13.5px; margin-bottom: 3px; }
.wechat-tip p { margin: 0; }

/* ------------------------------ 正文排版 ------------------------------ */

.post-body { margin-top: 34px; font-size: 16.5px; line-height: 1.9; color: var(--text); }
.post-body > *:first-child { margin-top: 0; }

.post-body h1, .post-body h2, .post-body h3, .post-body h4 {
  position: relative; font-weight: 600; letter-spacing: -.3px;
  scroll-margin-top: 88px;
}
.post-body h2 {
  font-size: 22px; margin: 44px 0 16px; padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
}
.post-body h3 { font-size: 18.5px; margin: 34px 0 13px; }
.post-body h4 { font-size: 16.5px; margin: 26px 0 10px; color: var(--text-2); }
.post-body h1 { font-size: 26px; margin: 40px 0 16px; }

.post-body .anchor {
  position: absolute; left: -22px; top: 50%; transform: translateY(-50%);
  color: var(--border-strong); font-weight: 400; font-size: 16px;
  opacity: 0; transition: opacity .15s;
}
.post-body h2:hover .anchor, .post-body h3:hover .anchor { opacity: 1; }
.post-body .anchor:hover { color: var(--accent); }

.post-body p { margin: 0 0 20px; }
.post-body a { border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.post-body strong { font-weight: 600; color: var(--text); }
.post-body em { font-style: italic; }
.post-body del { color: var(--text-3); }

.post-body ul, .post-body ol { margin: 0 0 20px; padding-left: 24px; }
.post-body li { margin-bottom: 8px; }
.post-body li > ul, .post-body li > ol { margin: 8px 0 0; }
.post-body li::marker { color: var(--text-3); }

.post-body blockquote {
  margin: 0 0 20px; padding: 15px 18px;
  background: var(--bg-soft); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2);
}
.post-body blockquote > *:last-child { margin-bottom: 0; }
.post-body blockquote p { font-size: 15.5px; }

.post-body :not(pre) > code {
  font-family: var(--mono); font-size: .875em;
  background: var(--bg-soft); color: #d6336c;
  padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--code-border);
}
[data-theme="dark"] .post-body :not(pre) > code { color: #ff7ab2; background: #1c2029; }

.post-body hr { border: none; border-top: 1px dashed var(--border-strong); margin: 36px 0; }

/* 代码块 */
.code-block {
  position: relative; margin: 0 0 22px;
  background: var(--code-bg); border: 1px solid var(--code-border);
  border-radius: var(--radius); overflow: hidden;
}
.code-block pre { margin: 0; padding: 17px 18px; overflow-x: auto; }
.code-block code {
  font-family: var(--mono); font-size: 13.5px; line-height: 1.75;
  color: var(--text); white-space: pre; tab-size: 2;
}
.code-lang {
  position: absolute; top: 0; left: 0;
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  padding: 4px 10px; border-right: 1px solid var(--code-border);
  border-bottom: 1px solid var(--code-border);
  border-radius: 0 var(--radius-sm) 0 var(--radius-sm);
  background: var(--bg-soft); text-transform: uppercase; letter-spacing: .5px;
}
.code-block:has(.code-lang) pre { padding-top: 34px; }
.code-copy {
  position: absolute; top: 7px; right: 8px;
  font-family: var(--font); font-size: 11.5px; color: var(--text-3);
  background: var(--bg); border: 1px solid var(--code-border);
  padding: 3px 9px; border-radius: 6px; cursor: pointer;
  opacity: 0; transition: opacity .15s, color .15s;
}
.code-block:hover .code-copy { opacity: 1; }
.code-copy:hover { color: var(--accent); border-color: var(--accent); }

/* 表格 */
.table-wrap { overflow-x: auto; margin: 0 0 22px; }
.post-body table {
  width: 100%; border-collapse: collapse; font-size: 14.5px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.post-body th, .post-body td {
  border: 1px solid var(--border); padding: 9px 13px; text-align: left; line-height: 1.7;
}
.post-body th { background: var(--bg-soft); font-weight: 600; }
.post-body tr:hover td { background: color-mix(in srgb, var(--bg-soft) 60%, transparent); }

/* 目录 */
.toc {
  position: sticky; top: 86px; align-self: start;
  max-height: calc(100vh - 120px); overflow-y: auto;
  font-size: 13.5px; padding-left: 18px; border-left: 1px solid var(--border);
}
.toc-title {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  letter-spacing: .8px; margin: 0 0 12px; text-transform: uppercase;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin-bottom: 7px; }
.toc a { color: var(--text-3); display: block; line-height: 1.5; }
.toc a:hover, .toc a.active { color: var(--accent-text); }
.toc-l3 { padding-left: 13px; font-size: 13px; }

/* 上一篇 / 下一篇 */
.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 52px; padding-top: 26px; border-top: 1px solid var(--border);
}
.post-nav-item {
  display: flex; flex-direction: column; gap: 5px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); transition: border-color .15s, background .15s;
}
.post-nav-item:hover { color: var(--text); border-color: var(--accent); background: var(--bg-soft); }
.post-nav-item span { font-size: 12px; color: var(--text-3); }
.post-nav-item strong { font-size: 14.5px; font-weight: 500; line-height: 1.5; }
.post-nav-item.next { text-align: right; }

.post-single { max-width: var(--read); margin: 0 auto; }

/* ------------------------------- 404 页面 ------------------------------- */

.not-found { text-align: center; padding: 90px 24px 110px; border-bottom: none; }
.nf-code {
  font-family: var(--mono); font-size: 72px; font-weight: 700;
  color: var(--border-strong); margin: 0 0 8px; line-height: 1;
}
.not-found .page-title { justify-content: center; }
.not-found .page-desc { margin-left: auto; margin-right: auto; }
.nf-actions { display: flex; gap: 10px; justify-content: center; margin-top: 26px; }

/* --------------------------------- 页脚 --------------------------------- */

.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); margin-top: 20px; }
.footer-inner {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr;
  gap: 32px; padding: 44px 24px 30px;
}
.footer-brand { font-size: 14.5px; font-weight: 600; margin: 0 0 8px; }
.footer-note { font-size: 13px; color: var(--text-3); margin: 0; line-height: 1.75; }
.footer-links { display: flex; flex-direction: column; gap: 9px; }
.footer-links a { font-size: 13.5px; color: var(--text-2); }
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 24px 26px; font-size: 12.5px; color: var(--text-3);
  border-top: 1px solid var(--border);
}

/* ------------------------------ 回到顶部 ------------------------------ */

.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 30;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-2);
  font-size: 15px; cursor: pointer; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s, transform .2s;
}
.to-top.show { opacity: 1; visibility: visible; }
.to-top:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* -------------------------------- 响应式 -------------------------------- */

@media (max-width: 1000px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 760px) {
  .wrap, .section, .page-head { padding-left: 18px; padding-right: 18px; }

  .nav-toggle { display: flex; }
  .header-inner { height: 56px; }

  .site-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--bg-elev); border-bottom: 1px solid var(--border);
    padding: 10px 14px 14px; display: none;
    box-shadow: var(--shadow-lift);
  }
  .site-nav.open { display: flex; }
  .site-nav > a { padding: 10px 12px; font-size: 15px; }
  .site-nav .icon-btn { margin: 6px 2px 0; }

  .hero { padding: 48px 0 38px; }
  .section { padding: 38px 18px; }
  .post-grid { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr; }

  .post-layout { padding-top: 30px; padding-bottom: 50px; gap: 30px; }
  .post-body { font-size: 16px; }
  .post-body h2 { font-size: 20px; margin-top: 34px; }
  .post-body h3 { font-size: 17.5px; }
  .post-body .anchor { display: none; }

  .post-nav { grid-template-columns: 1fr; }
  .post-nav-item.next { text-align: left; }

  .footer-inner { grid-template-columns: 1fr; gap: 22px; padding: 32px 18px 20px; }
  .footer-bottom { padding: 14px 18px 22px; }

  .archive-list li { flex-wrap: wrap; gap: 8px; }
  .archive-list a { flex: 1 1 100%; order: 2; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .site-header, .site-footer, .post-actions, .wechat-tip, .toc, .to-top, .post-nav { display: none !important; }
  .post-layout { grid-template-columns: 1fr; padding: 0; }
  body { font-size: 12pt; }
}
