/* ==========================================================================
   全站公共主题层 · 浅色 / 深色一键切换（华哥 2026-08-31）
   --------------------------------------------------------------------------
   1. 与「鸣儿」共用同一套 CSS 变量与同一个 localStorage key：minger-theme
      —— 在鸣儿里切换主题，全站（首页 / 项目地图 / 法律服务 / 用户中心 /
         后台）立即同步；反之亦然，真正做到「一键调整浅色/深色」。
   2. 默认深色（与鸣儿一致），不跟随系统，用户手动切换后才记忆。
   3. 本文件必须在 brand.css / minger.css 之前引入，供其变量引用。
   ========================================================================== */

/* ---------- 深色（默认） ---------- */
:root{
  /* 基础色板 */
  --bg:#0d1117; --bg2:#151b23; --bg3:#1c2430;
  --line:#252d38; --line2:#323c4a;
  --txt:#e8edf3; --txt2:#9aa7b6; --txt3:#6b7885;
  --gold:#d9b169; --gold2:#f0cf95;
  --teal:#3fb8a6; --blue:#5b8def; --red:#e05c5c;

  /* 全站语义变量（brand.css 的硬编码色统一走这里） */
  --page-bg:#0d1117;        /* 页面底色 */
  --card:#151b23;           /* 卡片/面板底色 */
  --card2:#1c2430;          /* 次级容器底色 */
  --card-border:#252d38;    /* 卡片描边 */
  --card-shadow:0 4px 16px rgba(0,0,0,.35);
  --text:#e8edf3;           /* 主文字 */
  --text2:#9aa7b6;          /* 次文字 */
  --text3:#6b7885;          /* 弱文字 */
  --brand:#5b8def;          /* 品牌蓝（深色下提亮保证可读） */
  --brand-deep:#0f172a;     /* 原 --deep 深蓝：深色下反转成近黑，用于页眉/页脚底 */
  --table-stripe:#1a212b;
  --table-head:#1c2430;

  /* 顶栏 / 底部导航 */
  --top-bg:rgba(13,17,23,.94);
  --tabbar-bg:rgba(13,17,23,.97);
  --tabbar-border:#252d38;
  --tabbar-on:#f0cf95;      /* 激活态（金） */
  --tabbar-off:#6b7885;
  --footer-bg:#0f172a;
  --footer-txt:#cfd6e6;

  /* 英雄区渐变（品牌蓝，深色下压暗不刺眼） */
  --hero-1:#0b3d91; --hero-2:#1257c9; --hero-3:#0a3480;

  /* 提示类 */
  --notice-bg:#221b0f; --notice-border:#4a3c22; --notice-color:#f0cf95;
  --warn-bg:#3a2a10; --warn-border:#6b5220; --warn-color:#f0cf95;
  --err-bg:#251313;  --err-border:#4d2626;  --err-color:#f0a0a0;

  /* 杂项 */
  --r:12px; --r2:16px;
  --safe:env(safe-area-inset-bottom,0px);
}

/* ---------- 浅色 ---------- */
html[data-theme="light"]{
  --bg:#f8fafc; --bg2:#ffffff; --bg3:#f1f5f9;
  --line:#e2e8f0; --line2:#cbd5e1;
  --txt:#0f172a; --txt2:#475569; --txt3:#94a3b8;
  --gold:#b8860b; --gold2:#a67c00;
  --teal:#0d9488; --blue:#2563eb; --red:#dc2626;

  --page-bg:#f6f8fc;
  --card:#ffffff;
  --card2:#ffffff;
  --card-border:#e2e8ff;
  --card-shadow:0 4px 16px rgba(26,26,77,.06);
  --text:#0f172a;
  --text2:#475569;
  --text3:#94a3b8;
  --brand:#2563eb;
  --brand-deep:#0f172a;
  --table-stripe:#fafbff;
  --table-head:#f1f5f9;

  --top-bg:rgba(255,255,255,.96);
  --tabbar-bg:rgba(255,255,255,.98);
  --tabbar-border:#e2e8f0;
  --tabbar-on:#b8860b;
  --tabbar-off:#94a3b8;
  --footer-bg:#0f172a;
  --footer-txt:#cfd6e6;

  --hero-1:#0055cc; --hero-2:#0066dc; --hero-3:#0047b3;

  --notice-bg:#fef3c7; --notice-border:#fde68a; --notice-color:#7a5b00;
  --warn-bg:#fff6e0; --warn-border:#fde68a; --warn-color:#7a5b00;
  --err-bg:#fee2e2;  --err-border:#fecaca;  --err-color:#991b1b;
}

/* ---------- 主题切换按钮（全站通用，鸣儿顶栏与全站顶栏共用） ---------- */
.theme-toggle{
  flex:0 0 auto;width:34px;height:34px;border-radius:50%;
  border:1px solid var(--line2);background:var(--bg2);color:var(--txt2);
  display:inline-flex;align-items:center;justify-content:center;
  font-size:16px;line-height:1;cursor:pointer;padding:0;
  -webkit-appearance:none;appearance:none;
}
.theme-toggle:active{background:var(--bg3)}
.theme-toggle:focus-visible{outline:2px solid var(--gold);outline-offset:2px}

/* 过渡：切换主题时颜色平滑过渡（避免元素闪烁） */
html.theme-ready body,
html.theme-ready .site-header,
html.theme-ready .page-card,
html.theme-ready .mobile-tabbar,
html.theme-ready .site-footer,
html.theme-ready .top,
html.theme-ready .tabbar{
  transition:background-color .22s ease, color .22s ease, border-color .22s ease;
}

/* 打印 & 减少动效偏好 */
@media (prefers-reduced-motion: reduce){
  html.theme-ready *{transition:none !important}
}
