/* ==========================================================================
   易支付 UI · base.css
   设计令牌 / 重置 / 排版 / 工具类 / 动效基建
   ========================================================================== */

:root {
  color-scheme: light;

  /* 品牌色 */
  --brand: #3a5cf5;
  --brand-600: #2c4ae0;
  --brand-700: #2137b0;
  --brand-50: #eef2ff;
  --brand-100: #e2e8ff;
  --brand-ring: rgba(58, 92, 245, .16);

  /* 中性色 */
  --bg: #f5f6f9;
  --bg-soft: #fafbfd;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eff1f6;
  --line: #e7e9f0;
  --line-2: #d7dbe6;
  --ink: #0e1526;
  --ink-2: #495469;
  --ink-3: #8b95a8;
  --ink-4: #adb6c6;

  /* 语义色 */
  --ok: #0f9f6e;
  --ok-50: #e7f7f0;
  --warn: #c07414;
  --warn-50: #fdf3e2;
  --danger: #de3b42;
  --danger-50: #fdeceb;
  --info: #0e8f9c;
  --info-50: #e5f6f7;

  /* 支付品牌 */
  --alipay: #1677ff;
  --wechat: #07c160;
  --qq: #12b7f5;

  /* 圆角 */
  --r-xs: 6px;
  --r-sm: 9px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  /* 阴影 */
  --sh-1: 0 1px 2px rgba(14, 21, 38, .05);
  --sh-2: 0 2px 4px rgba(14, 21, 38, .04), 0 12px 28px -16px rgba(14, 21, 38, .24);
  --sh-3: 0 34px 80px -34px rgba(14, 21, 38, .38);
  --sh-brand: 0 10px 24px -12px rgba(58, 92, 245, .7);

  /* 布局 */
  --topbar-h: 62px;
  --sidebar-w: 240px;

  /* 动效 */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur: .22s;

  --font-sans: "Inter", "HarmonyOS Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  color-scheme: dark;

  --brand: #6d88ff;
  --brand-600: #8ea2ff;
  --brand-700: #4d6bee;
  --brand-50: #141d33;
  --brand-100: #1b2542;
  --brand-ring: rgba(109, 136, 255, .22);

  --bg: #090c13;
  --bg-soft: #0c1018;
  --surface: #101620;
  --surface-2: #151c28;
  --surface-3: #1b2332;
  --line: #212a3a;
  --line-2: #2c3749;
  --ink: #e8eef8;
  --ink-2: #a2adc1;
  --ink-3: #6f7e97;
  --ink-4: #55617a;

  --ok: #3ddc97;
  --ok-50: #0c2a21;
  --warn: #f0b45c;
  --warn-50: #2a2114;
  --danger: #ff7070;
  --danger-50: #2c1618;
  --info: #4dd0e1;
  --info-50: #0b2529;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .45);
  --sh-2: 0 2px 4px rgba(0, 0, 0, .3), 0 14px 32px -18px rgba(0, 0, 0, .85);
  --sh-3: 0 34px 80px -30px #000;
  --sh-brand: 0 10px 26px -12px rgba(109, 136, 255, .55);
}

/* ---------- reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: var(--brand); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--ink-4); }

/* ---------- 排版 ---------- */
h1, h2, h3, h4 { font-weight: 650; letter-spacing: -.011em; color: var(--ink); }
h1 { font-size: 26px; line-height: 1.25; }
h2 { font-size: 19px; line-height: 1.35; }
h3 { font-size: 15px; line-height: 1.45; }

.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-2); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 工具类 ---------- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.row { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.center { display: flex; align-items: center; justify-content: center; }
.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mt-auto { margin-top: auto; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hide { display: none !important; }
.only-mobile { display: none !important; }

.grid { display: grid; gap: 16px; }
.grid-split { grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }

/* ---------- 动效基建 ---------- */
@keyframes riseIn {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: translate3d(0, 10px, 0) scale(.975); }
  to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes sheetUp {
  from { opacity: 0; transform: translate3d(0, 100%, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes shimmer {
  0%   { background-position: -320px 0; }
  100% { background-position: 320px 0; }
}

.anim-rise { animation: riseIn .5s var(--ease) both; }
.anim-fade { animation: fadeIn .35s var(--ease) both; }

/* 子元素依次入场：用 :nth-child 控制，避免依赖 JS */
.stagger > * { animation: riseIn .55s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .10s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }
.stagger > *:nth-child(7) { animation-delay: .255s; }
.stagger > *:nth-child(8) { animation-delay: .29s; }
.stagger > *:nth-child(9) { animation-delay: .32s; }
.stagger > *:nth-child(10) { animation-delay: .35s; }
.stagger > *:nth-child(n+11) { animation-delay: .37s; }

.lift {
  transition: transform .24s var(--ease), box-shadow .24s var(--ease), border-color .24s var(--ease);
}
.lift:hover {
  transform: translate3d(0, -2px, 0);
  box-shadow: var(--sh-2);
}

/* 尊重系统「减少动态效果」 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 响应式基建 ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .only-mobile { display: inline-flex !important; }
  .hide-mobile { display: none !important; }
}

@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 22px; }
}
