/* ===========================================
   VARIABLES - 颜色与主题变量
   =========================================== */
:root {
  /* 亮色主题 */
  --bg-primary: #FAFAFA;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F5F2ED;
  --text-primary: #1A1A1A;
  --text-secondary: #4A4A4A;
  --text-muted: #909090;
  --accent: #8B2942;
  --accent-hover: #6B1F32;
  --accent-subtle: #FDF2F4;
  --accent-light: #C4A35A;
  --border: #E5E5E0;
  --shadow-hover: rgba(139, 41, 66, 0.15);
}

[data-theme="dark"] {
  /* 暗色主题 */
  --bg-primary: #181818;
  --bg-secondary: #222222;
  --bg-tertiary: #2A2A2A;
  --text-primary: #F0F0F0;
  --text-secondary: #B8B8B8;
  --text-muted: #707070;
  --accent: #D4536D;
  --accent-hover: #E87A8E;
  --accent-subtle: #2E1F24;
  --accent-light: #D4AF37;
  --border: #333333;
  --shadow-hover: rgba(212, 83, 109, 0.2);
}

/* ===========================================
   BASE - 基础样式
   =========================================== */
* {
  transition: background-color 0.25s, border-color 0.25s, color 0.25s, box-shadow 0.25s;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  line-height: 1.7;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ===========================================
   HEADER - 顶部导航栏
   =========================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 250, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .site-header {
  background: rgba(24, 24, 24, 0.95);
}

.mobile-nav {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s;
}

.mobile-nav.open {
  max-height: 300px;
}

/* ===========================================
   NAVIGATION - 导航链接
   =========================================== */
.nav-link {
  position: relative;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent);
  transition: width 0.2s;
}

.nav-link:hover::after {
  width: 100%;
}

/* ===========================================
   BUTTONS - 按钮样式
   =========================================== */
.btn-primary {
  background: var(--accent);
  color: white;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow-hover);
}

.btn-ghost {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 10px 20px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-ghost:hover {
  background: var(--accent);
  color: white;
}

.theme-btn {
  background: var(--bg-tertiary);
  transition: transform 0.3s, background-color 0.2s;
}

.theme-btn:hover {
  transform: rotate(12deg) scale(1.05);
  background: var(--accent-subtle);
}

/* ===========================================
   SOCIAL ICONS - 社交图标
   =========================================== */
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s;
}

.social-icon:hover {
  background: var(--accent);
  color: white;
  transform: translateY(-2px);
}

/* ===========================================
   HERO - 首屏区域
   =========================================== */
.hero {
  padding: 0;
  min-height: 320px;
  position: relative;
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(24, 24, 24, 0.5) 0%,
    rgba(24, 24, 24, 0.1) 60%,
    rgba(24, 24, 24, 0.05) 100%
  );
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 320px;
  padding: 32px 0;
}

.hero-text {
  background: rgba(24, 24, 24, 0.3);
  backdrop-filter: blur(1px);
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 480px;
}

.hero-svg {
  position: absolute;
  transform: translate(0, -50%);
  top: 50%;
  right: 2rem;
  width: 480px;
  height: auto;
  z-index: 2;
}

/* ===========================================
   CARDS - 卡片组件
   =========================================== */
.article-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow-hover);
  border-color: var(--accent);
}

.article-card:hover .article-title {
  color: var(--accent);
}

.ranking-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color 0.2s;
}

.ranking-item:last-child {
  border-bottom: none;
}

.ranking-item:hover {
  background: var(--bg-tertiary);
}

.ranking-num {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ranking-num.top3 {
  background: var(--accent);
  color: white;
}

/* ===========================================
   TAGS - 标签
   =========================================== */
.tag {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all 0.2s;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
}

.tag:hover {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent);
}

/* ===========================================
   TABS - 分类标签
   =========================================== */
.cat-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.cat-tab:hover,
.cat-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ===========================================
   TYPOGRAPHY - 排版
   =========================================== */
.section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-primary);
}

.section-title::before {
  content: '// ';
  color: var(--accent);
  margin-right: 4px;
}

.badge-pill {
  background: var(--accent-subtle);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
}

.article-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
  transition: color 0.2s;
}

/* ===========================================
   LAYOUT - 布局
   =========================================== */
.two-col {
  display: flex;
  gap: 24px;
}

.main-col {
  flex: 1;
  min-width: 0;
}

.side-col {
  width: 260px;
  flex-shrink: 0;
}

.deco-line {
  height: 1px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    transparent 80%
  );
}

/* ===========================================
   UTILITIES - 工具类
   =========================================== */
.view-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.view-count .num {
  color: var(--accent);
  font-weight: 600;
}

/* ===========================================
   RESPONSIVE - 响应式
   =========================================== */
@media (max-width: 1024px) {
  /* 移动端布局 */
  .side-col {
    display: none;
  }

  .two-col {
    flex-direction: column;
  }

  .hero-inner {
    height: 22rem;
    flex-direction: column;
  }

  .hero-text {
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(24, 24, 24, 0.8);
    backdrop-filter: blur(0px);
    width: 100%;
    padding: 2em;
    z-index: 4;
  }

  .hero-svg {
    position: absolute;
    bottom: -2rem;
    right: 0rem;
    width: auto;
    height: 16rem;
    z-index: 3;
  }
}

/* ===========================================
   ANIMATIONS - 动画
   =========================================== */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

.cursor-blink {
  animation: blink 1s infinite;
}

.fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.heart-anim {
  animation: heartPulse 2s ease-in-out infinite;
}
/* ===========================================
   ARTICLE - 文章内容页
   =========================================== */
.article-body {
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  line-height: 1.8;
}

.article-body h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
  color: var(--text-primary);
}

.article-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  color: var(--text-primary);
}

.article-body p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 15px;
}

.article-body code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent);
}

.article-body pre {
  background: #1a1a1a;
  border-radius: 8px;
  padding: 16px;
  margin: 1rem 0;
  overflow-x: auto;
}

.article-body pre code {
  background: none;
  padding: 0;
  color: #E8E4DF;
}

.article-body ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1rem;
}

.article-body ul li {
  padding: 4px 0;
  padding-left: 20px;
  position: relative;
  color: var(--text-secondary);
}

.article-body ul li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 1rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.article-toc {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.article-toc a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
}

.article-toc a:hover {
  color: var(--accent);
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.article-nav a {
  flex: 1;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.article-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===========================================
   LOAD MORE
   =========================================== */
.load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.load-more-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===========================================
   RELATED CARDS
   =========================================== */
.related-card {
  display: block;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  transition: all 0.2s;
}
.related-card:hover {
  border-color: var(--accent);
}

/* ===========================================
   ARTICLE NAVIGATION (prev/next)
   =========================================== */
.article-nav {
  display: flex;
  gap: 12px;
  margin-top: 2rem;
}
.article-nav a {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  transition: all 0.2s;
  text-decoration: none;
}
.article-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.article-nav .nav-next {
  justify-content: flex-end;
  text-align: right;
}
.article-nav .nav-arrow {
  font-size: 16px;
  color: var(--text-muted);
}
.article-nav .nav-label {
  font-size: 11px;
  color: var(--text-muted);
}
.article-nav .nav-title {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* ===========================================
   TAG CLOUD
   =========================================== */
.tag-cloud-item {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  text-decoration: none;
  transition: all 0.2s;
  line-height: 1.6;
}
.tag-cloud-item:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}
.tag-cloud-item.active {
  background: var(--accent);
  color: #fff;
}
.tag-count {
  font-size: 0.75em;
  opacity: 0.7;
  margin-left: 2px;
}
