/* ============================================================
   AIGC Research Hub — Design Tokens
   Light (day) + Dark (night) themes via [data-theme] on <html>

   Tuned against CLAUDE.md:
   · Rule 1/2/10  bold hierarchy — wide, decisive type scale
   · Rule 4       strong separation — borders you can actually see
   · Rule 15      numbers dominate — dedicated display sizes
   · Rule 16      room to breathe — one spacing scale, generous defaults
   ============================================================ */

:root {
  /* ---------- Typography ---------- */
  --font-sans: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Cascadia Code", Menlo, monospace;

  /* Body range — small steps, used for text */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 15px;

  /* Heading range — deliberate jumps so levels never look similar */
  --fs-lg: 18px;    /* card / section titles      */
  --fs-xl: 23px;    /* major section headings     */
  --fs-2xl: 29px;   /* sub-page headings          */
  --fs-3xl: 38px;   /* page title — unmistakable  */

  /* Display range — numbers only (Rule 15) */
  --fs-num: 44px;   /* standard KPI value         */
  --fs-num-lg: 64px;/* focal / hero KPI value     */

  /* ---------- Spacing scale (Rule 16) ---------- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 22px;
  --sp-6: 28px;
  --sp-7: 36px;
  --sp-8: 48px;
  --sp-9: 64px;

  --card-pad: 26px;     /* internal card padding  */
  --gap: 22px;          /* between sibling cards  */
  --gap-section: 40px;  /* between major sections */

  /* ---------- Radius ---------- */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  /* ---------- Layout ---------- */
  --sidebar-w: 252px;
  --topbar-h: 62px;
  --page-x: 5%;               /* Rule 17: 5% / 90% / 5% */

  /* ---------- Motion ---------- */
  --dur: .16s;
  --dur-slow: .3s;
  --dur-reveal: .58s;
  --dur-count: 1100ms;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);   /* content settling into place */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1); /* slight overshoot */
}

/* ------------------------------------------------------------
   LIGHT (day) — default
   ------------------------------------------------------------ */
:root,
:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f2f5f9;
  --bg-sunken: #e7ecf3;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eef2f8;

  /* Rule 4 — borders must genuinely separate */
  --border: #dbe2ec;
  --border-strong: #b6c4d6;
  --border-focal: #93a6bf;

  --text: #0d1526;
  --text-2: #41506a;
  --text-3: #7b8ba4;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-strong: #1e40af;
  --primary-soft: #e6eefe;
  --primary-text: #1d4ed8;
  --on-primary: #ffffff;

  --success: #16a34a;
  --success-soft: #ddf3e5;
  --success-text: #15803d;

  --danger: #dc2626;
  --danger-soft: #fce7e7;
  --danger-text: #b91c1c;

  --warn: #d97706;
  --warn-soft: #fceed6;
  --warn-text: #a95c06;

  --purple: #7c3aed;
  --purple-soft: #efe8fd;
  --purple-text: #6d28d9;

  --teal: #0d9488;
  --teal-soft: #d9f2ef;
  --teal-text: #0f766e;

  --gray-soft: #eaeef4;
  --gray-text: #56667d;

  --overlay: rgba(13, 21, 38, .55);

  /* Depth — layered shadows read as real elevation, not a flat blur */
  --shadow-sm: 0 1px 2px rgba(13, 21, 38, .07);
  --shadow-md: 0 4px 16px rgba(13, 21, 38, .10);
  --shadow-lg: 0 14px 40px rgba(13, 21, 38, .18);
  --elev-1: 0 1px 2px rgba(13,21,38,.06), 0 2px 6px rgba(13,21,38,.05);
  --elev-2: 0 2px 4px rgba(13,21,38,.06), 0 6px 16px rgba(13,21,38,.08);
  --elev-3: 0 4px 8px rgba(13,21,38,.07), 0 14px 32px rgba(13,21,38,.13);
  --elev-4: 0 10px 20px rgba(13,21,38,.09), 0 28px 60px rgba(13,21,38,.18);
  /* the light catching a raised top edge */
  --sheen: inset 0 1px 0 rgba(255,255,255,.85);
  --sheen-strong: inset 0 1px 0 rgba(255,255,255,.28);
  --surface-grad: linear-gradient(180deg, #ffffff 0%, #fafbfe 100%);
  --shadow-focal: 0 10px 24px rgba(37,99,235,.28), 0 2px 6px rgba(37,99,235,.2);
  --shadow-primary: 0 4px 10px rgba(37,99,235,.28), 0 1px 2px rgba(37,99,235,.2);
  --shadow-danger: 0 4px 10px rgba(220,38,38,.26), 0 1px 2px rgba(220,38,38,.18);
  --shadow-success: 0 4px 10px rgba(22,163,74,.26), 0 1px 2px rgba(22,163,74,.18);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, .30);
}

/* ------------------------------------------------------------
   DARK (night)
   ------------------------------------------------------------ */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0d131b;
  --bg-sunken: #090e15;
  --surface: #161f2b;
  --surface-2: #1c2735;
  --surface-3: #223041;

  --border: #2b3849;
  --border-strong: #435671;
  --border-focal: #5b7191;

  --text: #e9eff7;
  --text-2: #a6b5c9;
  --text-3: #6b7d95;

  --primary: #3b82f6;
  --primary-hover: #5c96f8;
  --primary-strong: #2563eb;
  --primary-soft: rgba(59, 130, 246, .18);
  --primary-text: #85b4fc;
  --on-primary: #ffffff;

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, .16);
  --success-text: #5cd884;

  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, .16);
  --danger-text: #f58d8d;

  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, .16);
  --warn-text: #f7c05e;

  --purple: #8b5cf6;
  --purple-soft: rgba(139, 92, 246, .18);
  --purple-text: #b79ffa;

  --teal: #14b8a6;
  --teal-soft: rgba(20, 184, 166, .16);
  --teal-text: #4fd1c1;

  --gray-soft: rgba(148, 163, 184, .14);
  --gray-text: #9fadc0;

  --overlay: rgba(2, 6, 12, .68);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .38);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .45);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, .58);
  --elev-1: 0 1px 2px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.3);
  --elev-2: 0 2px 4px rgba(0,0,0,.4), 0 6px 16px rgba(0,0,0,.38);
  --elev-3: 0 4px 8px rgba(0,0,0,.45), 0 14px 32px rgba(0,0,0,.5);
  --elev-4: 0 10px 20px rgba(0,0,0,.5), 0 28px 60px rgba(0,0,0,.62);
  --sheen: inset 0 1px 0 rgba(255,255,255,.07);
  --sheen-strong: inset 0 1px 0 rgba(255,255,255,.16);
  --surface-grad: linear-gradient(180deg, #1a2432 0%, #151d29 100%);
  --shadow-focal: 0 10px 24px rgba(0,0,0,.55), 0 2px 6px rgba(59,130,246,.28);
  --shadow-primary: 0 4px 10px rgba(0,0,0,.45), 0 1px 2px rgba(59,130,246,.3);
  --shadow-danger: 0 4px 10px rgba(0,0,0,.45), 0 1px 2px rgba(239,68,68,.3);
  --shadow-success: 0 4px 10px rgba(0,0,0,.45), 0 1px 2px rgba(34,197,94,.3);
  --focus-ring: 0 0 0 3px rgba(59, 130, 246, .38);
}
