/* =========================================================
   拾光 · 阅读页样式（文章 / 内容页）
   设计语言与首页同源：
     宣纸暖底 · 墨色衬线 · 赤陶强调 · ✦ 装饰 · 明暗双主题
   首页的全屏导图样式见 style.css，两者互不影响。
   ========================================================= */

/* ---------- 1. 主题变量 ---------- */
:root[data-theme="light"] {
  --bg:            #faf7f2;
  --bg-deep:       #f1e9dc;
  --paper:         #fffdf8;
  --paper-soft:    #fbf6ec;
  --ink:           #1f2937;
  --ink-soft:      #4d5563;
  --ink-faint:     #6d7583;
  --line:          #e7e0d2;
  --line-soft:     #f1eadc;
  --accent:        #c2542d;
  --accent-soft:   rgba(194, 84, 45, .10);
  --gold:          #b8892f;
  --code-bg:       #20242b;
  --code-ink:      #e9e3d6;
  --code-line:     rgba(255, 255, 255, .08);
  --shadow:        0 1px 2px rgba(31, 41, 55, .04), 0 22px 50px -30px rgba(31, 41, 55, .28);
  --shadow-sm:     0 1px 2px rgba(31, 41, 55, .05), 0 8px 20px -14px rgba(31, 41, 55, .22);
  --sel:           rgba(194, 84, 45, .18);
}

:root[data-theme="dark"] {
  --bg:            #0e1217;
  --bg-deep:       #0a0d11;
  --paper:         #151a21;
  --paper-soft:    #12171d;
  --ink:           #eae5dc;
  --ink-soft:      #b3bac4;
  --ink-faint:     #8a929e;
  --line:          #242b34;
  --line-soft:     #1c222a;
  --accent:        #e8956b;
  --accent-soft:   rgba(232, 149, 107, .12);
  --gold:          #d4b06a;
  --code-bg:       #0a0d11;
  --code-ink:      #ddd7ca;
  --code-line:     rgba(255, 255, 255, .07);
  --shadow:        0 1px 2px rgba(0, 0, 0, .4), 0 30px 70px -40px rgba(0, 0, 0, .9);
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, .35), 0 12px 26px -18px rgba(0, 0, 0, .7);
  --sel:           rgba(232, 149, 107, .22);
}

/* ---------- 2. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong', serif;
  font-size: 16px;
  line-height: 1.9;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .45s ease, color .45s ease;
}

/* 纸张噪点 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .30;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] body::before {
  mix-blend-mode: screen;
  opacity: .10;
}

::selection { background: var(--sel); color: var(--ink); }

a { color: inherit; }

/* 极光光斑（首页 aurora 的轻量版） */
.page-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.page-glow i {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: glow-drift 22s ease-in-out infinite alternate;
}
.page-glow i:nth-child(1) {
  width: 48vw; height: 48vw; left: -14vw; top: -16vw;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
}
.page-glow i:nth-child(2) {
  width: 40vw; height: 40vw; right: -12vw; top: 26vh;
  background: radial-gradient(circle, rgba(91, 122, 157, .16), transparent 68%);
  animation-delay: -7s;
}
.page-glow i:nth-child(3) {
  width: 32vw; height: 32vw; left: 34vw; bottom: -14vw;
  background: radial-gradient(circle, rgba(184, 137, 47, .14), transparent 68%);
  animation-delay: -13s;
}
@keyframes glow-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(3vw, 4vh, 0) scale(1.08); }
}

/* 跳到正文（无障碍） */
.skip-link {
  position: fixed;
  top: -60px; left: 16px;
  z-index: 300;
  padding: 10px 18px;
  border-radius: 0 0 10px 10px;
  background: var(--accent);
  color: #fff;
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 13px;
  text-decoration: none;
  transition: top .2s ease;
}
.skip-link:focus { top: 0; }

