/* Site-wide palette from content/全站颜色.md. QR sculpture colors remain separate. */
:root {
  color-scheme: dark;

  /* 底色 */
  --bg:            #000000;  /* 页面 */
  --surface:       #111111;  /* 卡片、媒体占位、二维码卡 */
  --surface-2:     #1F1F1F;  /* 次要按钮（Visit Site / View in Figma） */
  --surface-2-hover:#2E2E2E;

  /* 文字 */
  --text-strong:   #FFFFFF;  /* 大标题、章节标题、加粗引导词、当前章节、导航 (21) */
  --text-body:     #D4D4D4;  /* 正文、列表 (14.2) */
  --text-secondary:#A3A3A3;  /* 副文案、未选中章节、信息行标签、03 / 14 的 14 (8.3) */
  --text-tertiary: #8A8A8A;  /* 图注、说明、页脚小字 (6.1) */

  /* 线 */
  --line:          rgba(255,255,255,.10);  /* 分割线、栏目条上下线 ≈ #1A1A1A */
  --line-strong:   #333333;                /* 描边按钮、标签胶囊、主题按钮圆环 */

  /* 主按钮（Let's Talk）与提示 */
  --fill:          #FFFFFF;
  --on-fill:       #000000;
  --tip-bg:        #FFFFFF;
  --tip-text:      #111111;

  /* 大卡片进度刻度（stacked-progress） */
  --tick:          #5A5A5A;
  --tick-near:     #8A8A8A;
  --tick-active:   #FFFFFF;

  /* 选中文字 */
  --selection-bg:  #FFFFFF;
  --selection-text:#000000;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg:            #F7F7F5;
  --surface:       #FFFFFF;
  --surface-2:     #EDEDEA;
  --surface-2-hover:#E2E2DE;

  --text-strong:   #111111;  /* (17.6) */
  --text-body:     #2E2E2C;  /* (12.7) */
  --text-secondary:#525250;  /* (7.3) */
  --text-tertiary: #6B6B68;  /* (5.0) */

  --line:          rgba(0,0,0,.10);        /* ≈ #DEDEDC */
  --line-strong:   #D6D6D3;

  --fill:          #111111;
  --on-fill:       #FFFFFF;
  --tip-bg:        #111111;
  --tip-text:      #FFFFFF;

  --tick:          #C4C4C0;
  --tick-near:     #8F8F8B;
  --tick-active:   #111111;

  --selection-bg:  #111111;
  --selection-text:#FFFFFF;
}

::selection { background: var(--selection-bg); color: var(--selection-text); }

/* Compatibility aliases keep the existing renderers and motion unchanged. */
:root {
  --background: var(--bg);
  --foreground: var(--text-strong);
  --muted: var(--text-secondary);
  --border: var(--line-strong);
  --background-rgb: 0 0 0;
  --ink-rgb: 255 255 255;
  --cursor-ink: var(--tip-bg);
  --text-soft: var(--text-body);
  --text-faint: var(--text-tertiary);
  --text-error: var(--text-tertiary);
  --action-hover: #f2f2f2;
  --action-active: #dedede;
  --stack-surface: var(--surface);
  --surface-border: var(--line);
  --cover-border: var(--line-strong);
  --section-divider: var(--line);
  --dialog-surface: var(--surface);
  --dialog-divider: var(--line);
  --dialog-backdrop: rgb(0 0 0 / 72%);
  --control-border: var(--line-strong);
  --checker-a: var(--surface);
  --checker-b: #0e0e0e;
  --card-glow-rgb: 255 255 255;
  --card-glow-opacity: 3.5%;
  --art-hi: #eee;
  --art-edge: #999;
  --art-mid: #555;
  --footer-ink: var(--text-tertiary);
  --footer-link: var(--text-tertiary);
  --portrait-filter: blur(.35px);
  --portrait-fallback-filter: grayscale(1);
  --selected-icon-filter: brightness(0);
  --inactive-icon-filter: brightness(0) invert(.639216);
}
:root[data-theme="light"] {
  --background-rgb: 247 247 245;
  --ink-rgb: 17 17 17;
  --text-soft: var(--text-body);
  --text-faint: var(--text-tertiary);
  --text-error: var(--text-tertiary);
  --action-hover: #292927;
  --action-active: #3a3a37;
  --stack-surface: var(--surface);
  --surface-border: var(--line);
  --cover-border: var(--line-strong);
  --section-divider: rgba(0,0,0,.06);
  --dialog-surface: var(--surface);
  --dialog-divider: var(--line);
  --dialog-backdrop: rgb(25 25 22 / 28%);
  --control-border: var(--line-strong);
  --checker-a: var(--surface);
  --checker-b: #fafaf8;
  --card-glow-opacity: 55%;
  --art-hi: #292927;
  --art-edge: #62625c;
  --art-mid: #99998f;
  --footer-ink: var(--text-tertiary);
  --footer-link: var(--text-tertiary);
  --portrait-filter: brightness(0);
  --portrait-fallback-filter: grayscale(1) invert(1);
  --selected-icon-filter: brightness(0) invert(1);
  --inactive-icon-filter: brightness(0) invert(.321569);
}
.theme-toggle {
  width: 40px; height: 40px; flex: none; padding: 0;
  border-radius: 50%; border: 1px solid var(--border);
  background: transparent; color: var(--foreground);
  display: grid; place-items: center; cursor: pointer;
}
.theme-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.theme-toggle svg { width: 18px; height: 18px; overflow: visible; }
/* Reduced-motion mode uses the existing static monochrome line-art assets. */
:root[data-theme="light"] .card-art:not(.is-animated) img { filter: invert(1); }
:root[data-theme="light"] .hero-background.particles-fallback > img {
  filter: brightness(0); opacity: .35;
  mask: url("./assets/portrait-line-art.png") center / cover no-repeat;
  mask-mode: luminance;
}
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) {
  mask-image: radial-gradient(circle closest-side, #000 82%, transparent 100%);
  mask-repeat: no-repeat;
  animation: theme-snapshot-reveal var(--reveal-duration) var(--reveal-easing) both;
}
@keyframes theme-snapshot-reveal {
  from { mask-size: 0px 0px; mask-position: var(--reveal-x) var(--reveal-y); }
  to {
    mask-size: calc(2 * var(--reveal-radius)) calc(2 * var(--reveal-radius));
    mask-position: calc(var(--reveal-x) - var(--reveal-radius)) calc(var(--reveal-y) - var(--reveal-radius));
  }
}
.theme-reveal-veil {
  position: fixed; inset: 0; overflow: hidden; z-index: 2147483646; pointer-events: none;
}
.theme-reveal-veil > div {
  position: absolute;
  left: calc(var(--reveal-x) - var(--reveal-radius)); top: calc(var(--reveal-y) - var(--reveal-radius));
  width: calc(2 * var(--reveal-radius)); height: calc(2 * var(--reveal-radius));
  background: radial-gradient(circle closest-side, var(--reveal-color) 82%, transparent);
  transform: scale(0); will-change: transform;
}
.theme-reveal-veil[data-target="light"] { --reveal-color: #f7f7f5; }
.theme-reveal-veil[data-target="dark"] { --reveal-color: #000; }
::view-transition { pointer-events: none; }
@media (max-width: 600px) {
  .theme-toggle { width: 36px; height: 36px; }
  .greeting p { display: none; }
  .header-actions { gap: 8px; }
}
