/*
 * 视觉风格：每套风格是一组变量（颜色、字体、圆角、页头尺寸），挂在 <html data-theme="..."> 上；
 * 版式和质感上的差异写在 skins.css 里。
 * 选择器不限定 :root，任何元素加 data-theme 都能就地套用（设置面板里的风格小样就是这样渲染的）。
 * 只用系统字体（国内访问 Google Fonts 经常超时，会拖慢整页渲染）。
 */
:root {
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "Hiragino Sans GB", system-ui, sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "Noto Serif SC", "SimSun", serif;
}

/* 学院蓝：藏青配朱砂，默认风格 */
:root, [data-theme="academy"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --ink: #142235;
  --text: #2a3546;
  --muted: #5b6878;
  --subtle: #8792a2;
  --line: #e1e6ed;
  --line-strong: #cbd3de;
  --input-hover: #b4bfcd;
  --placeholder: #a3adba;
  --primary: #1d4f7c;
  --primary-dark: #143b5e;
  --primary-soft: #e7eff8;
  --primary-hover: #d9e6f4;
  --primary-border: #cddcec;
  --primary-line: #b9cbe0;
  --primary-ring: rgba(29, 79, 124, .16);
  --primary-text-2: #4b6683;
  --primary-grad: #3c76a8;
  --primary-shadow: rgba(29, 79, 124, .24);
  --accent-line: #8fb0d1;
  --on-accent: #ffffff;
  --seal: #b23a2b;
  --seal-soft: #fbeeec;
  --seal-border: #ebc6c0;
  --success: #2c7a57;
  --success-soft: #e5f3ec;
  --success-border: #bfdccd;
  --success-bg: #f5fbf8;
  --warning: #9a6312;
  --warning-soft: #fdf4e3;
  --warning-border: #ecd8b4;
  --warning-text-2: #8a6a3a;
  --code-bg: #f6f8fa;
  --header-bg: rgba(255, 255, 255, .94);
  --head-tint: rgba(29, 79, 124, .05);
  --selection: #cfe0f2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(20, 34, 53, .05);
  --shadow: 0 1px 2px rgba(20, 34, 53, .04), 0 6px 20px rgba(20, 34, 53, .05);
  --shadow-lg: 0 10px 34px rgba(20, 34, 53, .16);
  --hero-from: #143b5e;
  --hero-to: #1d4f7c;
  --hero-text: #ffffff;
  --hero-muted: rgba(255, 255, 255, .74);
  /* 版式 */
  --font-display: var(--font-serif);
  --font-label: var(--font-sans);
  --header-h: 64px;
  --chrome-top: 64px;
}

/* 暖米稿纸：原来的奶油暖棕配色 */
[data-theme="paper"] {
  color-scheme: light;
  --bg: #f5f1eb;
  --surface: #fffdf9;
  --surface-2: #fbf7f1;
  --surface-3: #f1ebe2;
  --ink: #3f3128;
  --text: #4a3f36;
  --muted: #7d7066;
  --subtle: #a19388;
  --line: #e6ddd3;
  --line-strong: #d8cbbf;
  --input-hover: #c7b6a7;
  --placeholder: #b9afa7;
  --primary: #795f4b;
  --primary-dark: #5f4a3a;
  --primary-soft: #f4e8de;
  --primary-hover: #ecd9ca;
  --primary-border: #e3cfbf;
  --primary-line: #d4bba7;
  --primary-ring: rgba(185, 146, 117, .2);
  --primary-text-2: #8a6d58;
  --primary-grad: #d8a47f;
  --primary-shadow: rgba(103, 77, 57, .24);
  --accent-line: #d9b399;
  --on-accent: #ffffff;
  --seal: #c06a48;
  --seal-soft: #fbece4;
  --seal-border: #ecc9b8;
  --success: #5f7b5d;
  --success-soft: #e9f1e6;
  --success-border: #c9d8c5;
  --success-bg: #f6faf4;
  --warning: #a0693d;
  --warning-soft: #fbf0e2;
  --warning-border: #ecd5b9;
  --warning-text-2: #8f6a4c;
  --code-bg: #fbfaf7;
  --header-bg: rgba(251, 248, 243, .94);
  --head-tint: rgba(217, 155, 119, .08);
  --selection: #e8c7ae;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(86, 68, 50, .05);
  --shadow: 0 2px 4px rgba(86, 68, 50, .03), 0 10px 30px rgba(86, 68, 50, .06);
  --shadow-lg: 0 16px 44px rgba(86, 68, 50, .16);
  --hero-from: #5f4a3a;
  --hero-to: #8a6c55;
  --hero-text: #fffaf3;
  --hero-muted: rgba(255, 250, 243, .76);
  /* 版式 */
  --font-display: var(--font-kai);
  --font-label: var(--font-kai);
  --header-h: 68px;
  --chrome-top: 68px;
}