/* ---------- 3. 阅读进度 ---------- */
.read-progress {
  --p: 0%;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1200;
  height: 2px;
  pointer-events: none;
}
.read-progress i {
  display: block;
  width: var(--p);
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: width .12s linear;
}

/* ---------- 4. 顶栏 ---------- */
.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: linear-gradient(to bottom, var(--bg) 46%, transparent);
  transition: background .35s ease, box-shadow .35s ease;
}
.site-head.is-scrolled {
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  box-shadow: 0 1px 0 var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: #fff;
  font-family: 'Noto Serif SC', serif;
  font-weight: 900;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .35s cubic-bezier(.2, 1.2, .4, 1);
}
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.06); }
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-text b {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .12em;
  color: var(--ink);
}
.brand-text small {
  font-family: Inter, sans-serif;
  font-size: 8.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 3px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.btn-map {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  color: var(--ink-soft);
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 12.5px;
  text-decoration: none;
  transition: color .25s ease, border-color .25s ease, transform .25s ease, background .25s ease;
}
.btn-map svg { width: 14px; height: 14px; }
.btn-map:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  transform: translateX(-2px);
}

.icon-btn {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color .25s ease, border-color .25s ease, transform .25s ease, background .25s ease;
}
.icon-btn:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  transform: rotate(18deg);
}

/* ---------- 5. 版心 ---------- */
.reading {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(92px, 13vh, 132px) clamp(16px, 4vw, 24px) 56px;
}

/* ---------- 6. 文章头 ---------- */
.article-head {
  text-align: center;
  animation: rise .8s cubic-bezier(.2, .8, .2, 1) both;
}

.article-cats {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.cat-chip {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-decoration: none;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}
.cat-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -14px var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--paper));
}

.article-title {
  margin: 0 0 18px;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-weight: 900;
  font-size: clamp(1.75rem, 5vw, 2.7rem);
  line-height: 1.36;
  letter-spacing: .012em;
  text-wrap: balance;
}

.article-lede {
  max-width: 620px;
  margin: 0 auto 20px;
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.9;
  text-wrap: pretty;
}

.article-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.article-meta .dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
}
.article-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.article-meta svg { width: 13px; height: 13px; opacity: .8; }

.article-orn {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 30px 0 4px;
  color: var(--gold);
}
.article-orn::before,
.article-orn::after {
  content: '';
  flex: 1;
  height: 1px;
}
.article-orn::before { background: linear-gradient(90deg, transparent, var(--line)); }
.article-orn::after  { background: linear-gradient(90deg, var(--line), transparent); }
.article-orn b {
  font-size: 12px;
  font-style: normal;
  color: var(--accent);
  animation: twinkle 4.5s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: .55; transform: scale(.94); }
  50%      { opacity: 1;   transform: scale(1.06); }
}

/* ---------- 7. 文章卡片 ---------- */
.article-card {
  position: relative;
  margin-top: 30px;
  padding: clamp(24px, 4.6vw, 54px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: var(--shadow);
  animation: rise .8s cubic-bezier(.2, .8, .2, 1) .08s both;
}
.article-card::before {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--gold), transparent);
  opacity: .55;
}
/* 右侧竖排落款 */
@media (min-width: 1200px) {
  .article-card::after {
    content: '拾光 · 读';
    position: absolute;
    top: 40px; right: 15px;
    writing-mode: vertical-rl;
    font-family: 'Noto Serif SC', serif;
    font-size: 10px;
    letter-spacing: .5em;
    color: var(--ink-faint);
    opacity: .45;
    pointer-events: none;
  }
}

