/* 轻笔记 3.4 设计令牌：一张温润的纸，安放在沉静的木案上。
   浅色为「宣纸与暖案」，深色为「砚石与夜灯」。视图样式统一引用这里的令牌。
   衬线字体 QingSerif 拆分为按需子集，由 styles/fonts.css 声明。 */

:root {
  color-scheme: light;

  /* 表面阶梯：由远及近，层次分明且温润通透 */
  --desk: #e5e1d5;          /* 纸外的书桌底色 */
  --surface-0: #f7f5ef;     /* 应用窗口底 */
  --surface-1: #fbfaf6;     /* 侧栏、顶栏、工具栏 */
  --surface-2: #fffefb;     /* 卡片、对话框、浮层（高遮盖防透视） */
  --surface-3: #f0ece2;     /* 凹槽、分段底、悬停 */
  --surface-4: #e5e0d3;     /* 按下态 */
  --paper: #fffdf7;         /* 纸色 */
  --paper-night: #1f1e1b;   /* 夜读护眼纸色 */

  /* 墨色阶梯（确保正文 > 11:1，次文 > 6:1，辅文 ≥ 4.8:1 符合 WCAG AA） */
  --ink-1: #23221e;
  --ink-2: #54544c;
  --ink-3: #696a60;
  --ink-4: #8a897e;

  /* 边界线（非文本控件对比清晰） */
  --line: #e4e0d5;
  --line-strong: #c8c3b5;
  --line-subtle: rgb(42 38 30 / .07);

  /* 窑变陶土：核心交互与焦点色 */
  --accent: #b85d43;
  --accent-hover: #a54e36;
  --accent-ink: #8f3e27;
  --accent-soft: #f5e5dc;
  --accent-line: #e0bba7;
  --on-accent: #fffbf7;

  /* 松绿：保存就绪、正向反馈 */
  --green: #4d6f59;
  --green-soft: #e3ede6;

  /* 警示红 */
  --danger: #b23828;
  --danger-soft: #f8e2dd;

  /* 遮罩、毛玻璃、双层焦点环与纸面微纹理 */
  --scrim: rgb(28 25 20 / .34);
  --glass: rgb(255 254 250 / .84);
  --glass-strong: rgb(255 254 250 / .94);
  --glass-line: rgb(255 255 255 / .82);
  --glass-border: rgb(42 36 26 / .10);
  --glass-specular: inset 0 1px 0 rgb(255 255 255 / .78);
  --highlight: inset 0 1px 0 rgb(255 255 255 / .72);
  --swatch-ring: rgb(35 30 22 / .20);
  --focus: #9a442c;
  --ring: 0 0 0 2px var(--surface-2), 0 0 0 4px color-mix(in srgb, var(--focus) 72%, transparent);
  --ring-soft: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .22 0 0 0 .045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  /* 滚动条令牌（与底色对比 ≥ 3:1） */
  --scrollbar-thumb: #9e998b;
  --scrollbar-track: transparent;

  /* 暖棕环境光遮蔽投影系统 */
  --shadow-1: 0 1px 2px rgb(46 38 24 / .07), 0 0 0 1px rgb(46 38 24 / .03);
  --shadow-2: 0 6px 20px rgb(46 38 24 / .09), 0 2px 5px rgb(46 38 24 / .06);
  --shadow-3: 0 24px 64px rgb(32 26 18 / .20), 0 6px 18px rgb(32 26 18 / .09);
  --shadow-glass: 0 8px 28px rgb(42 34 22 / .10), 0 2px 6px rgb(42 34 22 / .06);
  --shadow-paper: 0 2px 4px rgb(48 39 25 / .09), 0 10px 28px rgb(48 39 25 / .11);
  --shadow-book: 0 2px 4px rgb(38 30 20 / .14), 0 10px 22px -4px rgb(38 30 20 / .16), 0 20px 36px -12px rgb(38 30 20 / .12);
  --shadow-book-hover: 0 4px 8px rgb(38 30 20 / .15), 0 18px 34px -6px rgb(38 30 20 / .22), 0 28px 48px -14px rgb(38 30 20 / .14);

  --radius-xs: 6px;
  --radius-s: 9px;
  --radius-m: 13px;
  --radius-l: 20px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --font-ui: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', 'PingFang SC', 'HarmonyOS Sans SC', 'MiSans', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Noto Sans CJK SC', 'Source Han Sans SC', system-ui, sans-serif;
  --font-serif: QingSerif, 'Songti SC', 'Noto Serif CJK SC', 'Noto Serif SC', 'Source Han Serif SC', Georgia, serif;

  --text-xs: 12px;
  --text-s: 13px;
  --text-m: 14.5px;
  --text-l: 17px;
  --text-xl: 22px;
  --text-2xl: 30px;
  --text-3xl: 40px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --control: 36px;
  --control-l: 40px;
  --sidebar: 244px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.18, .98, .28, 1.06);
  --fast: 130ms;
  --normal: 220ms;
  --slow: 320ms;

  accent-color: var(--accent);
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --desk: #121110;
  --surface-0: #181715;
  --surface-1: #1f1e1b;
  --surface-2: #282723;
  --surface-3: #33312c;
  --surface-4: #403d37;

  /* 深色墨阶：确保未选标签、占位符、副标题均具高可读性 */
  --ink-1: #f0ede4;
  --ink-2: #c6c2b6;
  --ink-3: #999589;
  --ink-4: #7a786f;

  --line: #36342f;
  --line-strong: #4d4a43;
  --line-subtle: rgb(255 250 240 / .06);

  --accent: #df8b6b;
  --accent-hover: #e79c7e;
  --accent-ink: #f0ad91;
  --accent-soft: #432e26;
  --accent-line: #764d3d;
  --on-accent: #1d120d;

  --green: #8eb79c;
  --green-soft: #26352c;

  --danger: #eb8470;
  --danger-soft: #4a261f;

  --scrim: rgb(0 0 0 / .62);
  --glass: rgb(36 35 31 / .86);
  --glass-strong: rgb(40 39 35 / .95);
  --glass-line: rgb(255 250 240 / .11);
  --glass-border: rgb(255 250 240 / .12);
  --glass-specular: inset 0 1px 0 rgb(255 250 240 / .09);
  --highlight: inset 0 1px 0 rgb(255 255 255 / .06);
  --swatch-ring: rgb(255 250 240 / .28);
  --focus: #f0ad91;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .024 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --scrollbar-thumb: #6f6c63;
  --scrollbar-track: transparent;

  --shadow-1: 0 1px 3px rgb(0 0 0 / .36), 0 0 0 1px rgb(255 255 255 / .03);
  --shadow-2: 0 6px 22px rgb(0 0 0 / .44), 0 2px 6px rgb(0 0 0 / .28);
  --shadow-3: 0 26px 68px rgb(0 0 0 / .65), 0 6px 18px rgb(0 0 0 / .38);
  --shadow-glass: 0 8px 28px rgb(0 0 0 / .42), 0 2px 6px rgb(0 0 0 / .26);
  --shadow-paper: 0 2px 6px rgb(0 0 0 / .45), 0 14px 36px rgb(0 0 0 / .52);
  --shadow-book: 0 3px 6px rgb(0 0 0 / .45), 0 12px 26px -4px rgb(0 0 0 / .55);
  --shadow-book-hover: 0 6px 12px rgb(0 0 0 / .50), 0 20px 38px -6px rgb(0 0 0 / .64);
}
