/* =====================================================================
   WindPass 设计系统 · 令牌层
   ---------------------------------------------------------------------
   唯一真相来源。所有颜色、字阶、间距、圆角、阴影、动效都从这里取。
   业务样式禁止再写硬编码色值/字号/圆角，一律引用变量。
   ===================================================================== */

:root {
  /* ---- 色彩：中性底 + 单一石板蓝强调 ---- */
  --wd-bg: #fbfbfd;
  --wd-bg-tint: #eef1f7;
  --wd-surface: #ffffff;
  --wd-surface-2: #f5f6f9;
  --wd-surface-3: #eef0f5;

  --wd-ink: #1d1d1f;          /* 主文字，对白底 16.1:1 */
  --wd-ink-2: #424245;        /* 次级文字 9.7:1 */
  --wd-ink-3: #6e6e73;        /* 辅助说明 5.0:1 */
  --wd-ink-4: #86868b;        /* 占位/禁用 3.6:1（仅用于非信息性图形） */

  --wd-line: rgba(29, 29, 31, 0.09);
  --wd-line-2: rgba(29, 29, 31, 0.16);

  --wd-accent: #4a5b7d;       /* 石板蓝，按钮/选中/强调 */
  --wd-accent-hover: #3d4c69;
  --wd-accent-soft: #e9edf5;
  --wd-accent-ring: rgba(74, 91, 125, 0.28);

  --wd-danger: #c0392f;
  --wd-danger-soft: #fdf1f0;
  --wd-success: #3f7d58;

  /* ---- 字阶：中文可读性优先，8 级封顶 ---- */
  --wd-font: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  --wd-font-num: "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, monospace;

  --wd-fs-display: clamp(2rem, 1.35rem + 2.6vw, 3rem);   /* 页面主标题 32→48 */
  --wd-fs-h2: clamp(1.3rem, 1.15rem + 0.6vw, 1.6rem);     /* 区块标题 21→26 */
  --wd-fs-h3: 1.125rem;                                   /* 18 小节标题 */
  --wd-fs-body: 0.9375rem;                                /* 15 正文 */
  --wd-fs-sm: 0.8125rem;                                  /* 13 辅助 */
  --wd-fs-xs: 0.75rem;                                    /* 12 标签 */

  --wd-lh-tight: 1.25;
  --wd-lh-snug: 1.45;
  --wd-lh-body: 1.7;
  --wd-lh-loose: 1.9;

  --wd-tracking-tight: -0.02em;
  --wd-tracking-wide: 0.04em;

  /* ---- 间距：4px 基准，8 级封顶 ---- */
  --wd-s1: 4px;
  --wd-s2: 8px;
  --wd-s3: 12px;
  --wd-s4: 16px;
  --wd-s5: 24px;
  --wd-s6: 32px;
  --wd-s7: 48px;
  --wd-s8: 64px;

  /* ---- 圆角：软 8/12 与硬 0 三档 ---- */
  --wd-r-sm: 8px;
  --wd-r-md: 12px;
  --wd-r-lg: 16px;
  --wd-r-xl: 22px;
  --wd-r-pill: 999px;

  /* ---- 阴影：只在真正悬浮层使用 ---- */
  --wd-shadow-pop: 0 18px 48px rgba(30, 40, 60, 0.16), 0 2px 6px rgba(0, 0, 0, 0.05);
  --wd-shadow-card: 0 1px 2px rgba(29, 29, 31, 0.04);

  /* ---- 动效 ---- */
  --wd-dur: 0.2s;
  --wd-dur-slow: 0.32s;
  --wd-ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* ---- 布局 ---- */
  --wd-page-max: 1180px;
  --wd-page-pad: clamp(20px, 5vw, 56px);
  --wd-topbar-h: 60px;
  --wd-panel-gap: var(--wd-s5);
}

/* ---------------------------------------------------------------------
   1. 基础重置（只重置盒模型与继承，保留旧层的行为样式）
   --------------------------------------------------------------------- */
