/* =========================================================================
   万事勿忧衡元智库 · 全站设计 Token (site.css)
   W3 D5-D6 · 页面拆分 · 一瓢出品
   --------------------------------------------------------------------------
   设计双轨制：
   · 首页（index.html）保留 sage 棕色系 · 不强制改色
   · 新页面（mbti/health/articles/about）使用 玄紫 #534AB7 主色
   · 共用组件 banner / nav / footer 全站一致
   ========================================================================= */

:root {
  /* —— 玄紫主色（新页面）—— */
  --brand-primary: #534AB7;       /* 主色：玄紫 */
  --brand-deep:    #26215C;       /* 深空紫：标题/重点 */
  --brand-bg:      #F7F5F1;       /* 米白：背景 */
  --brand-soft:    #EFEBFA;       /* 淡紫：卡片底 */
  --brand-accent:  #8B7FD8;       /* 紫调强调色 */

  /* —— 首页保留 sage 棕色系 —— */
  --sage:          #5F5E5A;
  --sage-soft:     #A8A6A0;
  --amber:         #8B7355;
  --amber-soft:    #D4A84B;

  /* —— 中性色 —— */
  --txt:           #2A2A2A;
  --txt-soft:      #666;
  --txt-faint:     #999;
  --border:        #E8E4DD;
  --white:         #FFFFFF;
  --success:       #4CAF50;
  --warning:       #F0C060;
  --danger:        #C05050;

  /* —— 尺寸 —— */
  --max-w:         64rem;         /* max-w-5xl */
  --radius:        14px;
  --radius-sm:     8px;
  --shadow:        0 2px 12px rgba(83, 74, 183, 0.08);
  --shadow-lg:     0 8px 32px rgba(83, 74, 183, 0.12);
}

/* —— 字体 —— */
body { font-family: 'Noto Sans SC', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif; color: var(--txt); }
h1, h2, h3, h4, h5, .serif { font-family: 'Noto Serif SC', 'Songti SC', serif; }

/* =========================================================================
   全站导航（nav）
   ========================================================================= */
.site-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-wrap: wrap;
}
.site-nav-brand {
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--brand-deep);
  padding: 12px 0;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.site-nav-brand .brand-mark {
  color: var(--brand-primary);
  font-size: 1.3rem;
}
.site-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 0;
}
.site-nav-links a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--txt-soft);
  text-decoration: none;
  transition: all 0.15s;
}
.site-nav-links a:hover {
  background: var(--brand-soft);
  color: var(--brand-primary);
}
.site-nav-links a.active {
  background: var(--brand-primary);
  color: var(--white);
  font-weight: 600;
}

/* =========================================================================
   全站 banner · 全站永久免费
   ========================================================================= */
.site-banner {
  background: linear-gradient(135deg, #F4F0FB 0%, #E8E0F5 100%);
  border: 1px solid var(--brand-soft);
  border-radius: var(--radius);
  padding: 10px 18px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brand-deep);
  margin: 16px auto;
  max-width: var(--max-w);
}

/* =========================================================================
   全站 footer / 免责声明 / 隐私
   ========================================================================= */
.site-disclaimer,
.site-privacy {
  max-width: var(--max-w);
  margin: 12px auto;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.75rem;
  line-height: 1.7;
}
.site-disclaimer {
  background: #FFF8F0;
  border: 1px solid var(--warning);
  color: #5a3a10;
}
.site-privacy {
  background: #F5F6F8;
  border: 1px solid var(--border);
  color: var(--txt-soft);
}
.site-disclaimer strong,
.site-privacy strong { color: var(--brand-deep); }

/* =========================================================================
   玄紫风（新页面）
   ========================================================================= */
.hero-purple {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-deep) 100%);
  color: var(--white);
  padding: 48px 24px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  text-align: center;
}
.hero-purple h1 {
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 700;
  margin: 0 0 8px;
}
.hero-purple p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.95rem;
}
.hero-purple .hero-icon {
  font-size: 2.6rem;
  margin-bottom: 12px;
}

