/* ============================================================
   1. 设计变量 —— 清新活泼版
   薄荷绿 × 天空蓝 为主，珊瑚 / 蜜柚黄 / 雾紫 作点缀
============================================================ */
:root {
  /* 品牌色 */
  --brand: #0d9488;          /* 青绿：链接与交互主色 */
  --brand-2: #0284c7;        /* 天空蓝：次级交互色 */
  --brand-light: #2dd4bf;    /* 亮薄荷：深色背景下的高亮 */
  --brand-deep: #0f766e;     /* 深青绿 */
  /* 柔和渐变（装饰用，浅色底上点缀） */
  --brand-gradient: linear-gradient(135deg, #2dd4bf 0%, #38bdf8 100%);
  /* 饱和渐变（配白字的场合：按钮 / 表头 / 进度条） */
  --brand-gradient-strong: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
  --accent-coral: #ff8a7a;
  --accent-gold: #ffb703;
  --accent-lilac: #b8a5ff;

  /* 浅色模式语义色 */
  --bg-body: #f6fbf9;        /* 带一丝薄荷的空气感底色 */
  --bg-card: #ffffff;
  --bg-soft: #ecf9f4;        /* 薄荷浅底 */
  --text-main: #29404a;      /* 青灰主文字 */
  --text-muted: #7b929c;
  --border-soft: #dcedee;
  --inline-code-bg: #e8f7f3;

  /* 阴影与圆角 */
  --shadow-sm: 0 2px 10px rgba(13, 148, 136, 0.08);
  --shadow-md: 0 10px 30px rgba(2, 132, 199, 0.16);
  --radius: 14px;

  /* 代码块（两种模式下均为深色） */
  --code-bg: #282c34;
  --code-header-bg: #21252b;
  --code-text: #abb2bf;

  /* 字体栈：正文衬线 + 标题霞鹜文楷 + 代码 JetBrains Mono */
  --body-font: 'Lora', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  --header-font: 'LXGW WenKai', 'Open Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --mono-font: 'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace;
}

/* 暗色模式：青色调暗夜，烟花背景继续保留 */
html[data-theme="dark"] {
  color-scheme: dark;
  --page-col: #0f1619;
  --text-col: #c6d4d6;
  --link-col: #2dd4bf;
  --hover-col: #7dd3fc;
  --footer-col: #0b1113;
  --footer-text-col: #71878c;
  --footer-link-col: #c6d4d6;
  --footer-hover-col: #5eead4;
  --mid-col: #71878c;

  --bg-body: #0f1619;
  --bg-card: #182125;
  --bg-soft: #1e2b2e;
  --text-main: #e0ebe9;
  --text-muted: #7f959a;
  --border-soft: #2a3a3f;
  --inline-code-bg: #1c2b2a;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   2. 中文排版
============================================================ */
body {
  background-color: var(--bg-body);
  font-size: 1.0625rem;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

p {
  line-height: 1.85;
  margin: 1.5rem 0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
}

/* 锚点偏移：避免跳转后标题被固定导航栏遮挡 */
html {
  scroll-padding-top: 96px;
}
.blog-post h2, .blog-post h3, .blog-post h4 {
  scroll-margin-top: 96px;
}

/* 首页 Hero 标题 */
.intro-header.big-img .page-heading h1,
.intro-header.big-img .post-heading h1 {
  letter-spacing: 3px;
  text-shadow: 0 2px 12px rgba(15, 60, 80, 0.45);
}

.intro-header.big-img .page-subheading,
.intro-header.big-img .post-subheading {
  letter-spacing: 1.5px;
  text-shadow: 0 1px 8px rgba(15, 60, 80, 0.4);
}

/* 暗色模式下文章页头在烟花背景上使用亮色文字 */
html[data-theme="dark"] .post-heading h1,
html[data-theme="dark"] .post-heading .post-subheading,
html[data-theme="dark"] .post-heading .post-meta,
html[data-theme="dark"] .post-heading,
html[data-theme="dark"] .post-heading strong {
  color: #f2fbfa !important;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

/* 浅色模式隐藏烟花画布，保持页面干净清新 */
html:not([data-theme="dark"]) #fireworks-bg {
  display: none;
}

/* 浅色模式给文章页加一点若隐若现的薄荷波点 */
html:not([data-theme="dark"]) body:has(main.post-layout-container) {
  background-image: radial-gradient(rgba(13, 148, 136, 0.07) 1.5px, transparent 1.5px);
  background-size: 26px 26px;
}

/* 选中文本配色 */
::selection {
  background: rgba(45, 212, 191, 0.3);
}

/* 全局滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(13, 148, 136, 0.35);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(13, 148, 136, 0.6);
}

/* ============================================================
   3. 导航栏 —— 毛玻璃效果，轻盈通透
============================================================ */
.navbar-custom {
  background: rgba(255, 255, 255, 0.82) !important;
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
  box-shadow: 0 2px 18px rgba(13, 148, 136, 0.12);
}

html[data-theme="dark"] .navbar-custom {
  background: rgba(15, 22, 25, 0.82) !important;
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}

/* 品牌名做薄荷→天空渐变字 */
.navbar-custom .navbar-brand {
  color: transparent !important;
  background: var(--brand-gradient-strong);
  -webkit-background-clip: text;
  background-clip: text;
  font-family: var(--header-font);
  font-weight: 700;
  transition: opacity 0.3s ease;
}

.navbar-custom .navbar-brand:hover {
  opacity: 0.8;
}

.navbar-custom .navbar-nav .nav-link {
  color: var(--text-main) !important;
  position: relative;
  transition: color 0.25s ease;
}

/* 导航链接底部小色条，hover 弹出 */
.navbar-custom .navbar-nav .nav-link::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 3px;
  border-radius: 3px;
  background: var(--brand-gradient);
  transform: translateX(-50%);
  transition: width 0.25s ease;
}

.navbar-custom .navbar-nav .nav-link:hover,
.navbar-custom .navbar-nav .nav-link:focus {
  color: var(--brand) !important;
}

html[data-theme="dark"] .navbar-custom .navbar-nav .nav-link:hover,
html[data-theme="dark"] .navbar-custom .navbar-nav .nav-link:focus {
  color: var(--brand-light) !important;
}

.navbar-custom .navbar-nav .nav-link:hover::after,
.navbar-custom .navbar-nav .nav-link:focus::after {
  width: 60%;
}

.navbar-custom .navbar-nav .nav-item {
  letter-spacing: 1px;
}

/* 汉堡按钮在深色毛玻璃下保持可见 */
html[data-theme="dark"] .navbar-custom .navbar-toggler {
  border-color: var(--border-soft);
}
html[data-theme="dark"] .navbar-custom .navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(198,212,214, 0.8)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* 主题切换按钮 */
#theme-toggle {
  cursor: pointer;
  font-size: 1.05rem;
}

/* 下拉菜单 */
.navbar-custom .dropdown-menu {
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

html[data-theme="dark"] .dropdown-menu {
  background-color: var(--bg-card);
  border-color: var(--border-soft);
}
html[data-theme="dark"] .dropdown-item {
  color: var(--text-main);
}
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
  background-color: var(--bg-soft);
  color: var(--link-col);
}

/* 导航头像：白色光环 + 薄荷投影 */
.navbar-custom .avatar-container .avatar-img-border {
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95), 0 4px 14px rgba(13, 148, 136, 0.35) !important;
}

