/* ╔══════════════════════════════════════════════════════════════════════════╗
   ║  问星 · 全站设计地基  site.css                                              ║
   ║  ----------------------------------------------------------------------    ║
   ║  这是「问星」官网唯一一套设计系统。所有页面（主页 / 法律 / 支持 / 子页面    ║
   ║  生成器产出）都消费这里的 token 与组件，永不各自内联一套。                  ║
   ║                                                                            ║
   ║  纸墨风：衬线全文 · 发丝线分隔 · 大留白 · App 强调色实底胶囊。              ║
   ║  色彩三层（核心思想：季节定「内容色」，时辰定「天色与一天的明暗氛围」）：   ║
   ║    (a) 纸墨基色  = 季节 × 明暗，取自 App 节气主题（唯一事实源对照见下注）。 ║
   ║    (b) 派生      = hairline / link / bg-alt / 卡片浮层，全部由基色 mix。    ║
   ║    (c) 时辰层    = 「一日天色」对角渐变两端 + 全页低透氛围 tint。           ║
   ║                                                                            ║
   ║  契约属性：html[data-season] · html[data-theme] · html[data-shichen]       ║
   ║  浅深回退：html.sys-dark（系统深色，site.js 写）+ prefers-color-scheme。   ║
   ╚══════════════════════════════════════════════════════════════════════════╝ */

/* ════════════════════════════════════════════════════════════════════════
   (a) 纸墨基色 — 季节 × 明暗
   ------------------------------------------------------------------------
   色值出处（App 节气主题 .background / .primaryText / .secondaryText /
   .decorativeAccent，逐项取 light / dark 端，floats×255 取整）：
     spring → 问星/Theme/主题/节气/立春.swift
     summer → 问星/Theme/主题/节气/夏至.swift
     autumn → 问星/Theme/主题/节气/立秋.swift
     winter → 问星/Theme/主题/节气/冬至.swift
   季节由 site.js refineSeason() 按 almanac 八节交节定（首帧先按月估算）。
   ════════════════════════════════════════════════════════════════════════ */

/* ── 浅色（默认） ── */
html[data-season="spring"] {
  --bg: #D9E0E8; --bg-alt: #D2DAE3; --ink: #292E33; --ink-2: #69737D;
  --accent: #D4914A; --cta-a: #D4914A; --cta-b: #B5743A;
}
html[data-season="summer"] {
  --bg: #F0E8D1; --bg-alt: #EAE0C4; --ink: #4C2E14; --ink-2: #8A6947;
  --accent: #EB8C26; --cta-a: #F0A13E; --cta-b: #D2741A;
}
html[data-season="autumn"] {
  --bg: #F2E7D6; --bg-alt: #ECDFC9; --ink: #43291A; --ink-2: #856952;
  --accent: #C56A2E; --cta-a: #D96F33; --cta-b: #A83A14;
}
html[data-season="winter"] {
  --bg: #D4D9ED; --bg-alt: #CCD2E8; --ink: #26293D; --ink-2: #646E8B;
  --accent: #D98C40; --cta-a: #7388A8; --cta-b: #4A5C7E;
}

/* ── 深色 ── 触发：用户手动 data-theme=dark，或系统深色（sys-dark）且未手动选浅。
   site.js 的「自动·随天时」会按当前时辰把 data-theme 设成 light / dark（见 applyTheme）。 ── */
html[data-theme="dark"][data-season="spring"],
html.sys-dark:not([data-theme="light"])[data-season="spring"] {
  --bg: #0F1224; --bg-alt: #141733; --ink: #E0E5ED; --ink-2: #8A949E;
  --accent: #DBA876; --cta-a: #87AA5B; --cta-b: #5C7E3C;
}
html[data-theme="dark"][data-season="summer"],
html.sys-dark:not([data-theme="light"])[data-season="summer"] {
  --bg: #0F0F24; --bg-alt: #161633; --ink: #F2E5D2; --ink-2: #B39466;
  --accent: #FA9E33; --cta-a: #CF8A33; --cta-b: #A3661F;
}
html[data-theme="dark"][data-season="autumn"],
html.sys-dark:not([data-theme="light"])[data-season="autumn"] {
  --bg: #211217; --bg-alt: #2B181D; --ink: #F2E2D6; --ink-2: #9E8C75;
  --accent: #F0905A; --cta-a: #C4602A; --cta-b: #94431A;
}
html[data-theme="dark"][data-season="winter"],
html.sys-dark:not([data-theme="light"])[data-season="winter"] {
  --bg: #0D0F26; --bg-alt: #141733; --ink: #E0E5F5; --ink-2: #808AAD;
  --accent: #D98C40; --cta-a: #7388A8; --cta-b: #51648A;
}

