/* ============================================================
   academic 主题 —— 极简学术风格
   还原 minimal-academic-homepage 设计：浅色卡片 + 毛玻璃 + 大圆角
   ============================================================ */

:root {
  --bg: #f5f5f7;
  --card: rgba(255, 255, 255, 0.94);
  --card-soft: rgba(255, 255, 255, 0.72);
  --text: #1d1d1f;
  --subtle: #3f4247;
  --muted: #6b7078;
  --line: #e5e5ea;
  --line-soft: #f0f0f2;
  --link: #0066cc;
  --chip: #f2f2f4;
  --chip-text: #52565c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.06);
  --soft-shadow: 0 8px 26px rgba(0, 0, 0, 0.045);
  --radius: 24px;
  --radius-sm: 18px;
}

/* 深色模式（手动切换，由 build.js 注入 data-theme 控制） */
html[data-theme="dark"] {
  --bg: #0d1117;
  --card: rgba(22, 27, 34, 0.92);
  --card-soft: rgba(22, 27, 34, 0.7);
  --text: #e6edf3;
  --subtle: #c9d1d9;
  --muted: #8b949e;
  --line: #30363d;
  --line-soft: #21262d;
  --link: #58a6ff;
  --chip: #161b22;
  --chip-text: #c9d1d9;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  --soft-shadow: 0 8px 26px rgba(0, 0, 0, 0.3);
}
/* 跟随系统（无 data-theme 时） */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #0d1117;
    --card: rgba(22, 27, 34, 0.92);
    --card-soft: rgba(22, 27, 34, 0.7);
    --text: #e6edf3;
    --subtle: #c9d1d9;
    --muted: #8b949e;
    --line: #30363d;
    --line-soft: #21262d;
    --link: #58a6ff;
    --chip: #161b22;
    --chip-text: #c9d1d9;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
    --soft-shadow: 0 8px 26px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.62;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 34rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(40, 50, 65, 0.5), transparent 34rem),
    var(--bg);
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 34px 20px 42px;
}

/* ---------------- 顶部导航 ---------------- */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
}
.nav-name {
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
  text-decoration: none;
}
.nav-links { display: flex; gap: 18px; flex-wrap: wrap; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.12s ease;
}
.nav-links a:hover { color: var(--link); }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: var(--radius);
  padding: 34px 36px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
html[data-theme="dark"] .card { border-color: var(--line); }

/* ---------------- Hero ---------------- */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 42px; align-items: center; }
.hero-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: 132px; height: 132px;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  background: #fff;
}
.hero-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

h1 {
  margin: 0 0 8px;
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: -0.045em;
  font-weight: 760;
}
h2 {
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.025em;
  font-weight: 720;
}
h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.015em;
  font-weight: 700;
}
p { margin: 6px 0; }

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

.identity { font-size: 17px; color: var(--subtle); margin-bottom: 10px; }
.about-line {
  max-width: 640px;
  margin-top: 12px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.66;
}

/* ---------------- 胶囊链接 ---------------- */
.links { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.pill-link, .mini-link {
  display: inline-flex; align-items: center; gap: .35em;
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.pill-link {
  padding: 6px 14px;
  border: 1px solid #d7e6fb;
  background: rgba(247, 250, 255, 0.9);
  color: var(--link);
  font-size: 14.5px;
}
.pill-link:hover, .mini-link:hover {
  text-decoration: none;
  background: #edf5ff;
  border-color: #bfd8f7;
  transform: translateY(-1px);
}
html[data-theme="dark"] .pill-link,
html[data-theme="dark"] .mini-link { background: rgba(56, 84, 112, 0.25); border-color: #2a3a4a; }
html[data-theme="dark"] .pill-link:hover,
html[data-theme="dark"] .mini-link:hover { background: rgba(56, 84, 112, 0.4); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .pill-link,
  html:not([data-theme="light"]) .mini-link { background: rgba(56, 84, 112, 0.25); border-color: #2a3a4a; }
  html:not([data-theme="light"]) .pill-link:hover,
  html:not([data-theme="light"]) .mini-link:hover { background: rgba(56, 84, 112, 0.4); }
}

.mini-link {
  padding: 4px 11px;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--link);
  font-size: 13.5px;
}

/* ---------------- 文章列表 ---------------- */
.post-list { margin: 0; padding: 0; list-style: none; }
.post-list li {
  position: relative;
  margin-bottom: 9px;
  padding-left: 16px;
  font-size: 15px;
  line-height: 1.5;
}
.post-list li::before {
  content: "";
  position: absolute;
  left: 1px; top: 0.7em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #aeb4bd;
}
.post-list a { color: var(--text); text-decoration: none; transition: color 0.12s ease; }
.post-list a:hover { color: var(--link); text-decoration: none; }
.post-meta {
  color: var(--muted);
  font-size: 13.5px;
  margin-left: 6px;
}

/* ---------------- 分类卡片网格 ---------------- */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cat-card {
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 18px 16px;
  box-shadow: var(--soft-shadow);
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.cat-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--link);
}
.cat-card-name { font-size: 16px; font-weight: 680; letter-spacing: -0.01em; }
.cat-card-count { font-size: 13px; color: var(--muted); }

/* 标签 */
.tag {
  display: inline-block;
  margin: 6px 6px 0 0;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--chip-text);
  font-size: 13px;
  line-height: 1.5;
  text-decoration: none;
  transition: background 0.12s;
}
.tag:hover { background: var(--line); text-decoration: none; }

/* ---------------- 文章正文 ---------------- */
.post-body { margin-top: 8px; }
.post-body h2 { font-size: 22px; margin-top: 1.8rem; }
.post-body h3 { font-size: 18px; margin-top: 1.4rem; }
.post-body p { margin: .9rem 0; line-height: 1.75; }
.post-body blockquote {
  margin: 1rem 0;
  padding: .6rem 1.1rem;
  border-left: 3px solid var(--link);
  background: var(--card-soft);
  color: var(--muted);
  border-radius: 0 8px 8px 0;
}
.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88em;
  background: var(--chip);
  padding: .12em .4em;
  border-radius: 5px;
}
.post-body pre {
  background: var(--chip);
  padding: 1rem 1.2rem;
  border-radius: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  line-height: 1.55;
}
.post-body pre code { background: none; padding: 0; }
.post-body img { max-width: 100%; border-radius: 12px; }
.post-body ul, .post-body ol { padding-left: 1.4em; }
.post-body table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
.post-body th, .post-body td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: left; }
.post-body th { background: var(--card-soft); }
.post-body hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.post-body strong { font-weight: 680; }

