
/* ========== MOBILE OVERFLOW FIX (v3) ========== */

/* Fix body-level horizontal scroll */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

/* Target: .sidebar-card which contains 热门文章 */
.sidebar-card {
    max-width: 100% !important;
    overflow: hidden !important;
}

/* Target: .card-list inside sidebar-card */
.sidebar-card .card-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
}

/* Target: EVERY <a> link inside card-list */
.sidebar-card .card-list a,
.card-list a,
.sidebar-card a {
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    width: 100% !important;
    padding-right: 16px !important; /* space for ellipsis */
    box-sizing: border-box !important;
    line-height: inherit !important;
}

/* Also target any <li> or direct children */
.sidebar-card .card-list > * {
    max-width: 100% !important;
    overflow: hidden !important;
}

/* Generic safety net for any text in sidebar */
.sidebar-card * {
    max-width: 100% !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Mobile-specific: under 768px */
@media (max-width: 768px) {
    .sidebar-card .card-list a,
    .card-list a {
        white-space: normal !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        text-overflow: clip !important;
        overflow: hidden !important;
        line-height: 1.4 !important;
        max-height: 2.8em !important;
        word-break: break-all !important;
    }
}

/* ============================================
   open.azhuge.com — Phase 1 设计系统
   配色 + 排版 + Hero 区域
   ============================================ */

/* --- CSS 变量：设计令牌 --- */
:root {
  /* 主色系：蓝紫渐变 */
  --primary:       #4F6EF7;
  --primary-light: #7B9CFF;
  --primary-dark:  #3A56D4;
  --accent:        #F59E0B;

  /* 中性色 */
  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* 功能色 */
  --success: #10B981;
  --warning: #F59E0B;
  --danger:  #EF4444;

  /* 阴影层次 */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.12);
  --shadow-xl:  0 16px 48px rgba(0,0,0,0.16);

  /* 圆角 */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-full:9999px;

  /* 间距 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12:48px;
  --space-16:64px;

  /* 正文排版 */
  --font-sans:  "PingFang SC","Microsoft YaHei","Helvetica Neue",Arial,sans-serif;
  --font-serif: "Noto Serif SC","Source Han Serif SC","SimSun",serif;
  --font-mono:  "JetBrains Mono","Fira Code","Consolas",monospace;

  --text-base:  16px;
  --text-lg:    18px;
  --text-xl:    20px;
  --text-2xl:   24px;
  --text-3xl:   30px;
  --text-4xl:   36px;
  --leading-body: 1.85;
  --leading-heading: 1.4;
}

/* ============================================
   全局排版
   ============================================ */
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   文章 Hero 区域
   ============================================ */
.article-hero {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-12) var(--space-6) var(--space-8);
  text-align: center;
}

/* 分类 + 阅读时长 */
.article-hero__meta-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  font-size: 13px;
  color: var(--gray-500);
}

.article-hero__category {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}
.article-hero__category:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,110,247,0.35);
  color: white;
}

.article-hero__read-time {
  color: var(--gray-400);
}

/* 标题 */
.article-hero__title {
  font-family: var(--font-sans);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: var(--leading-heading);
  color: var(--gray-900);
  margin: 0 0 var(--space-6);
  letter-spacing: -0.02em;
}

/* 元信息：作者 + 时间 + 浏览量 */
.article-hero__meta-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  font-size: 13px;
  color: var(--gray-500);
}

.article-hero__author {
  display: flex;
  align-items: center;
  gap: 6px;
}
.article-hero__author-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.article-hero__stat {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--gray-400);
}
.article-hero__stat i {
  font-size: 14px;
}

/* 分隔线 */
.article-hero__divider {
  width: 60px;
  height: 3px;
  margin: var(--space-8) auto 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  border: none;
}

/* ============================================
   文章封面图
   ============================================ */
.article-cover {
  max-width: 880px;
  margin: 0 auto var(--space-12);
  padding: 0 var(--space-6);
}
.article-cover__img {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: block;
  transition: transform 0.4s, box-shadow 0.4s;
}
.article-cover__img:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-xl);
}
.article-cover__caption {
  text-align: center;
  font-size: 13px;
  color: var(--gray-400);
  margin-top: var(--space-3);
  font-style: italic;
}

/* ============================================
   文章正文 — 核心排版
   ============================================ */
.article-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-6) var(--space-16);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--gray-700);
}

/* 段落 */
.article-body p {
  margin: 0 0 var(--space-6);
}

/* 首段强调 */
.article-body > p:first-of-type {
  font-size: var(--text-lg);
  color: var(--gray-600);
  font-weight: 400;
}