/* ════════════════════════════════════════════════════════════════════════
   (c) 时辰层 — 「一日天色」（每时辰一档）
   ------------------------------------------------------------------------
   出处：问星/Domain/时辰/时辰.swift 天色(_:) 的 LinearGradient 两端
   （topLeading→bottomTrailing），floats×255 取整。0 子 … 11 亥。
   --sky-top / --sky-bot：hero「天色」面板对角渐变两端。
   --tint：当前时辰主色（取 sky-top），整页低透氛围用它叠一层冷暖呼吸。
   时辰索引由 site.js applyShichen() 设 html[data-shichen]；缺省（无 JS / 未设）
   时下面给 :root 一份「日中·午」兜底，保证 hero 永不空白。
   ════════════════════════════════════════════════════════════════════════ */
:root { --sky-top: #547AA1; --sky-bot: #2E4F75; --tint: #547AA1; }  /* 兜底 = 午 */
html[data-shichen="0"]  { --sky-top: #171C36; --sky-bot: #080A1A; --tint: #171C36; } /* 子 · 夜半 */
html[data-shichen="1"]  { --sky-top: #1C213D; --sky-bot: #0A0D1F; --tint: #1C213D; } /* 丑 · 鸡鸣 */
html[data-shichen="2"]  { --sky-top: #262B4D; --sky-bot: #0F142B; --tint: #262B4D; } /* 寅 · 平旦 */
html[data-shichen="3"]  { --sky-top: #734740; --sky-bot: #2E1F2E; --tint: #734740; } /* 卯 · 日出 */
html[data-shichen="4"]  { --sky-top: #3D5775; --sky-bot: #1C2E4D; --tint: #3D5775; } /* 辰 · 食时 */
html[data-shichen="5"]  { --sky-top: #47688C; --sky-bot: #244061; --tint: #47688C; } /* 巳 · 隅中 */
html[data-shichen="6"]  { --sky-top: #547AA1; --sky-bot: #2E4F75; --tint: #547AA1; } /* 午 · 日中 */
html[data-shichen="7"]  { --sky-top: #546E87; --sky-bot: #2E4563; --tint: #546E87; } /* 未 · 日昳 */
html[data-shichen="8"]  { --sky-top: #806B57; --sky-bot: #42302E; --tint: #806B57; } /* 申 · 哺时 */
html[data-shichen="9"]  { --sky-top: #85452B; --sky-bot: #381C21; --tint: #85452B; } /* 酉 · 日入 */
html[data-shichen="10"] { --sky-top: #422E57; --sky-bot: #1C142E; --tint: #422E57; } /* 戌 · 黄昏 */
html[data-shichen="11"] { --sky-top: #212445; --sky-bot: #0D0F24; --tint: #212445; } /* 亥 · 人定 */

/* ════════════════════════════════════════════════════════════════════════
   (b) 派生 token + 全局基底
   ════════════════════════════════════════════════════════════════════════ */
:root {
  /* 无障碍兜底：万一 data-season 没被设上（JS 关闭且首帧脚本未跑等极端情形），
     给一份中性纸墨，页面永不无色 / 黑底白字。正常路径下被季节块覆盖。 */
  --bg: #F0E8D1; --bg-alt: #EAE0C4; --ink: #3A2510; --ink-2: #8A6947;
  --accent: #C98A3A; --cta-a: #E0913C; --cta-b: #B5702A;

  --hairline: color-mix(in srgb, var(--ink) 14%, transparent);
  --link: var(--accent);
  /* 卡片浮层：纸面朝白插一点（浅色更亮、深色因 --bg 暗会偏暗，靠 ink 反插补亮） */
  --card: color-mix(in srgb, var(--bg) 92%, #fff 8%);
  --shadow: color-mix(in srgb, var(--ink) 22%, transparent);
  /* 时辰氛围层强度：浅色克制（正文可读优先），深色可略强。默认浅色档。 */
  --tint-strength: 4%;
}
html[data-theme="dark"], html.sys-dark:not([data-theme="light"]) {
  --card: color-mix(in srgb, var(--bg) 86%, #fff 14%);
  --shadow: color-mix(in srgb, #000 45%, transparent);
  --tint-strength: 7%;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }
body {
  /* App 同体：全文衬线（App 全文 .serif design）。中日韩越各取本地黑体回退里的衬线优先项。 */
  font-family: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif CJK SC",
    "Hiragino Mincho ProN", "Apple SD Gothic Neo", "Times New Roman", serif;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.9;
  /* 切换顺滑：背景 / 文字 ~600ms 过渡（reduced-motion 关，见文末） */
  transition: background-color 0.6s ease, color 0.6s ease;
  -webkit-tap-highlight-color: transparent;
  /* 整页时辰氛围：纸墨基色（--bg）之上，叠一层极低透的时辰色（固定大径向，随滚动不动），
     让整页随时辰有冷暖明暗的呼吸，又不压正文对比度。强度走 --tint-strength（浅 4% / 深 7%）。
     两层都画在 body 背景里（多重 background），避免 z-index/层叠上下文的坑：
     上层 = 时辰 tint 渐变（fixed 视口锚定），下层 = 纸墨纯色底。 */
  background:
    radial-gradient(120% 80% at 50% -10%,
      color-mix(in srgb, var(--tint) var(--tint-strength), transparent) 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed, fixed;
}
.serif { font-family: inherit; } /* mockup 标记类保留（页面本身已是衬线） */
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ════════════════════════════════════════════════════════════════════════
   顶栏 nav — sticky 毛玻璃 · 左 wordmark 问星 · 右 App Store 胶囊
   ════════════════════════════════════════════════════════════════════════ */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  height: 50px;
  padding: 0 max(22px, env(safe-area-inset-left)) 0 max(22px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 0.5px solid var(--hairline);
  font-size: 14px;
  transition: background-color 0.6s ease, border-color 0.6s ease;
}
.nav .brand { color: var(--ink); font-weight: 500; letter-spacing: 4px; text-decoration: none; }
.nav a.dl { font-size: 13px; letter-spacing: 1px; }

/* ════════════════════════════════════════════════════════════════════════
   章节 .sec — 留白 + 发丝线-圆点-发丝线 分隔（= App sectionDivider）
   三段式：.eyebrow(宽字距章节标签) / h2 / .copy
   ════════════════════════════════════════════════════════════════════════ */
.sec { padding: 104px 24px 110px; text-align: center; }
.sec.alt, .sec.deep { background: transparent; }
/* 章节分隔 = App sectionDivider：38×0.5 线 + 3pt 圆点 + 38×0.5 线 */
.sec::before {
  content: ""; display: block;
  width: 92px; height: 3px;
  margin: 0 auto 64px;
  background:
    radial-gradient(circle 1.5px at center, color-mix(in srgb, var(--accent) 45%, transparent) 97%, transparent) center / 3px 3px no-repeat,
    linear-gradient(color-mix(in srgb, var(--accent) 28%, transparent), color-mix(in srgb, var(--accent) 28%, transparent)) left center / 38px 0.5px no-repeat,
    linear-gradient(color-mix(in srgb, var(--accent) 28%, transparent), color-mix(in srgb, var(--accent) 28%, transparent)) right center / 38px 0.5px no-repeat;
}
.sec.no-rule::before { display: none; }
/* 章节标签 = App 规格（11pt semibold serif · tracking 4）放大到网页 */
.eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: 6px; text-indent: 6px;
  color: color-mix(in srgb, var(--ink-2) 82%, transparent);
  margin-bottom: 20px;
}
.sec h2 {
  font-size: clamp(30px, 4.6vw, 44px);
  font-weight: 500; letter-spacing: 0.06em; line-height: 1.4;
  margin: 0 auto 20px; max-width: 860px;
}
.sec .copy {
  font-size: clamp(16px, 2.2vw, 18px);
  font-weight: 300; letter-spacing: 0.03em;
  color: var(--ink-2); max-width: 620px; margin: 0 auto;
  line-height: 2;
}
.visual { margin-top: 64px; display: flex; justify-content: center; align-items: center; gap: 36px; flex-wrap: wrap; }

/* 西文 / 越南语 / 韩语字距覆盖（CJK 字距对拉丁字母过宽） */
html[lang^="en"] .eyebrow, html[lang="vi"] .eyebrow { letter-spacing: 2.5px; text-indent: 0; }
html[lang^="en"] .sec h2, html[lang="vi"] .sec h2 { letter-spacing: 0.01em; }

/* ════════════════════════════════════════════════════════════════════════
   浮现 .rise — 一次性、克制；由 site.js observeRise() 加 .in
   ════════════════════════════════════════════════════════════════════════ */
.rise { opacity: 0; transform: translateY(16px); transition: opacity 0.8s ease, transform 0.8s ease; }
.rise.in { opacity: 1; transform: none; }

/* ════════════════════════════════════════════════════════════════════════
   Hero — 通用骨架（主页 mockup 等页面专属内容在 index.html / mockups.css）
   ------------------------------------------------------------------------
   .sky-panel = hero「天色」面板：当前时辰的对角渐变（展示主角，内文一律浅色）。
   ════════════════════════════════════════════════════════════════════════ */
.hero { padding: 84px 24px 0; text-align: center; }
.hero .dateline {
  font-size: 13px; font-weight: 300; letter-spacing: 3px;
  color: color-mix(in srgb, var(--ink-2) 75%, transparent);
  font-variant-numeric: tabular-nums;
  margin-bottom: 26px;
}
.hero h1 {
  font-size: clamp(52px, 9vw, 80px);
  font-weight: 400; letter-spacing: 0.24em; text-indent: 0.24em; line-height: 1.15;
}
.hero .sub {
  font-size: clamp(17px, 2.6vw, 21px); color: var(--ink-2);
  margin-top: 16px; font-weight: 300; letter-spacing: 0.1em;
}
.hero .cta-row { margin: 34px 0 72px; display: flex; gap: 22px; justify-content: center; align-items: center; flex-wrap: wrap; }
html[lang^="en"] .hero h1, html[lang="vi"] .hero h1 { letter-spacing: 0.05em; text-indent: 0; font-size: clamp(44px, 8vw, 68px); }
html[lang="ko"] .hero h1 { letter-spacing: 0.14em; text-indent: 0.14em; }
html[lang^="en"] .hero .sub, html[lang="vi"] .hero .sub { letter-spacing: 0.02em; }

/* 「天色」面板：随当前时辰对角渐变（--sky-top→--sky-bot），整页随时辰呼吸的主角。
   内文恒浅色（天空底色多偏暗），与正文纸墨色脱钩。 */
.sky-panel {
  position: relative; overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--sky-top) 0%, var(--sky-bot) 100%);
  color: #F2ECE0;
  transition: background 0.6s ease;
}
.sky-panel { width: min(560px, 92vw); padding: 56px 40px 52px; text-align: center; box-shadow: 0 18px 44px var(--shadow); }
.sky-panel .sky-inner { position: relative; z-index: 1; }
.sky-panel .sky-label { color: rgba(255, 255, 255, 0.66); font-size: 12px; font-weight: 600; letter-spacing: 5px; text-indent: 5px; }
.sky-panel .sky-name { font-size: clamp(38px, 6vw, 52px); font-weight: 400; letter-spacing: 0.1em; margin-top: 16px; line-height: 1.2; }
.sky-panel .sky-sub { font-size: 14px; font-weight: 300; letter-spacing: 1px; color: rgba(255, 255, 255, 0.78); margin-top: 12px; font-variant-numeric: tabular-nums; }
html[lang^="en"] .sky-panel .sky-label, html[lang="vi"] .sky-panel .sky-label { letter-spacing: 2px; text-indent: 0; }
html[lang^="en"] .sky-panel .sky-name, html[lang="vi"] .sky-panel .sky-name { letter-spacing: 0.02em; }

/* ════════════════════════════════════════════════════════════════════════
   按钮 .btn-pill — App 全局主按钮语言：胶囊 · accent 对角渐变实底 · 双层阴影
   ════════════════════════════════════════════════════════════════════════ */
.btn-pill {
  display: inline-flex; align-items: center; justify-content: center;
  height: 50px; padding: 0 38px; border-radius: 980px;
  background: linear-gradient(135deg, var(--cta-a) 0%, var(--cta-b) 100%);
  color: #fffdf6; font-size: 15px; font-weight: 500; letter-spacing: 3px; text-indent: 3px;
  text-decoration: none;
  box-shadow:
    0 8px 22px color-mix(in srgb, var(--cta-b) 30%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.6s ease;
}
.btn-pill:hover { transform: translateY(-1px); text-decoration: none; }
.btn-pill:active { transform: translateY(1px); }
html[lang^="en"] .btn-pill, html[lang="vi"] .btn-pill { letter-spacing: 1px; text-indent: 0; }

/* ════════════════════════════════════════════════════════════════════════
   事实清单 .facts — 牌记式：纸上发丝线围格
   ════════════════════════════════════════════════════════════════════════ */
.facts {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--hairline);
  max-width: 860px; margin: 64px auto 0;
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.fact { background: var(--bg); padding: 30px 20px 26px; transition: background-color 0.6s ease; }
.fact .v { font-size: 19px; font-weight: 500; color: var(--ink); line-height: 1.4; letter-spacing: 1px; }
.fact .k { font-size: 12.5px; font-weight: 300; color: var(--ink-2); margin-top: 7px; line-height: 1.7; }
@media (max-width: 700px) { .facts { grid-template-columns: 1fr 1fr; } }

/* ════════════════════════════════════════════════════════════════════════
   页脚 footer + .chrome-row（语言切换 + 主题三态）
   ════════════════════════════════════════════════════════════════════════ */
.footer {
  max-width: 980px; margin: 0 auto; padding: 28px 24px 20px;
  border-top: 1px solid var(--hairline);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px;
  font-size: 12px; color: var(--ink-2);
}
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--ink-2); }
.footer-links a:hover { color: var(--ink); }
.chrome-row {
  max-width: 980px; margin: 0 auto; padding: 10px 24px 26px;
  padding-bottom: max(26px, env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  font-size: 11px; color: var(--ink-2);
}
.lang-switcher button, .theme-toggle button {
  background: none; border: none; padding: 4px 6px; margin: 0 1px;
  font: inherit; font-size: 12px; color: var(--ink-2); cursor: pointer; opacity: 0.85;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s ease, opacity 0.2s ease;
}
.lang-switcher button:hover, .theme-toggle button:hover { opacity: 1; }
.lang-switcher button.active, .theme-toggle button.active { color: var(--ink); font-weight: 600; opacity: 1; }
.lang-switcher .sep { opacity: 0.35; }

/* ════════════════════════════════════════════════════════════════════════
   子页面通用件 — 法律 / 支持等可读文档页
   ------------------------------------------------------------------------
   .article-page 包裹器 + .article 正文（可读宽度 ~46em）+ .home-link 返回主页。
   下一阶段子页面生成器复用：nav + .article-page + footer 即得与主页同体的页。
   ════════════════════════════════════════════════════════════════════════ */
.article-page { max-width: 46em; margin: 0 auto; padding: 56px 24px 96px; }
.home-link {
  display: inline-block; font-size: 13px; letter-spacing: 1.5px;
  color: var(--ink-2); text-decoration: none; margin-bottom: 28px;
  border-bottom: 1px solid transparent; transition: border-color 0.15s;
}
.home-link::before { content: "← "; }
.home-link:hover { text-decoration: none; border-bottom-color: var(--ink-2); }
.article h1 {
  font-size: clamp(26px, 4vw, 32px); font-weight: 400; letter-spacing: 4px;
  color: var(--ink); line-height: 1.3; margin-bottom: 10px;
}
.article .meta {
  font-size: 12px; color: color-mix(in srgb, var(--ink-2) 80%, transparent);
  letter-spacing: 2px; margin-bottom: 44px; padding-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
}
.article h2 { font-size: 20px; font-weight: 500; letter-spacing: 1.5px; color: var(--ink); margin: 38px 0 14px; }
.article h3 { font-size: 17px; font-weight: 500; color: var(--ink); margin: 26px 0 10px; }
.article p { margin: 12px 0; color: color-mix(in srgb, var(--ink) 88%, transparent); }
.article ul { margin: 12px 0; padding-left: 22px; color: color-mix(in srgb, var(--ink) 88%, transparent); }
.article li { margin: 6px 0; padding-left: 4px; }
.article li::marker { color: var(--accent); }
.article strong { color: var(--ink); font-weight: 600; }
.article em { font-style: italic; color: var(--ink-2); }
.article hr { border: none; border-top: 1px solid var(--hairline); margin: 38px 0 20px; }
html[lang^="en"] .article h1, html[lang="vi"] .article h1 { letter-spacing: 1px; }
html[lang^="en"] .article h2, html[lang="vi"] .article h2 { letter-spacing: 0.5px; }

/* ════════════════════════════════════════════════════════════════════════
   响应式 + 无障碍
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 720px) {
  .sec { padding: 80px 20px; }
  .visual { gap: 24px; margin-top: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  /* 关掉所有切换 / 浮现过渡（含随时辰变色的 600ms） */
  *, *::before, *::after { transition: none !important; }
  .rise { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
