/* ==========================================================================
   预测豆 Comadou · 主题换挡组件（两版共用）
   --------------------------------------------------------------------------
   本文件与具体配色无关，深浅两版都加载，负责：
     1) 导航栏「白天 / 黑夜」换挡器样式
     2) 两版专属区块的显隐（.theme-dark-only / .theme-light-only）
     3) 左上角品牌标记在白天版的呈现（复用白天版设计稿的「豆苗」图形）
   版本: 1.0.0 · 2026-11
   ========================================================================== */

/* ---------- 1. 两版专属区块显隐 ---------- */
.theme-light-only { display: none; }

html[data-theme="light"] .theme-light-only { display: block; }
html[data-theme="light"] .theme-dark-only { display: none !important; }

/* ---------- 1b. 强调色变量（列表页横幅内联引用，按主题取值） ---------- */
:root {
  --acc-mint: #4bf3c8;
  --acc-violet: #8d46e7;
  --acc-amber: #f8e42e;
  --acc-orange: #ff7d54;
  --acc-sky: #40aaff;
  --logo-groove: #0d0f14;
}

html[data-theme="light"] {
  --acc-mint: #3f7a5f;
  --acc-violet: #6b4fa0;
  --acc-amber: #7a6614;
  --acc-orange: #a85a33;
  --acc-sky: #3a6d93;
}

/* ---------- 2. 换挡器 ---------- */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  vertical-align: middle;
}

html[data-theme="light"] .theme-switch {
  border-color: var(--line-strong);
  background: #f4f1e8;
}

.theme-switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 30px;
  height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--t4);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: color .25s ease, background-color .25s ease, box-shadow .25s ease;
}

.theme-switch-btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-switch-btn:hover { color: var(--t2); }
html[data-theme="light"] .theme-switch-btn { color: var(--t2); }
html[data-theme="light"] .theme-switch-btn:hover { color: var(--t1); }

.theme-switch-btn[aria-pressed="true"] {
  color: #fff;
  background-color: var(--beam);
  background-image: none;
  box-shadow: 0 2px 10px rgba(50, 69, 255, .28);
}

html[data-theme="light"] .theme-switch-btn[aria-pressed="true"] {
  color: #fdfcf9;
  background-color: var(--accent);
  background-image: none;
  box-shadow: 0 2px 10px rgba(89, 104, 79, .28);
}

.theme-switch-btn:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

/* 导航里的位置：与登录/注册按钮保持同一节奏 */
.nav-theme-item { display: flex; align-items: center; }

/* 移动端顶栏容器：换挡器 + 汉堡按钮 */
.navbar-tools {
  display: flex;
  align-items: center;
  gap: .375rem;
  flex: 0 0 auto;
}

/* 移动端换挡器：默认不显示，小屏常驻 */
.theme-switch-mobile { display: none; }

@media (max-width: 1199.98px) {
  .theme-switch-btn { padding: 0 7px; }
  .theme-switch-btn .ts-label { display: none; }
}

@media (max-width: 991.98px) {
  .theme-switch-mobile {
    display: inline-flex;
    padding: 2px;
  }
  .theme-switch-mobile .theme-switch-btn {
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
  }
  .theme-switch-mobile .theme-switch-btn svg {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
  }
  /* 菜单里的换挡器在小屏隐藏，避免与顶栏重复 */
  .blog-navbar .nav-theme-item { display: none; }
}

@media (max-width: 400px) {
  .theme-switch { padding: 2px; }
  .theme-switch-btn { min-width: 26px; height: 26px; padding: 0 5px; }
  .navbar-tools { gap: .25rem; }
}

/* 黑夜版导航文字：theme.css 用 !important 写死 #495057（在深底上仅 2.3:1），
   这里按设计规范改回 --t3 / 高亮白，保证与新增换挡器同一可读水准 */
html[data-theme="dark"] .blog-navbar .nav-link { color: var(--t3) !important; }
html[data-theme="dark"] .blog-navbar .nav-item a.active,
html[data-theme="dark"] .blog-navbar .nav-link.active { color: #fff !important; }
html[data-theme="dark"] .theme-switch-btn { color: var(--t3); }
html[data-theme="dark"] .theme-switch-btn[aria-pressed="true"] { color: #fff; }

/* ---------- 3. 品牌标记「豆苗」（两版共用同一图形） ----------
   深色版：品牌渐变填充（渐变在 base.html 的 #cd-brand-grad 中定义）
   浅色版：鼠尾草绿实心，与白天版设计稿一致
   原来的「豆」字符圆盘不再使用，.brand-badge 负责撤掉圆盘与字符 */
.brand-badge {
  border-radius: 0 !important;
  background: transparent !important;
  overflow: visible !important;
}
.brand-badge::before { display: none !important; }
.brand-badge .badge-glyph { display: none; }

.brand-mark {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  color: var(--mint);
  transition: transform .45s cubic-bezier(.23, 1, .32, 1);
}
/* 叶脉：用页面底色挖空，两版各自取自己的底色 */
.brand-mark .mark-groove { stroke: var(--logo-groove, #0d0f14); }

/* 悬停：轻微倾斜 + 放大（与换挡器的动效节奏一致） */
a.navbar-brand:hover .brand-mark,
.footer-brand-row:hover .brand-mark,
.about-dou:hover .brand-mark,
.about-profile:hover .brand-mark {
  transform: rotate(-8deg) scale(1.06);
}

/* 浅色版：渐变填充换成实心主色 */
html[data-theme="light"] .brand-mark { color: var(--accent); }
html[data-theme="light"] .brand-mark .mark-body { fill: currentColor; }

/* 尺寸：白天版导航略小，页脚/侧栏/关于页按各自容器等比 */
html[data-theme="light"] .navbar-brand .brand-badge { width: 30px; height: 30px; flex: 0 0 30px; }

@media (prefers-reduced-motion: reduce) {
  .theme-switch-btn,
  .brand-mark { transition: none; }
}