/* ============================================================
   4. 首页文章卡片
============================================================ */
.posts-list {
  max-width: 900px;
  margin: 0 auto;
}

.post-preview {
  border: 2px solid transparent !important;
  background:
    linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
    linear-gradient(135deg, var(--border-soft), var(--border-soft)) border-box;
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  margin: 0 0 1.5rem 0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease, transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* hover：渐变描边 + 上浮 + 顶部渐变光带 */
.post-preview:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  background:
    linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
    var(--brand-gradient) border-box;
}

.post-preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.post-preview:hover::before {
  opacity: 1;
}

.post-preview .post-title {
  color: var(--text-main);
  font-weight: 700;
  transition: color 0.25s ease;
}

.post-preview a {
  color: var(--text-main);
}

.post-preview a:hover .post-title {
  color: var(--brand);
}

.post-preview .post-subtitle {
  color: var(--text-muted);
}

.post-preview .post-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* 日期 / 时长小图标与文字留出间距 */
.post-meta i {
  margin-right: 5px;
}

.post-preview .post-meta i {
  color: var(--brand);
}

/* 分类徽章（首页卡片顶部彩色小胶囊） */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--header-font);
  margin-bottom: 0.6rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cat-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 10px rgba(13, 148, 136, 0.25);
}

