/* ==========================================================================
   shining —— 个人博客主题样式
   布局：左侧固定侧边栏 + 右侧内容区，单栏文章流
   ========================================================================== */

/* ---------- 1. 设计变量（配色主题） ---------- */

:root {
  color-scheme: light;

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  --content-width: 1400px;

  --bg: #ffffff;
  --bg-2: #f4f4f5;
  --bg-3: #e9e9eb;
  --text: #1f2937;
  --text-90: rgba(31, 41, 55, 0.9);
  --text-80: rgba(31, 41, 55, 0.8);
  --text-70: rgba(31, 41, 55, 0.7);
  --text-50: rgba(31, 41, 55, 0.5);
  --text-40: rgba(31, 41, 55, 0.4);
  --line: rgba(31, 41, 55, 0.08);
  --line-strong: rgba(31, 41, 55, 0.16);
  --code-bg: #1e222b;
  --code-text: #e6e9ef;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d232a;
  --bg-2: #252d37;
  --bg-3: #2f3944;
  --text: #b6bec9;
  --text-90: rgba(182, 190, 201, 0.95);
  --text-80: rgba(182, 190, 201, 0.84);
  --text-70: rgba(182, 190, 201, 0.72);
  --text-50: rgba(182, 190, 201, 0.5);
  --text-40: rgba(182, 190, 201, 0.38);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --code-bg: #11151a;
  --code-text: #d7dce5;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.45);
}

[data-theme="cupcake"] {
  color-scheme: light;
  --bg: #faf7f5;
  --bg-2: #f2eae3;
  --bg-3: #e7d9cd;
  --text: #3b2f2f;
  --text-90: rgba(59, 47, 47, 0.92);
  --text-80: rgba(59, 47, 47, 0.82);
  --text-70: rgba(59, 47, 47, 0.7);
  --text-50: rgba(59, 47, 47, 0.5);
  --text-40: rgba(59, 47, 47, 0.38);
  --line: rgba(59, 47, 47, 0.1);
  --line-strong: rgba(59, 47, 47, 0.2);
  --code-bg: #33292a;
  --code-text: #f7efe9;
}

[data-theme="forest"] {
  color-scheme: dark;
  --bg: #141d1a;
  --bg-2: #1b2723;
  --bg-3: #24332d;
  --text: #d5e3da;
  --text-90: rgba(213, 227, 218, 0.94);
  --text-80: rgba(213, 227, 218, 0.84);
  --text-70: rgba(213, 227, 218, 0.72);
  --text-50: rgba(213, 227, 218, 0.5);
  --text-40: rgba(213, 227, 218, 0.38);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --code-bg: #0d1412;
  --code-text: #d9e7de;
}

[data-theme="nord"] {
  color-scheme: light;
  --bg: #f4f6f9;
  --bg-2: #e5e9f0;
  --bg-3: #d5dce8;
  --text: #2e3440;
  --text-90: rgba(46, 52, 64, 0.94);
  --text-80: rgba(46, 52, 64, 0.84);
  --text-70: rgba(46, 52, 64, 0.7);
  --text-50: rgba(46, 52, 64, 0.5);
  --text-40: rgba(46, 52, 64, 0.38);
  --line: rgba(46, 52, 64, 0.1);
  --line-strong: rgba(46, 52, 64, 0.2);
  --code-bg: #2e3440;
  --code-text: #eceff4;
}

[data-theme="business"] {
  color-scheme: dark;
  --bg: #1f2429;
  --bg-2: #272d34;
  --bg-3: #323a42;
  --text: #cfd6de;
  --text-90: rgba(207, 214, 222, 0.94);
  --text-80: rgba(207, 214, 222, 0.84);
  --text-70: rgba(207, 214, 222, 0.72);
  --text-50: rgba(207, 214, 222, 0.5);
  --text-40: rgba(207, 214, 222, 0.38);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --code-bg: #171b1f;
  --code-text: #d6dde5;
}