html body.page-shell,
html body.map-page {
  font-family: var(--wd-font) !important;
  font-size: var(--wd-fs-body) !important;
  line-height: var(--wd-lh-body) !important;
  color: var(--wd-ink) !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------------------------------------------------------------------
   2. 标题层级：全站统一，最多 3 级 + 展示级
   --------------------------------------------------------------------- */
html body.page-shell h1,
html body.map-page h1 {
  font-family: var(--wd-font) !important;
  font-size: var(--wd-fs-display) !important;
  font-weight: 600 !important;
  line-height: var(--wd-lh-tight) !important;
  letter-spacing: var(--wd-tracking-tight) !important;
  color: var(--wd-ink) !important;
  margin: 0 0 var(--wd-s2) !important;
}

html body.page-shell h2,
html body.map-page h2,
html body.page-shell .section-title {
  font-family: var(--wd-font) !important;
  font-size: var(--wd-fs-h2) !important;
  font-weight: 600 !important;
  line-height: var(--wd-lh-snug) !important;
  letter-spacing: var(--wd-tracking-tight) !important;
  color: var(--wd-ink) !important;
}

html body.page-shell h3,
html body.map-page h3 {
  font-family: var(--wd-font) !important;
  font-size: var(--wd-fs-h3) !important;
  font-weight: 600 !important;
  line-height: var(--wd-lh-snug) !important;
  color: var(--wd-ink) !important;
}

html body.page-shell h4,
html body.page-shell h5,
html body.page-shell h6 {
  font-family: var(--wd-font) !important;
  font-size: var(--wd-fs-body) !important;
  font-weight: 600 !important;
  color: var(--wd-ink) !important;
}

/* ---------------------------------------------------------------------
   3. 正文与标签
   --------------------------------------------------------------------- */
html body.page-shell p,
html body.map-page p {
  font-family: var(--wd-font) !important;
  font-size: var(--wd-fs-body) !important;
  line-height: var(--wd-lh-body) !important;
  color: var(--wd-ink-2) !important;
}

html body.page-shell small,
html body.map-page small {
  font-size: var(--wd-fs-sm) !important;
  line-height: var(--wd-lh-snug) !important;
}

html body.page-shell .muted {
  color: var(--wd-ink-3) !important;
  font-size: var(--wd-fs-sm) !important;
}

/* ---------------------------------------------------------------------
   4. 表单控件：统一高度、圆角、聚焦态
   --------------------------------------------------------------------- */
html body.page-shell input[type="text"],
html body.page-shell input[type="search"],
html body.page-shell input[type="email"],
html body.page-shell input[type="password"],
html body.page-shell input[type="number"],
html body.page-shell input[type="url"],
html body.page-shell textarea,
html body.page-shell select,
html body.map-page input[type="text"],
html body.map-page input[type="search"],
html body.map-page textarea,
html body.map-page select {
  font-family: var(--wd-font) !important;
  font-size: var(--wd-fs-body) !important;
  line-height: var(--wd-lh-snug) !important;
  color: var(--wd-ink) !important;
  border: 1px solid var(--wd-line-2) !important;
  border-radius: var(--wd-r-md) !important;
  background: var(--wd-surface) !important;
  box-shadow: none !important;
}

html body.page-shell textarea {
  line-height: var(--wd-lh-body) !important;
}

html body.page-shell input:focus,
html body.page-shell textarea:focus,
html body.page-shell select:focus,
html body.map-page input:focus,
html body.map-page textarea:focus,
html body.map-page select:focus {
  outline: none !important;
  border-color: var(--wd-accent) !important;
  box-shadow: 0 0 0 3px var(--wd-accent-ring) !important;
}

html body.page-shell input::placeholder,
html body.page-shell textarea::placeholder,
html body.map-page input::placeholder {
  color: var(--wd-ink-4) !important;
}

/* ---------------------------------------------------------------------
   5. 按钮：主/次/幽灵三型，圆角 12px，禁止药丸
   --------------------------------------------------------------------- */
html body.page-shell .btn,
html body.map-page .btn,
html body.page-shell button.btn,
html body.map-page button.btn {
  font-family: var(--wd-font) !important;
  font-size: var(--wd-fs-sm) !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  border-radius: var(--wd-r-md) !important;
  min-height: 40px !important;
  padding: 0 var(--wd-s4) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: var(--wd-s2) !important;
  transition: background var(--wd-dur) var(--wd-ease),
    border-color var(--wd-dur) var(--wd-ease), color var(--wd-dur) var(--wd-ease),
    box-shadow var(--wd-dur) var(--wd-ease), transform 0.12s var(--wd-ease) !important;
}

/* 隐藏态必须压住上面的 inline-flex（否则 hidden 按钮全部显形） */
html body.page-shell .btn.hidden,
html body.map-page .btn.hidden,
html body.page-shell button.hidden,
html body.map-page button.hidden,
html body.page-shell .hidden,
html body.map-page .hidden {
  display: none !important;
}

html body.page-shell .btn-primary,
html body.map-page .btn-primary {
  background: var(--wd-accent) !important;
  border-color: var(--wd-accent) !important;
  color: #fff !important;
  box-shadow: none !important;
}

html body.page-shell .btn-primary:hover,
html body.map-page .btn-primary:hover {
  background: var(--wd-accent-hover) !important;
  border-color: var(--wd-accent-hover) !important;
}

html body.page-shell .btn-ghost,
html body.map-page .btn-ghost {
  background: var(--wd-surface) !important;
  border-color: var(--wd-line-2) !important;
  color: var(--wd-ink) !important;
  box-shadow: none !important;
}

html body.page-shell .btn-ghost:hover,
html body.map-page .btn-ghost:hover {
  background: var(--wd-surface-2) !important;
}

html body.page-shell .btn:active,
html body.map-page .btn:active {
  transform: translateY(1px) !important;
}

/* ---------------------------------------------------------------------
   6. 焦点可见性：键盘可达
   --------------------------------------------------------------------- */
html body.page-shell a:focus-visible,
html body.page-shell button:focus-visible,
html body.page-shell input:focus-visible,
html body.page-shell select:focus-visible,
html body.page-shell textarea:focus-visible,
html body.map-page a:focus-visible,
html body.map-page button:focus-visible,
html body.map-page input:focus-visible {
  outline: 2px solid var(--wd-accent) !important;
  outline-offset: 2px !important;
}

/* ---------------------------------------------------------------------
   7. 滚动条：细窄、低调
   --------------------------------------------------------------------- */
html body.page-shell ::-webkit-scrollbar,
html body.map-page ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html body.page-shell ::-webkit-scrollbar-thumb,
html body.map-page ::-webkit-scrollbar-thumb {
  background: rgba(29, 29, 31, 0.16);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}

html body.page-shell ::-webkit-scrollbar-thumb:hover,
html body.map-page ::-webkit-scrollbar-thumb:hover {
  background: rgba(29, 29, 31, 0.28);
  background-clip: content-box;
}