/* ---------- 8. 正文排版 ---------- */
.post-body {
  color: var(--ink-soft);
  font-size: clamp(16px, 1.08vw, 17.2px);
  line-height: 2.05;
  letter-spacing: .012em;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.post-body > *:first-child { margin-top: 0; }
.post-body > *:last-child  { margin-bottom: 0; }

.post-body p {
  margin: 0 0 1.25em;
  text-wrap: pretty;
}

/* 首字下沉 */
.post-body > p:first-of-type::first-letter {
  float: left;
  margin: .06em .12em 0 0;
  padding: 0;
  font-family: 'Noto Serif SC', serif;
  font-size: 3em;
  font-weight: 900;
  line-height: .92;
  color: var(--accent);
}
/* 首段正好是图片 / 代码时不下沉 */
.post-body > p:first-of-type:has(> img:only-child)::first-letter { all: unset; }

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5 {
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-weight: 900;
  line-height: 1.5;
  letter-spacing: .012em;
  scroll-margin-top: 96px;
}

.post-body h1,
.post-body h2 {
  position: relative;
  margin: 2.15em 0 .9em;
  padding-left: 18px;
  font-size: 1.46em;
}
.post-body h1 { font-size: 1.55em; }
.post-body h1::before,
.post-body h2::before {
  content: '';
  position: absolute;
  left: 0; top: .22em; bottom: .22em;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--gold));
}

.post-body h3 {
  position: relative;
  margin: 1.9em 0 .7em;
  padding-left: 20px;
  font-size: 1.2em;
}
.post-body h3::before {
  content: '◆';
  position: absolute;
  left: 1px; top: .34em;
  font-size: .5em;
  color: var(--gold);
}

.post-body h4 { margin: 1.7em 0 .6em; font-size: 1.05em; }
.post-body h5 { margin: 1.5em 0 .5em; font-size: .98em; color: var(--ink-soft); }

.post-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--accent) 42%, transparent);
  transition: color .22s ease, border-color .22s ease;
}
.post-body a:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.post-body strong, .post-body b { color: var(--ink); font-weight: 700; }
.post-body em { color: var(--ink); }

.post-body mark {
  color: var(--ink);
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%);
  padding: 0 2px;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.3em;
  padding-left: 1.55em;
}
.post-body li { margin: .38em 0; }
.post-body li::marker { color: var(--accent); }
.post-body li > ul,
.post-body li > ol { margin: .35em 0 .3em; }

/* 引用 */
.post-body blockquote {
  position: relative;
  margin: 1.7em 0;
  padding: 18px 22px 18px 48px;
  border-left: 3px solid var(--accent);
  border-radius: 0 14px 14px 0;
  background: var(--accent-soft);
  color: var(--ink);
}
.post-body blockquote::before {
  content: '「';
  position: absolute;
  left: 15px; top: 8px;
  font-family: 'Noto Serif SC', serif;
  font-size: 1.5em;
  font-weight: 900;
  color: var(--accent);
  opacity: .7;
}
.post-body blockquote p { margin-bottom: .6em; }
.post-body blockquote p:last-child { margin-bottom: 0; }

/* 行内代码 */
.post-body code {
  padding: .12em .42em;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .87em;
  word-break: break-word;
}

/* 代码块（未包装时的兜底） */
.post-body > pre,
.post-body pre {
  margin: 1.7em 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 13.5px;
  line-height: 1.75;
  tab-size: 4;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.post-body pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
}

/* 代码块（JS 增强后） */
.code-block {
  margin: 1.7em 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: var(--shadow-sm);
}
.code-block pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--code-line);
  background: rgba(255, 255, 255, .045);
  font-family: Inter, 'Noto Sans SC', sans-serif;
}
.code-lang {
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(233, 227, 214, .55);
}
.code-copy {
  appearance: none;
  padding: 3px 11px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: transparent;
  color: rgba(233, 227, 214, .72);
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 11px;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.code-copy:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .08);
}
.code-copy.is-done {
  color: #9ed3a6;
  border-color: rgba(158, 211, 166, .5);
}

/* 图片 */
.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.7em auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
  transition: transform .35s ease, box-shadow .35s ease;
}
.post-body img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.post-body figure { margin: 1.7em 0; }
.post-body figure img { margin: 0 auto; }
.post-body figcaption {
  margin-top: 10px;
  text-align: center;
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 12px;
  color: var(--ink-faint);
}

