/* ═══════════════════════════════════════════
   彝跃 — 精修中性极简 Design Tokens v2
   字体：阿里普惠体 3.0 (CDN) + Noto Sans SC 回退
   配色：暖调黑白为底，彝红点睛（小范围跳色）
   ═══════════════════════════════════════════ */

/* ── 阿里普惠体 3.0 (jsDelivr CDN) ── */
@font-face {
  font-family: 'PuHuiTi';
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  src: url('https://cdn.jsdelivr.net/gh/alibaba/puhuiti-webfont/woff2/AlibabaPuHuiTi-3-45-Light.woff2') format('woff2');
}
@font-face {
  font-family: 'PuHuiTi';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('https://cdn.jsdelivr.net/gh/alibaba/puhuiti-webfont/woff2/AlibabaPuHuiTi-3-55-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'PuHuiTi';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('https://cdn.jsdelivr.net/gh/alibaba/puhuiti-webfont/woff2/AlibabaPuHuiTi-3-65-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'PuHuiTi';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('https://cdn.jsdelivr.net/gh/alibaba/puhuiti-webfont/woff2/AlibabaPuHuiTi-3-85-Bold.woff2') format('woff2');
}

:root {
  /* ── 中性灰阶 — 微暖底，纸感 ── */
  --bg:        #FFFFFF;
  --bg-soft:   #F5F4F1;
  --bg-card:   #FFFFFF;
  --bg-hover:  #F0EFEB;
  --bg-elev:   #FBFAF8;

  /* 文字 — 暖近黑 */
  --fg:        #14120F;
  --fg-muted:  #6F6A62;
  --fg-dim:    #B9B4AA;

  /* 强调 — 黑即主强调 */
  --accent:    #14120F;
  --accent-soft: rgba(20,18,15,0.06);
  --accent-dark: #000000;

  /* ── 跳色 — 彝红点睛（小范围使用：当前态/关键 CTA/品牌细节）── */
  --pop:       #C6362C;
  --pop-strong:#A52820;
  --pop-soft:  rgba(198,54,44,0.08);
  /* 金色微点缀（针线/刻度等极少量细节） */
  --gold:      #B98A2E;

  /* 通知红点（与跳色统一） */
  --red:       #C6362C;

  /* 语义色 */
  --ok:        #2F7D4F;
  --warn:      #B7791F;
  --err:       #C6362C;
  --info:      #3A6EA5;

  /* 选中 / 焦点 / 遮罩 */
  --selection-bg: #14120F;
  --selection-fg: #FFFFFF;
  --focus-ring: 0 0 0 3px rgba(20,18,15,0.14);
  --overlay:   rgba(14,12,10,0.45);

  /* 线条 */
  --border:    #EAE8E2;
  --border-strong: #CFCBC1;

  /* 圆角 */
  --radius-sm: 3px;
  --radius:    5px;
  --radius-lg: 10px;
  --radius-pill: 999px;

  /* 字体 */
  --font: 'PuHuiTi', 'Noto Sans SC', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-display: 'PuHuiTi', 'Noto Sans SC', system-ui, sans-serif;
  --max-w: 1280px;

  /* 两层顶栏高度 */
  --nav1-h: 40px;     /* 顶1栏：品牌黑底 */
  --nav2-h: 60px;     /* 顶2栏：功能栏 */
  --nav-h: calc(var(--nav1-h) + var(--nav2-h));

  /* 动效 — 与 js/motion.js 的 GSAP 缓动对齐 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-emph: cubic-bezier(0.16, 1, 0.3, 1);   /* expo-out，入场编排用 */
  --dur-1: 120ms;   /* 微反馈：hover/press */
  --dur-2: 240ms;   /* 常规过渡 */
  --dur-3: 420ms;   /* 容器/面板 */

  /* 阴影 — 分层柔化 */
  --shadow-xs: 0 1px 2px rgba(20,18,15,0.04);
  --shadow-sm: 0 1px 2px rgba(20,18,15,0.05), 0 1px 6px rgba(20,18,15,0.03);
  --shadow: 0 2px 8px rgba(20,18,15,0.04), 0 8px 24px rgba(20,18,15,0.05);
  --shadow-lg: 0 4px 12px rgba(20,18,15,0.05), 0 16px 48px rgba(20,18,15,0.10);

  /* ── 布局令牌（桌面兜底值；移动端在文件尾部覆盖）── */
  --bp-mobile: 500px;
  --gutter: 32px;
  --tabbar-h: 0px;           /* 桌面无底部 TabBar */
  --nav-safe-top: 0px;       /* 桌面无安全区 */

  /* 间距 scale（8px 网格） */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;
  --sp-4: 16px; --sp-6: 24px; --sp-8: 32px;

  /* 字号 scale */
  --text-xs: 0.7rem;  --text-sm: 0.78rem; --text-base: 0.95rem; /* body≈15px */
  --text-md: 1rem;    --text-lg: 1.15rem; --text-xl: 1.35rem;   --text-2xl: 1.7rem;
  --text-display: clamp(2.6rem, 6vw, 5.2rem);  /* 首页主标题档 */

  /* 行高 */
  --lh-tight: 1.2; --lh-body: 1.7; --lh-relaxed: 1.8;

  /* 触摸目标 (Apple HIG) */
  --touch: 44px; --touch-sm: 38px;
}

/* ── 深色模式 ── */
[data-theme="dark"] {
  --bg:        #121110;
  --bg-soft:   #1A1917;
  --bg-card:   #1E1D1A;
  --bg-hover:  #272522;
  --bg-elev:   #22201D;
  --fg:        #F3F1EC;
  --fg-muted:  #A19B91;
  --fg-dim:    #6B665C;
  --accent:    #F3F1EC;
  --accent-soft: rgba(243,241,236,0.08);
  --accent-dark: #FFFFFF;
  --pop:       #E0574B;
  --pop-strong:#EC6B5F;
  --pop-soft:  rgba(224,87,75,0.14);
  --gold:      #D0A44A;
  --red:       #E0574B;
  --ok:        #4CA46F;
  --warn:      #D29A3F;
  --err:       #E0574B;
  --info:      #6A9BCF;
  --selection-bg: #F3F1EC;
  --selection-fg: #14120F;
  --focus-ring: 0 0 0 3px rgba(243,241,236,0.16);
  --overlay:   rgba(0,0,0,0.55);
  --border:    #2C2A26;
  --border-strong: #3E3B34;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35), 0 1px 6px rgba(0,0,0,0.25);
  --shadow: 0 2px 8px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.35), 0 16px 48px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}
