/* ============================================
   CSS变量定义 - 文章页专用
   ============================================ */

:root {
  --primary: #165dff;
  --primary-light: #4b85ff;
  --primary-strong: #0d42c6;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-tertiary: #6b7280;
  --text-muted: #9ca3af;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --border-light: rgba(17, 24, 39, 0.08);
  --border-medium: rgba(17, 24, 39, 0.12);
  --shadow-sm: 0 2px 8px rgba(15, 39, 71, 0.06);
  --shadow-md: 0 10px 24px rgba(15, 39, 71, 0.1);
  --shadow-lg: 0 22px 54px rgba(15, 39, 71, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  background: radial-gradient(circle at top left, rgba(22, 93, 255, 0.16), transparent 24%),
    radial-gradient(circle at bottom right, rgba(14, 66, 194, 0.08), transparent 18%),
    linear-gradient(135deg, #f3f7fc, #f9fbff 58%, #ebf1fb);
  min-height: 100vh;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

/* ============================================
   站点头部样式 - 兼容旧模板
   ============================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 14px rgba(15, 39, 71, 0.08);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  flex: 1;
  min-width: 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  font-size: clamp(20px, 2vw, 24px);
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.04em;
  text-decoration: none;
}

.logo::before {
  content: "▤";
  color: #ff785a;
}

.logo::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #ff785a);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-left: auto;
  border: 1px solid rgba(22, 93, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-primary);
  box-shadow: 0 10px 24px rgba(15, 39, 71, 0.08);
  cursor: pointer;
}

.menu-toggle svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-width: 0;
}

.nav-links a {
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.active {
  color: var(--primary);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, #165dff, #0d42c6);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(13, 66, 198, 0.22);
  transition: transform 0.2s ease;
}

.nav-btn:hover {
  transform: translateY(-2px);
}

/* 无障碍隐藏文本 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   站点底部样式 - 兼容旧模板
   ============================================ */

.site-footer {
  margin-top: 30px;
  padding: 24px 24px 34px;
  background: #0f1728;
  color: rgba(255, 255, 255, 0.88);
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.site-footer p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.68);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-links a {
  color: #fff;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--primary-light);
}

/* ============================================
   浮动联系按钮 - 兼容旧模板
   ============================================ */

.floating-contact {
  position: fixed;
  right: 18px;
  bottom: 24px;
  z-index: 1100;
  display: grid;
  gap: 12px;
}

.floating-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, #165dff, #0d42c6);
  color: #fff;
  box-shadow: 0 20px 38px rgba(13, 66, 198, 0.26);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.floating-item:hover,
.floating-item:focus-visible {
  transform: translateY(-2px);
}

.floating-icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* ============================================
   文章页布局样式
   ============================================ */

.article-wrapper {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  gap: 24px;
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 24px;
}

/* 文章目录 */
.article-toc {
  position: sticky;
  top: 80px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.toc-inner {
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.article-toc h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text-primary);
}

.article-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-toc li {
  margin: 4px 0;
}

.article-toc a {
  display: block;
  padding: 6px 10px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.article-toc a:hover,
.article-toc a.active {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
}

/* 文章内容 */
.article-content {
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  min-width: 0;
}

.article-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

.article-header h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  margin: 0 0 12px;
  color: var(--text-primary);
  line-height: 1.3;
}

.article-meta {
  display: flex;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-top: 16px;
}

.article-section {
  margin-bottom: 32px;
}

.article-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-light);
}

.article-section h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 20px 0 12px;
  color: var(--text-primary);
}

.article-section p {
  line-height: 1.8;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.article-section ul,
.article-section ol {
  padding-left: 20px;
  margin: 0 0 16px;
}

.article-section li {
  margin: 8px 0;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* 数据表格 */
.data-table-wrapper {
  overflow-x: auto;
  margin: 20px 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border: 1px solid var(--border-light);
}

.data-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.data-table td {
  color: var(--text-secondary);
}

.data-table tr:nth-child(even) {
  background: var(--bg-secondary);
}

/* 侧边栏 */
.article-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-card {
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.sidebar-card h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text-primary);
}

.sidebar-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 12px;
}