/* 徽章轮换的六种马卡龙配色（组合选择器提高优先级） */
.cat-badge.cat-c0 { background: #dcf7f0; color: #0f766e; }
.cat-badge.cat-c1 { background: #e3f2fd; color: #0369a1; }
.cat-badge.cat-c2 { background: #ffefe9; color: #c2410c; }
.cat-badge.cat-c3 { background: #fff4d6; color: #a16207; }
.cat-badge.cat-c4 { background: #f0eaff; color: #6d5bd0; }
.cat-badge.cat-c5 { background: #fdeaf5; color: #be185d; }

html[data-theme="dark"] .cat-badge.cat-c0 { background: rgba(45, 212, 191, 0.16); color: #5eead4; }
html[data-theme="dark"] .cat-badge.cat-c1 { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
html[data-theme="dark"] .cat-badge.cat-c2 { background: rgba(255, 138, 122, 0.16); color: #fda293; }
html[data-theme="dark"] .cat-badge.cat-c3 { background: rgba(255, 183, 3, 0.16); color: #fcd34d; }
html[data-theme="dark"] .cat-badge.cat-c4 { background: rgba(184, 165, 255, 0.16); color: #c4b5fd; }
html[data-theme="dark"] .cat-badge.cat-c5 { background: rgba(244, 114, 182, 0.16); color: #f9a8d4; }

.post-preview .post-image img {
  border-radius: 10px;
}

.post-read-more {
  color: var(--brand) !important;
  font-weight: 600;
  white-space: nowrap;
}

.post-read-more:hover {
  color: var(--brand-2) !important;
}

/* 标签胶囊：六色马卡龙轮换（兼容首页 li>a 与文章页直接 a 两种结构） */
.blog-tags a {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 13px;
  font-size: 0.85rem;
  margin: 2px 2px;
  background: var(--bg-soft);
  color: var(--text-main);
  transition: transform 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
}

.blog-tags li:nth-child(6n+1) > a, .blog-tags > a:nth-child(6n+1) { background: #dcf7f0; color: #0f766e; }
.blog-tags li:nth-child(6n+2) > a, .blog-tags > a:nth-child(6n+2) { background: #e3f2fd; color: #0369a1; }
.blog-tags li:nth-child(6n+3) > a, .blog-tags > a:nth-child(6n+3) { background: #ffefe9; color: #c2410c; }
.blog-tags li:nth-child(6n+4) > a, .blog-tags > a:nth-child(6n+4) { background: #fff4d6; color: #a16207; }
.blog-tags li:nth-child(6n+5) > a, .blog-tags > a:nth-child(6n+5) { background: #f0eaff; color: #6d5bd0; }
.blog-tags li:nth-child(6n+6) > a, .blog-tags > a:nth-child(6n+6) { background: #fdeaf5; color: #be185d; }

html[data-theme="dark"] .blog-tags li:nth-child(6n+1) > a, html[data-theme="dark"] .blog-tags > a:nth-child(6n+1) { background: rgba(45, 212, 191, 0.16); color: #5eead4; }
html[data-theme="dark"] .blog-tags li:nth-child(6n+2) > a, html[data-theme="dark"] .blog-tags > a:nth-child(6n+2) { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
html[data-theme="dark"] .blog-tags li:nth-child(6n+3) > a, html[data-theme="dark"] .blog-tags > a:nth-child(6n+3) { background: rgba(255, 138, 122, 0.16); color: #fda293; }
html[data-theme="dark"] .blog-tags li:nth-child(6n+4) > a, html[data-theme="dark"] .blog-tags > a:nth-child(6n+4) { background: rgba(255, 183, 3, 0.16); color: #fcd34d; }
html[data-theme="dark"] .blog-tags li:nth-child(6n+5) > a, html[data-theme="dark"] .blog-tags > a:nth-child(6n+5) { background: rgba(184, 165, 255, 0.16); color: #c4b5fd; }
html[data-theme="dark"] .blog-tags li:nth-child(6n+6) > a, html[data-theme="dark"] .blog-tags > a:nth-child(6n+6) { background: rgba(244, 114, 182, 0.16); color: #f9a8d4; }

.blog-tags a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.2);
}

/* 分页按钮：圆润胶囊 */
.pagination.main-pager .page-link,
.pagination.blog-pager .page-link {
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--brand);
  margin: 0 5px;
  padding: 0.45rem 1.2rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.pagination.main-pager .page-link:hover,
.pagination.blog-pager .page-link:hover {
  background: var(--brand-gradient-strong);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.35);
}

.pagination.main-pager i,
.pagination.blog-pager i {
  color: inherit;
}

/* ============================================================
   5. 代码块（深色 + Mac 窗口栏 + 复制按钮）
============================================================ */
div.highlighter-rouge,
div.highlight {
  border-radius: 12px;
}

div.highlighter-rouge {
  background: var(--code-bg);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

div.highlighter-rouge div.highlight {
  background: var(--code-bg);
}

.highlighter-rouge pre.highlight,
div.highlighter-rouge pre {
  background: var(--code-bg) !important;
  color: var(--code-text);
  margin: 0;
  padding: 1rem 1.25rem;
  font-family: var(--mono-font);
  font-size: 0.875rem;
  line-height: 1.7;
  overflow-x: auto;
  border: none;
}

/* JS 注入的 Mac 风格标题栏 */
.code-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--code-header-bg);
  padding: 8px 14px;
  user-select: none;
}

.code-header .code-dots {
  display: inline-flex;
  gap: 6px;
}

.code-header .code-dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.code-header .code-dots i:nth-child(1) { background: #ff5f56; }
.code-header .code-dots i:nth-child(2) { background: #ffbd2e; }
.code-header .code-dots i:nth-child(3) { background: #27c93f; }

.code-header .code-lang {
  margin-left: 6px;
  font-family: var(--mono-font);
  font-size: 0.75rem;
  color: #7f848e;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.code-header .copy-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid #3a3f4b;
  border-radius: 6px;
  color: #9ea3ad;
  font-size: 0.75rem;
  padding: 2px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--mono-font);
}

.code-header .copy-btn:hover {
  color: #fff;
  border-color: #2dd4bf;
  background: rgba(45, 212, 191, 0.15);
}

.code-header .copy-btn.copied {
  color: #27c93f;
  border-color: #27c93f;
}

/* 代码块滚动条 */
.highlighter-rouge pre::-webkit-scrollbar {
  height: 6px;
}
.highlighter-rouge pre::-webkit-scrollbar-thumb {
  background: #3a3f4b;
}

/* Rouge 深色高亮（One Dark 系配色，覆盖 pygment_highlights.css） */
.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs { color: #7f848e; font-style: italic; }
.highlight .cp { color: #7f848e; font-weight: normal; }
.highlight .k, .highlight .kc, .highlight .kd, .highlight .kp, .highlight .kr { color: #c678dd; font-weight: normal; }
.highlight .kt { color: #e5c07b; font-weight: normal; }
.highlight .o, .highlight .ow { color: #56b6c2; font-weight: normal; }
.highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2,
.highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .s1 { color: #98c379; }
.highlight .sr { color: #56b6c2; }
.highlight .ss { color: #e5c07b; }
.highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .mo, .highlight .il { color: #d19a66; }
.highlight .na { color: #d19a66; }
.highlight .nb { color: #56b6c2; }
.highlight .nc { color: #e5c07b; font-weight: normal; }
.highlight .no { color: #d19a66; }
.highlight .ni { color: #c678dd; }
.highlight .ne, .highlight .nf { color: #61afef; font-weight: normal; }
.highlight .nn { color: #e5c07b; }
.highlight .nt { color: #e06c75; }
.highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi { color: #e06c75; }
.highlight .bp { color: #56b6c2; }
.highlight .err { color: #e06c75; background: transparent; }
.highlight .gd { color: #e06c75; background: rgba(224, 108, 117, 0.12); }
.highlight .gd .x { color: #e06c75; background: rgba(224, 108, 117, 0.2); }
.highlight .gi { color: #98c379; background: rgba(152, 195, 121, 0.12); }
.highlight .gi .x { color: #98c379; background: rgba(152, 195, 121, 0.2); }
.highlight .ge { font-style: italic; }
.highlight .gs { font-weight: bold; }
.highlight .gh, .highlight .gu { color: #61afef; }
.highlight .go, .highlight .gp { color: #7f848e; }
.highlight .gr, .highlight .gt { color: #e06c75; }
.highlight .w { color: transparent; }

/* 行内代码 */
:not(pre) > code {
  background: var(--inline-code-bg);
  color: var(--brand-deep);
  border-radius: 6px;
  padding: 2px 8px;
  font-family: var(--mono-font);
  font-size: 0.88em;
}

html[data-theme="dark"] :not(pre) > code {
  color: #5eead4;
}

/* ============================================================
   6. 内容组件：表格 / 引用 / 键盘 / 图片 / 分隔线
============================================================ */
main table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
}

main table thead th {
  background: var(--brand-gradient-strong);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

main table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-col);
}

main table tbody tr:nth-child(even) td {
  background: var(--bg-soft);
}

main table tbody tr:hover td {
  background: rgba(45, 212, 191, 0.12);
}

blockquote {
  border-left: 4px solid var(--brand-light);
  background: var(--bg-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: normal;
  font-family: var(--header-font);
}

blockquote p:last-child {
  margin-bottom: 0;
}

kbd {
  background: var(--text-main);
  color: var(--bg-card);
  border-radius: 5px;
  padding: 2px 8px;
  font-family: var(--mono-font);
  font-size: 0.82em;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

/* 正文图片 */
main .blog-post img,
.post-main-col article img {
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

main .blog-post img:hover,
.post-main-col article img:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-md);
}

html[data-theme="dark"] main img {
  filter: brightness(0.92);
}

/* 分隔线：中间一颗小薄荷圆点 */
hr {
  border: none;
  height: 1px;
  background: var(--border-soft);
  margin: 2.5rem auto;
  max-width: 60%;
  position: relative;
}

hr::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-gradient-strong);
}

/* 文章内标题层次：小标题前的小色块 */
.post-main-col .blog-post h2,
.post-main-col article h2 {
  margin-top: 2.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-soft);
}

.post-main-col .blog-post h3,
.post-main-col article h3 {
  margin-top: 2rem;
}

.post-main-col .blog-post h3::before,
.post-main-col article h3::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 3px;
  background: var(--brand-gradient);
}

/* ============================================================
   7. 文章页三栏布局
============================================================ */
body > main.post-layout-container {
  width: 100%;
  flex: 1;
  box-sizing: border-box;
}

.post-layout-container {
  width: 100%;
  padding: 2rem 3%;
  box-sizing: border-box;
}

.post-layout-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: flex-start;
  align-items: flex-start;
  max-width: 1600px;
  margin: 0 auto;
  gap: 0;
}

/* 左侧边栏 - 文章目录 */
.post-sidebar-left-col {
  width: 15%;
  min-width: 150px;
  max-width: 220px;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  position: -webkit-sticky;
  position: sticky;
  top: 80px;
  padding-right: 1rem;
  box-sizing: border-box;
}

/* 右侧边栏 - 本文目录 */
.post-sidebar-right-col {
  width: 15%;
  min-width: 140px;
  max-width: 200px;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  position: -webkit-sticky;
  position: sticky;
  top: 80px;
  padding-left: 1rem;
  box-sizing: border-box;
}

/* 中间主内容 */
.post-main-col {
  -webkit-flex: 1 1 0%;
  flex: 1 1 0%;
  min-width: 0;
  max-width: 900px;
  box-sizing: border-box;
}

/* 侧边栏通用样式 */
.sidebar-inner {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  transition: background-color 0.3s ease;
}

.sidebar-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid;
  border-image: var(--brand-gradient) 1;
  font-family: var(--header-font);
}

/* 左侧分类目录 */
.sidebar-category {
  margin-bottom: 0.5rem;
}

.sidebar-category-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand);
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}

html[data-theme="dark"] .sidebar-category-title {
  color: var(--brand-light);
}

.sidebar-category-title:hover {
  background: var(--bg-soft);
}

.sidebar-collapse-icon {
  margin-left: auto;
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.sidebar-category-list {
  list-style: none;
  padding: 0;
  margin: 0;
  transition: max-height 0.3s ease;
  overflow: hidden;
}

.sidebar-category-list.collapsed {
  max-height: 0 !important;
  margin: 0;
  padding: 0;
}

.sidebar-post-item {
  padding: 4px 8px 4px 24px;
}

.sidebar-post-item a {
  font-size: 0.82rem;
  color: var(--text-col);
  text-decoration: none;
  display: block;
  line-height: 1.5;
  transition: color 0.2s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-post-item a:hover {
  color: var(--brand);
}

.sidebar-post-item.active a {
  color: var(--brand);
  font-weight: 600;
}

.sidebar-post-item.active {
  position: relative;
}

.sidebar-post-item.active::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand-gradient-strong);
}

/* 右侧本文目录 */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item {
  padding: 3px 0;
}

.toc-item a {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  line-height: 1.5;
  transition: color 0.2s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.toc-item a.toc-active {
  color: var(--brand);
  font-weight: 600;
}

html[data-theme="dark"] .toc-item a.toc-active {
  color: var(--brand-light);
}

.toc-h3 {
  padding-left: 14px;
}

.toc-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin: 1rem 0 0;
}

/* 侧边栏滚动条 */
.sidebar-inner::-webkit-scrollbar {
  width: 4px;
}
.sidebar-inner::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-inner::-webkit-scrollbar-thumb {
  background: var(--border-soft);
  border-radius: 2px;
}
.sidebar-inner::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === 响应式：中等屏幕缩小侧边栏 === */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .post-sidebar-left-col,
  .post-sidebar-right-col {
    min-width: 120px;
    width: 14%;
  }
}

/* === 响应式：小屏幕隐藏侧边栏，内容居中 === */
@media (max-width: 991.98px) {
  .post-layout-container {
    padding: 1.5rem 1rem;
  }

  .post-layout-row {
    display: block;
    max-width: 900px;
    margin: 0 auto;
  }

  .post-main-col {
    max-width: 100%;
  }

  .post-sidebar-left-col,
  .post-sidebar-right-col {
    display: none !important;
  }
}

/* 文章内容区卡片化 */
.post-main-col .blog-post {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.3s ease;
}

.post-main-col .blog-tags {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-soft);
}

.post-main-col .pagination {
  margin-top: 1.5rem;
}

/* ============================================================
   8. 相关文章推荐
============================================================ */
.related-posts {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  margin-top: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.related-posts .related-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--header-font);
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid;
  border-image: var(--brand-gradient) 1;
}

.related-posts ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-posts li {
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border-soft);
}

.related-posts li:last-child {
  border-bottom: none;
}

.related-posts a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 10px;
  transition: color 0.25s ease;
}

.related-posts a:hover {
  color: var(--brand);
}

html[data-theme="dark"] .related-posts a:hover {
  color: var(--brand-light);
}

.related-posts .related-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
  font-family: var(--mono-font);
}

/* ============================================================
   9. 归档页时间线
============================================================ */
.archive-container {
  max-width: 800px;
  margin: 0 auto;
}

.archive-year {
  font-family: var(--header-font);
  font-size: 1.75rem;
  font-weight: 700;
  color: transparent;
  background: var(--brand-gradient-strong);
  -webkit-background-clip: text;
  background-clip: text;
  margin: 2.2rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.archive-year::after {
  content: '';
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: var(--brand-gradient);
  opacity: 0.35;
}

.archive-year:first-child {
  margin-top: 0.5rem;
}

.archive-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 0.6rem 0.9rem;
  border-left: 3px solid var(--border-soft);
  border-radius: 0 10px 10px 0;
  margin-left: 6px;
  position: relative;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

/* 时间线圆点 */
.archive-item::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 50%;
  transform: translateY(-50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand-gradient-strong);
  box-shadow: 0 0 0 4px var(--bg-soft);
  transition: box-shadow 0.25s ease;
}

.archive-item:hover {
  background: var(--bg-soft);
  border-left-color: var(--brand-light);
  transform: translateX(6px);
}

.archive-item:hover::before {
  box-shadow: 0 0 0 5px rgba(45, 212, 191, 0.25);
}

.archive-date {
  font-family: var(--mono-font);
  color: var(--text-muted);
  font-size: 0.85rem;
  min-width: 96px;
  flex-shrink: 0;
}

.archive-title {
  color: var(--text-col);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.25s ease;
}

.archive-title:hover {
  color: var(--brand);
  text-decoration: none;
}

/* ============================================================
   10. 阅读进度条 / 返回顶部
============================================================ */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--brand-gradient);
  z-index: 2000;
  transition: width 0.1s linear;
}

#back-to-top {
  position: fixed;
  right: 28px;
  bottom: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--brand-gradient-strong);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all 0.3s ease;
  z-index: 1500;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.55);
}

/* ============================================================
   11. 滚动渐入动画
============================================================ */
.fade-in-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .fade-in-up {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   12. 关于页
============================================================ */
.about-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 1.5rem;
  border: 4px solid transparent;
  background: var(--brand-gradient-strong);
  box-shadow: var(--shadow-md);
  padding: 3px;
}

.about-skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 0;
  list-style: none;
}

.about-skill-tags li {
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.9rem;
  font-family: var(--header-font);
}

.about-skill-tags li:nth-child(6n+1) { background: #dcf7f0; color: #0f766e; }
.about-skill-tags li:nth-child(6n+2) { background: #e3f2fd; color: #0369a1; }
.about-skill-tags li:nth-child(6n+3) { background: #ffefe9; color: #c2410c; }
.about-skill-tags li:nth-child(6n+4) { background: #fff4d6; color: #a16207; }
.about-skill-tags li:nth-child(6n+5) { background: #f0eaff; color: #6d5bd0; }
.about-skill-tags li:nth-child(6n+6) { background: #fdeaf5; color: #be185d; }

html[data-theme="dark"] .about-skill-tags li:nth-child(6n+1) { background: rgba(45, 212, 191, 0.16); color: #5eead4; }
html[data-theme="dark"] .about-skill-tags li:nth-child(6n+2) { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
html[data-theme="dark"] .about-skill-tags li:nth-child(6n+3) { background: rgba(255, 138, 122, 0.16); color: #fda293; }
html[data-theme="dark"] .about-skill-tags li:nth-child(6n+4) { background: rgba(255, 183, 3, 0.16); color: #fcd34d; }
html[data-theme="dark"] .about-skill-tags li:nth-child(6n+5) { background: rgba(184, 165, 255, 0.16); color: #c4b5fd; }
html[data-theme="dark"] .about-skill-tags li:nth-child(6n+6) { background: rgba(244, 114, 182, 0.16); color: #f9a8d4; }

.about-github-btn {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 10px 26px;
  border-radius: 999px;
  background: var(--brand-gradient-strong);
  color: #fff !important;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.about-github-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.4);
  text-decoration: none;
}

/* ============================================================
   13. 暗色模式补充：bootstrap 组件
============================================================ */
html[data-theme="dark"] .modal-content {
  background-color: var(--bg-card);
  color: var(--text-main);
}

html[data-theme="dark"] .modal-content .close {
  color: var(--text-main);
  text-shadow: none;
}

html[data-theme="dark"] .form-control {
  background-color: var(--bg-soft);
  border-color: var(--border-soft);
  color: var(--text-main);
}

html[data-theme="dark"] .form-control:focus {
  background-color: var(--bg-soft);
  color: var(--text-main);
  border-color: var(--brand);
}

html[data-theme="dark"] .jumbotron {
  background: var(--bg-card);
}

html[data-theme="dark"] .well {
  background-color: var(--bg-card);
  border-color: var(--border-soft);
}

html[data-theme="dark"] .panel {
  background-color: var(--bg-card);
  border-color: var(--border-soft);
}

/* ============================================================
   14. 首页开源项目展示
============================================================ */
.projects-section {
  max-width: 960px;
  margin: 0 auto 2.5rem;
}

.projects-header {
  margin-bottom: 1.5rem;
}

.projects-heading {
  font-family: var(--header-font);
  font-size: 1.6rem;
  font-weight: 700;
  color: transparent;
  background: var(--brand-gradient-strong);
  -webkit-background-clip: text;
  background-clip: text;
  margin: 0 0 0.4rem;
  display: inline-block;
  position: relative;
}

.projects-heading::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 3px;
  border-radius: 3px;
  background: var(--brand-gradient);
}

.projects-subheading {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0.9rem 0 0;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 1.75rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
    linear-gradient(135deg, var(--border-soft), var(--border-soft)) border-box;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  text-decoration: none;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  background:
    linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
    var(--brand-gradient) border-box;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:hover::before {
  opacity: 1;
}

.project-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.project-card-tag {
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--header-font);
}

.project-card-tag.tag-c0 { background: #dcf7f0; color: #0f766e; }
.project-card-tag.tag-c1 { background: #e3f2fd; color: #0369a1; }
.project-card-tag.tag-c2 { background: #fff4d6; color: #a16207; }
.project-card-tag.tag-c3 { background: #f0eaff; color: #6d5bd0; }

html[data-theme="dark"] .project-card-tag.tag-c0 { background: rgba(45, 212, 191, 0.16); color: #5eead4; }
html[data-theme="dark"] .project-card-tag.tag-c1 { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
html[data-theme="dark"] .project-card-tag.tag-c2 { background: rgba(255, 183, 3, 0.16); color: #fcd34d; }
html[data-theme="dark"] .project-card-tag.tag-c3 { background: rgba(184, 165, 255, 0.16); color: #c4b5fd; }

.project-card-icon {
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: color 0.25s ease;
}

.project-card:hover .project-card-icon {
  color: var(--brand);
}

.project-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 0.55rem;
  font-family: var(--mono-font);
  transition: color 0.25s ease;
}

.project-card:hover .project-card-title {
  color: var(--brand);
}

html[data-theme="dark"] .project-card:hover .project-card-title {
  color: var(--brand-light);
}

.project-card-desc {
  flex: 1;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin: 0 0 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-soft);
}

.lang-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lang-dot.lang-python {
  background: #3572A5;
}

.project-card-updated {
  margin-left: auto;
}

.projects-more {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 1.5rem 0 0;
}

.projects-more a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed var(--brand-light);
  transition: color 0.25s ease;
}

.projects-more a:hover {
  color: var(--brand-2);
}
