/*
 * 今刻 Nowly · 法务页共享样式
 *
 * 配色与排版 1:1 取自 App 的设计令牌(src/core/theme.ts),让浏览器里打开的
 * 协议页与 App 内是同一套观感:
 *   日间 background #f4f1ea / ink #2a2721 / muted #8f897d / line #e7e1d5
 *        chip #efeae0 / card #ffffff
 *   夜间 background #1a1d2a / ink #eceef5 / muted #8a8fa3 / line #2c3040
 *        chip #242838 / card #222634
 *   accent #c9584b(日夜同色)
 * 圆角取 theme.radius(lg 14 / md 10 / sm 6 / pill 999),留白取 layout.headGutter 22。
 *
 * 字体按 App 的双语规则(PRD §12.3):英文态走 Fraunces/Newsreader-Italic/Inter
 * 艺术排版,中文态标题走系统无衬线(苹方)。字号在 App 令牌的比例上按网页阅读
 * 尺度整体放大(App 正文 12.5px 在桌面浏览器里偏小),保持层级关系不变。
 *
 * 夜间态跟随系统 prefers-color-scheme —— App 内是「深色表盘/下午盘 → 夜间」,
 * 网页没有表盘可依据,跟随系统是唯一合理的判据。
 */

:root {
  --bg: #f4f1ea;
  --ink: #2a2721;
  --muted: #8f897d;
  --line: #e7e1d5;
  --chip: #efeae0;
  --card: #ffffff;
  --accent: #c9584b;
  --gutter: 22px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1d2a;
    --ink: #eceef5;
    --muted: #8a8fa3;
    --line: #2c3040;
    --chip: #242838;
    --card: #222634;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.78 -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'tnum';
}

/* 英文态艺术排版:与 App 的 core/fonts.ts 注册的三款字体一致 */
body.lang-en {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wrap {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 var(--gutter) 72px;
}

/* ===== 页头(原型 .pg-head:大标题 + 斜体副标) ===== */

.head {
  padding: 40px 0 22px;
}

.brand {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.18;
  color: var(--ink);
}

body.lang-en h1 {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-weight: 400;
  letter-spacing: -0.3px;
  line-height: 1.12;
}

.sub {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}

body.lang-en .sub {
  font-family: 'Newsreader', Georgia, serif;
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.1px;
}

.meta {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* ===== 章节 ===== */

h2 {
  margin: 34px 0 10px;
  padding-top: 20px;
  /* 从目录锚点跳过来时,别让标题贴死在视口顶边 */
  scroll-margin-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

body.lang-en h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.2px;
}

h3 {
  margin: 20px 0 6px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
}

p {
  margin: 10px 0;
}

ul {
  margin: 10px 0;
  padding-left: 22px;
}

li {
  margin: 5px 0;
}

strong {
  font-weight: 600;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* ===== 目录(11~13 节的长文,给个跳转入口) ===== */

.toc {
  margin: 8px 0 4px;
  padding: 16px 20px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.toc-t {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  font-size: 14.5px;
}

.toc li {
  margin: 3px 0;
}

.toc a {
  color: var(--ink);
  text-decoration: none;
}

.toc a:hover,
.toc a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

/* ===== 提示块(原型 .acct-note / 我的页说明卡) ===== */

.note {
  margin: 14px 0;
  padding: 14px 16px;
  background: var(--chip);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  font-size: 15px;
}

.note ul {
  margin: 8px 0 0;
}

.note :last-child {
  margin-bottom: 0;
}

/* ===== 表格(卡片化:card 底 + line 描边 + lg 圆角) ===== */

.tbl {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

th,
td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--chip);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

/* ===== 页脚 ===== */

footer {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

footer p {
  margin: 6px 0;
}

footer a {
  color: var(--muted);
}

/* 键盘焦点可见(浏览器默认轮廓在深色底上对比不足) */
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 打印/存 PDF:去掉装饰底色,链接补出地址,表格不跨页断行 */
@media print {
  :root {
    --bg: #ffffff;
    --ink: #000000;
    --muted: #555555;
    --line: #cccccc;
    --chip: #f4f4f4;
    --card: #ffffff;
  }

  .toc,
  footer {
    display: none;
  }

  a {
    color: var(--ink);
    text-decoration: none;
  }

  h2 {
    break-after: avoid;
  }

  .tbl,
  tr,
  .note {
    break-inside: avoid;
  }
}

/* 窄屏:留白收紧,表格允许横向滚动而不是挤压列宽 */
@media (max-width: 560px) {
  :root {
    --gutter: 18px;
  }

  body {
    font-size: 15.5px;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 18px;
  }

  .head {
    padding-top: 28px;
  }

  .tbl {
    overflow-x: auto;
  }

  table {
    min-width: 480px;
  }
}
