:root {
  /* 背景层 */
  --bg-page: #f4f5f7;
  --bg-card: #ffffff;
  --bg-nav: #ffffff;
  --bg-subtle: #f5f6f8;
  --bg-hover: #e5e7eb;
  --bg-soft: #f9fafb;
  --bg-soft-hover: #f1f5f9;
  --bg-code-inline: #f3f4f6;
  --bg-blockquote: #f8fafc;
  --bg-th: #f9fafb;
  --bg-pre: #1f2937;
  /* 文字层 */
  --text-primary: #1f2329;
  --text-heading: #111111;
  --text-secondary: #555555;
  --text-body: #374151;
  --text-muted: #6b7280;
  --text-faint: #8a919f;
  --text-placeholder: #9ca3af;
  --text-link: #2563eb;
  /* 边框层 */
  --border: #f0f1f3;
  --border-subtle: #eef0f2;
  --border-line: #f1f2f4;
  --border-solid: #e5e7eb;
  --border-rail: #e6e8ec;
  /* 主题色 */
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-alt: #4a7cf6;
  --accent-soft: #dbeafe;
  /* 其他 */
  --dot: #cfd6df;
  --shadow: rgba(17, 24, 39, 0.05);
  --code-text: #d6336c;
  --pre-text: #e5e7eb;
  --success: #1e7e34;
  --danger: #dc2626;
}
[data-theme="dark"] {
  /* 背景层 */
  --bg-page: #0d1117;
  --bg-card: #161b22;
  --bg-nav: #161b22;
  --bg-subtle: #21262d;
  --bg-hover: #30363d;
  --bg-soft: #1c2128;
  --bg-soft-hover: #21262d;
  --bg-code-inline: #21262d;
  --bg-blockquote: #161b22;
  --bg-th: #1c2128;
  --bg-pre: #0d1117;
  /* 文字层 */
  --text-primary: #e6edf3;
  --text-heading: #f0f6fc;
  --text-secondary: #c9d1d9;
  --text-body: #c9d1d9;
  --text-muted: #8b949e;
  --text-faint: #8b949e;
  --text-placeholder: #6e7681;
  --text-link: #58a6ff;
  /* 边框层 */
  --border: #30363d;
  --border-subtle: #30363d;
  --border-line: #30363d;
  --border-solid: #30363d;
  --border-rail: #30363d;
  /* 主题色 */
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --accent-alt: #58a6ff;
  --accent-soft: rgba(31, 111, 235, 0.2);
  /* 其他 */
  --dot: #30363d;
  --shadow: rgba(0, 0, 0, 0.3);
  --code-text: #ff7b72;
  --pre-text: #e6edf3;
  --success: #3fb950;
  --danger: #f85149;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Figtree", sans-serif;
}
body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}
a {
  text-decoration: none;
  color: inherit;
}
img {
  display: block;
}
ul {
  list-style: none;
}
/* ===== 顶部导航 ===== */
.blog-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.blog-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.blog-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-heading);
}
.blog-nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}
.blog-nav-links a {
  font-size: 14px;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.blog-nav-links a:hover {
  color: var(--text-heading);
}
/* 主题切换按钮 */
.theme-toggle {
  background: var(--bg-subtle);
  border: 1px solid var(--border-solid);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  color: var(--text-secondary);
}
.theme-toggle:hover {
  background: var(--bg-hover);
  transform: rotate(15deg);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.theme-toggle .icon-sun {
  display: none;
}
[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}
[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}
/* ===== 主体布局（移动端单列） ===== */
.blog-main {
  max-width: 1200px;
  margin: 0 auto;
  /*padding: 16px 16px 40px;*/
  display: flex;
  flex-direction: column-reverse;
  gap: 16px;
  margin-top: 1px;
}
.card {
  background: var(--bg-card);
  /*border-radius: 12px;*/
  padding: 20px;
  box-shadow: 0 1px 3px var(--shadow);
  transition: background-color 0.2s ease;
}
/* ===== 个人资料卡 ===== */
.profile-top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}
.profile-name {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}
.profile-bio {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}
.profile-divider {
  display: none;
}
.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}
.social-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.social-btn:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
}
.social-btn svg {
  width: 20px;
  height: 20px;
}
.social-txt {
  font-size: 12px;
  color: var(--text-muted);
}
/* ===== 社交内容弹窗 ===== */
.social-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.social-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.social-modal-box {
  position: relative;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
  min-width: 280px;
  max-width: 90vw;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.social-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.social-modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.social-modal-body {
  color: var(--text-primary);
}
.social-text-value {
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-radius: 8px;
  word-break: break-all;
  font-size: 14px;
}
.social-copy-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
/* ===== 精选文章 ===== */
.side-title {
  font-size: 15px;
  font-weight: 700;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  line-height: 1.3;
  margin-bottom: 6px;
}
.feat-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-line);
}
.feat-item:last-child {
  border-bottom: none;
}
.feat-num {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.feat-item a {
  font-size: 14px;
  color: var(--text-body);
  transition: color 0.2s;
}
.feat-item a:hover {
  color: var(--accent);
}
/* ===== 专栏入口 ===== */
.album-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-line);
}
.album-tab {
  font-size: 13px;
  color: var(--text-body);
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--bg-subtle);
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.album-tab:hover {
  background: var(--bg-hover);
  color: var(--text-heading);
}
.album-tab.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
/* ===== 文章时间线 ===== */
.year-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0 10px;
}
.year-head h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.year-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-body);
  position: relative;
}
.year-count::before {
  content: "";
  z-index: 1;
  width: 8px;
  height: 8px;
  margin-top: -7px;
  border: 3px solid var(--accent-alt);
  border-radius: 50%;
  background: var(--bg-card);
  margin-top: 1px;
}
.count-ring {
  display: block;
}
.post-item {
  position: relative;
  display: grid;
  grid-template-columns: 52px 20px 1fr;
}
.post-item time {
  padding-top: 2px;
  font-size: 16px;
  text-align: right;
  color: var(--text-faint);
}
.post-rail {
  position: relative;
}
/*
.post-rail::before {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    border-left: 2px dashed var(--border-rail);
}*/
.post-body {
  padding: 16px 16px;
  border-left: 2px dashed var(--border-rail);
}
.post-item:first-child .post-rail::before {
  top: 28px;
}
.post-item:last-child .post-rail::before {
  bottom: auto;
  height: 28px;
}
.post-dot {
  position: absolute;
  top: 32px;
  left: 100%;
  transform: translate(-50%, -50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot);
  transition: background 0.2s, transform 0.2s;
}
.post-item:hover .post-dot {
  background: var(--accent);
  transform: translate(-50%, -50%) scale(1.4);
}
.post-title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
}
.post-title a {
  transition: color 0.2s;
}
.post-title a:hover {
  color: var(--accent-hover);
}
.post-sum {
  margin-top: 6px;
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-empty,
.blog-empty-sm {
  font-size: 14px;
  color: var(--text-placeholder);
  padding: 12px 0;
}
/* ===== 分页 ===== */
.blog-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.blog-pager a,
.blog-pager span {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-body);
  background: var(--bg-subtle);
  transition: background 0.2s, color 0.2s;
}
.blog-pager a:hover {
  background: var(--bg-hover);
  color: var(--text-heading);
}
.blog-pager .is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.blog-pager .is-gap {
  background: transparent;
  color: var(--text-placeholder);
}
/* ===== 文章详情 ===== */
.post-header {
  margin-bottom: 28px;
}
.post-header h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--text-heading);
  letter-spacing: 0.3px;
}
.post-meta {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.post-meta a {
  color: var(--text-muted);
  transition: color 0.2s;
}
.post-meta a:hover {
  color: var(--accent);
}
/* 正文排版：Markdown 渲染结果 */
.post-content {
  font-size: 18px;
  line-height: 1.85;
  color: var(--text-body);
  word-break: break-word;
}
.post-content > *:first-child {
  margin-top: 0;
}
.post-content p {
  margin: 14px 0;
}
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin: 28px 0 12px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-heading);
}
.post-content h1 {
  font-size: 22px;
}
.post-content h2 {
  font-size: 20px;
}
.post-content h3 {
  font-size: 18px;
}
.post-content h4 {
  font-size: 16px;
}
.post-content a {
  color: var(--accent-hover);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color 0.2s;
}
.post-content a:hover {
  border-bottom-color: var(--accent-hover);
}
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
}
.post-content blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--accent);
  background: var(--bg-blockquote);
  color: var(--text-body);
  border-radius: 0 6px 6px 0;
}
.post-content blockquote p {
  margin: 6px 0;
}
.post-content ul,
.post-content ol {
  margin: 14px 0;
  padding-left: 24px;
}
.post-content li {
  margin: 6px 0;
}
.post-content code {
  background: var(--bg-code-inline);
  color: var(--code-text);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
.post-content pre {
  background: var(--bg-pre);
  color: var(--pre-text);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  line-height: 1.6;
}
.post-content pre code {
  background: none;
  color: inherit;
  padding: 0;
}
.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
}
.post-content th,
.post-content td {
  border: 1px solid var(--border-solid);
  padding: 8px 12px;
  text-align: left;
}
.post-content th {
  background: var(--bg-th);
  font-weight: 600;
}
.post-content hr {
  border: none;
  border-top: 1px solid var(--border-solid);
  margin: 24px 0;
}
/* 标签 */
.post-tags {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.post-tags-label {
  font-size: 13px;
  color: var(--text-faint);
}
.post-tag {
  font-size: 12px;
  color: var(--text-body);
  background: var(--bg-subtle);
  padding: 4px 10px;
  border-radius: 12px;
  transition: background 0.2s, color 0.2s;
}
.post-tag:hover {
  background: var(--accent);
  color: #fff;
}
/* ===== 标签云 ===== */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0 4px;
}
.tag-cloud-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--bg-subtle);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.tag-cloud-item:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}
.tag-cloud-name {
  font-size: 14px;
  color: var(--text-body);
}
.tag-cloud-item:hover .tag-cloud-name {
  color: #fff;
}
.tag-cloud-count {
  font-size: 12px;
  color: var(--text-faint);
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.tag-cloud-item:hover .tag-cloud-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
/* 上一篇 / 下一篇 */
.post-nav {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border-line);
  display: flex;
  gap: 16px;
}
.post-nav a {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  background: var(--bg-soft);
  border-radius: 8px;
  transition: background 0.2s;
}
.post-nav a:hover {
  background: var(--bg-soft-hover);
}
.post-nav-label {
  font-size: 12px;
  color: var(--text-placeholder);
}
.post-nav-title {
  font-size: 14px;
  color: var(--text-body);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Newsletter 订阅卡片 */
.nl-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}
.nl-row {
  display: flex;
  gap: 8px;
  flex-direction: column;
}
.nl-input {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  border: 1px solid var(--border-solid);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.nl-input::placeholder {
  color: var(--text-placeholder);
}
.nl-input:focus {
  outline: none;
  border-color: var(--accent);
}
.nl-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s;
}
.nl-btn:hover {
  opacity: 0.9;
}
.nl-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.nl-msg {
  margin-top: 10px;
  font-size: 13px;
  min-height: 18px;
}
.nl-msg.is-error {
  color: var(--danger);
}
.nl-msg.is-success {
  color: var(--success);
}
.blog-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
/* ===== 桌面端双栏（≥900px） ===== */
@media (min-width: 900px) {
  .blog-main {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
    padding: 24px 24px 56px;
  }
  .card {
    border-radius: 12px;
  }
  .blog-side {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  /* 资料卡切换为居中竖排 */
  .profile-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .avatar {
    width: 96px;
    height: 96px;
  }
  .profile-name {
    margin: 14px 0 10px;
    font-size: 18px;
  }
  .profile-divider {
    display: block;
    width: 40px;
    height: 1px;
    background: var(--border-solid);
    margin: 0 auto 12px;
  }
  .social-row {
    justify-content: center;
    gap: 14px;
    margin-top: 4px;
  }
  .social-btn {
    border-radius: 50%;
  }
  .card {
    padding: 20px;
  }
  .post-header h1 {
    font-size: 30px;
  }
}