[data-theme="dracula"] {
  color-scheme: dark;
  --bg: #21222c;
  --bg-2: #2a2c38;
  --bg-3: #343746;
  --text: #e2e4ef;
  --text-90: rgba(226, 228, 239, 0.95);
  --text-80: rgba(226, 228, 239, 0.85);
  --text-70: rgba(226, 228, 239, 0.72);
  --text-50: rgba(226, 228, 239, 0.5);
  --text-40: rgba(226, 228, 239, 0.38);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.2);
  --code-bg: #191a21;
  --code-text: #f8f8f2;
}

[data-theme="retro"] {
  color-scheme: light;
  --bg: #f6f2e4;
  --bg-2: #ece3cd;
  --bg-3: #ded1b3;
  --text: #3e3128;
  --text-90: rgba(62, 49, 40, 0.94);
  --text-80: rgba(62, 49, 40, 0.84);
  --text-70: rgba(62, 49, 40, 0.7);
  --text-50: rgba(62, 49, 40, 0.5);
  --text-40: rgba(62, 49, 40, 0.38);
  --line: rgba(62, 49, 40, 0.1);
  --line-strong: rgba(62, 49, 40, 0.2);
  --code-bg: #3e3128;
  --code-text: #f6f2e4;
}

[data-theme="autumn"] {
  color-scheme: light;
  --bg: #fbf5ec;
  --bg-2: #f4e6d6;
  --bg-3: #ead4bb;
  --text: #3f332b;
  --text-90: rgba(63, 51, 43, 0.94);
  --text-80: rgba(63, 51, 43, 0.84);
  --text-70: rgba(63, 51, 43, 0.7);
  --text-50: rgba(63, 51, 43, 0.5);
  --text-40: rgba(63, 51, 43, 0.38);
  --line: rgba(63, 51, 43, 0.1);
  --line-strong: rgba(63, 51, 43, 0.2);
  --code-bg: #3b2f27;
  --code-text: #fbeee0;
}

[data-theme="valentine"] {
  color-scheme: light;
  --bg: #fdf5f7;
  --bg-2: #f8e6eb;
  --bg-3: #eed3da;
  --text: #4a2f38;
  --text-90: rgba(74, 47, 56, 0.94);
  --text-80: rgba(74, 47, 56, 0.84);
  --text-70: rgba(74, 47, 56, 0.7);
  --text-50: rgba(74, 47, 56, 0.5);
  --text-40: rgba(74, 47, 56, 0.38);
  --line: rgba(74, 47, 56, 0.1);
  --line-strong: rgba(74, 47, 56, 0.2);
  --code-bg: #3d2730;
  --code-text: #fdeef2;
}

[data-theme="synthwave"] {
  color-scheme: dark;
  --bg: #1a1426;
  --bg-2: #241a33;
  --bg-3: #322344;
  --text: #e6dcf5;
  --text-90: rgba(230, 220, 245, 0.95);
  --text-80: rgba(230, 220, 245, 0.85);
  --text-70: rgba(230, 220, 245, 0.72);
  --text-50: rgba(230, 220, 245, 0.5);
  --text-40: rgba(230, 220, 245, 0.38);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.2);
  --code-bg: #130e1c;
  --code-text: #f0e8ff;
}

[data-theme="cyberpunk"] {
  color-scheme: dark;
  --bg: #1b1c22;
  --bg-2: #26282f;
  --bg-3: #34373f;
  --text: #e7eaef;
  --text-90: rgba(231, 234, 239, 0.95);
  --text-80: rgba(231, 234, 239, 0.85);
  --text-70: rgba(231, 234, 239, 0.72);
  --text-50: rgba(231, 234, 239, 0.52);
  --text-40: rgba(231, 234, 239, 0.4);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.22);
  --code-bg: #101116;
  --code-text: #eef1f6;
}