/* 表格 */
.table-wrap {
  margin: 1.7em 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
  background: var(--paper-soft);
}
.post-body table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: .88em;
  line-height: 1.7;
}
.post-body th,
.post-body td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.post-body th {
  color: var(--ink);
  font-weight: 600;
  background: var(--accent-soft);
  border-bottom-color: var(--line);
  white-space: nowrap;
}
.post-body tr:last-child td { border-bottom: 0; }
.post-body tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }

/* 分隔线 → ✦ */
.post-body hr {
  display: flex;
  align-items: center;
  gap: 14px;
  height: auto;
  margin: 2.4em 0;
  border: 0;
  background: none;
}
.post-body hr::before {
  content: '✦';
  font-size: 11px;
  color: var(--gold);
  line-height: 1;
}
.post-body hr::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* WordPress 遗留元素 */
.post-body font { font: inherit; color: inherit; }
.post-body .wp-caption { max-width: 100%; }
.post-body .wp-caption-text {
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
}

/* ---------- 9. 文末标签 ---------- */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 38px;
  padding-top: 26px;
  border-top: 1px dashed var(--line);
}
.tags-label {
  margin-right: 2px;
  font-family: 'Noto Serif SC', serif;
  font-size: 12.5px;
  letter-spacing: .1em;
  color: var(--ink-faint);
}
.tag-chip {
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 12px;
  text-decoration: none;
  transition: all .25s ease;
}
.tag-chip:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

/* ---------- 10. 上下篇 ---------- */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 34px;
  animation: rise .8s cubic-bezier(.2, .8, .2, 1) .16s both;
}
.pager-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 66%, transparent);
  text-decoration: none;
  transition: transform .3s ease, border-color .3s ease, background .3s ease, box-shadow .3s ease;
}
.pager-item.next { text-align: right; align-items: flex-end; }
.pager-item:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.pager-item.is-empty {
  border-color: transparent;
  background: transparent;
  pointer-events: none;
}
.pager-k {
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ink-faint);
}
.pager-t {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--ink);
  font-family: 'Noto Serif SC', serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
}

/* ---------- 11. 文末 ---------- */
.article-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}
.foot-note {
  font-family: 'Noto Serif SC', serif;
  font-size: 12px;
  letter-spacing: .18em;
  color: var(--ink-faint);
}
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 66%, transparent);
  color: var(--ink-soft);
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 12.5px;
  text-decoration: none;
  transition: all .25s ease;
}
.btn-back:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  background: var(--accent-soft);
  transform: translateX(-3px);
}

/* ---------- 12. 目录（侧栏） ---------- */
.toc {
  position: fixed;
  top: 118px;
  right: max(24px, calc((100vw - 1320px) / 2));
  z-index: 40;
  width: 220px;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-right: 4px;
}
.toc[hidden] { display: none; }

.toc-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .24em;
  color: var(--ink-faint);
}
.toc-title span { color: var(--gold); font-size: 10px; }

.toc-list {
  margin: 0;
  padding: 0 0 0 0;
  list-style: none;
  border-left: 1px solid var(--line);
}
.toc-item a {
  display: block;
  margin-left: -1px;
  padding: 6px 0 6px 15px;
  border-left: 1px solid transparent;
  color: var(--ink-soft);
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 12.5px;
  line-height: 1.55;
  text-decoration: none;
  transition: color .2s ease, border-color .2s ease;
}
.toc-item a:hover { color: var(--ink); }
.toc-item a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.toc-item.depth-1 a,
.toc-item.depth-2 a { padding-left: 15px; }
.toc-item.depth-3 a { padding-left: 29px; font-size: 12px; }
.toc-item.depth-3 a.is-active { border-left-color: color-mix(in srgb, var(--accent) 55%, transparent); }

