/* ==========================================================================
   风雪 API · 共享设计系统 (design-system.css)
   ──────────────────────────────────────────────────────────────────────────
   用途：门户（/、/pricing、/models、/docs）与用户中心（/me/）共用这一份。
   改动此文件 = 两边同时生效。新增页面请直接引用，不要另起一套。

   包含：
     · 设计令牌（颜色 / 字号 / 圆角 / 行高 / 字重 / 层级 / 节奏 / 动效）
     · 深色模式变量
     · 基础重置与排版
     · 通用容器 .wrap
     · 导航 .topnav / .logo / .logo-mark
     · 按钮 .btn / .btn-primary / .btn-ghost / .btn-sm
     · 表单 .inp / .field
     · 卡片 .card / .card-head
     · 工具类与无障碍

   不包含（各页面自己维护）：
     · 门户专属：hero / feature-grid / pricing table / docs 双栏
     · 用户中心专属：sidebar / shell / 各业务卡片
   ========================================================================== */

/* ══════════════════════════════════════════════════════════
   1. 设计令牌
   ══════════════════════════════════════════════════════════ */
:root {
  /* ── 主色 ── */
  --blue: #6b8ff5;
  --blue-deep: #3558c8;
  --violet: #9db6fb;
  --cyan: #86cbe6;
  --grad: linear-gradient(100deg, #5a80ea 0%, #7c9df6 34%, #a8c0fb 68%, #c6e2f6 100%);
  --grad-icon: linear-gradient(180deg, #7c9df6 0%, #5a80ea 100%);
  --title-grad: linear-gradient(100deg, #3d5da8 6%, #5b84e8 44%, #93b4f4 76%, #a8cfee 100%);
  --c: var(--blue);

  /* ── 中性色 ── */
  --ink: #1a1a1a;
  --ink-2: #4a4a4a;
  --muted: #6b7280;
  --line: #ececec;
  --pill: #e8e8e8;
  --soft: #f4f6fa;
  --bg: #ffffff;

  /* ── 字号阶梯 ── */
  --fs-2xs: 11.5px;
  --fs-xs: 12.5px;
  --fs-sm: 13.5px;
  --fs-base: 14.5px;
  --fs-md: 16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 26px;
  --fs-4xl: 32px;
  --fs-5xl: 44px;

  /* ── 圆角 ── */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* ── 行高 / 字重 ── */
  --lh-tight: 1.35;
  --lh-body: 1.7;
  --fw-normal: 400;
  --fw-mid: 600;
  --fw-bold: 700;

  /* ── 层级 ── */
  --z-base: 1;
  --z-drop: 60;
  --z-dock: 70;
  --z-modal: 300;
  --z-top: 999;

  /* ── 竖向节奏 ── */
  --sec-pad: 84px;
  --sec-head-gap: 44px;
  --hero-pad-b: 96px;
  --sub-hero-pad-b: 56px;

  /* ── 阴影 ── */
  --shadow-card: 0 1px 2px rgba(30, 41, 80, .04), 0 8px 24px rgba(30, 41, 80, .05);
  --shadow-pop: 0 16px 44px rgba(20, 30, 60, .14);

  /* ── 动效 ── */
  --dur: .28s;
  --ease-out: cubic-bezier(.2, .7, .3, 1);
  --theme-switch-dur: .5s;
}

/* ── 深色模式 ── */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9edf7;
  --ink-2: #c6cddd;
  --muted: #8d97ae;
  --line: #262e3f;
  --soft: #161c2a;
  --pill: #2b3346;
  --bg: #0c1119;
  --blue: #7c9bf7;
  --blue-deep: #a8bfff;
  --grad: linear-gradient(100deg, #6b8ff5 0%, #8aa6f8 34%, #a9bdfb 68%, #8fd0e8 100%);
  --grad-icon: linear-gradient(180deg, #8aa6f8 0%, #6b8ff5 100%);
  --title-grad: linear-gradient(100deg, #d8e4ff 6%, #a9c0ff 44%, #c3b4ff 76%, #9ad8ef 100%);
  --shadow-card: none;
  --shadow-pop: 0 16px 44px rgba(0, 0, 0, .5);
}

/* ══════════════════════════════════════════════════════════
   2. 基础重置
   ══════════════════════════════════════════════════════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC",
               system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
html[data-theme="dark"] body { background: var(--bg); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }

::selection { background: rgba(107, 143, 245, .22); }

/* 键盘焦点 */
:focus-visible {
  outline: 2px solid var(--blue-deep);
  outline-offset: 3px;
  border-radius: 4px;
}

/* 跳到主内容 */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  padding: 10px 16px; background: var(--blue-deep); color: #fff;
  border-radius: 0 0 var(--r-sm) 0; z-index: var(--z-top);
}
.skip-link:focus { left: 0; }

/* ══════════════════════════════════════════════════════════
   3. 通用容器
   ══════════════════════════════════════════════════════════ */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 420px) { .wrap { padding: 0 20px; } }

/* ══════════════════════════════════════════════════════════
   4. 顶部导航
   ══════════════════════════════════════════════════════════ */
.topnav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: var(--z-drop);
  transition: background .3s ease, backdrop-filter .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.topnav.is-stuck {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: var(--line);
}
html[data-theme="dark"] .topnav.is-stuck { background: rgba(12, 17, 25, .86); }

/* 用户中心用的是 sticky，覆盖这一条即可 */
.topnav.is-static {
  position: sticky;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] .topnav.is-static { background: rgba(12, 17, 25, .88); }

.topnav-inner { display: flex; align-items: center; height: 68px; }

.logo {
  display: flex; align-items: center; gap: 9px;
  font-size: var(--fs-md); font-weight: var(--fw-bold);
  letter-spacing: .06em; flex: none;
}
.logo-mark {
  width: 24px; height: 24px; border-radius: var(--r-sm);
  background: var(--grad-icon);
  display: grid; place-items: center;
  color: #fff; font-size: var(--fs-xs); font-weight: 800;
  box-shadow: 0 4px 12px rgba(122, 156, 245, .34);
  flex: none;
}

/* 门户导航链接（用户中心用下拉菜单，不引用这段） */
.topnav-links {
  margin-left: auto;
  display: flex; align-items: center; gap: 30px;
  font-size: var(--fs-base); color: var(--ink-2);
}
.topnav-links a {
  position: relative; padding-bottom: 4px;
  transition: color var(--dur) var(--ease-out);
}
.topnav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 2px; border-radius: var(--r-sm);
  background: var(--grad);
  transform: scaleX(0); transform-origin: left;
  transition: transform .32s cubic-bezier(.2, .7, .3, 1);
}
@media (hover: hover) { .topnav-links a:hover { color: var(--blue-deep); } }
.topnav-links a:focus-visible { color: var(--blue-deep); }
.topnav-links a.active::after { transform: scaleX(1); }
@media (hover: hover) { .topnav-links a:hover::after { transform: scaleX(1); } }
.topnav-links a:focus-visible::after { transform: scaleX(1); }
.topnav-links a.active { color: var(--ink); font-weight: var(--fw-mid); }

.topnav-actions { display: flex; align-items: center; gap: 10px; margin-left: 26px; }

/* ══════════════════════════════════════════════════════════
   5. 按钮
   ══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 18px;
  border-radius: var(--r-pill);
  font-size: var(--fs-base); font-weight: var(--fw-mid);
  white-space: nowrap;
  transition: transform .18s ease, box-shadow .22s ease,
              background .22s ease, color .22s ease, border-color .22s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--grad-icon); color: #fff;
  box-shadow: 0 4px 14px rgba(90, 128, 234, .32);
}
@media (hover: hover) {
  .btn-primary:hover { box-shadow: 0 7px 20px rgba(90, 128, 234, .42); transform: translateY(-1px); }
}
.btn-ghost {
  background: #fff; color: var(--ink-2);
  border: 1px solid var(--line);
}
@media (hover: hover) { .btn-ghost:hover { border-color: #d8dce6; color: var(--ink); } }
html[data-theme="dark"] .btn-ghost { background: #141b28; border-color: var(--line); }
html[data-theme="dark"] .btn-ghost:hover { border-color: #33405c; color: var(--ink); }

.btn-sm { height: 32px; padding: 0 14px; font-size: var(--fs-sm); }

/* ══════════════════════════════════════════════════════════
   6. 表单
   ══════════════════════════════════════════════════════════ */
.inp {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-sm);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
html[data-theme="dark"] .inp { background: #141b28; }
.inp:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(107, 143, 245, .12);
}
.inp::placeholder { color: var(--muted); }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block; margin-bottom: 6px;
  font-size: var(--fs-xs); color: var(--muted);
}

/* ══════════════════════════════════════════════════════════
   7. 卡片
   ══════════════════════════════════════════════════════════ */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}
html[data-theme="dark"] .card { background: #141b28; box-shadow: none; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.card-head h2 {
  font-size: var(--fs-md);
  font-weight: var(--fw-mid);
  color: var(--ink);
  margin: 0;
}

/* ══════════════════════════════════════════════════════════
   8. 工具类
   ══════════════════════════════════════════════════════════ */
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ══════════════════════════════════════════════════════════
   9. 主题切换按钮（共享）
   ══════════════════════════════════════════════════════════ */
.theme-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--muted);
  transition: background .2s ease, color .2s ease;
  flex: none;
  background: none; border: none; cursor: pointer;
}
@media (hover: hover) { .theme-btn:hover { background: var(--soft); color: var(--ink); } }
html[data-theme="dark"] .theme-btn:hover { background: #1c2434; }
.theme-btn .icon-sun { display: none; }
html[data-theme="dark"] .theme-btn .icon-moon { display: none; }
html[data-theme="dark"] .theme-btn .icon-sun { display: block; }