/* ---------- 2. 基础重置 ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--bg-3);
  color: var(--text);
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  display: inline-block;
  vertical-align: -0.15em;
}

/* ---------- 3. 整体骨架 ---------- */

.layout {
  display: flex;
  align-items: stretch;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- 4. 侧边栏 ---------- */

.sidebar {
  width: 25%;
  flex: none;
  z-index: 20;
}

.sidebar-inner {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 4px 40px 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar-inner::-webkit-scrollbar {
  display: none;
}

.sidebar-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -8px 0;
  border-radius: 10px;
  color: var(--text-80);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.tool-btn:hover {
  color: var(--text);
  background: var(--bg-2);
}

.tool-btn .icon {
  width: 24px;
  height: 24px;
}

.avatar-wrap {
  position: relative;
  margin-top: 132px;
  display: inline-block;
  width: fit-content;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-2);
  transition: transform 0.35s ease;
}

.avatar-wrap:hover .avatar {
  transform: rotate(-2deg) scale(1.02);
}

.site-title {
  margin: 32px 0 0;
  font-size: 36px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.site-desc {
  margin: 16px 0 0;
  font-size: 16px;
  font-weight: 300;
  color: var(--text-70);
}

.socials {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}

.socials a {
  display: inline-flex;
  color: var(--text-40);
  transition: color 0.2s ease, transform 0.2s ease;
}

.socials a:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.socials .icon {
  width: 20px;
  height: 20px;
}

/* 菜单 */

.menu {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.menu a,
.menu .menu-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  color: var(--text-70);
  transition: color 0.2s ease;
}

.menu a:hover,
.menu .menu-toggle:hover,
.menu li.open > .menu-toggle,
.menu li.open > a {
  color: var(--text);
}

.menu li {
  position: relative;
}

.menu-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.menu-group-head .chevron {
  width: 16px;
  height: 16px;
  color: var(--text-40);
  transition: transform 0.25s ease;
}

.menu li.open .chevron {
  transform: rotate(90deg);
}

.submenu {
  display: none;
  margin-top: 14px;
  padding-left: 0;
  flex-direction: column;
  gap: 10px;
}

.menu li.open .submenu {
  display: flex;
}

.submenu a {
  font-size: 14px;
  color: var(--text-70);
}

/* ---------- 5. 内容区 ---------- */

.content {
  flex: 1;
  min-width: 0;
  max-width: 992px;
  padding: 32px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 32px;
}

.section-link {
  flex: none;
  font-size: 13px;
  color: var(--text-50);
  transition: color 0.2s ease;
}

.section-link:hover {
  color: var(--text);
}

.section-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  color: var(--text-90);
}

.section-title .icon {
  width: 18px;
  height: 18px;
}

/* 文章列表项 */

.post-item {
  display: flex;
  padding-bottom: 48px;
}

.post-cover {
  position: relative;
  flex: none;
  width: 224px;
  height: 160px;
  margin-right: 32px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-2);
}

.post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.post-item:hover .post-cover img {
  transform: scale(1.04);
}

.post-body {
  flex: 1;
  min-width: 0;
}

.post-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.45;
  font-weight: 800;
  color: var(--text);
  transition: color 0.2s ease;
}

.post-item:hover .post-title {
  color: var(--text);
  opacity: 0.86;
}

.post-abstract {
  margin: 16px 0;
  font-size: 17px;
  font-weight: 300;
  line-height: 1.65;
  color: var(--text-80);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  font-weight: 300;
  color: var(--text-50);
}

.meta-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.meta-group a {
  color: var(--text-50);
  transition: color 0.2s ease;
}

.meta-group a:hover {
  color: var(--text);
}

.meta-group .icon {
  width: 13px;
  height: 13px;
  opacity: 0.9;
}

.meta-cats {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.meta-cats a {
  margin-right: 2px;
}

/* 阅读更多 */

.more-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-bottom: 2px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-90);
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.more-link:hover {
  border-bottom-color: var(--text);
  color: var(--text);
}