/* 青瓷：青绿配素白 */
[data-theme="jade"] {
  color-scheme: light;
  --bg: #eff4f2;
  --surface: #ffffff;
  --surface-2: #f6faf8;
  --surface-3: #e5eeea;
  --ink: #12302a;
  --text: #26413b;
  --muted: #56716a;
  --subtle: #849a94;
  --line: #dbe6e2;
  --line-strong: #c3d4ce;
  --input-hover: #a9c2ba;
  --placeholder: #9fb3ad;
  --primary: #1f6f62;
  --primary-dark: #155247;
  --primary-soft: #e2f0ec;
  --primary-hover: #d1e7e0;
  --primary-border: #c0dcd3;
  --primary-line: #a5cabe;
  --primary-ring: rgba(31, 111, 98, .16);
  --primary-text-2: #3f6a60;
  --primary-grad: #45a08d;
  --primary-shadow: rgba(31, 111, 98, .24);
  --accent-line: #8cc0b2;
  --on-accent: #ffffff;
  --seal: #b5523b;
  --seal-soft: #fbefe9;
  --seal-border: #ecc8bb;
  --success: #2f7d4f;
  --success-soft: #e3f2e8;
  --success-border: #bddcc8;
  --success-bg: #f4faf6;
  --warning: #9a6a12;
  --warning-soft: #fcf4e2;
  --warning-border: #ead8b0;
  --warning-text-2: #85683a;
  --code-bg: #f4f8f7;
  --header-bg: rgba(255, 255, 255, .94);
  --head-tint: rgba(31, 111, 98, .06);
  --selection: #c9e6dd;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(18, 48, 42, .05);
  --shadow: 0 1px 2px rgba(18, 48, 42, .04), 0 8px 24px rgba(18, 48, 42, .06);
  --shadow-lg: 0 12px 36px rgba(18, 48, 42, .16);
  --hero-from: #134a40;
  --hero-to: #1f6f62;
  --hero-text: #ffffff;
  --hero-muted: rgba(255, 255, 255, .76);
  /* 版式 */
  --font-display: var(--font-sans);
  --font-label: var(--font-sans);
  --header-h: 60px;
  --chrome-top: 84px;
}

/* 墨夜：深色，夜里写论文不刺眼 */
[data-theme="ink"] {
  color-scheme: dark;
  --bg: #0f141b;
  --surface: #161d27;
  --surface-2: #1a2230;
  --surface-3: #202a38;
  --ink: #e9eef5;
  --text: #cdd6e2;
  --muted: #9ba8b9;
  --subtle: #748296;
  --line: #263243;
  --line-strong: #34435a;
  --input-hover: #475a78;
  --placeholder: #5f6d80;
  --primary: #82b4e6;
  --primary-dark: #a8cbf0;
  --primary-soft: rgba(130, 180, 230, .12);
  --primary-hover: rgba(130, 180, 230, .2);
  --primary-border: rgba(130, 180, 230, .28);
  --primary-line: rgba(130, 180, 230, .4);
  --primary-ring: rgba(130, 180, 230, .25);
  --primary-text-2: #9fbad6;
  --primary-grad: #4f86bd;
  --primary-shadow: rgba(0, 0, 0, .45);
  --accent-line: #4f7fae;
  --on-accent: #0c1420;
  --seal: #f08f7d;
  --seal-soft: rgba(240, 143, 125, .12);
  --seal-border: rgba(240, 143, 125, .32);
  --success: #6cc59a;
  --success-soft: rgba(108, 197, 154, .13);
  --success-border: rgba(108, 197, 154, .32);
  --success-bg: rgba(108, 197, 154, .06);
  --warning: #e4b660;
  --warning-soft: rgba(228, 182, 96, .12);
  --warning-border: rgba(228, 182, 96, .32);
  --warning-text-2: #c9a467;
  --code-bg: #121923;
  --header-bg: rgba(22, 29, 39, .92);
  --head-tint: rgba(130, 180, 230, .06);
  --selection: rgba(130, 180, 230, .35);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, .5);
  --hero-from: #0b1118;
  --hero-to: #17263a;
  --hero-text: #e9eef5;
  --hero-muted: #9ba8b9;
  /* 版式 */
  --font-display: var(--font-sans);
  --font-label: var(--font-mono);
  --header-h: 52px;
  --chrome-top: 52px;
}

:root {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* 切换风格时让颜色平滑过渡，平时不加过渡以免影响输入手感 */
html.theme-switching, html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {
  transition: background-color .35s ease, border-color .35s ease, color .25s ease, box-shadow .35s ease !important;
}
