@charset "UTF-8";
/* =============================================================================
   base.css — 设计令牌 / 重置 / 排版 / 全局背景
   所有组件只消费这里的变量，改主题只需改本文件顶部。
   ============================================================================= */

/* ---------------------------------------------------------------- 0. 字体
   全站只下载一个字体文件，而且是「标题专用」的子集：
   正文与 UI 走系统无衬线（零下载、首屏不掉字），
   只有展示级标题（hero / 页面大标题 / 小节标题 / 年份）用衬线。
   衬线是本站的语气——制图、旧书、编号，比几何无衬线更贴合「星图」这个概念。
   子集由 .build/subset_display.py 生成，只含站点里真实出现过的字（约 320KB）。 */
@font-face {
  font-family: "Chweb Display";
  src: url("../fonts/display-serif.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------------- 1. 令牌
   视觉语言：「雾霭 · 宣纸 · 微光」
     · 底色不是纯黑/纯白，而是带一点色偏的暖灰 / 深蓝灰
     · 背景是几团低饱和的柔光缓慢漂移（颜色随时段流转）
     · 表面一律半透明 + 背景模糊，靠层次而不是靠描边
     · 强调色收敛为「雾蓝 + 陶土粉」，整体低饱和
   改主题只需改本文件这一段。 */
:root {
  color-scheme: dark;

  /* 背景层级 */
  --bg-0: #0d1017;
  --bg-1: #141922;
  --bg-2: #1b212c;

  /* 表面 / 描边（磨砂玻璃） */
  --surface: rgba(255, 255, 255, 0.07);
  --surface-hi: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.12);
  --border-hi: rgba(255, 255, 255, 0.24);

  /* 文字 */
  --text: #e9ebf1;
  --text-dim: #a9b0be;
  --text-mute: #848c9c;

  /* 品牌 / 语义 */
  --brand: #8ea2d8;
  --brand-2: #c2958f;
  --brand-soft: rgba(142, 162, 216, 0.16);
  --ok: #6f9c7d;
  --warn: #c9a26a;
  --bad: #c07f7f;

  /* 渐变 */
  --grad-text: linear-gradient(96deg, #eef1f7 0%, #b9c6e2 46%, #d9bfb9 100%);
  --grad-brand: linear-gradient(135deg, #8ea2d8 0%, #c2958f 100%);
  --hairline: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 45%);

  /* 阴影 —— 多层叠加才有「质感」，且都往冷色偏一点 */
  --shadow-1: 0 1px 2px rgba(6, 10, 20, 0.30), 0 4px 12px -6px rgba(6, 10, 20, 0.55);
  --shadow-2: 0 18px 40px -22px rgba(6, 10, 20, 0.85);
  --shadow-3: 0 34px 80px -34px rgba(6, 10, 20, 0.9);
  --ring: 0 0 0 1px var(--border) inset;

  /* 圆角 */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;

  /*  easing —— 统一动效语言 */
  /* ---------------------------------------------------------------- 动效令牌
     参考 Apple 的动效语言：平滑、无过冲、位移克制、时间长而不拖沓。
     · 缓动只有三条，别再自造：
         --ease-apple   进出都平顺，绝大多数属性过渡（位移 / 颜色 / 边框）用它
         --ease-out     出场用（元素进入视口），尾段收得慢，显得从容
         --ease-in-out  换场用，两端都收
     · 时长按「动作幅度」选，不按喜好：
         按压 0.12s → hover 0.16s → 常规 0.32s → 出场 0.62s → 大段 0.9s
     · 交错统一 80ms：再快显得急，再慢显得散 */
  --ease-apple: cubic-bezier(0.28, 0.11, 0.32, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  /* 这里原本是 cubic-bezier(0.34, 1.42, 0.64, 1)——过冲到 1.42，
     弹一下是"有活力"，但不属于这套语言（Apple 几乎不用回弹）。
     保留变量名（有 6 处引用），改成极轻微回弹，只留给按压这类极短反馈。 */
  --ease-spring: cubic-bezier(0.34, 1.12, 0.64, 1);

  --d-xs: 0.12s;
  --d-fast: 0.16s;
  --d-sm: 0.22s;
  --d-base: 0.32s;
  --d-slow: 0.62s;
  --d-lg: 0.9s;
  --stagger: 80ms;

  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI",
    "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", "Cascadia Code", Consolas,
    "Liberation Mono", monospace;
  /* 展示级衬线：网络字体优先，缺字回落到系统宋体（各平台都有） */
  --font-display: "Chweb Display", "Noto Serif SC", "Source Han Serif SC", "Songti SC",
    "STSong", "SimSun", "Noto Serif CJK SC", serif;

  /* ---------------------------------------------------------------- 字号阶梯
     两套并存，各管一头，禁止写裸 px：
     ① 静态阶梯（下面 9 档）——界面与正文。比例约 1.125（大二阶），
        相邻档位差 1~2px，肉眼几乎无感但层级清晰。
        中文正文不低于 13px；--text-3xs 仅限宠物 HUD 这类极小覆盖层。
     ② 流式令牌（--f-hero/--f-display/--f-section/--f-lede）——页面大标题、
        区块标题、导语，随视口缩放，见下方「流式字号」一节。 */
  --text-3xs: 10px;
  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-base: 15px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 21px;

  /* ---------------------------------------------------------------- 间距阶梯
     4px 基网，8px 为主步长。组件内间距用 1~5，区块间距用 6~10。 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 56px;
  --sp-10: 72px;

  /* 行高阶梯：标题收紧、正文放松、微型标签再收紧 */
  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.65;
  --leading-relaxed: 1.8;

  /* ---------------------------------------------------------------- 流式字号
     跨组件复用的流体档位。字号阶梯（上面 12 档）管组件内文字，
     这里管随视口伸缩的标题——两套分工，别在组件里另写 clamp。 */
  --f-hero: clamp(54px, 12.5vw, 118px);   /* 首页大标题，允许大得夸张 */
  --f-display: clamp(30px, 5.2vw, 52px);  /* 页面大标题 */
  --f-section: clamp(19px, 2.4vw, 23px);  /* 区块标题 */
  --f-lede: clamp(15px, 1.6vw, 17px);     /* 大标题下的导语 */

  /* 布局 */
  --header-h: 62px;
  --maxw: 1180px;
  --measure: 68ch;
  --pad: clamp(18px, 4vw, 40px);

  /* ------------------------------------------------------------ 背景层令牌
     见 background.css：几团柔光（--tone-*）+ 颗粒 + 边缘压暗。 */
  --wash-1: #121724;
  --wash-2: #0b0e15;
  --mesh-a: rgba(142, 162, 216, 0.20);   /* 由 --tone-1 覆盖 */
  --mesh-b: rgba(194, 149, 143, 0.16);   /* 由 --tone-2 覆盖 */
  --mesh-c: rgba(111, 156, 125, 0.14);   /* 由 --tone-3 覆盖 */
  /* 发丝级强调色：小分隔点、气泡尾巴这类最小号的细节 */
  --tick: rgba(255, 255, 255, 0.22);
  --grain-opacity: 0.055;
  --frost-rgb: 4, 6, 12;
  --frost-alpha: 0.62;
  --frost: radial-gradient(120% 88% at 50% 2%, transparent 46%, rgba(var(--frost-rgb), var(--frost-alpha)) 112%);

  /* 时段色（JS 写 body[data-tone]）：背景柔光随时段流转 */
  --tone-1: #8ea2d8;
  --tone-2: #c2958f;
  --tone-3: #6f9c7d;
}

/* 浅色主题 —— 暖白纸面 ------------------------------------------------ */
[data-theme="light"] {
  color-scheme: light;
  --bg-0: #f2efe9;
  --bg-1: #faf8f4;
  --bg-2: #eae6de;
  --surface: rgba(255, 255, 255, 0.62);
  --surface-hi: rgba(255, 255, 255, 0.86);
  --border: rgba(38, 44, 60, 0.11);
  --border-hi: rgba(38, 44, 60, 0.22);
  --text: #1e222b;
  --text-dim: #565d6d;
  --text-mute: #6b7280;
  --brand: #5b6ea8;
  --brand-2: #9a625a;
  --brand-soft: rgba(91, 110, 168, 0.12);
  --ok: #4f7a5f;
  --warn: #91692a;
  --bad: #a25454;
  --grad-text: linear-gradient(96deg, #2b3346 0%, #4b5f96 46%, #8d5f58 100%);
  --grad-brand: linear-gradient(135deg, #5b6ea8 0%, #a87068 100%);
  --hairline: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 60%);
  --shadow-1: 0 1px 2px rgba(60, 66, 84, 0.06), 0 4px 14px -8px rgba(60, 66, 84, 0.20);
  --shadow-2: 0 18px 40px -24px rgba(60, 66, 84, 0.26);
  --shadow-3: 0 34px 80px -36px rgba(60, 66, 84, 0.30);

  --wash-1: #f7f4ee;
  --wash-2: #ece8e0;
  --tick: rgba(38, 44, 60, 0.28);
  --grain-opacity: 0.042;
  --frost-rgb: 150, 142, 128;
  --frost-alpha: 0.16;
  --frost: radial-gradient(120% 88% at 50% 2%, transparent 46%, rgba(var(--frost-rgb), var(--frost-alpha)) 112%);
}

/* ------------------------------------------------------------------ 时段配色
   八个时段各有一套「底色 + 三团柔光 + 暗角强度」。规则：
     · 白天亮、夜里沉：wash 的明度走一个拱形，正午最高、凌晨最低
     · 色温也走一条线：凌晨冷蓝 → 早上暖橙 → 正午中性 → 傍晚玫瑰 → 深夜偏紫
     · 柔光靠「夜里调暗」而不是「白天调亮」——CSS opacity 上限是 1，
       想更亮只能把黑夜压下去，正午自然就突出了
     · 暗角强度随时段变：夜里收得紧（0.72），正午几乎不压（0.36），
       否则大白天四周一圈黑，怎么都不像白天
     · 只动背景，不动文字色——对比度由 --text 保证，不会因为时段变化而变差
   属性挂在 <html> 上（data-theme + data-period），由 layout 的内联脚本在首帧前写好，
   避免夜间访问时先闪一下默认背景。 */
[data-period="late"] {
  --wash-1: #0a0d16; --wash-2: #070910;
  --tone-1: #6b7aa8; --tone-2: #7e6d92; --tone-3: #465f7a;
  --mesh-opacity: 0.62; --frost-alpha: 0.72; --grain-opacity: 0.045;
}
[data-period="dawn"] {
  --wash-1: #151520; --wash-2: #0c0d14;
  --tone-1: #d8a08c; --tone-2: #d8bd93; --tone-3: #8fa8c8;
  --mesh-opacity: 0.8; --frost-alpha: 0.58; --grain-opacity: 0.052;
}
[data-period="morning"] {
  --wash-1: #1b2433; --wash-2: #111623;
  --tone-1: #93aed8; --tone-2: #c9b8a0; --tone-3: #8fb8a8;
  --mesh-opacity: 0.9; --frost-alpha: 0.46; --grain-opacity: 0.058;
}
[data-period="noon"] {
  --wash-1: #222c3e; --wash-2: #161b28;
  --tone-1: #d8c08c; --tone-2: #d89f8f; --tone-3: #8fb0d0;
  --mesh-opacity: 1.0; --frost-alpha: 0.36; --grain-opacity: 0.062;
}
[data-period="afternoon"] {
  --wash-1: #1e2736; --wash-2: #121825;
  --tone-1: #8fa8d0; --tone-2: #b89ab0; --tone-3: #8fb89a;
  --mesh-opacity: 0.94; --frost-alpha: 0.44; --grain-opacity: 0.058;
}
[data-period="dusk"] {
  --wash-1: #251f2b; --wash-2: #150f18;
  --tone-1: #c08fa0; --tone-2: #c9a888; --tone-3: #7f8fb8;
  --mesh-opacity: 0.88; --frost-alpha: 0.55; --grain-opacity: 0.05;
}
[data-period="evening"] {
  --wash-1: #16131d; --wash-2: #0c0a11;
  --tone-1: #7f87b8; --tone-2: #a07f9a; --tone-3: #5f6f8f;
  --mesh-opacity: 0.74; --frost-alpha: 0.64; --grain-opacity: 0.046;
}
[data-period="deep"] {
  --wash-1: #0b0e17; --wash-2: #080a0f;
  --tone-1: #6f7fb5; --tone-2: #8f6f9e; --tone-3: #4f6f8f;
  --mesh-opacity: 0.62; --frost-alpha: 0.72; --grain-opacity: 0.045;
}

/* 浅色主题：暖白纸面，白天更亮、夜里收一档 */
[data-theme="light"][data-period="late"] {
  --wash-1: #e9e6e2; --wash-2: #e3e0dc;
  --tone-1: #8d9ac0; --tone-2: #b08f9e; --tone-3: #7f96a8;
  --mesh-opacity: 0.66; --frost-alpha: 0.18; --grain-opacity: 0.038;
}
[data-theme="light"][data-period="dawn"] {
  --wash-1: #fbf3e9; --wash-2: #f0e9df;
  --tone-1: #d8a08c; --tone-2: #e0c49a; --tone-3: #9db4cf;
  --mesh-opacity: 0.84; --frost-alpha: 0.14; --grain-opacity: 0.042;
}
[data-theme="light"][data-period="morning"] {
  --wash-1: #faf8f2; --wash-2: #f0ede4;
  --tone-1: #93aed8; --tone-2: #cbbaa2; --tone-3: #93b8a8;
  --mesh-opacity: 0.92; --frost-alpha: 0.12; --grain-opacity: 0.046;
}
[data-theme="light"][data-period="noon"] {
  --wash-1: #fffefa; --wash-2: #f6f2e9;
  --tone-1: #d8c08c; --tone-2: #dc9f8f; --tone-3: #8fb0d0;
  --mesh-opacity: 1.0; --frost-alpha: 0.1; --grain-opacity: 0.05;
}
[data-theme="light"][data-period="afternoon"] {
  --wash-1: #f9f6ee; --wash-2: #f0ece3;
  --tone-1: #8fa8d0; --tone-2: #bb9db3; --tone-3: #8fb89a;
  --mesh-opacity: 0.92; --frost-alpha: 0.12; --grain-opacity: 0.046;
}
[data-theme="light"][data-period="dusk"] {
  --wash-1: #fbf0e6; --wash-2: #f1e2d6;
  --tone-1: #c08fa0; --tone-2: #cbaa8a; --tone-3: #8794b8;
  --mesh-opacity: 0.88; --frost-alpha: 0.15; --grain-opacity: 0.042;
}
[data-theme="light"][data-period="evening"] {
  --wash-1: #f0ece7; --wash-2: #e8e3de;
  --tone-1: #8b93c0; --tone-2: #a98a9e; --tone-3: #6f7f9c;
  --mesh-opacity: 0.74; --frost-alpha: 0.17; --grain-opacity: 0.04;
}
[data-theme="light"][data-period="deep"] {
  --wash-1: #e9e6e3; --wash-2: #e1ded9;
  --tone-1: #8d97bd; --tone-2: #ab8ba0; --tone-3: #77879f;
  --mesh-opacity: 0.66; --frost-alpha: 0.18; --grain-opacity: 0.038;
}

/* ---------------------------------------------------------------- 2. 重置 */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
/* 开启阻尼滚动运镜时（core/camera.js），必须让 CSS 的平滑滚动让位，
   否则 window.scrollTo 会被 scroll-behavior 接管，两层缓动打架。 */
html.is-camera { scroll-behavior: auto; }

body {
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "tnum" 0;
  /* 中英混排：让标点不要顶到行首、允许行末标点悬挂 */
  text-spacing-trim: trim-start;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
/* 安全网：图标库的 SVG 只带 viewBox，组件规则漏写尺寸时会按容器 100% 放大
   （曾导致 tip 图标变成 1084px）。给无 class 的图标一个保守默认尺寸；
   带 class 的图形（星图、折线图等）和写了组件规则的图标不受影响。 */
svg:not([class]):not([width]) { width: 1em; height: 1em; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }

/* 标题：统一由衬线体承担「展示」语气，正文保持无衬线。
   西文标题收紧字距、中文标题保持正常（汉字负字距会粘连）。 */
h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-wrap: balance;
  hanging-punctuation: allow-end;
}
p { text-wrap: pretty; }

/* hidden 属性的兜底。UA 的 [hidden]{display:none} 只是元素选择器，
   组件类里写了 .note{display:flex} 之类就能把它盖掉，于是「藏起来」
   的元素照样占位——MC 页曾因此多出一条 34px 的空条，留言板的
   「加载更早」按钮在隐藏状态下也一直露着。 */
[hidden] { display: none !important; }

/* 键盘焦点环。注意：不要在这里写 border-radius——outline 在现代浏览器里
   本就自动跟随元素自身的圆角，强行指定反而会把胶囊按钮掰成 6px 圆角。 */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

/* 锚点跳转要给吸顶导航让位，否则目标标题会被顶栏压住 */
[id] { scroll-margin-top: calc(var(--header-h) + 18px); }

::selection { background: var(--brand-soft); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); background-clip: content-box; }

/* -------------------------------------------------- 3. 全局背景（见 background.css）
   星图制图系统：坐标点阵 / 星座 / 流星 / 暗角 / 颗粒 / 取景框。
   标记结构在各 HTML 页：<div class="bg">…</div>。*/

/* ------------------------------------------------------- 4. 排版工具类 */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--font-mono); }
.dim { color: var(--text-dim); }
.mute { color: var(--text-mute); }
/* 展示级文字：衬线 + 关闭伪粗体。中文不走负字距，靠字号本身拉开层级。 */
.display {
  font-family: var(--font-display);
  font-weight: 620;
  font-synthesis: none;
  letter-spacing: 0;
  text-spacing-trim: space-all;
  hanging-punctuation: allow-end;
}
/* ------------------------------------------ 5. 无障碍：尊重减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------------- 6. file:// 直开时的降级提示横幅 */
.boot-warning {
  position: fixed;
  z-index: 999;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: min(680px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-hi);
  background: var(--surface-hi);
  backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--shadow-2);
  font-size: var(--text-md);
  line-height: 1.6;
}
.boot-warning code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
}