.more-link .icon {
  width: 16px;
  height: 16px;
}

/* ---------- 6. 文章页 ---------- */

.post-header {
  margin-bottom: 32px;
}

.post-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.32;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.post-header .post-meta {
  margin-top: 14px;
  font-size: 13px;
}

.post-header .post-meta .date {
  margin-left: auto;
}

.article {
  font-size: 17px;
  line-height: 1.78;
  color: var(--text);
}

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

.article p {
  margin: 0 0 20px;
}

.article h2 {
  margin: 44px 0 18px;
  font-size: 25px;
  line-height: 1.4;
  font-weight: 800;
  scroll-margin-top: 24px;
}

.article h3 {
  margin: 32px 0 14px;
  font-size: 20px;
  line-height: 1.45;
  font-weight: 700;
  scroll-margin-top: 24px;
}

.article a {
  border-bottom: 1px solid var(--text-40);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.article a:hover {
  border-bottom-color: var(--text);
  color: var(--text);
}

.article strong {
  font-weight: 700;
}

.article ul,
.article ol {
  margin: 0 0 20px;
  padding-left: 24px;
}

.article ul {
  list-style: disc;
}

.article ol {
  list-style: decimal;
}

.article li {
  margin-bottom: 8px;
}

.article blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--line-strong);
  color: var(--text-70);
  font-style: italic;
}

.article blockquote p {
  margin: 0;
}

.article table {
  width: 100%;
  margin: 26px 0;
  border-collapse: collapse;
  font-size: 15px;
}

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

.article thead th {
  font-weight: 700;
  color: var(--text-90);
  border-bottom: 1px solid var(--line-strong);
}

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

.article code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-2);
  color: var(--text-90);
}

.article pre {
  position: relative;
  margin: 26px 0;
  padding: 46px 22px 20px;
  border-radius: 12px;
  background: var(--code-bg);
  color: var(--code-text);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.65;
  tab-size: 2;

  /* 语法高亮配色（深浅主题共用一套，底色本来就是深色） */
  --hl-comment: #7b8496;
  --hl-keyword: #c792ea;
  --hl-string: #9ddc7d;
  --hl-number: #e5a06a;
  --hl-function: #6cb6ff;
  --hl-variable: #ef7f88;
  --hl-attr: #e5c07b;
  --hl-builtin: #56b6c2;
  --hl-symbol: #82a3ff;
}