/* h2 小标题 */
.article-body h2 {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--gray-900);
  margin: var(--space-12) 0 var(--space-4);
  padding-left: var(--space-4);
  border-left: 4px solid var(--primary);
  line-height: var(--leading-heading);
}

/* h3 小标题 */
.article-body h3 {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--gray-800);
  margin: var(--space-8) 0 var(--space-4);
  line-height: var(--leading-heading);
}

/* 引用块 */
.article-body blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-6);
  background: linear-gradient(135deg, rgba(79,110,247,0.04), rgba(245,158,11,0.04));
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--gray-600);
  font-style: italic;
  line-height: var(--leading-body);
}

/* 代码块 */
.article-body pre {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-6);
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  position: relative;
}
.article-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
}

/* 行内代码 */
.article-body code {
  background: var(--gray-100);
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* 链接 */
.article-body a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}
.article-body a:hover {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

/* 列表 */
.article-body ul, .article-body ol {
  margin: var(--space-4) 0;
  padding-left: var(--space-6);
}
.article-body li {
  margin-bottom: var(--space-2);
}

/* 图片 */
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: block;
  margin: var(--space-6) auto;
  transition: transform 0.3s, box-shadow 0.3s;
}
.article-body img:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-md);
}

/* 表格 */
.article-body table {
  width: 100%;
  margin: var(--space-6) 0;
  border-collapse: collapse;
  font-size: 14px;
}
.article-body th {
  background: var(--gray-100);
  font-weight: 600;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
}
.article-body td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--gray-100);
}
.article-body tr:hover td {
  background: var(--gray-50);
}

/* 分隔线 */
.article-body hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gray-200), transparent);
  margin: var(--space-12) 0;
}

/* ============================================
   标签
   ============================================ */
.article-tags {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-6) var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.article-tags__label {
  font-size: 13px;
  color: var(--gray-500);
  margin-right: var(--space-2);
}
.article-tags__tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  background: var(--gray-100);
  color: var(--gray-600);
  border-radius: var(--radius-full);
  font-size: 12px;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.article-tags__tag:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(79,110,247,0.25);
}

/* ============================================
   相关文章 — 升级版卡片
   ============================================ */
.related-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-12) var(--space-6);
}

.related-section__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 var(--space-8);
  text-align: center;
  position: relative;
}
.related-section__title::after {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  margin: var(--space-3) auto 0;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-6);
}

.related-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--gray-100);
}
.related-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.related-card__thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
  transition: transform 0.4s;
}
.related-card:hover .related-card__thumb {
  transform: scale(1.05);
}

.related-card__body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.related-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0 0 var(--space-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card__excerpt {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.6;
  margin: 0 0 var(--space-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.related-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 12px;
  color: var(--gray-400);
  margin-top: auto;
}

/* ============================================
   评论区
   ============================================ */
.comment-section {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-16);
}

.comment-section__title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 var(--space-6);
}

.comment-form__row {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.comment-form__input {
  flex: 1;
  padding: 10px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-sans);
  transition: all 0.2s;
  background: white;
  outline: none;
}
.comment-form__input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,110,247,0.12);
}

.comment-form__textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-sans);
  resize: vertical;
  min-height: 120px;
  transition: all 0.2s;
  background: white;
  outline: none;
  line-height: 1.7;
}
.comment-form__textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,110,247,0.12);
}

.comment-form__submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(79,110,247,0.3);
}
.comment-form__submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79,110,247,0.4);
}
.comment-form__submit:active {
  transform: translateY(0);
}

/* ============================================
   页脚升级
   ============================================ */
.site-footer {
  background: var(--gray-900);
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  padding-top: var(--space-12);
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-12);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-brand h3 {
  color: white;
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 var(--space-4);
  letter-spacing: -0.02em;
}

.footer-brand p {
  line-height: 1.8;
  margin: 0 0 var(--space-4);
}

.footer-brand__logo {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-3);
}

.footer-col h4 {
  color: white;
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 var(--space-4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: var(--space-3);
}

.footer-col a {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  transition: color 0.2s;
  font-size: 13px;
}
.footer-col a:hover {
  color: var(--primary-light);
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 768px) {
  .article-hero {
    padding: var(--space-8) var(--space-4) var(--space-6);
  }
  .article-hero__title {
    font-size: var(--text-2xl);
  }
  .article-hero__meta-bottom {
    flex-wrap: wrap;
    gap: var(--space-3);
  }
  .article-body {
    padding: 0 var(--space-4) var(--space-12);
    font-size: 15px;
  }
  .related-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  .comment-form__row {
    flex-direction: column;
  }
}



/* ============================================
   Phase 2: 导航栏升级
   ============================================ */
.site-nav {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.site-nav .nav-item a {
  position: relative;
  color: var(--gray-700);
  font-weight: 500;
  padding: 8px 16px;
  transition: color 0.25s;
}
.site-nav .nav-item a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: translateX(-50%);
  transition: width 0.25s ease;
}
.site-nav .nav-item a:hover {
  color: var(--primary);
}
.site-nav .nav-item a:hover::after,
.site-nav .nav-item.active a::after {
  width: 70%;
}

/* Logo */
.site-logo {
  font-size: 20px !important;
  font-weight: 800 !important;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 搜索框 */
.site-search input {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-full);
  padding: 8px 18px 8px 36px;
  font-size: 13px;
  outline: none;
  transition: all 0.25s;
  width: 180px;
}
.site-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,110,247,0.08);
  width: 260px;
}

