/* ─────────────────────────────────────────────────────────────────────────────
   Lab Knowledge — design tokens
   清爽、低饱和、无衬线的实验室知识平台视觉系统。
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  --c-paper:        #f7f9fc;
  --c-paper-soft:   #eef3f8;
  --c-paper-edge:   #dde6ef;

  --c-ink:          #172033;
  --c-ink-soft:     #42526a;
  --c-ink-mute:     #5b6675;   /* ≥4.5:1 on --c-paper (was #6b788c ≈4.2:1) */
  --c-ink-faint:    #6c7889;   /* ~4.2:1 on --c-paper (was #9aa6b5 ≈2.3:1) */

  --c-line:         #d7e0ea;
  --c-line-strong:  #b9c7d6;

  --c-brand:        #2563eb;
  --c-brand-soft:   #1d4ed8;
  --c-brand-glow:   rgba(37, 99, 235, 0.10);

  --c-accent:       #0f766e;
  --c-accent-soft:  #14b8a6;

  --c-gold:         #b7791f;
  --c-azure:        #0369a1;
  --c-violet:       #6d5bd0;

  --c-success:      #15803d;
  --c-warn:         #b45309;
  --c-danger:       #b91c1c;

  --c-code-bg:      #edf2f7;
  --c-code-fg:      #1f2937;
  --c-code-line:    #d4dde8;

  /* Syntax-highlight palette (paper). Tokenised so ink/auto can remap once. */
  --code-comment:   #7a7461;
  --code-kw:        #2e4f3d;
  --code-str:       #8e2a1f;
  --code-builtin:   #2c4f6b;
  --code-fn:        #5e4a78;
  --code-class:     #9a7326;
  --code-op:        #4a5350;
  --code-num:       #b53a2c;

  --ff-serif:  "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --ff-sans:   -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Helvetica Neue", Arial, sans-serif;
  --ff-mono:   "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, Menlo, monospace;

  --fs-1: clamp(2.4rem, 1.6rem + 2.2vw, 3.6rem);
  --fs-2: clamp(1.85rem, 1.3rem + 1.4vw, 2.6rem);
  --fs-3: 1.55rem;
  --fs-4: 1.25rem;
  --fs-body: 1rem;          /* 16px base */
  --fs-small: 0.875rem;
  --fs-xs: 0.78rem;

  --lh-tight: 1.18;
  --lh-snug:  1.35;
  --lh-body:  1.7;
  --lh-loose: 1.85;

  --tracking-tight: -0.015em;
  --tracking-wide:  0.04em;
  --tracking-caps:  0.12em;

  /* — Spacing scale (8pt-ish, non-linear) — */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 2.75rem;
  --sp-8: 4rem;
  --sp-9: 5.5rem;

  /* — Layout — */
  --shell-max:     1240px;
  --shell-tight:   880px;       /* 阅读栏宽，约 70 字符 */
  --shell-prose:   720px;
  --gutter:        clamp(1rem, 2.5vw, 2.5rem);

  /* — Radius — */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* — Shadows: 极克制，主要靠分隔线 — */
  --sh-1: 0 1px 0 rgba(26, 31, 29, 0.04);
  --sh-2: 0 1px 2px rgba(26, 31, 29, 0.05), 0 0 0 1px var(--c-paper-edge);
  --sh-3: 0 12px 32px -16px rgba(26, 31, 29, 0.18);

  /* — Motion — */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-emph:     cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);   /* expo-out: entrances & reveals */
  --dur-fast:    140ms;
  --dur-base:    220ms;
  --dur-slow:    420ms;
}

/* dark variant via [data-theme="ink"] — auto-toggle 在下方 @media 中处理 */
[data-theme="ink"] {
  color-scheme: dark;

  --c-paper:       #0d1117;
  --c-paper-soft:  #121821;
  --c-paper-edge:  #222b37;
  --c-ink:         #d6dde7;
  --c-ink-soft:    #aab5c3;
  --c-ink-mute:    #7d8898;
  --c-ink-faint:   #828f9f;   /* ≥4.5:1 on --c-paper (was #536071 ≈3:1) */
  --c-line:        #242e3a;
  --c-line-strong: #344150;
  --c-brand:       #6f93d8;
  --c-brand-soft:  #8aa8e3;
  --c-brand-glow:  rgba(111, 147, 216, 0.12);
  --c-accent:      #54c8ba;
  --c-accent-soft: #6fd6c8;
  --c-gold:        #d9a441;
  --c-azure:       #4a9fd4;
  --c-violet:      #9b8ae0;
  --c-success:     #4ca86a;
  --c-warn:        #d68a3a;
  --c-danger:      #e0736f;
  --c-code-bg:     #111722;
  --c-code-fg:     #cbd5e1;
  --c-code-line:   #263241;

  --code-comment:  #7d8a7a;
  --code-kw:       #8fc4a8;
  --code-str:      #e0857a;
  --code-builtin:  #7fa8cf;
  --code-fn:       #b09cd6;
  --code-class:    #d9b866;
  --code-op:       #9aa6a2;
  --code-num:      #e0a08f;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;

    --c-paper:       #0d1117;
    --c-paper-soft:  #121821;
    --c-paper-edge:  #222b37;
    --c-ink:         #d6dde7;
    --c-ink-soft:    #aab5c3;
    --c-ink-mute:    #7d8898;
    --c-ink-faint:   #828f9f;
    --c-line:        #242e3a;
    --c-line-strong: #344150;
    --c-brand:       #6f93d8;
    --c-brand-soft:  #8aa8e3;
    --c-brand-glow:  rgba(111, 147, 216, 0.12);
    --c-accent:      #54c8ba;
    --c-accent-soft: #6fd6c8;
    --c-gold:        #d9a441;
    --c-azure:       #4a9fd4;
    --c-violet:      #9b8ae0;
    --c-success:     #4ca86a;
    --c-warn:        #d68a3a;
    --c-danger:      #e0736f;
    --c-code-bg:     #111722;
    --c-code-fg:     #cbd5e1;
    --c-code-line:   #263241;

    --code-comment:  #7d8a7a;
    --code-kw:       #8fc4a8;
    --code-str:      #e0857a;
    --code-builtin:  #7fa8cf;
    --code-fn:       #b09cd6;
    --code-class:    #d9b866;
    --code-op:       #9aa6a2;
    --code-num:      #e0a08f;
  }
}