a { color: inherit; text-decoration: none; cursor: pointer; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
svg { display: block; }

/* ── 全局细节 ── */
::selection { background: var(--selection-bg); color: var(--selection-fg); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* 细滚动条（webkit + Firefox） */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* 动效降级 — 用户系统设置优先 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* 标题 */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.4rem, 6vw, 5rem); font-weight: 400; }
h2 { font-size: clamp(1.8rem, 3.5vw, 3rem); font-weight: 500; }
h3 { font-size: 1.1rem; font-weight: 500; }

/* 工具类 */
.empty { text-align: center; padding: 80px 20px; color: var(--fg-dim); }
.empty p { margin-top: 8px; font-size: 0.9rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--bg-hover); }
.avatar--lg { width: 72px; height: 72px; }
.tag { display: inline-block; padding: 2px 10px; border: 1px solid var(--border); font-size: 0.7rem; background: transparent; color: var(--fg-muted); }
.tag--ok { border-color: var(--fg); color: var(--fg); }
.icon-svg { width: 20px; height: 20px; flex-shrink: 0; }

/* 跳色工具类（克制使用） */
.pop { color: var(--pop); }

/* ── 移动端令牌覆盖（≤500px）──
   注：tokens.css 最先加载，此块按视口覆盖 :root；
   navbar.css:276 的 --nav1-h/--nav2-h 同域覆盖，var() 在计算值期解析，顺序无关 */
@media (max-width: 500px) {
  :root {
    --gutter: 16px;
    --text-sm: 0.72rem; --text-base: 0.875rem; --text-lg: 1.05rem;
    --text-xl: 1.2rem; --text-2xl: 1.45rem;
    --lh-body: 1.6;
    --tabbar-h: calc(58px + env(safe-area-inset-bottom));
    --nav-safe-top: env(safe-area-inset-top);
    /* 移动端：隐藏黑底 tier1；顶栏两行 = 上行居中 LOGO(信息展示,贴刘海下) + 下行功能区工具条。
       功能区绝不贴摄像头 —— 页面顶部高度 = LOGO 行 + 工具条 + 安全区 */
    --mob-tools-h: 44px;   /* 功能工具条高 = 苹果 HIG 触摸目标下限 */
    --nav-h: calc(var(--nav2-h) + var(--mob-tools-h) + env(safe-area-inset-top));
  }
}
