:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-alt: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --subtle: #9ca3af;
  --primary: #333;
  --primary-soft: rgba(37, 99, 235, 0.14);
  --primary-strong: rgba(37, 99, 235, 0.28);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 28px 64px rgba(15, 23, 42, 0.14);
  --shadow-md: 0 18px 42px rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 10px 24px rgba(15, 23, 42, 0.08);
  --max-width: 1200px;
  /* 灰色调色板 */
  --gray-600: #a0a6ae;
  --gray-700: #8c939c;
}

/* 深色模式下的灰色调色板 */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161618;
  --bg-alt: #1b1b1f;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --subtle: #64748b;
  --primary: #ddd;
  --primary-soft: rgba(100, 100, 100, 0.22);
  --primary-strong: rgba(100, 100, 100, 0.32);
  --border: #292b2e;
  --border-strong: rgba(3, 14, 27, 0.2);
  --shadow-lg: 0 16px 32px rgba(20, 20, 20, 0.34);
  --shadow-md: 0 10px 23px rgba(20, 20, 20, 0.28);
  --shadow-sm: 0 6px 14px rgba(20, 20, 20, 0.22);
  --gray-600: #44485291;
  --gray-700: #3a3e4791;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Punctuation SC", Inter, ui-sans-serif, system-ui, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}

a:hover {
  color: var(--primary-strong);
  text-decoration: underline;
}

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 1.25rem clamp(1rem, 5vw, 2.75rem);
  align-items: center;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.site-header-box {
  width: min(100%, var(--max-width));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  width: clamp(36px, 6vw, 52px);
  height: clamp(36px, 6vw, 52px);
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.15);
  cursor: pointer;
}

.brand-title {
  font-size: clamp(1.7rem, 3.2vw, 2.15rem);
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
}

.site-nav {
  justify-self: center;
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
}
.site-nav-box {
  display: flex;
  align-items: center;
}
.nav-link {
  padding: 0.45rem 1.05rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-link:hover {
  transform: translateY(-1px);
  background: var(--primary-strong);
  color: #fff;
}

.theme-switch {
  justify-self: end;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
}

.theme-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary-soft);
  display: inline-flex;
  align-items: center;
  padding: 4px;
  transition: background 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.switch-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  transition: transform 0.25s ease, background 0.25s ease;
}

.theme-switch input:checked + .switch-track {
  background: var(--primary-strong);
  box-shadow: 0 10px 22px rgba(96, 165, 250, 0.25);
}

.theme-switch input:checked + .switch-track .switch-thumb {
  transform: translateX(24px);
  background: #fff;
}

/* 确保深色模式下切换按钮样式正确 */
html[data-theme="dark"] .theme-switch input:checked + .switch-track {
  background: var(--primary-strong);
  box-shadow: 0 10px 22px rgba(96, 165, 250, 0.35);
}

html[data-theme="dark"]
  .theme-switch
  input:checked
  + .switch-track
  .switch-thumb {
  transform: translateX(24px);
  background: #fff;
}

.switch-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.site-main {
  flex: 1;
  width: min(100%, var(--max-width));
  margin: 0 auto;
  padding: 1rem 8px;
}

/* 在768px以上屏幕移除左右padding */
@media (min-width: 769px) {
  .site-main {
    padding-left: 0;
    padding-right: 0;
  }
}

.grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 2fr);
  gap: 1.5rem;
}

/* 当只有文章列表时（没有侧边栏），文章列表占据100%宽度 */
.grid-layout:has(> .post-list:only-child) {
  grid-template-columns: 1fr;
}

.grid-layout:has(> .post-list:only-child) .post-list {
  grid-column: 1 / -1;
}

.post-list {
  display: line-grid;
  gap: clamp(1.35rem, 3vw, 2.2rem);
}
.post-list.post {
  overflow: hidden;
}

.summary-card {
  padding: clamp(1rem, 8px, 1.6rem);
  border-radius: 24px;
  background: var(--bg-alt);
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.summary-card h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.3em;
}

.summary-card h2 a {
  color: var(--text);
}

.summary-card h2 a:hover {
  color: var(--primary);
}

