/* =========================================================
 * css/base.css —— 设计令牌 / 主题 / 重置 / 排版
 * CSCA Math Lab · Thanh Ngân
 * ========================================================= */

/* ---------- 1. 设计令牌 ---------- */
:root {
  /* 主色：理性蓝紫渐变 */
  --brand-1: #4f46e5;
  --brand-2: #7c3aed;
  --brand-3: #a855f7;
  /* 语义色 */
  --vi: #059669;          /* 越南语 */
  --vi-soft: #10b981;
  --warn: #f59e0b;        /* 易错陷阱 */
  --danger: #e11d48;
  --info: #0ea5e9;
  --gold: #d4a017;

  /* 中性 */
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-glass: rgba(255, 255, 255, .72);
  --text: #16203a;
  --text-2: #475569;
  --muted: #7b8794;
  --border: #e4e8f0;
  --border-2: #d8deea;

  /* 圆角 / 阴影 */
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --sh-1: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --sh-2: 0 4px 12px rgba(16, 24, 40, .07), 0 2px 4px rgba(16, 24, 40, .04);
  --sh-3: 0 12px 28px rgba(16, 24, 40, .10), 0 4px 10px rgba(16, 24, 40, .05);
  --sh-brand: 0 14px 34px rgba(79, 70, 229, .28);
  --sh-vi: 0 14px 30px rgba(5, 150, 105, .26);

  /* 尺寸 */
  --sidebar-w: 280px;
  --topbar-h: 70px;

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

/* ---------- 2. 暗黑主题 ---------- */
[data-theme="dark"] {
  --bg: #0b1020;
  --bg-2: #101728;
  --surface: #151d33;
  --surface-2: #1a2340;
  --surface-glass: rgba(21, 29, 51, .72);
  --text: #eaf0ff;
  --text-2: #b8c4dd;
  --muted: #8b98b4;
  --border: #26314f;
  --border-2: #33405f;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 6px 16px rgba(0, 0, 0, .45);
  --sh-3: 0 18px 40px rgba(0, 0, 0, .55);
  --sh-brand: 0 16px 38px rgba(99, 102, 241, .40);

  --vi: #34d399;
  --vi-soft: #6ee7b7;
}

/* ---------- 3. 重置 ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .35s ease, color .35s ease;
}
/* 背景光斑（奢华感来源） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(680px 420px at 88% -8%, rgba(124, 58, 237, .16), transparent 62%),
    radial-gradient(560px 380px at 6% 4%, rgba(79, 70, 229, .14), transparent 60%),
    radial-gradient(520px 420px at 50% 108%, rgba(5, 150, 105, .10), transparent 65%);
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(680px 420px at 88% -8%, rgba(124, 58, 237, .26), transparent 62%),
    radial-gradient(560px 380px at 6% 4%, rgba(79, 70, 229, .22), transparent 60%),
    radial-gradient(520px 420px at 50% 108%, rgba(16, 185, 129, .14), transparent 65%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
svg { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.3px; }
p { margin: 0; }
ul { margin: 0; padding-left: 1.1em; }
code { font-family: var(--font-mono); font-size: .92em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
::selection { background: rgba(124, 58, 237, .28); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 4. 通用排版工具 ---------- */
.vi { color: var(--vi) !important; }
.vi-text { color: var(--vi); font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

.fade-up { animation: fadeUp .55s cubic-bezier(.22, .68, .3, 1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.pop { animation: pop .35s cubic-bezier(.2, .9, .3, 1.4) both; }
@keyframes pop { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