/* 文章操作按钮 */
.article-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.wechat-card {
  position: fixed;
  right: 92px;
  bottom: 24px;
  z-index: 1100;
  width: min(220px, calc(100vw - 120px));
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: 0 22px 54px rgba(15, 39, 71, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.wechat-card.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.wechat-card img {
  width: 100%;
  border-radius: 14px;
}

.wechat-card p {
  margin-top: 10px;
  color: #243248;
  text-align: center;
  line-height: 1.7;
}

/* ============================================
   文章页特定样式 - 兼容旧模板
   ============================================ */

.article-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  margin-bottom: 16px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

.breadcrumbs a {
  color: var(--text-tertiary);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--primary);
}

.breadcrumbs span {
  color: var(--text-muted);
}

.article-desc {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-top: 12px;
}

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

.related-card {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
}

.related-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.related-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.related-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
}

.related-card h3 a {
  color: var(--text-primary);
  text-decoration: none;
}

.related-card h3 a:hover {
  color: var(--primary);
}

.prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.prev-next .prev,
.prev-next .next {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-light);
}

.prev-next .next {
  text-align: right;
}

.prev-next span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.prev-next a {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.prev-next a:hover {
  color: var(--primary);
}

.sidebar-list {
  list-style: none;
}

.sidebar-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-list li:last-child {
  border-bottom: none;
}

.sidebar-list a {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  text-decoration: none;
}

.sidebar-list a:hover {
  color: var(--primary);
}

.sidebar-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: linear-gradient(180deg, #165dff, #0d42c6);
  color: #fff;
  text-align: center;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.sidebar-btn:hover {
  transform: translateY(-2px);
}

.info-box {
  margin: 24px 0;
  padding: 16px 20px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 12px;
  border-left: 4px solid var(--primary);
}

.info-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--primary);
  font-weight: 600;
}

.warning-box {
  margin: 24px 0;
  padding: 16px 20px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 12px;
  border-left: 4px solid #f59e0b;
}

.warning-box strong {
  display: block;
  margin-bottom: 8px;
  color: #b45309;
  font-weight: 600;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.action-btn.primary {
  background: linear-gradient(180deg, #165dff, #0d42c6);
  color: #fff;
  box-shadow: 0 10px 24px rgba(13, 66, 198, 0.22);
}

.action-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(13, 66, 198, 0.3);
}

.action-btn.secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.action-btn.secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-medium);
}

/* ============================================
   响应式调整 - 兼容旧模板
   ============================================ */

@media (max-width: 1024px) {
  .article-wrapper {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .article-toc {
    position: relative;
    top: 0;
    max-height: none;
    order: 2;
  }

  .article-content {
    order: 1;
  }

  .article-sidebar {
    order: 3;
  }
}

@media (max-width: 760px) {
  .nav {
    position: relative;
    padding: 12px 16px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .nav-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 16px;
    right: 16px;
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(17, 24, 39, 0.08);
    box-shadow: 0 18px 42px rgba(15, 39, 71, 0.16);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .nav-panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .nav-links a {
    padding: 10px 14px;
    border-radius: 10px;
  }

  .nav-links a:hover,
  .nav-links a.active {
    background: rgba(37, 99, 235, 0.08);
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .site-footer {
    padding: 20px 16px;
  }

  .footer-links {
    justify-content: center;
  }

  .floating-contact {
    right: 12px;
    bottom: 18px;
  }

  .floating-item {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  .wechat-card {
    right: 74px;
    bottom: 18px;
    width: min(190px, calc(100vw - 98px));
  }

  .article-wrapper {
    padding: 0 16px;
    margin: 16px auto;
  }

  .article-content {
    padding: 20px;
  }

  .article-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
  }

  .article-section {
    margin-bottom: 24px;
  }

  .prev-next {
    grid-template-columns: 1fr;
  }

  .prev-next .next {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .related-grid {
    grid-template-columns: 1fr;
  }

  .site-footer {
    padding: 16px;
  }
}