.badge-pinned {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.summary-meta {
  margin: 0.5rem 0 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.summary-meta span {
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  padding: 1px 2px;
}

.summary-meta span a:hover {
  text-decoration: underline;
}

/* 为可点击的文章块添加悬停效果 */
.summary-card[onclick] {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.summary-card[onclick]:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* 移动端触摸效果 */
.summary-card.touch-active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
  background: var(--primary-soft);
}

/* 移动端点击反馈 */
@media (hover: none) and (pointer: coarse) {
  .summary-card[onclick] {
    cursor: pointer;
  }

  .summary-card[onclick]:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* 文章描述分隔线 */
.summary-divider {
  margin: 8px 0;
  border: none;
  border-top: 1px solid var(--border);
  opacity: 0.6;
}

.summary-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.7;
}

.summary-footer {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.summary-footer span {
  color: var(--muted);
  font-size: 0.9rem;
}

.summary-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.25rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.summary-link:hover {
  background: var(--primary-strong);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.summary-link:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 7rem;
  align-self: start;
  max-height: calc(100vh - 4rem);
}

/* 当有关于我们或联系我们模块时，高度自适应 */
.sidebar-card {
  padding: clamp(1.35rem, 4vw, 2.25rem);
  border-radius: 24px;
  background: var(--bg-alt);
  box-shadow: var(--shadow-md);
}

/* 当只有标签模块时，标签模块高度100% */
.sidebar-card:only-child {
  height: 100%;
}

/* 当有关于我们或联系我们模块时，所有卡片平均分配高度 */
.sidebar-card:not(:only-child) {
  /* flex: 1; */
  /* min-height: 0; 允许flex项目收缩 */
}

.sidebar-card h2 {
  margin: 0;
  font-size: 1.1rem;
  margin-bottom: 20px;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.sidebar-card li a {
  color: var(--primary);
  font-weight: 600;
}

.tag-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.tag-chip:hover {
  background: var(--primary-strong);
  color: #fff;
}

.tag-header,
.tags-header,
.category-header {
  margin-bottom: 1.1rem;
}

.tag-header h1,
.tags-header h1,
.category-header h1 {
  margin: 0;
  font-size: 1.2rem;
}

.tag-header p,
.tags-header p,
.category-header p {
  font-style: italic;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.tag-gallery {
  display: grid;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.tag-card {
  border-radius: 22px;
  padding: clamp(1.35rem, 4vw, 2.35rem);
  background: var(--bg-alt);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 0.8rem;
}

.tag-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.tag-card a {
  color: var(--primary);
  font-weight: 600;
}

.chip-group,
.chip {
  display: inline-flex;
}

.chip-group {
  gap: 0.45rem;
  flex-wrap: wrap;
}

.chip {
  padding: 6px;
  font-size: 0.85rem !important;
  line-height: 0.85rem !important;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.post-card {
  width: 100%;
  padding: clamp(1.85rem, 5vw, 3rem);
  border-radius: 30px;
  background: var(--bg-alt);
}

.post-header {
  display: grid;
  gap: 0.85rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.6rem;
  margin-bottom: 1.9rem;
}

.post-breadcrumb {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.post-breadcrumb a {
  color: inherit;
}

.post-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1.2;
}

.post-meta {
  margin: 0;
  color: var(--muted);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
  vertical-align: middle;
}

.post-content {
  width: 100%;
  gap: 1.35rem;
  font-size: 1rem;
  overflow-x: hidden;
}

.post-content * {
  max-width: 100%;
  overflow-x: auto;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-content img {
  cursor: pointer;
  max-width: 100%;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  display: block;
  margin: 10px 0;
}

.post-content pre {
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  padding: 1rem 1.3rem;
  border-radius: 18px;
  overflow-x: auto;
  font-size: 0.95rem;
}

.post-content code {
  background: rgba(37, 99, 235, 0.16);
  color: var(--primary);
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  font-size: 0.92rem;
}

.post-secondary {
  display: grid;
  gap: 1.4rem;
  margin-top: 2rem;
}

.post-secondary .sidebar-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.post-secondary .sidebar-card li a {
  color: var(--primary);
  font-weight: 600;
}

.site-footer {
  margin-top: auto;
  padding: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  border-top: 1px solid var(--border);
}

/* 分类页面全宽度布局 */
.category-page .grid-layout {
  grid-template-columns: 1fr;
}

.category-page .post-list,
.tags-page .post-list {
  max-width: none;
}

/* 分类页面隐藏侧边栏 */
.category-page .sidebar {
  display: none;
}

/* 标签页面保持一栏布局 */
.tags-page .grid-layout {
  grid-template-columns: 1fr;
}

/* 标签页面侧边栏高度100% */
.tags-page .sidebar {
  height: 100%;
}

.tags-page .sidebar-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 空状态样式 */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--bg-alt);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.6;
}

.empty-state h3 {
  margin: 0 0 1rem 0;
  font-size: 1.5rem;
  color: var(--text);
  font-weight: 600;
}

.empty-state p {
  margin: 0 0 2rem 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.empty-link {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.2s ease;
}

.empty-link:hover {
  background: var(--primary-strong);
  transform: translateY(-2px);
}

@media (max-width: 1080px) {
  .grid-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .site-header {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 1.25rem;
  }

  .brand {
    justify-self: center;
  }

  .site-nav {
    justify-self: center;
  }

  .theme-switch {
    justify-self: center;
  }

  .sidebar {
    order: -1;
    margin-bottom: 2rem;
  }

  .tag-gallery {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 720px) {
  .post-content img {
    width: 100%;
  }

  .summary-card {
    padding: clamp(1.25rem, 6vw, 1.9rem);
  }

  .site-header {
    padding-inline: clamp(1rem, 5vw, 1.5rem);
  }

  .site-nav {
    gap: 0.6rem;
  }

  .nav-link {
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
  }

  .brand-title {
    font-size: clamp(1.5rem, 4vw, 1.8rem);
  }

  .brand-logo {
    width: clamp(32px, 8vw, 44px);
    height: clamp(32px, 8vw, 44px);
  }

  .post-title {
    font-size: clamp(1.6rem, 5vw, 2rem);
  }

  .article-title {
    font-size: clamp(1.8rem, 6vw, 2.2rem);
  }

  .tag-gallery {
    grid-template-columns: 1fr;
  }

  .tag-card {
    padding: clamp(1rem, 5vw, 1.5rem);
  }

  .sidebar-card {
    padding: clamp(1rem, 5vw, 1.5rem);
  }

  .post-meta {
    align-items: flex-start;
    gap: 0.3rem;
  }

  .summary-meta {
    align-items: flex-start;
    gap: 0.3rem;
  }
}

/* 上一篇下一篇导航 */
.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-navigation .nav-link {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
  background: var(--primary-soft);
  color: var(--primary);
  gap: 0.5rem;
}

.post-navigation .nav-link.prev-link {
  text-align: left;
  justify-content: flex-start;
}

.post-navigation .nav-link.next-link {
  text-align: right;
  justify-content: flex-end;
}

.post-navigation .nav-link:not(.disabled):hover {
  background: var(--primary-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.post-navigation .nav-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.post-navigation .nav-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-navigation .nav-link.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.post-navigation .nav-link.disabled .nav-title {
  color: var(--muted);
}

/* 移动端适配 */
@media (max-width: 720px) {
  .post-navigation {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
  }

  .post-navigation .nav-link {
    padding: 0.875rem;
  }

  .post-navigation .nav-title {
    font-size: 0.95rem;
  }
}

/* 移动端抽屉菜单 */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100vh; /* 使用100vh，但通过JavaScript动态调整高度 */
  max-height: 100vh; /* 确保不超过视口高度 */
  background: var(--bg-alt);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: right 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.mobile-drawer.open {
  right: 0;
}

.mobile-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-drawer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mobile-drawer-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.mobile-drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.mobile-drawer-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.75rem;
  border-radius: 0.5rem;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  font-size: 1.5rem;
  font-weight: bold;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.mobile-drawer-close:hover {
  background: var(--primary-soft);
  color: var(--primary);
  transform: scale(1.1);
}

.mobile-drawer-close:active {
  transform: scale(0.95);
}

.mobile-drawer-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.mobile-drawer-nav {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.mobile-nav-section {
  margin-bottom: 1.5rem;
}

.mobile-nav-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mobile-drawer-nav .nav-link {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  transition: background 0.2s ease, transform 0.2s ease;
  margin-bottom: 0.5rem;
}

.mobile-drawer-nav .nav-link:hover {
  background: var(--primary-strong);
  color: #fff;
  transform: translateX(4px);
}

.mobile-drawer-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-radius: 0.75rem;
  background: var(--primary-soft);
  color: var(--primary);
  border: 2px solid var(--primary-strong);
  margin-top: auto;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
  flex-shrink: 0;
}

.mobile-drawer-theme-label {
  font-weight: 600;
}

/* 移动端抽屉中的主题切换开关样式 */
.mobile-drawer-theme .theme-switch {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.mobile-drawer-theme .theme-switch input {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: auto !important;
  width: 48px !important;
  height: 24px !important;
  margin: 0 !important;
  cursor: pointer;
  z-index: 2;
  top: 0;
  right: 0;
}

.mobile-drawer-theme .switch-track {
  width: 48px;
  height: 24px;
  border-radius: 999px;
  background: var(--primary-soft);
  display: inline-flex;
  align-items: center;
  padding: 3px;
  transition: background 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  cursor: pointer;
}

.mobile-drawer-theme .switch-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  transition: transform 0.25s ease, background 0.25s ease;
}

.mobile-drawer-theme .theme-switch input:checked + .switch-track {
  background: var(--primary-strong);
  box-shadow: 0 6px 16px rgba(96, 165, 250, 0.25);
}

.mobile-drawer-theme .theme-switch input:checked + .switch-track .switch-thumb {
  transform: translateX(24px);
  background: #fff;
}

/* 移动端抽屉中的分类和标签模块样式 */
.mobile-category-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.mobile-category-list .nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mobile-category-list .nav-link:hover {
  background: var(--primary-strong);
  color: #fff;
  transform: translateX(4px);
}

.mobile-category-list .no-categories-text {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: var(--primary-soft);
  color: var(--muted);
  font-style: italic;
  text-align: center;
  font-size: 0.9rem;
}

.mobile-tag-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.mobile-tag-flow .tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mobile-tag-flow .tag-chip:hover {
  background: var(--primary-strong);
  color: #fff;
  transform: translateY(-1px);
}

.mobile-tag-flow .nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mobile-tag-flow .nav-link:hover {
  background: var(--primary-strong);
  color: #fff;
  transform: translateY(-1px);
}

.mobile-tag-flow .no-tags-text {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: var(--primary-soft);
  color: var(--muted);
  font-style: italic;
  text-align: center;
  width: 100%;
  font-size: 0.9rem;
}

/* 深色模式下的移动端主题切换样式 */
html[data-theme="dark"] .mobile-drawer-theme {
  background: var(--primary-soft);
  border: 2px solid var(--primary-strong);
  color: var(--primary);
}

html[data-theme="dark"] .mobile-drawer-theme .switch-track {
  background: var(--primary-soft);
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2);
}

html[data-theme="dark"] .mobile-drawer-theme .switch-thumb {
  background: var(--primary);
}

html[data-theme="dark"]
  .mobile-drawer-theme
  .theme-switch
  input:checked
  + .switch-track {
  background: var(--primary-strong);
  box-shadow: 0 6px 16px rgba(96, 165, 250, 0.35);
}

.mobile-menu-button {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  background: var(--bg);
  color: #777;
  border: none;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease,
    background-color 0.2s ease;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-button svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.mobile-menu-button:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
  background: var(--primary-strong);
}

.mobile-menu-button:active {
  transform: scale(0.95);
}

@media (max-width: 1080px) {
  /* 在1080px以下，标签页和分类页的侧边栏单独一行显示 */
  .tags-page .grid-layout,
  .category-page .grid-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .tags-page .sidebar,
  .category-page .sidebar {
    order: 1;
    margin-bottom: 2rem;
  }

  .tags-page .post-list,
  .category-page .post-list {
    order: 2;
  }
}

@media (max-width: 768px) {
  .mobile-menu-button {
    display: flex !important;
    position: static;
    width: 44px;
    height: 44px;
    margin-left: 0.5rem;
    animation: none;
  }

  .site-nav {
    display: none !important;
  }

  .theme-switch {
    display: none !important;
  }

  .site-header-box {
    justify-content: space-between;
    align-items: center;
  }

  .brand {
    justify-self: flex-start;
    flex-direction: row;
    gap: clamp(0.5rem, 2vw, 1rem);
  }

  .nav-link {
    padding: 0.35rem 0.8rem;
    font-size: 0.9rem;
  }

  /* 在768px以下隐藏标签页、分类页和首页的侧边栏，避免拥挤 */
  .tags-page .sidebar,
  .category-page .sidebar,
  .site-main .sidebar {
    display: none;
  }

  .tags-page .grid-layout,
  .category-page .grid-layout,
  .site-main .grid-layout {
    grid-template-columns: 1fr;
  }

  /* 移动端抽屉菜单样式调整 */
  .mobile-drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .mobile-nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .mobile-nav-section-title {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
  }

  .mobile-category-list,
  .mobile-tag-flow {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .mobile-category-list .nav-link,
  .mobile-tag-flow .tag-chip {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    text-decoration: none;
    transition: background-color 0.2s ease;
  }

  .mobile-category-list .nav-link:hover,
  .mobile-tag-flow .tag-chip:hover {
    background: var(--primary-strong);
    color: #fff;
  }

  .no-categories-text,
  .no-tags-text {
    color: var(--muted);
    font-style: italic;
  }
}

/* 为移动端菜单按钮添加脉冲动画 */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.mobile-menu-button {
  animation: pulse 2s infinite;
}

.mobile-menu-button:hover {
  animation: none;
}

/* 深色模式下的移动端菜单按钮优化 */
html[data-theme="dark"] .mobile-menu-button {
  background: var(--bg);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

html[data-theme="dark"] .mobile-menu-button:hover {
  background: var(--primary-strong);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

/* 返回顶部按钮样式 */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  background: var(--gray-600);
  color: white;
  border: none;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
}

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

.back-to-top:hover {
  background: var(--gray-700);
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.back-to-top:active {
  transform: translateY(0);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* 移动端抽屉按钮样式优化 */
.mobile-menu-button {
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
}

.mobile-menu-button svg {
  width: 20px;
  height: 20px;
}

/* 大屏幕时只显示返回顶部按钮 */
@media (min-width: 769px) {
  .mobile-menu-button {
    display: none !important;
  }

  .back-to-top {
    display: flex;
  }
}

/* 小屏幕时显示抽屉按钮，返回顶部按钮在抽屉按钮下方 */
@media (max-width: 768px) {
  .mobile-menu-button {
    display: flex !important;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
  }

  .back-to-top {
    bottom: 5.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
  }

  .back-to-top svg {
    width: 20px;
    height: 20px;
  }
}

/* 超小屏幕尺寸调整 */
@media (max-width: 480px) {
  .mobile-menu-button {
    width: 52px;
    height: 52px;
    bottom: 1.5rem;
    right: 1.5rem;
  }

  .back-to-top {
    width: 52px;
    height: 52px;
    bottom: 6rem;
    right: 1.5rem;
  }

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

  .mobile-menu-button svg {
    width: 24px;
    height: 24px;
  }
}

/* 深色模式下的返回顶部按钮 */
html[data-theme="dark"] .back-to-top {
  background: var(--gray-600);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .back-to-top:hover {
  background: var(--gray-700);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

@media (max-width: 480px) {
  .site-header {
    padding: 1rem;
    gap: 1rem;
  }

  .brand-title {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
  }

  .brand-logo {
    width: 28px;
    height: 28px;
  }

  .post-title {
    font-size: 1.4rem;
  }

  .article-title {
    font-size: 1.6rem;
  }

  .summary-card h2 {
    font-size: 1.2rem;
  }

  .tag-header h1,
  .tags-header h1 {
    font-size: 1.6rem;
  }

  .tag-chip {
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
  }

  .mobile-drawer {
    width: 280px;
    right: -280px;
  }

  .mobile-menu-button {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
  }
}

/* PC端：电话显示为普通文本 */
@media (min-width: 769px) {
  .contact-phone:hover {
    color: default;
    text-decoration: none;
  }
}

/* 移动端：电话显示为可点击链接 */
@media (max-width: 768px) {
  .contact-phone {
    color: var(--primary);
  }
}
.anchor-level {
  font-size: 0.95rem;
  line-height: 0.95rem;
  width: 100%;
  margin: 0;
}
.anchor-level-1 {
  font-weight: 600;
  padding: 0 0 0.25rem 0;
}
.anchor-level-2 {
  padding: 0 0 0.25rem 1rem;
}
.anchor-level-3 {
  padding: 0 0 0.25rem 2rem;
}
.anchor-level-4 {
  padding: 0 0 0.25rem 3rem;
}
.anchor-level-5 {
  padding: 0 0 0.25rem 4rem;
}
.anchor-level-6 {
  padding: 0 0 0.25rem 5rem;
}
.anchor-link {
  display: block;
  color: var(--muted);
  font-size: 0 ninerem;
  text-decoration: none;
  transition: color 0.2s ease;
}
