/* ------------------------------------------------------------------
   Hai 隐私政策 · 站点样式（无外部依赖，可直接部署到 Cloudflare Pages）
   设计取向：法律文档要像文档，不像落地页。留白、细线、单一强调色。
   ------------------------------------------------------------------ */

:root {
  color-scheme: light dark;

  --paper:        #FBFAF7;
  --surface:      #FFFFFF;
  --ink:          #1B2220;
  --ink-soft:     #58645F;
  --ink-faint:    #8B948F;
  --line:         #E7E3DA;
  --line-strong:  #D5D0C4;
  --accent:       #2F5A5E;
  --accent-ink:   #24474B;
  --accent-wash:  #EDF3F2;
  --warn-wash:    #FBF4E9;
  --warn-line:    #E8D5B5;

  --radius: 12px;
  --radius-sm: 8px;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:       #121617;
    --surface:     #181D1F;
    --ink:         #E7EBE9;
    --ink-soft:    #A0AAA6;
    --ink-faint:   #74807B;
    --line:        #262E30;
    --line-strong: #354042;
    --accent:      #8FBDB2;
    --accent-ink:  #B4D6CD;
    --accent-wash: #1B2626;
    --warn-wash:   #24201A;
    --warn-line:   #4A3D28;
  }
}

/* 手动切换优先于系统偏好：两者都用 data-theme 落地 */
:root[data-theme="light"] {
  --paper: #FBFAF7; --surface: #FFFFFF; --ink: #1B2220; --ink-soft: #58645F;
  --ink-faint: #8B948F; --line: #E7E3DA; --line-strong: #D5D0C4;
  --accent: #2F5A5E; --accent-ink: #24474B; --accent-wash: #EDF3F2;
  --warn-wash: #FBF4E9; --warn-line: #E8D5B5;
}

:root[data-theme="dark"] {
  --paper: #121617; --surface: #181D1F; --ink: #E7EBE9; --ink-soft: #A0AAA6;
  --ink-faint: #74807B; --line: #262E30; --line-strong: #354042;
  --accent: #8FBDB2; --accent-ink: #B4D6CD; --accent-wash: #1B2626;
  --warn-wash: #24201A; --warn-line: #4A3D28;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

a {
  color: var(--accent-ink);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip:focus { left: 16px; top: 12px; }

/* ── 顶栏 ───────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}
.brand img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: block;
}
.brand__text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
}
.brand__name { font-weight: 600; font-size: 14.5px; letter-spacing: .01em; }
.brand__doc {
  font-size: 12.5px;
  color: var(--ink-faint);
  padding-left: 8px;
  border-left: 1px solid var(--line-strong);
}

.header-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12.5px;
  line-height: 1;
  padding: 7px 10px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.tool:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}
.tool svg { width: 14px; height: 14px; display: block; }

/* 深浅色图标：默认显示月亮（点击转深色），深色下显示太阳。
   属性覆盖放在媒体查询之后，手动切换才能压过系统偏好。 */
/* 选择器带上 .tool：单写 `.icon-sun` 的优先级低于上面的 `.tool svg`，
   结果太阳和月亮会同时显示（已实际踩到）。 */
.tool .icon-sun  { display: none; }
.tool .icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
  .tool .icon-sun  { display: block; }
  .tool .icon-moon { display: none; }
  :root[data-theme="light"] .tool .icon-sun  { display: none; }
  :root[data-theme="light"] .tool .icon-moon { display: block; }
}

:root[data-theme="dark"] .tool .icon-sun  { display: block; }
:root[data-theme="dark"] .tool .icon-moon { display: none; }

/* ── 版心 ───────────────────────────────────────────────────── */

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 24px 96px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 48px;
}

@media (min-width: 940px) {
  .shell {
    grid-template-columns: 216px minmax(0, 1fr);
    gap: 56px;
    padding-top: 64px;
  }
}

/* ── 目录 ───────────────────────────────────────────────────── */

.toc { display: none; }

@media (min-width: 940px) {
  .toc {
    display: block;
    position: sticky;
    top: 86px;
    align-self: start;
    font-size: 13px;
    line-height: 1.62;
  }
}

.toc__label {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 12px;
  font-weight: 600;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 5px 0 5px 12px;
  margin-left: -1px;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 1px solid transparent;
  transition: color .14s ease, border-color .14s ease;
}
.toc a:hover {
  color: var(--accent-ink);
  border-left-color: var(--accent);
}

/* ── 正文 ───────────────────────────────────────────────────── */

.doc { min-width: 0; max-width: 720px; }

.doc__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 26px;
  font-size: 13px;
  color: var(--ink-faint);
}

h1 {
  font-size: clamp(30px, 4vw, 38px);
  line-height: 1.25;
  letter-spacing: -.01em;
  margin: 0 0 18px;
  font-weight: 650;
}

h2 {
  font-size: 21px;
  line-height: 1.4;
  letter-spacing: -.005em;
  margin: 52px 0 14px;
  font-weight: 620;
  scroll-margin-top: 84px;
}

h2 .num {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  vertical-align: 3px;
  margin-right: 10px;
  letter-spacing: .02em;
}

h3 {
  font-size: 15.5px;
  font-weight: 620;
  margin: 28px 0 8px;
}

p {
  margin: 0 0 14px;
  text-wrap: pretty;
}

.lede {
  font-size: 17.5px;
  color: var(--ink-soft);
  margin-bottom: 30px;
}

ul, ol { margin: 0 0 16px; padding-left: 22px; }
li {
  margin: 0 0 7px;
  text-wrap: pretty;
}
li::marker { color: var(--ink-faint); }

strong { font-weight: 620; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 44px 0;
}

/* ── 摘要卡 ─────────────────────────────────────────────────── */

