/* -*- coding: utf-8 -*- */
/* 博客样式：页眉页尾美化 + 阅读目录 + 卡片入场动画 + markdown 阅读样式 */

:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #24292f;
  --muted: #6e7781;
  --accent: #2563eb;
  --accent-soft: #e8effc;
  --border: #e2e5ea;
  --danger: #dc2626;
  --code-bg: #f3f4f6;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06);
  --grad: linear-gradient(90deg, #2563eb, #7c3aed, #db2777);
}

* { box-sizing: border-box; }

/* 兜底：hidden 属性必须生效（防止类样式的 display 覆盖，如 .modal-mask 的 flex） */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  /* 淡彩渐变背景：让吸顶页眉的毛玻璃效果可感知 */
  /* 注:不用 background-attachment: fixed —— 窗口拉伸时会导致整页重绘闪烁 */
  background: linear-gradient(165deg, #edf3ff 0%, #f6f7f9 28%, #fdf1f6 62%, #f2f7f2 100%);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  line-height: 1.7;
  font-size: 15px;
}

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

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

/* ================= 页眉 ================= */
.site-header {
  background: rgba(255, 255, 255, .68);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid rgba(226, 229, 234, .7);
  position: sticky;
  top: 0;
  z-index: 100;
  /* 强制 GPU 合成层,避免拉伸/滚动时毛玻璃重绘闪烁 */
  transform: translateZ(0);
  transition: box-shadow .25s ease, background .25s ease;
}
/* 窗口拉伸期间临时禁用毛玻璃(resize 防抖由 JS 控制),消除整页重绘闪烁 */
body.is-resizing .site-header {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(255, 255, 255, .92);
}
/* 滚动后阴影，强化吸顶感 */
.site-header.scrolled { box-shadow: 0 4px 18px rgba(30, 60, 130, .18); }
/* 不支持 backdrop-filter 的浏览器回退为不透明 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: #ffffff; }
}
.header-accent {
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #7c3aed, #db2777, #2563eb);
  background-size: 300% 100%;
  animation: gradientShift 10s ease infinite;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.site-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: .5px;
}
.site-title:hover { text-decoration: none; opacity: .85; }
.title-mark { font-size: 15px; color: var(--accent); }
.header-nav { display: flex; align-items: center; gap: 20px; }
.nav-link {
  position: relative;
  color: var(--text);
  font-size: 14px;
  padding: 4px 0;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  border-radius: 2px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-link:hover::after { transform: scaleX(1); }
.auth-status { font-size: 13px; color: #16a34a; }

/* ================= 布局 ================= */
.layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  padding-top: 24px;
  padding-bottom: 40px;
  align-items: start;
}
.side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 16px; }
/* 阅读模式：右侧栏隐藏，主列占满整行（否则 grid 的 280px 列会留下空白） */
.layout.reading { grid-template-columns: minmax(0, 1fr); }
.layout.reading .side { display: none; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.card-title { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }

/* ---------- 搜索 ---------- */
#search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: var(--bg);
  transition: border-color .2s, box-shadow .2s;
}
#search-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* ---------- 标签 ---------- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s;
}
.tag-btn em { font-style: normal; color: var(--muted); font-size: 11.5px; }
.tag-btn:hover { border-color: var(--accent); color: var(--accent); }
.tag-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-btn.active em { color: rgba(255, 255, 255, .8); }

/* ---------- 归档 ---------- */
.archive-list { display: flex; flex-direction: column; gap: 4px; }
.archive-link { color: var(--text); font-size: 13.5px; padding: 2px 4px; border-radius: 6px; }
.archive-link:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.archive-link em { font-style: normal; color: var(--muted); font-size: 12px; margin-left: 4px; }

/* ================= 文章列表（含入场动画） ================= */
.month-group { margin-bottom: 26px; }
.month-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.month-title::before { content: '▍'; color: var(--accent); margin-right: 6px; }

