/* Design tokens. Loaded first so every sheet resolves the same values; theme overrides live here too. */
:root {
  color-scheme: dark;

  /* Semantic colors (overridden by the light theme) */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: #111827;
  --bg-card-hover: #1f2937;
  --surface-raised: #161e2d;
  --surface-soft: #ffffff06;
  --surface-input: #0e1420;
  --surface-code: #0b111c;
  --theme-overlay: #050914b8;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.4);
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #8b95a7;
  --text-link: #c4b5fd;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --button-primary-bg: #7159c4;
  --action-gap: 8px;
  --action-section-gap: 12px;
  --action-height: 34px;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Fixed palette: these keep the same value in every theme, so they must not be used
     where the light theme is expected to recolor the element. */
  --color-white: #fff;
  --color-black: #000;
  --gray-900: #111827;
  --surface-deep: #050811;
  --surface-inset-dark: #0c1220;
  --surface-panel-dark: #101725;
  --overlay-control-bg: #101521e8;
  --white-alpha-04: #ffffff04;
  --white-alpha-05: #ffffff05;
  --white-alpha-06: #ffffff06;
  --white-alpha-08: #ffffff08;
  --white-alpha-0a: #ffffff0a;
  --white-alpha-0b: #ffffff0b;
  --white-alpha-0c: #ffffff0c;
  --white-alpha-0d: #ffffff0d;
  --white-alpha-12: #ffffff12;
  --violet-focus: #b7a5ff;
  --violet-accent: #8872e9;
  --violet-accent-tint: #8872e922;
  --violet-pale: #c7baff;
  --violet-light: #b8a3ff;
  --violet-bright: #a991ff;
  --violet-muted: #b7a5ed;
  --violet-300: #c4b5fd;
  --violet-400: #a78bfa;
  --indigo-300: #a5b4fc;
  --emerald-300: #6ee7b7;
  --amber-400: #fbbf24;
  --slate-300: #cbd5e1;
  --text-dim-auth: #929db4;
  --text-dim-menu: #7f899e;
  --text-dim-note: #8e9ab1;
  --text-dim-admin: #8996ae;
  --text-dim-messages: #8695af;
  --text-dim-guestbook: #8d9bb4;
  --text-dim-guestbook-meta: #8795ae;
  --text-dim-skills: #8c9fbb;
  --auth-input-text: #edf0fa;
  --border-skills: #293247;
  --light-accent-tint-0d: #7454a50d;
  --light-accent-tint-2b: #7454a52b;

  /* Shadows */
  --shadow-color-soft: #0002;
  --shadow-color: #0003;

  /* Shape and type */
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --admin-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --display-font: Georgia, "Noto Serif SC", "Songti SC", SimSun, serif;
  --code-font: "JetBrains Mono", "Cascadia Code", "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, "PingFang SC", "Microsoft YaHei", monospace;
  --admin-body-size: .875rem;
  --admin-control-size: .875rem;
  --admin-meta-size: .75rem;
  --admin-space-group: 24px;
  --community-profile-bg: #0a101bc0;
  --community-profile-hover: #181d32;
  --community-icon-bg: var(--white-alpha-06);
  --community-wechat: #7fcda3;
  --community-bilibili: #74cce4;
  --community-xiaohongshu: #ff99a8;
  --community-douyin: #e7e6f3;
  --community-github: #d9def0;
  --community-qq: #70c7ed;
  --json-key: #9fcbff;
  --json-string: #9cdcae;
  --json-number: #ffb879;
  --json-literal: #d6a1eb;
  --code-selection-bg: #2f3c78;
  --code-selection-fg: #ffffff;

  /* Metadata tags */
  --tag-radius: 6px;
  --tag-font-size: 11px;
  --tag-line-height: 18px;
  --tag-padding: 2px 7px;
  --tag-neutral-bg: color-mix(in srgb,var(--text-link) 8%,transparent);
  --tag-neutral-fg: var(--text-link);
  --tag-accent-fg: var(--text-link);
  --tag-blue-fg: #a8caff;
  --tag-warning-fg: var(--warning);

  /* z-index scale. Values are the exact numbers used before tokenisation; keep the order intact.
     --z-local-* only order siblings inside a component's own stacking context. */
  --z-below: -1;
  --z-local-1: 1;
  --z-local-2: 2;
  --z-local-3: 3;
  --z-local-4: 4;
  --z-local-5: 5;
  --z-local-6: 6;
  --z-local-8: 8;
  --z-side-rail: 20;
  --z-expanded: 40;
  --z-floating-bar: 90;
  --z-sticky: 100;
  --z-dropdown: 110;
  --z-dropdown-raised: 150;
  --z-modal: 500;
  --z-toast: 1000;
  --z-modal-nested: 1200;
  --z-popover: 10000;
  --z-popover-top: 10010;
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] {
  color-scheme: light;
  --bg-primary: #f6f5f1; --bg-secondary: #eeede7; --bg-card: #fffefa; --bg-card-hover: #eae7e0;
  --surface-raised: #fffefa; --surface-soft: #29231b06; --surface-input: #fffefa;
  --border-color: #322b211c; --border-active: #7157a870;
  --text-primary: #29272d; --text-secondary: #605e69; --text-muted: #6b6672;
  --accent: #70529e; --accent-hover: #5a4084; --accent-gradient: linear-gradient(135deg,#7454a5,#8865ac);
  --success: #247454; --warning: #8f6418; --danger: #ac384d; --theme-overlay: #29233270;
  --community-profile-bg: #f2f0eb; --community-profile-hover: #eae6df; --community-icon-bg: #fffefa;
  --community-wechat: #27754e; --community-bilibili: #226c81; --community-xiaohongshu: #b64763;
  --community-douyin: #62536e; --community-github: #56505e; --community-qq: #226c81;
  --text-link: #70529e; --surface-code: #eeece5;
  --button-primary-bg: #70529e;
  --tag-blue-fg: #245f9b; --tag-warning-fg: #805812;
  --json-key: #1f5a92; --json-string: #1f6b4a; --json-number: #9c4711; --json-literal: #7b3594;
  --code-selection-bg: #d4c6ec; --code-selection-fg: #1f182b;
}