/* 窄屏目录（折叠） */
.toc-mobile {
  display: none;
  margin: 24px 0 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-soft);
  animation: rise .8s cubic-bezier(.2, .8, .2, 1) .1s both;
}
.toc-mobile[hidden] { display: none; }
.toc-mobile summary {
  padding: 11px 16px;
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--ink-faint);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::before { content: '✦'; color: var(--gold); font-size: 10px; }
.toc-mobile summary::after {
  content: '＋';
  margin-left: auto;
  color: var(--ink-faint);
  transition: transform .25s ease;
}
.toc-mobile[open] summary::after { transform: rotate(45deg); }
.toc-mobile .toc-list {
  margin: 0 16px 12px;
  border-left-color: var(--line);
}
.toc-mobile .toc-item a { font-size: 12.5px; }

@media (max-width: 1339px) {
  .toc { display: none; }
  .toc-mobile { display: block; }
}

/* ---------- 13. 灯箱 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  padding: 4vh 4vw;
  background: rgba(10, 9, 7, .88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: zoom-out;
  animation: fade .25s ease both;
}
.lightbox[hidden] { display: none; }
.lightbox figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 0;
}
.lightbox img {
  max-width: 94vw;
  max-height: 84vh;
  border-radius: 10px;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .9);
  cursor: default;
}
.lightbox figcaption {
  margin: 0;
  max-width: 80vw;
  text-align: center;
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 12px;
  color: rgba(255, 255, 255, .62);
}
.lightbox figcaption:empty { display: none; }
.lb-close {
  position: absolute;
  top: 18px; right: 20px;
  width: 38px; height: 38px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, .8);
  font-size: 15px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.lb-close:hover { background: rgba(255, 255, 255, .12); color: #fff; }

body.no-scroll,
html.no-scroll { overflow: hidden; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 14. 页脚 ---------- */
.site-foot {
  position: relative;
  z-index: 1;
  padding: 26px 20px 46px;
  text-align: center;
  font-family: Inter, 'Noto Sans SC', sans-serif;
  font-size: 11.5px;
  letter-spacing: .08em;
  color: var(--ink-faint);
}
.site-foot p { margin: 0; }
.site-foot .dot {
  display: inline-block;
  width: 3px; height: 3px;
  margin: 0 10px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
  opacity: .5;
}

/* ---------- 15. 焦点 / 动效偏好 / 打印 ---------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

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

/* ---------- 16. 响应式 ---------- */
@media (max-width: 640px) {
  .reading { padding-bottom: 40px; }
  .article-card { border-radius: 20px; padding: 22px 18px; }
  .article-title { font-size: clamp(1.6rem, 7.4vw, 2rem); }
  .post-body { line-height: 1.98; }
  .post-body > p:first-of-type::first-letter { font-size: 2.5em; }
  .article-card::before { left: 6%; right: 6%; }
  .pager { grid-template-columns: 1fr; }
  .pager-item.next { text-align: left; align-items: flex-start; }
  .pager-item.is-empty { display: none; }
  .article-foot { flex-direction: column-reverse; align-items: flex-start; }
  .brand-text small { display: none; }
  .btn-map span { display: none; }
  .btn-map { padding: 0 11px; }
  .toc-mobile { margin-top: 18px; }
}

@media (max-width: 380px) {
  .article-meta { font-size: 11.5px; gap: 4px 9px; }
  .article-card { padding: 18px 15px; }
}

@media print {
  .site-head, .toc, .toc-mobile, .read-progress, .pager,
  .article-foot, .site-foot, .page-glow, .lightbox, .code-copy { display: none !important; }
  body { background: #fff; color: #111; }
  body::before { display: none; }
  .reading { max-width: none; padding: 0; }
  .article-card { border: 0; box-shadow: none; padding: 0; }
  .post-body pre { border: 1px solid #ddd; box-shadow: none; }
  .post-body a { color: inherit; border-bottom: 0; }
}