.article pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.article pre .lang {
  position: absolute;
  top: 16px;
  left: 22px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

/* 复制按钮 */

.code-copy {
  position: absolute;
  top: 10px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.code-copy:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.code-copy.copied {
  color: #7ee2a8;
  border-color: rgba(126, 226, 168, 0.45);
}

/* 语法高亮 token */

.hljs-comment,
.hljs-quote {
  color: var(--hl-comment);
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-doctag {
  color: var(--hl-keyword);
}

.hljs-string,
.hljs-regexp,
.hljs-addition {
  color: var(--hl-string);
}

.hljs-number,
.hljs-meta .hljs-number {
  color: var(--hl-number);
}

.hljs-title,
.hljs-title.function_,
.hljs-section {
  color: var(--hl-function);
}

.hljs-variable,
.hljs-template-variable,
.hljs-attr,
.hljs-attribute {
  color: var(--hl-variable);
}

.hljs-built_in,
.hljs-type,
.hljs-class .hljs-title {
  color: var(--hl-builtin);
}

.hljs-symbol,
.hljs-bullet,
.hljs-link {
  color: var(--hl-symbol);
}

.hljs-params,
.hljs-meta,
.hljs-punctuation {
  color: var(--hl-attr);
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: 700;
}

.article img {
  border-radius: 10px;
  margin: 26px 0;
}

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

/* 代码块行号 */

.article pre code {
  display: block;
  counter-reset: line;
  /* 行与行之间的换行符只是分隔用，不能真的换行 */
  white-space: normal;
}

.article pre .line {
  display: block;
  counter-increment: line;
  padding-left: 2.4em;
  position: relative;
  /* 单行内保留缩进和多余空格，但不折行 */
  white-space: pre;
}

.article pre .line::before {
  content: counter(line);
  position: absolute;
  left: 0;
  width: 1.5em;
  text-align: right;
  color: rgba(255, 255, 255, 0.26);
  -webkit-user-select: none;
  user-select: none;
}

/* 文章底部悬浮操作条 */

.post-actions {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-70);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.action-btn:hover {
  background: var(--bg-2);
  color: var(--text);
}

.action-btn .icon {
  width: 16px;
  height: 16px;
}

.action-btn:active {
  transform: scale(0.97);
}

/* 分享后的小提示 */

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 200;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 分类页 */

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 32px;
}

.category-tab {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-70);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.category-tab:hover {
  background: var(--bg-2);
  color: var(--text);
}

.category-tab.active {
  background: var(--text);
  color: var(--bg);
}

/* 未启用脚本时只显示第一个分类，行为和原主题一致 */
.category-panel {
  display: none;
}

.category-panel:first-child {
  display: block;
}

.category-panels.ready .category-panel {
  display: none;
}

.category-panels.ready .category-panel.is-active {
  display: block;
}
/* 独立页面（关于等） */

.page-article {
  padding-top: 4px;
}

/* 文章页目录 */

.toc {
  margin-top: 18px;
}

.toc-title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 400;
  color: var(--text-70);
}

.toc ol {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.toc li {
  position: relative;
  margin-left: -1px;
  border-left: 1px solid transparent;
}

.toc a {
  display: block;
  padding: 4px 0 4px 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-70);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.toc li.depth-3 a {
  padding-left: 26px;
  font-size: 13px;
}

.toc a:hover {
  color: var(--text);
}

.toc li.active > a {
  color: var(--text-90);
  background: var(--bg-2);
  border-radius: 0 6px 6px 0;
}

/* ---------- 7. 配色切换面板 ---------- */

.theme-picker {
  position: relative;
}

.theme-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: -12px;
  width: 236px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 60;
}

.theme-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.theme-panel-title {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-50);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.swatch {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.swatch::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, currentColor);
  opacity: 0.9;
}

.swatch:hover {
  transform: scale(1.12);
}

.swatch.active {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text-40);
}

/* ---------- 8. 顶栏（移动端） ---------- */

.mobile-bar {
  display: none;
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.mobile-bar .avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.mobile-bar .site-name {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.mobile-bar .spacer {
  flex: 1;
}

.mobile-bar .tool-btn {
  width: 36px;
  height: 36px;
}

/* 移动端抽屉菜单 */

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.36);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  width: 78%;
  max-width: 320px;
  padding: 20px 22px;
  background: var(--bg);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.22, 0.7, 0.28, 1);
  overflow-y: auto;
}

body.drawer-open .drawer {
  transform: none;
}

body.drawer-open .drawer-mask {
  opacity: 1;
  visibility: visible;
}

.drawer .menu {
  margin-top: 34px;
}

/* 搜索弹层 */

.search-layer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  justify-content: center;
  padding: 12vh 20px 0;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}

.search-layer.open {
  opacity: 1;
  visibility: visible;
}

.search-box {
  width: 100%;
  max-width: 560px;
  height: fit-content;
  border-radius: 16px;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(-8px);
  transition: transform 0.22s ease;
}