/* 登录/注册按钮 */
.btn-login {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 18px;
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
}
.btn-login:hover {
  background: var(--primary);
  color: white;
}

/* ============================================
   Phase 2: 标签云统一色调
   ============================================ */
.tag-cloud {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-6) 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.tag-cloud a {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  text-decoration: none;
  transition: all 0.25s;
  border: 1px solid var(--gray-200);
  color: var(--gray-500);
}
.tag-cloud a:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(79,110,247,0.25);
}
.tag-cloud a:nth-child(5n+1):hover { background:#6366F1; border-color:#6366F1; }
.tag-cloud a:nth-child(5n+2):hover { background:#8B5CF6; border-color:#8B5CF6; }
.tag-cloud a:nth-child(5n+3):hover { background:#EC4899; border-color:#EC4899; }
.tag-cloud a:nth-child(5n+4):hover { background:#F59E0B; border-color:#F59E0B; }
.tag-cloud a:nth-child(5n+5):hover { background:#10B981; border-color:#10B981; }

/* ============================================
   Phase 2: 热门文章列表升级
   ============================================ */
.hot-list {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  list-style: none;
}
.hot-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.2s;
}
.hot-list li:hover { background: var(--gray-50); }

.hot-list__rank {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.hot-list li:nth-child(1) .hot-list__rank { background:#FFF3CD; color:#B8860B; }
.hot-list li:nth-child(2) .hot-list__rank { background:#E8EEFF; color:#4A6CF7; }
.hot-list li:nth-child(3) .hot-list__rank { background:#FFE8ED; color:#E74C8C; }
.hot-list li:nth-child(n+4) .hot-list__rank { background:var(--gray-100); color:var(--gray-400); }

.hot-list__title {
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
}
.hot-list__title a {
  color: var(--gray-700);
  text-decoration: none;
}
.hot-list__title a:hover {
  color: var(--primary);
}

/* ============================================
   Phase 3: 滚动进度条
   ============================================ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 9999;
  transition: width 0.05s linear;
  pointer-events: none;
}

/* ============================================
   Phase 3: 回到顶部按钮
   ============================================ */
.back-to-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 4px 16px rgba(79,110,247,0.35);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 22px rgba(79,110,247,0.45);
}

/* ============================================
   Phase 3: 文章目录 TOC
   ============================================ */
.article-toc {
  position: fixed;
  left: calc((100vw - 1200px)/2 - 190px);
  top: 200px;
  width: 170px;
  z-index: 100;
}
.article-toc__title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 var(--space-3);
}
.article-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--gray-200);
}
.article-toc li {
  position: relative;
  margin: 0;
  padding-left: var(--space-3);
}
.article-toc li::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-300);
  transition: all 0.2s;
}
.article-toc li.active::before {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,110,247,0.2);
}
.article-toc li.active > a {
  color: var(--primary);
  font-weight: 700;
}
.article-toc a {
  display: block;
  font-size: 13px;
  color: var(--gray-500);
  text-decoration: none;
  padding: 4px 0;
  line-height: 1.5;
  transition: color 0.2s;
}
.article-toc a:hover { color: var(--primary); }

@media(max-width:1400px){ .article-toc{display:none;} }

/* ============================================
   Phase 3: 面包屑美化
   ============================================ */
.breadcrumb {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--gray-500);
}
.breadcrumb a {
  color: var(--gray-500);
  text-decoration: none;
  transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .separator { color: var(--gray-300); }
.breadcrumb .current { color: var(--gray-700); font-weight: 500; }

/* ============================================
   动画关键帧
   ============================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 4px 12px rgba(79,110,247,0.3); }
  50% { box-shadow: 0 4px 24px rgba(79,110,247,0.45); }
}

.article-hero { animation: fadeInUp 0.6s ease-out; }
.article-cover { animation: fadeInUp 0.6s ease-out 0.1s both; }
.article-body { animation: fadeInUp 0.6s ease-out 0.2s both; }
.related-card { animation: fadeInUp 0.5s ease-out both; }
.related-card:nth-child(2) { animation-delay: 0.1s; }
.related-card:nth-child(3) { animation-delay: 0.2s; }


/* ============================================
   移动端文本溢出修复 — 紧急补丁
   ============================================ */

/* 热门文章列表：强制截断 */
.hot-list {
  max-width: 100%;
  overflow: hidden;
}
.hot-list li {
  min-width: 0; /* 关键：让 flex 子项可以收缩 */
  width: 100%;
  box-sizing: border-box;
}
.hot-list__title {
  min-width: 0; /* 允许收缩 */
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;  /* 单行省略号 */
  word-break: normal;
  overflow-wrap: break-word;
}

/* 如果需要显示多行，用下面这个替代上面的 white-space nowrap */
/* .hot-list__title { */
/*   display: -webkit-box; */
/*   -webkit-line-clamp: 2; */
/*   -webkit-box-orient: vertical; */
/*   white-space: normal; */
/* } */

/* 相关文章卡片标题：已有 line-clamp，确保生效 */
.related-card__title {
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
  overflow-wrap: break-word;
}
.related-card__excerpt {
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
  overflow-wrap: break-word;
}

/* 面包屑：防止长标题撑破 */
.breadcrumb {
  max-width: 100vw;
  overflow: hidden;
  padding-left: 12px;
  padding-right: 12px;
}
.breadcrumb .current {
  max-width: 50vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}

/* 文章 Hero 标题 */
.article-hero__title {
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* 评论输入框 */
.comment-form__input,
.comment-form__textarea {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* 标签云 */
.tag-cloud {
  max-width: 100%;
}
.tag-cloud a {
  max-width: 45vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 10px;
  font-size: 11px;
}

/* 全局安全网：所有可能溢出的文字元素 */
a, h1, h2, h3, h4, p, li, span {
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* 图片防溢出 */
img {
  max-width: 100%;
  height: auto;
}

/* 移动端专项 */
@media(max-width: 768px) {
  .hot-list__title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.5;
  }
  
  .related-grid {
    grid-template-columns: 1fr;
  }
  
  .article-body {
    font-size: 15px;
    word-break: break-word;
  }
  
  .article-hero__meta-bottom {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  /* 容器加内边距，防止内容贴边 */
  .hot-list {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  .related-section {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  .comment-section {
    padding-left: 16px;
    padding-right: 16px;
  }
}


/* ============================================
   手机端文字溢出精准修复（v2 - 用正确选择器）
   实际HTML结构: .sidebar-card > .card-list > a
   ============================================ */

/* 侧边栏卡片（热门文章/热门标签） */
.sidebar-card {
  max-width: 100%;
  overflow: hidden;
}

/* 热门文章列表项 — 核心修复 */
.card-list {
  max-width: 100% !important;
  overflow: hidden !important;
}
.card-list div,
.card-list a {
  display: block;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;       /* 单行省略号 */
  word-break: break-all !important;    /* 强制断长词 */
  overflow-wrap: break-word !important;
  box-sizing: border-box !important;
  padding-right: 16px !important;      /* 给省略号留空间 */
}

/* 移动端：允许两行 */
@media(max-width:768px){
  .card-list a {
    white-space: normal !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    line-height: 1.5 !important;
    padding-right: 4px !important;
  }
  
  /* 整个侧边栏区域在手机上也要限宽 */
  .sidebar-card {
    max-width: 100vw !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    margin-left: -12px !important;
    margin-right: -12px !important;
  }
  
  /* 内容主体区也要防溢出 */
  .content-main,
  [class*="content"],
  [class*="article"] {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
}

/* 全局安全网：防止任何元素水平滚动 */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

/* 面包屑区域 */
.breadcrumb-custom,
[class*="breadcrumb"],
.nav-breadcrumb {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* ========== MOBILE LAYOUT FIX v1 ========== */

/* Ensure content-wrapper takes full space between nav and footer */
.content-wrapper {
    display: block !important;
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 16px !important;
    box-sizing: border-box !important;
    min-height: auto !important;
}

.content-inner {
    width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
}

.row {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}

.col-md-9,
.col-md-12 {
    width: 100% !important;
    display: block !important;
    float: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.col-md-3,
.content-sidebar {
    display: none !important; /* Hide sidebar on mobile */
}

/* Footer must NOT cover content */
.site-footer {
    position: relative !important;
    z-index: auto !important;
    clear: both !important;
    margin-top: 0 !important;
    padding-top: 24px !important;
}

/* Body should allow scrolling when content > viewport */
html, body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-x: hidden !important;
}