.post-head { margin-bottom: 8px; }
.post-head .crumbs { margin: 0 0 6px; font-size: 13.5px; color: var(--muted); }
.post-head .crumbs a { color: var(--muted); }
.post-back { margin-top: 2.5rem; font-size: 14.5px; }

/* ---------------- 页脚 ---------------- */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  padding: 8px 0 28px;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .container { padding: 24px 14px 36px; }
  .top-nav { display: none; }
  .card { padding: 26px 22px; border-radius: 20px; }
  .hero { grid-template-columns: 1fr; gap: 22px; }
  .hero-mark { justify-self: start; width: 96px; height: 96px; border-radius: 22px; }
  .cat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  h1 { font-size: 32px; }
  h2 { font-size: 22px; }
  .identity, .about-line { font-size: 15.5px; }
}

/* ---------------- 回到顶部 ---------------- */
#back-to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 9990;
  display: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--soft-shadow);
  font-size: 18px;
  transition: color 0.12s, transform 0.12s;
}
#back-to-top:hover { color: var(--link); transform: translateY(-1px); }
#back-to-top.show { display: inline-flex; }

/* ---------------- 顶部导航：语言 / 主题 控件 ---------------- */
.nav-action {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.nav-action svg { width: 14px; height: 14px; flex-shrink: 0; }
.nav-action:hover {
  color: var(--link);
  border-color: var(--link);
  text-decoration: none;
}
.nav-theme-wrap { position: relative; }
.nav-theme-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 5px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
  min-width: 8.5rem;
  z-index: 100;
}
.nav-theme-wrap.open .nav-theme-menu { display: flex; }
.nav-theme-menu button {
  display: flex;
  align-items: center;
  gap: .4em;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  transition: background 0.1s, color 0.1s;
}
.nav-theme-menu button svg { width: 13px; height: 13px; }
.nav-theme-menu button:hover { background: var(--line-soft); color: var(--text); }
.nav-theme-menu button.active { color: var(--link); font-weight: 600; }

/* 移动端：导航控件与链接一起堆叠 */
@media (max-width: 820px) {
  .nav-action { font-size: 13px; padding: 4px 10px; }
}

/* ---------------- 文章分享按钮 ---------------- */
.share {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .8rem;
}
.share-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}
.share-btns {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.14s ease, color 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.share-btn svg { width: 17px; height: 17px; }
.share-btn:hover {
  transform: translateY(-2px);
  color: var(--link);
  border-color: var(--link);
  background: var(--card);
}
.share-copied {
  font-size: 13px;
  color: #2da44e;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.share-copied.show { opacity: 1; }

/* ---------------- 页脚访问统计 ---------------- */
.footer-stats {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  opacity: 0.7;
}
#busuanzi_container_page_pv {
  display: inline; /* 文章页阅读量内联在 post-meta */
}

/* ---------------- 文章底部推荐栏 ---------------- */
.related {
  margin-top: 20px;
}
.related-title {
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  font-size: 20px;
  font-weight: 720;
  letter-spacing: -0.02em;
  color: var(--text);
}
.related-sub {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--muted);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.related-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--soft-shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.16s ease, border-color 0.16s ease;
  min-height: 120px;
}
.related-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--link);
}
.related-cat {
  display: inline-block;
  width: fit-content;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--chip-text);
  font-size: 12px;
  font-weight: 600;
}
.related-name {
  font-size: 15.5px;
  font-weight: 620;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text);
  flex: 1;
}
.related-date {
  font-size: 12.5px;
  color: var(--muted);
}
@media (max-width: 760px) {
  .related-grid { grid-template-columns: 1fr; }
}