.card-purple {
  background: var(--white);
  border: 1px solid var(--brand-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-purple h3 {
  color: var(--brand-deep);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 12px;
}
.card-purple h4 {
  color: var(--brand-primary);
  font-size: 0.875rem;
  margin: 0 0 8px;
}

.btn-primary {
  background: var(--brand-primary);
  color: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-primary:hover {
  background: var(--brand-deep);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  background: var(--sage-soft);
  cursor: not-allowed;
  transform: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.form-grid label {
  font-size: 0.8rem;
  color: var(--txt-soft);
  display: block;
  margin-bottom: 4px;
}
.form-grid select,
.form-grid input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--white);
  box-sizing: border-box;
}
.form-grid select:focus,
.form-grid input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* —— 标签 / 标记 —— */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: var(--brand-soft);
  color: var(--brand-deep);
  margin: 2px;
}
.tag-fire { background: #FDE8E6; color: #8B2E25; }
.tag-water { background: #E0EEF7; color: #2E5A7B; }
.tag-wood { background: #E8F4D8; color: #4A6B28; }
.tag-metal { background: #E8ECEA; color: #4A5F57; }
.tag-earth { background: #F5EAD8; color: #7A5A28; }

/* —— 五行能量条（玄紫版） —— */
.wuxing-bar {
  display: flex;
  gap: 10px;
  margin: 12px 0;
  align-items: flex-end;
  height: 120px;
}
.wuxing-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.wuxing-bar-item .bar {
  width: 100%;
  max-width: 48px;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.6s ease;
}
.wuxing-bar-item .label {
  font-size: 0.7rem;
  color: var(--txt-faint);
}

/* —— 加载态 / 错误态 —— */
.loading {
  text-align: center;
  padding: 32px 16px;
  color: var(--brand-primary);
  font-size: 0.9rem;
}
.error {
  background: #FDF2F2;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin: 12px 0;
}

/* —— 文章卡片 —— */
.article-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: all 0.15s;
  cursor: pointer;
}
.article-card:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.article-card .article-meta {
  display: flex;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--txt-faint);
  margin-top: 6px;
}
.article-card .article-title {
  font-weight: 600;
  color: var(--brand-deep);
  font-size: 0.95rem;
}
.article-card .article-level {
  background: var(--brand-soft);
  color: var(--brand-deep);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
}

.cat-pill {
  background: var(--brand-soft);
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius);
  padding: 10px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.cat-pill:hover, .cat-pill.active {
  background: var(--brand-primary);
  color: var(--white);
}
.cat-pill .cat-name { font-weight: 700; font-size: 0.85rem; }
.cat-pill .cat-count { font-size: 0.7rem; opacity: 0.7; }

/* —— 体质 / MBTI 结果大卡 —— */
.result-hero {
  background: linear-gradient(135deg, var(--brand-soft) 0%, var(--white) 100%);
  border: 2px solid var(--brand-primary);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin: 20px 0;
}
.result-hero .big-code {
  font-family: 'Noto Serif SC', serif;
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--brand-deep);
  letter-spacing: 0.15em;
  margin: 8px 0;
}
.result-hero .subtitle {
  color: var(--brand-primary);
  font-size: 0.95rem;
}

.trait-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.trait-card {
  background: var(--white);
  border: 1px solid var(--brand-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.8rem;
}
.trait-card .trait-label {
  color: var(--brand-primary);
  font-weight: 600;
  margin-bottom: 4px;
}

/* =========================================================================
   知识库 · 八大分类导航 (A2 · 2026-07-23)
   --------------------------------------------------------------------------
   8 张分类卡片 · 响应式栅格 (>1024px 4 列 / 768-1024 2 列 / <768 1 列)
   ========================================================================= */
.category-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 8px 0 18px;
}
@media (max-width: 1024px) and (min-width: 768px) {
  .category-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .category-nav { grid-template-columns: 1fr; }
}
.category-card {
  background: var(--white);
  border: 1px solid var(--brand-soft);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}
.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand-primary);
  opacity: 0.4;
  transition: opacity 0.15s;
}
.category-card:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  color: inherit;
}
.category-card:hover::before { opacity: 1; }
.category-card .cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.category-card .cat-icon {
  font-size: 1.6rem;
  line-height: 1;
}
.category-card .cat-count {
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.category-card .cat-count.empty {
  background: #F0EDE6;
  color: var(--txt-faint);
}
.category-card .cat-zh {
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  color: var(--brand-deep);
  font-size: 1.05rem;
  line-height: 1.2;
}
.category-card .cat-en {
  font-size: 0.72rem;
  color: var(--txt-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.category-card .cat-desc {
  font-size: 0.78rem;
  color: var(--txt-soft);
  line-height: 1.55;
  margin-top: 2px;
  flex: 1;
}
.category-card .cat-arrow {
  font-size: 0.78rem;
  color: var(--brand-primary);
  font-weight: 600;
  margin-top: 4px;
  align-self: flex-end;
}

/* —— 响应式 —— */
@media (max-width: 640px) {
  .site-nav-inner { flex-direction: column; align-items: stretch; }
  .site-nav-brand { padding: 10px 0 4px; }
  .site-nav-links { justify-content: center; padding: 4px 0 10px; }
  .site-nav-links a { padding: 4px 10px; font-size: 0.8rem; }
  .hero-purple { padding: 32px 16px; }
}
/* =========================================================================
   暗色模式 · WB-SITE-POLISH-20260723-B · B2.3
   --------------------------------------------------------------------------
   .dark-mode 覆盖关键变量；其余组件沿用变量即可自适应
   ========================================================================= */
body.dark-mode {
  --brand-bg:    #1A1A18;
  --brand-soft:  #2A2745;
  --brand-deep:  #B7AFEA;
  --brand-primary: #8B7FD8;
  --txt:         #E8E6E0;
  --txt-soft:    #B5B2A8;
  --txt-faint:   #8B877D;
  --border:      #3A3833;
  --white:       #252420;
  --shadow:      0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg:   0 8px 32px rgba(0, 0, 0, 0.6);
  background: var(--brand-bg);
  color: var(--txt);
}
body.dark-mode .site-nav { background: #252420; border-bottom-color: var(--border); }
body.dark-mode .site-nav-brand { color: var(--brand-deep); }
body.dark-mode .site-nav-links a { color: var(--txt-soft); }
body.dark-mode .site-nav-links a:hover { background: var(--brand-soft); color: var(--brand-deep); }
body.dark-mode .site-banner { background: linear-gradient(135deg, #2A2745 0%, #3A3258 100%); color: var(--brand-deep); }
body.dark-mode .site-disclaimer { background: #2E2A1F; color: #D4C28F; border-color: #6B5530; }
body.dark-mode .site-privacy { background: #252420; color: var(--txt-soft); border-color: var(--border); }
body.dark-mode .card-purple { background: #252420; border-color: var(--border); }
body.dark-mode .article-card { background: #252420; border-color: var(--border); }
body.dark-mode .article-card .article-title { color: var(--brand-deep); }
body.dark-mode .article-card .article-level { background: var(--brand-soft); color: var(--brand-deep); }
body.dark-mode .cat-pill { background: var(--brand-soft); border-color: var(--brand-primary); color: var(--brand-deep); }
body.dark-mode .cat-pill:hover, body.dark-mode .cat-pill.active { background: var(--brand-primary); color: var(--white); }
body.dark-mode .btn-primary { background: var(--brand-primary); color: #1A1A18; }
body.dark-mode .btn-primary:hover { background: var(--brand-deep); }
body.dark-mode .form-grid select, body.dark-mode .form-grid input {
  background: #1A1A18; color: var(--txt); border-color: var(--border);
}
body.dark-mode .hero-purple { background: linear-gradient(135deg, #2A2745 0%, #1F1B3E 100%); }
body.dark-mode .result-hero { background: linear-gradient(135deg, #2A2745 0%, #252420 100%); border-color: var(--brand-primary); }
body.dark-mode .result-hero .big-code { color: var(--brand-deep); }
body.dark-mode .trait-card { background: #252420; border-color: var(--border); color: var(--txt); }
body.dark-mode .error { background: #3A1F1F; border-color: #8B2E2E; color: #E89898; }
body.dark-mode .tag { background: var(--brand-soft); color: var(--brand-deep); }
body.dark-mode a { color: #B7AFEA; }
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, body.dark-mode h4 { color: var(--brand-deep); }
body.dark-mode blockquote { background: #2A2745; border-left-color: var(--brand-primary); }
body.dark-mode input, body.dark-mode textarea { background: #1A1A18; color: var(--txt); border-color: var(--border); }
body.dark-mode .comment-item { background: #252420; border-color: var(--border); color: var(--txt); }
body.dark-mode .rating-value, body.dark-mode .recommend-meta, body.dark-mode .comment-meta { color: var(--txt-faint); }
body.dark-mode .recommend-item:hover { background: var(--brand-soft); border-color: var(--brand-primary); }

/* —— 主题切换按钮 —— */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 1.05rem;
  cursor: pointer;
  color: var(--txt-soft);
  transition: all 0.15s;
  margin-left: 8px;
  line-height: 1.2;
}
.theme-toggle:hover { background: var(--brand-soft); color: var(--brand-deep); border-color: var(--brand-primary); }
.theme-toggle-floating {
  position: fixed; top: 12px; right: 12px; z-index: 999;
  background: var(--white); box-shadow: var(--shadow);
}

/* =========================================================================
   互动层组件 · WB-SITE-POLISH-20260723-B · B1 + B2
   ========================================================================= */
/* —— 阅读时长 —— */
.read-time {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand-deep);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  margin: 0 0 14px;
  font-weight: 600;
}

/* —— 文章评分 —— */
.rating-widget {
  display: flex; align-items: center; gap: 6px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 18px 0;
}
.rating-widget .rating-star {
  background: transparent; border: none; cursor: pointer;
  font-size: 1.4rem; color: var(--brand-primary); padding: 0 2px;
  transition: transform 0.1s;
}
.rating-widget .rating-star:hover { transform: scale(1.15); }
.rating-widget .rating-star.is-filled { color: #F5A623; }
.rating-widget .rating-value {
  margin-left: 8px; color: var(--txt-soft); font-size: 0.85rem;
}
.rating-widget .rating-hint {
  margin-left: 8px; color: var(--warning); font-size: 0.75rem;
}

/* —— 评论 —— */
.comments-widget {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin: 18px 0;
}
.comments-widget .comments-header h4 { margin: 0 0 10px; color: var(--brand-deep); font-size: 0.95rem; }
.comments-widget .comments-list { list-style: none; padding: 0; margin: 0 0 12px; }
.comments-widget .comments-empty { color: var(--txt-faint); padding: 10px 0; text-align: center; font-size: 0.85rem; }
.comments-widget .comment-item {
  background: var(--brand-soft); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 8px;
}
.comments-widget .comment-meta { font-size: 0.72rem; color: var(--txt-faint); margin-bottom: 4px; display: flex; gap: 12px; }
.comments-widget .comment-name { font-weight: 700; color: var(--brand-deep); }
.comments-widget .comment-body { color: var(--txt); font-size: 0.88rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.comments-widget .comment-form { display: flex; flex-direction: column; gap: 8px; }
.comments-widget .comment-name-input {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.85rem; background: var(--brand-bg); color: var(--txt);
}
.comments-widget .comment-body-input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.88rem; background: var(--brand-bg); color: var(--txt);
  resize: vertical; font-family: inherit;
}
.comments-widget .comment-actions { display: flex; align-items: center; justify-content: space-between; }
.comments-widget .comment-count { color: var(--txt-faint); font-size: 0.75rem; }
.comments-widget .comment-submit { padding: 6px 16px; font-size: 0.85rem; }

/* —— 相关推荐 —— */
.recommend-widget {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin: 18px 0;
}
.recommend-widget .recommend-header h4 { margin: 0 0 10px; color: var(--brand-deep); font-size: 0.95rem; }
.recommend-widget .recommend-list { list-style: none; padding: 0; margin: 0; }
.recommend-widget .recommend-item {
  padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-sm);
  margin-bottom: 6px; cursor: pointer; transition: all 0.12s;
}
.recommend-widget .recommend-item:hover { background: var(--brand-soft); border-color: var(--brand-primary); }
.recommend-widget .recommend-title { color: var(--brand-deep); font-weight: 600; font-size: 0.88rem; }
.recommend-widget .recommend-meta { font-size: 0.7rem; color: var(--txt-faint); margin-top: 3px; display: flex; gap: 8px; }
.recommend-widget .recommend-cat { background: var(--brand-soft); padding: 1px 8px; border-radius: 4px; color: var(--brand-deep); }
.recommend-widget .recommend-level { padding: 1px 8px; }
.recommend-widget .recommend-empty { color: var(--txt-faint); padding: 10px 0; text-align: center; font-size: 0.85rem; }

/* —— 目录侧边栏 —— */
.toc, .toc-auto {
  position: fixed; top: 90px; right: 16px; z-index: 50;
  width: 220px; max-height: calc(100vh - 120px); overflow-y: auto;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
  font-size: 0.82rem;
}
.toc-auto .toc-header { font-weight: 700; color: var(--brand-deep); margin-bottom: 8px; font-size: 0.85rem; }
.toc-auto .toc-list { list-style: none; padding: 0; margin: 0; }
.toc-auto .toc-item { margin: 3px 0; }
.toc-auto .toc-item a { color: var(--txt-soft); text-decoration: none; padding: 3px 6px; border-radius: 4px; display: block; transition: all 0.1s; }
.toc-auto .toc-item a:hover, .toc-auto .toc-item a.active { background: var(--brand-soft); color: var(--brand-deep); }
.toc-auto .toc-l3 a { padding-left: 14px; font-size: 0.78rem; }
@media (max-width: 1200px) { .toc-auto { display: none; } }

/* —— 弹窗文章正文美化 —— */
.wsm-article-popup {
  background: var(--brand-bg);
  min-height: 100vh; padding: 24px 16px;
}
.wsm-article-popup .article-content { max-width: 780px; margin: 0 auto; }