.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 10px;
  transition: box-shadow .15s, opacity .5s ease, transform .5s ease;
}
.post-card:hover { box-shadow: 0 3px 10px rgba(0, 0, 0, .08); }
.post-title { margin: 0 0 6px; font-size: 16.5px; }
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); text-decoration: none; }
.post-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.post-date { color: var(--muted); }
.tag {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  transition: all .15s;
}
.tag:hover { text-decoration: none; background: var(--accent); color: #fff; }
.post-excerpt { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; }
.edit-link { color: var(--muted); font-size: 12.5px; }
.edit-link:hover { color: var(--accent); }

/* 入场动画：JS 加 anim-ready 后才隐藏初始态，无 JS 时内容始终可见 */
body.anim-ready .month-title,
body.anim-ready .post-card,
body.anim-ready .post-full,
body.anim-ready .markdown-body,
body.anim-ready .empty {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .5s ease, transform .5s ease;
}
body.anim-ready .visible {
  opacity: 1;
  transform: none;
}
body.anim-ready .post-card { transition-delay: var(--d, 0ms); }

.empty {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

/* ================= 阅读页 + 目录 ================= */
.post-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.post-layout.no-toc { grid-template-columns: 1fr; }
.post-full {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 40px;
}
.post-full-title { margin: 0 0 8px; font-size: 26px; line-height: 1.4; }

.toc {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 13px;
}
.toc-title { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.toc a {
  display: block;
  padding: 4px 8px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all .2s;
}
.toc a:hover { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.toc a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}
.toc li.toc-level-h3 a { padding-left: 20px; }
.toc li.toc-level-h4 a { padding-left: 32px; }

/* 锚点滚动时避开吸顶页眉 */
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  scroll-margin-top: 76px;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  margin: 1.5em 0 .6em;
  line-height: 1.4;
}
.markdown-body h1 { font-size: 24px; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.markdown-body h2 { font-size: 20px; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.markdown-body h3 { font-size: 17px; }
.markdown-body p { margin: .8em 0; }
.markdown-body a { text-decoration: underline; }
.markdown-body ul, .markdown-body ol { padding-left: 1.6em; margin: .8em 0; }
.markdown-body li { margin: .25em 0; }
.markdown-body blockquote {
  margin: 1em 0;
  padding: .4em 1em;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  color: #445;
}
.markdown-body code {
  background: var(--code-bg);
  border-radius: 4px;
  padding: .15em .4em;
  font-size: 13.5px;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
}
.markdown-body pre {
  background: #1e2530;
  color: #e6edf3;
  padding: 14px 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1em 0;
}
.markdown-body pre code { background: none; padding: 0; color: inherit; font-size: 13px; }
.markdown-body img { max-width: 100%; border-radius: 8px; }
.markdown-body table { border-collapse: collapse; margin: 1em 0; width: 100%; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 7px 12px; text-align: left; }
.markdown-body th { background: var(--bg); }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

/* ================= 页脚 ================= */
.site-footer {
  margin-top: 48px;
  padding: 40px 0 32px;
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(37, 99, 235, .05));
  border-top: 1px solid rgba(226, 229, 234, .6);
  color: var(--muted);
}
.footer-divider {
  width: 64px;
  height: 3px;
  margin: 0 auto 18px;
  border-radius: 3px;
  background: var(--grad);
}
.footer-quote { margin: 0 0 6px; font-size: 14px; color: var(--text); }
.footer-copy { margin: 0; font-size: 12.5px; opacity: .85; }
.footer-icp { margin: 6px 0 0; font-size: 12.5px; opacity: .85; }
.footer-icp a { color: var(--muted); }

/* ================= 编辑器页 ================= */
.editor-wrap { padding-top: 24px; padding-bottom: 60px; }
.auth-bar { display: flex; align-items: center; gap: 10px; max-width: 480px; margin-bottom: 16px; }
.auth-bar label { font-size: 14px; color: var(--muted); }
.auth-bar input[type="password"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.auth-bar input[type="password"]:focus { border-color: var(--accent); }
.login-msg { font-size: 13px; color: var(--danger); }

.meta-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.field {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.field:focus { border-color: var(--accent); }
.meta-form .field:first-child { grid-column: 1 / -1; }
.field[readonly] { background: var(--bg); color: var(--muted); }

.actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { opacity: .9; color: #fff; }
.btn.danger { color: var(--danger); border-color: #f3c4c4; }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.save-status { font-size: 13.5px; color: var(--muted); margin-left: 6px; }

/* EasyMDE 微调 */
.EasyMDEContainer { border-radius: var(--radius); overflow: hidden; }
.editor-toolbar { border-color: var(--border) !important; }
.CodeMirror { border-color: var(--border) !important; min-height: 420px; }

/* ================= 响应式 ================= */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .post-layout { grid-template-columns: 1fr; }
  .toc { display: none; } /* 小屏隐藏目录 */
  .post-full { padding: 20px 18px; }
  .meta-form { grid-template-columns: 1fr; }
  .meta-form .field:first-child { grid-column: auto; }
}

/* 无障碍：用户偏好减少动画时，去掉位移和错峰，保留轻微淡入 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .header-accent { animation: none; }
  body.anim-ready .month-title,
  body.anim-ready .post-card,
  body.anim-ready .post-full,
  body.anim-ready .markdown-body,
  body.anim-ready .empty {
    opacity: 0;
    transform: none;
    transition: opacity .45s ease;
  }
  body.anim-ready .post-card { transition-delay: 0ms; }
  body.anim-ready .visible { opacity: 1; }
}

/* ================= 插入图片弹窗 ================= */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  width: 100%;
  max-width: 460px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
  animation: modalIn .18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.modal-title { margin: 0 0 4px; font-size: 17px; }
.modal-tip { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.modal-label { display: block; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.modal-label .field { display: block; width: 100%; margin-top: 4px; }
.req { color: var(--danger); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ================= 美化增强（2026-08-04） ================= */

/* ---------- 阅读进度条（全宽容器 + 内部渐变按比例填充，随页头宽度） ---------- */
#progress-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 300;
  pointer-events: none;
}
#progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  background: var(--grad);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
  transition: transform .08s linear;
}

/* ---------- 返回顶部 ---------- */
#back-top {
  position: fixed;
  right: 24px; bottom: 28px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .14);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .25s, transform .25s, border-color .2s, color .2s;
  z-index: 150;
}
#back-top.show { opacity: 1; transform: none; pointer-events: auto; }
#back-top:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 主题切换按钮 ---------- */
.theme-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 14px;
  line-height: 1.6;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.theme-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Hero 区 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  margin-top: 24px;
  padding: 38px 36px 30px;
  border-radius: 16px;
  border: 1px solid var(--border);
  /* 强制 GPU 合成层,减少窗口拉伸时背景重绘闪烁 */
  transform: translateZ(0);
  /* 背景图（--hero-img 由 JS 从 config 注入）+ 半透明遮罩层 + 装饰渐变 */
  background-image:
    var(--hero-img, none),
    linear-gradient(rgba(246, 247, 249, .82), rgba(246, 247, 249, .82)),
    radial-gradient(420px 200px at 85% -30%, rgba(124, 58, 237, .16), transparent 70%),
    radial-gradient(380px 220px at -10% 120%, rgba(37, 99, 235, .14), transparent 70%),
    linear-gradient(135deg, rgba(255, 255, 255, .6), rgba(255, 255, 255, .2));
  background-color: var(--card);
  background-size: cover, auto, auto, auto, auto;
  background-position: center;
  background-repeat: no-repeat, repeat, repeat, repeat, repeat;
  box-shadow: var(--shadow);
}
.hero-kicker {
  margin: 0 0 6px;
  font-size: 12.5px;
  letter-spacing: 2px;
  color: var(--accent);
  font-weight: 600;
  /* 与 hero-title 一致的描边,提升背景图上的可读性 */
  -webkit-text-stroke: 1px rgba(0, 0, 0, .45);
}
.hero-title {
  margin: 0 0 8px;
  font-size: 42px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: .5px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* 浅色主题:黑色描边,提升背景图上的可读性 */
  -webkit-text-stroke: 1.5px rgba(0, 0, 0, .62);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
.hero-sub {
  margin: 0;
  font-size: 15.5px;
  color: var(--muted);
  /* 与 hero-title 一致的描边 */
  -webkit-text-stroke: 1px rgba(0, 0, 0, .55);
  text-shadow: 0 1px 3px rgba(255,255,255,.6);
}
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}
.stat b {
  display: block;
  font-size: 21px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
  /* 与 hero-title 一致的描边 */
  -webkit-text-stroke: 1px rgba(0, 0, 0, .5);
}
.stat span {
  font-size: 12.5px;
  color: var(--muted);
  /* 与 hero-title 一致的描边 */
  -webkit-text-stroke: 1px rgba(0, 0, 0, .5);
}

/* 阅读页隐藏 Hero（body.reading-mode 由 JS 控制） */
body.reading-mode .hero { display: none; }

/* ---------- 文章卡片增强 ---------- */
.post-card {
  position: relative;
  overflow: hidden;
  cursor: pointer; /* 整卡可点击跳详情 */
  transition: box-shadow .2s, transform .2s;
}
/* 入场动画期间保持原过渡，动画完成后恢复快速过渡（.done 由 JS 添加） */
body.anim-ready .post-card:not(.done) { transition: box-shadow .2s, opacity .5s ease, transform .5s ease; }
body.anim-ready .post-card.done { transition: box-shadow .2s, transform .2s; }
.post-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--grad);
  opacity: 0;
  transition: opacity .25s;
}
.post-card:hover::before { opacity: 1; }
.post-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, .08); }
.post-title a { transition: color .2s; }
.post-title a:hover {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 标签彩色化（--th 色相由 JS 按标签名生成） ---------- */
.tag { background: hsl(var(--th, 215), 72%, 93%); color: hsl(var(--th, 215), 55%, 34%); }
.tag:hover { background: hsl(var(--th, 215), 55%, 45%); color: #fff; }

/* ---------- 阅读页增强 ---------- */
.read-time { color: var(--muted); font-size: 12.5px; }
.read-time::before { content: '⏱ '; }

/* ---------- 代码块：语言标签 + 复制按钮 ---------- */
.markdown-body pre { padding: 0; }
.markdown-body pre code {
  display: block;
  padding: 14px 16px;
  overflow-x: auto;
}
.code-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  font-size: 12px;
  color: #8b98a5;
  background: rgba(255, 255, 255, .05);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px 8px 0 0;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
}
.code-lang { text-transform: lowercase; }
.code-copy {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #c6d0da;
  border-radius: 6px;
  font-size: 12px;
  padding: 2px 10px;
  cursor: pointer;
  transition: all .15s;
}
.code-copy:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.code-copy.copied { color: #7ee2a8; border-color: rgba(126, 226, 168, .4); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3ccd6; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 深色模式（html[data-theme=dark]，JS 切换并记忆） ---------- */
html[data-theme="dark"] {
  --bg: #0f1419;
  --card: #151c25;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #5b9dff;
  --accent-soft: rgba(91, 157, 255, .14);
  --border: #232c38;
  --code-bg: #1a2230;
  --shadow: 0 1px 3px rgba(0, 0, 0, .45);
}
html[data-theme="dark"] body {
  background: linear-gradient(165deg, #111827 0%, #0f1419 35%, #170f22 65%, #0f1714 100%);
}
html[data-theme="dark"] .site-header { background: rgba(15, 20, 25, .72); }
body.is-resizing .site-header,
html[data-theme="dark"] body.is-resizing .site-header { background: rgba(16, 21, 27, .96); }
html[data-theme="dark"] .site-header.scrolled { box-shadow: 0 4px 18px rgba(0, 0, 0, .45); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-theme="dark"] .site-header { background: #10151b; }
}
html[data-theme="dark"] #search-input { background: var(--bg); }
html[data-theme="dark"] #search-input:focus { background: var(--card); }
html[data-theme="dark"] .markdown-body blockquote { color: #aab4c0; }
html[data-theme="dark"] .modal-mask { background: rgba(0, 0, 0, .62); }
html[data-theme="dark"] .hero {
  background-image:
    var(--hero-img, none),
    linear-gradient(rgba(15, 20, 25, .85), rgba(15, 20, 25, .85)),
    radial-gradient(420px 200px at 85% -30%, rgba(124, 58, 237, .22), transparent 70%),
    radial-gradient(380px 220px at -10% 120%, rgba(37, 99, 235, .2), transparent 70%),
    linear-gradient(135deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, 0));
  background-color: var(--card);
  background-size: cover, auto, auto, auto, auto;
  background-position: center;
}
html[data-theme="dark"] .hero-title {
  /* 深色主题:白色描边 */
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, .62);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] .hero-kicker { -webkit-text-stroke: 1px rgba(255, 255, 255, .45); }
html[data-theme="dark"] .hero-sub {
  /* 深色主题:白色描边 */
  -webkit-text-stroke: 1px rgba(255, 255, 255, .55);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .55);
}
html[data-theme="dark"] .stat b { -webkit-text-stroke: 1px rgba(255, 255, 255, .5); }
html[data-theme="dark"] .stat span { -webkit-text-stroke: 1px rgba(255, 255, 255, .5); }
html[data-theme="dark"] .tag { background: hsl(var(--th, 215), 45%, 20%); color: hsl(var(--th, 215), 75%, 74%); }
html[data-theme="dark"] .tag:hover { background: hsl(var(--th, 215), 60%, 38%); color: #fff; }
html[data-theme="dark"] .footer-quote { color: #c7d1db; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2b3644; }
/* 编辑器页（EasyMDE）深色适配 */
html[data-theme="dark"] .EasyMDEContainer,
html[data-theme="dark"] .editor-toolbar,
html[data-theme="dark"] .CodeMirror,
html[data-theme="dark"] .editor-preview { background: var(--card); color: var(--text); }
html[data-theme="dark"] .editor-toolbar { border-color: var(--border) !important; }
html[data-theme="dark"] .CodeMirror { border-color: var(--border) !important; }
html[data-theme="dark"] .CodeMirror-cursor { border-left-color: var(--text); }
html[data-theme="dark"] .CodeMirror-selected { background: rgba(91, 157, 255, .25); }
html[data-theme="dark"] .editor-toolbar button { color: var(--muted); }
html[data-theme="dark"] .editor-toolbar button:hover,
html[data-theme="dark"] .editor-toolbar button.active { background: var(--accent-soft); color: var(--accent); }
html[data-theme="dark"] .editor-preview-side { border-color: var(--border); }

/* ---------- 响应式补充 ---------- */
@media (max-width: 640px) {
  .hero { padding: 26px 20px 22px; }
  .hero-title { font-size: 32px; }
  .hero-stats { gap: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .post-card:hover { transform: none; }
}