.summary {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 24px 6px;
  margin: 0 0 8px;
}

.summary__title {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  margin: 0 0 14px;
}

.summary ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px 24px;
}

@media (min-width: 620px) {
  .summary ul { grid-template-columns: 1fr 1fr; }
}

.summary li {
  margin: 0;
  padding-left: 24px;
  position: relative;
  font-size: 14.5px;
  line-height: 1.66;
  color: var(--ink-soft);
}

.summary li svg {
  position: absolute;
  left: 0;
  top: 3px;
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.summary li b {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 2px;
}

/* ── 提示框 ─────────────────────────────────────────────────── */

.callout {
  border-left: 2px solid var(--accent);
  background: var(--accent-wash);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 22px 0;
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--ink-soft);
}
.callout p:last-child { margin-bottom: 0; }
.callout b { color: var(--ink); font-weight: 620; }

.callout--warn {
  border-left-color: var(--warn-line);
  background: var(--warn-wash);
}

/* ── 表格 ───────────────────────────────────────────────────── */

.table-wrap {
  margin: 20px 0 24px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.8px;
  line-height: 1.62;
  min-width: 560px;
}

thead th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink-faint);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 60%, var(--surface));
  white-space: nowrap;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink-soft);
}

tbody tr:last-child td { border-bottom: 0; }
tbody td:first-child {
  color: var(--ink);
  font-weight: 560;
  white-space: nowrap;
}

td code, th code { white-space: nowrap; }

/* ── 代码 ───────────────────────────────────────────────────── */

code {
  font-family: var(--mono);
  font-size: .86em;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  padding: .16em .42em;
  border-radius: 5px;
  color: var(--ink);
  word-break: break-word;
}

pre {
  margin: 16px 0 22px;
  padding: 15px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 12.8px;
  line-height: 1.72;
}
pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
  color: var(--ink-soft);
  /* 附录里的路径命令比版心宽。这里用 pre-wrap 让它在容器内换行：
     只是视觉折行，DOM 里仍是一整行，复制出去不会多出换行符。
     用 pre + overflow 的话内容会被切掉一截，读者看不到完整路径。 */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── 附录列表 ───────────────────────────────────────────────── */

.checklist {
  list-style: none;
  padding: 0;
  margin: 18px 0 8px;
  border-top: 1px solid var(--line);
}
.checklist li {
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
  color: var(--ink-soft);
}
.checklist li b {
  display: block;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 2px;
}

/* ── 页脚 ───────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.site-footer__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 24px 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: baseline;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.site-footer__inner a { color: var(--ink-soft); }
.site-footer__sep { margin-left: auto; }

/* ── 打印 ───────────────────────────────────────────────────── */

@media print {
  :root { --paper: #fff; --surface: #fff; --ink: #000; --ink-soft: #222; }
  .site-header, .toc, .skip, .header-tools { display: none !important; }
  .shell { display: block; padding: 0; max-width: none; }
  .doc { max-width: none; }
  body { font-size: 11pt; }
  h2 { page-break-after: avoid; margin-top: 22pt; }
  .table-wrap, pre, .callout, .summary { page-break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}

/* 单栏版心（支持页、404 这类只有一列内容的页面）。
   直接把 shell 收窄，而不是把 .doc 居中：后者会让页码/留白跟着 1080 的网格走，
   宽屏上仍然偏左。收窄后整列自然居中，行长也落在易读区间。 */
.shell--single {
  max-width: 768px;
  grid-template-columns: minmax(0, 1fr);
  padding-top: 72px;
}
.shell--single .doc { max-width: none; }

/* ── 支持页 ─────────────────────────────────────────────────── */

/* 联系卡：整页唯一一处「行动点」，用实心按钮把它标出来 */
.contact-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 4px 0 8px;
}
.contact-card p { margin-bottom: 12px; }
.contact-card p:last-child { margin-bottom: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--paper);
  text-decoration: none;
  font-size: 14px;
  font-weight: 560;
  padding: 9px 16px;
  border-radius: 999px;
  transition: filter .16s ease;
}
.btn:hover { filter: brightness(1.12); }
:root[data-theme="dark"] .btn,
html[data-theme="dark"] .btn { color: #101514; }

.contact-card .meta {
  font-size: 12.8px;
  color: var(--ink-faint);
  margin-top: 12px;
}

/* FAQ：用 details/summary，无 JS 也能展开；打印时会保持折叠，属已知取舍 */
.faq {
  border-top: 1px solid var(--line);
  margin: 18px 0 10px;
}
.faq details {
  border-bottom: 1px solid var(--line);
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 15px 34px 15px 0;
  position: relative;
  font-size: 15.2px;
  font-weight: 580;
  line-height: 1.55;
  color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  font-weight: 400;
  color: var(--ink-faint);
  line-height: 1;
}
.faq details[open] summary::after { content: "−"; }
.faq details[open] summary { color: var(--accent-ink); }

.faq .answer {
  padding: 0 34px 17px 0;
  font-size: 14.6px;
  line-height: 1.75;
  color: var(--ink-soft);
}
.faq .answer p:last-child { margin-bottom: 0; }
.faq .answer ul { margin-bottom: 8px; }

/* 步骤/清单：编号由 CSS 生成，避免手写序号对不齐 */
.steps {
  list-style: none;
  padding: 0;
  margin: 18px 0 20px;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 34px;
  margin-bottom: 12px;
  font-size: 14.8px;
  color: var(--ink-soft);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 22px;
  text-align: center;
}

/* 页脚的多链接排布 */
.site-footer__links { display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* 单栏页的顶栏与正文同宽，视觉上是一列 */
.site-header--narrow .site-header__inner { max-width: 768px; }