.search-layer.open .search-box {
  transform: none;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.search-field .icon {
  width: 18px;
  height: 18px;
  color: var(--text-40);
}

.search-field input {
  flex: 1;
  border: 0;
  outline: 0;
  background: none;
  font: inherit;
  font-size: 16px;
  color: var(--text);
}

.search-field input::placeholder {
  color: var(--text-40);
}

.search-field kbd {
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  color: var(--text-50);
}

.search-results {
  max-height: 46vh;
  overflow-y: auto;
  padding: 8px;
}

.search-results a {
  display: block;
  padding: 11px 12px;
  border-radius: 9px;
  font-size: 15px;
  color: var(--text-80);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.search-results a:hover {
  background: var(--bg-2);
  color: var(--text);
}

.search-results .empty {
  padding: 22px 12px;
  text-align: center;
  font-size: 14px;
  color: var(--text-50);
}

/* ---------- 9. 页脚 ---------- */

.footer {
  margin-top: 40px;
  padding: 8px 16px 40px;
  background: var(--bg);
}

/* 文章页底部有悬浮操作条，给页脚留出空间，避免文字被压住 */
body.has-actions .footer {
  padding-bottom: 96px;
}

.footer hr {
  margin: 24px auto;
  max-width: var(--content-width);
  border: 0;
  border-top: 1px solid var(--line);
}

.footer-line {
  display: block;
  text-align: center;
  font-size: 14px;
  color: var(--text-70);
  line-height: 2;
}

.footer-line a {
  transition: color 0.2s ease;
}

.footer-line a:hover {
  color: var(--text);
}

/* ---------- 10. 回到顶部 ---------- */

.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.to-top.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  opacity: 0.78;
}

.to-top .icon {
  width: 22px;
  height: 22px;
}

/* ---------- 11. 404 页面 ---------- */

.error-page {
  max-width: 560px;
  margin: 18vh auto 0;
  padding: 0 24px;
  text-align: center;
}

.error-code {
  margin: 0;
  font-size: 88px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  opacity: 0.16;
}

.error-title {
  margin: 8px 0 12px;
  font-size: 26px;
  font-weight: 800;
}

.error-desc {
  margin: 0 0 28px;
  font-size: 16px;
  font-weight: 300;
  color: var(--text-70);
}

.error-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 2px;
  font-size: 15px;
  font-weight: 700;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.error-link:hover {
  border-bottom-color: var(--text);
}

.error-link .icon {
  width: 16px;
  height: 16px;
}

/* ---------- 12. 入场动画 ---------- */

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.fade-in {
  animation: fade-in-up 0.6s cubic-bezier(0.22, 0.7, 0.3, 1) both;
  animation-delay: var(--delay, 0s);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 12. 响应式 ---------- */

@media (max-width: 1279px) {
  .content {
    max-width: none;
    padding: 32px 24px;
  }
}

@media (max-width: 1023px) {
  .mobile-bar {
    display: flex;
  }

  .sidebar {
    display: none;
  }

  .layout {
    display: block;
    padding: 0 16px;
  }

  .content {
    max-width: none;
    padding: 132px 0 24px;
  }

  .section-head {
    margin-bottom: 24px;
  }

  .section-title {
    font-size: 17px;
  }

  .post-item {
    display: block;
    padding-bottom: 36px;
  }

  .post-cover {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    border-radius: 12px;
    margin: 0 0 18px;
  }

  .post-title {
    font-size: 21px;
    line-height: 1.45;
  }

  .post-abstract {
    margin: 12px 0;
    font-size: 17px;
  }

  .post-header h1 {
    font-size: 25px;
  }

  .article {
    font-size: 16px;
  }

  .article h2 {
    font-size: 22px;
  }

  .article h3 {
    font-size: 18px;
  }
}

@media (max-width: 639px) {
  .content {
    padding-top: 122px;
  }

  .mobile-bar {
    padding: 13px 16px;
    gap: 12px;
  }

  .mobile-bar .site-name {
    font-size: 20px;
  }

  .post-title {
    font-size: 20px;
  }

  .post-abstract {
    font-size: 16px;
  }

  .theme-panel {
    left: auto;
    right: -12px;
  }
}
