/* 法律文件页（中文站）：privacy.html「隐私与安全」与 terms.html「使用条款」共用。
 * 英日站仍用 subpage.css 里的 .legal-page 旧样式，两份样式互不影响。
 * 结构：首屏（面包屑 → H1 → 导语 → 日期 → 文件切换）→ 左侧目录 + 右侧正文（编号章节、安全措施卡片、联系方式）。
 * 字号走全站阶梯变量，断点里只重定义变量；正文取 16px 阅读字号（与详情页一样单独设定）。
 * 踩坑提示：subpage-system 的 body.subpage :where(p, li) 会把段落涂灰，design-tokens 的 .subpage :is(p, li) 会压行高，
 * ≤700px 时 .subpage :is(button, a) 不换行，closing-section 里的链接会被涂成蓝底——对应规则都在本文件显式还原。
 */
body.legal-center {
  --t-display: 56px; --t-h2: 28px; --t-h3: 20px; --t-lead: 18px;
  --t-body: 16px; --t-card: 15px; --t-small: 14px; --t-label: 12px;
  --lg-ink: #101828; --lg-text: #344054; --lg-muted: #5f6b7c; --lg-subtle: #98a2b3;
  --lg-line: #e6ebf3; --lg-line-strong: #cdd7e8; --lg-soft: #f5f7fb; --lg-canvas: #f7f9fc;
  --lg-blue: #315dff; --lg-blue-deep: #2449dc; --lg-blue-soft: #edf2ff;
  --lg-sticky: 108px;
}
/* subpage.css 给 html, body 设了 overflow-x: hidden !important，body 会成为滚动容器，目录的 position: sticky 失效。
 * clip 同样裁掉横向溢出，但不生成滚动容器。 */
html:has(body.legal-center), body.subpage.legal-center { background: #fff; overflow-x: clip !important; }
.lg-main { background: #fff; color: var(--lg-ink); }
body.subpage main.lg-main > section { border-top: 0; }
.lg-main a { white-space: normal; }
.lg-shell { width: min(1180px, calc(100% - 2 * var(--shx-gutter, 24px))); margin-inline: auto; }

/* ---------- 首屏 ---------- */
.lg-hero { padding: 96px 0 0; background: linear-gradient(180deg, #eef3fc 0%, #f6f8fe 60%, #fff 100%); }
.lg-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 22px; color: var(--lg-subtle); font-size: var(--t-small); line-height: 1.5; }
.lg-main .lg-crumbs a { color: var(--lg-muted); text-decoration: none; transition: color .15s ease; }
.lg-main .lg-crumbs a:hover { color: var(--lg-blue); }
.lg-hero h1 { margin: 0; color: var(--lg-ink); font-size: var(--t-display); font-weight: 700; line-height: 1.15; letter-spacing: -.04em; }
.lg-hero p.lg-lead { max-width: 700px; margin: 18px 0 0; color: var(--lg-muted); font-size: var(--t-lead); line-height: 1.75; text-wrap: pretty; }
.lg-hero p.lg-meta { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 22px 0 0; color: var(--lg-muted); font-size: var(--t-small); line-height: 1.6; font-variant-numeric: tabular-nums; }
.lg-meta span { display: inline-flex; align-items: center; gap: 8px; }
.lg-meta span::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: #9fb2ff; }

/* 文件切换：与博客、客户案例页的下划线标签页同一写法 */
.lg-tabs { position: relative; display: flex; gap: 32px; margin-top: 44px; }
.lg-tabs::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--lg-line); pointer-events: none; }
.lg-main a.lg-tab { position: relative; display: inline-flex; flex: none; flex-direction: column; align-items: center; justify-content: center; height: 54px; color: var(--lg-muted); font-size: var(--t-body); line-height: 1; text-decoration: none; white-space: nowrap; transition: color .15s ease; }
.lg-tab::before { content: attr(data-label); height: 0; overflow: hidden; font-weight: 600; visibility: hidden; }
.lg-tab::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; height: 2px; border-radius: 2px; background: var(--lg-blue); transform: scaleX(0); transition: transform .2s ease; }
.lg-main a.lg-tab:hover { color: var(--lg-ink); }
.lg-main a.lg-tab[aria-current="page"] { color: var(--lg-ink); font-weight: 600; }
.lg-tab[aria-current="page"]::after { transform: scaleX(1); }
.lg-main a.lg-tab:focus-visible { outline: 2px solid var(--lg-blue); outline-offset: -2px; border-radius: 6px; }

/* ---------- 正文：左侧目录 + 右侧文档 ---------- */
.lg-body { padding: 56px 0 120px; }
.lg-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 80px; align-items: start; }
.lg-side { position: sticky; top: var(--lg-sticky); max-height: calc(100vh - var(--lg-sticky) - 24px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.lg-side p.lg-toc-title { margin: 0 0 12px; color: var(--lg-ink); font-size: var(--t-small); font-weight: 600; line-height: 1.5; }
.lg-toc ol { display: grid; gap: 2px; margin: 0; padding: 0; border-left: 1px solid var(--lg-line); list-style: none; }
.lg-main .lg-toc a { display: flex; gap: 10px; margin-left: -1px; padding: 5px 0 5px 14px; border-left: 2px solid transparent; color: var(--lg-muted); font-size: var(--t-small); line-height: 1.55; text-decoration: none; transition: color .15s ease, border-color .15s ease; }
.lg-toc a span { flex: none; min-width: 18px; color: var(--lg-subtle); font-variant-numeric: tabular-nums; }
.lg-main .lg-toc a:hover { color: var(--lg-ink); }
.lg-main .lg-toc a.is-active { border-left-color: var(--lg-blue); color: var(--lg-blue-deep); font-weight: 600; }
.lg-toc a.is-active span { color: var(--lg-blue); }

.lg-help { margin-top: 28px; padding: 20px; border: 1px solid var(--lg-line); border-radius: 16px; background: #f8faff; }
.lg-help b { display: block; color: var(--lg-ink); font-size: var(--t-card); font-weight: 600; line-height: 1.5; }
.lg-help p { margin: 6px 0 12px; color: var(--lg-muted); font-size: 13px; line-height: 1.7; }
.lg-main .lg-help a { color: var(--lg-blue); font-size: var(--t-small); font-weight: 600; text-decoration: none; }
.lg-main .lg-help a:hover { color: var(--lg-blue-deep); text-decoration: underline; }

/* 窄屏目录：折叠框 */
.lg-toc-mobile { display: none; margin: 0 0 28px; border: 1px solid var(--lg-line); border-radius: 14px; background: var(--lg-canvas); }
.lg-toc-mobile > summary { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; color: var(--lg-ink); font-size: var(--t-card); font-weight: 600; list-style: none; cursor: pointer; }
.lg-toc-mobile > summary::-webkit-details-marker { display: none; }
.lg-toc-mobile > summary::after { content: ''; width: 8px; height: 8px; margin-top: -4px; border-right: 2px solid var(--lg-subtle); border-bottom: 2px solid var(--lg-subtle); transform: rotate(45deg); transition: transform .2s ease; }
.lg-toc-mobile[open] > summary::after { margin-top: 4px; transform: rotate(-135deg); }
.lg-toc-mobile ol { display: grid; margin: 0; padding: 0 18px 8px; list-style: none; }
.lg-main .lg-toc-mobile a { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--lg-line); color: var(--lg-muted); font-size: var(--t-small); line-height: 1.55; text-decoration: none; }
.lg-toc-mobile a span { flex: none; min-width: 18px; color: var(--lg-subtle); font-variant-numeric: tabular-nums; }

/* ---------- 文档排版 ---------- */
.lg-doc { min-width: 0; max-width: 780px; }
.lg-doc p, .lg-doc li, .lg-doc dd { margin: 0; color: var(--lg-text); font-size: var(--t-body); line-height: 1.9; text-wrap: pretty; }
.lg-doc strong { color: var(--lg-ink); font-weight: 600; }
.lg-main .lg-doc a { color: var(--lg-blue); text-decoration: underline; text-decoration-color: rgba(49, 93, 255, .35); text-underline-offset: 3px; }
.lg-main .lg-doc a:hover { color: var(--lg-blue-deep); text-decoration-color: currentColor; }

/* 编号章节 */
/* styles.css 已给 html 设了 scroll-padding-top（桌面 96px、窄屏 76px）让出固定导航，这里只再留 16px，叠加后章节标题落在导航下方约 112px */
.lg-sec { margin-top: 56px; scroll-margin-top: 16px; }
.lg-doc > .lg-sec:first-of-type { margin-top: 0; }
/* 段落类规则 .lg-doc p 的特异性是 (0,1,1)，间距规则要写到 (0,2,0) 以上才能生效 */
.lg-doc .lg-sec > * + * { margin-top: 14px; }
.lg-sec > h2 { display: flex; align-items: baseline; gap: 14px; margin: 0 0 20px; color: var(--lg-ink); font-size: var(--t-h2); font-weight: 600; line-height: 1.35; letter-spacing: -.025em; text-wrap: pretty; }
.lg-doc .lg-sec > h2 + * { margin-top: 0; }
.lg-num { flex: none; color: var(--lg-blue); font-size: .64em; font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.lg-sec h3 { margin: 0; color: var(--lg-ink); font-weight: 600; line-height: 1.45; letter-spacing: -.015em; }

.lg-doc ul.lg-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lg-doc .lg-list > li { position: relative; padding-left: 18px; line-height: 1.85; }
.lg-list > li::before { content: ''; position: absolute; left: 2px; top: .78em; width: 6px; height: 6px; border-radius: 50%; background: #9fb2ff; }

/* 安全措施卡片 */
.lg-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lg-card { padding: 22px 22px 20px; border: 1px solid var(--lg-line); border-radius: 16px; background: #fff; }
.lg-card-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--lg-blue-soft); color: var(--lg-blue); }
.lg-card-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lg-card h3 { margin-top: 14px; font-size: 18px; }
.lg-doc .lg-card p { margin-top: 6px; color: var(--lg-muted); font-size: var(--t-card); line-height: 1.75; }

/* 联系方式 */
.lg-contact { display: grid; margin: 0; border: 1px solid var(--lg-line); border-radius: 16px; overflow: hidden; }
.lg-contact > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; padding: 16px 20px; border-top: 1px solid var(--lg-line); }
.lg-contact > div:first-child { border-top: 0; }
.lg-contact dt { color: var(--lg-muted); font-size: var(--t-small); line-height: 1.9; }
.lg-doc .lg-contact dd { color: var(--lg-ink); font-size: var(--t-card); line-height: 1.8; overflow-wrap: anywhere; }

/* 底部 CTA 的描边次按钮：subpage-system 会把 .closing-section 里的链接涂成蓝底，这里显式还原 */
.legal-center .site-cta .cta-row .lg-cta-ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px; border: 1px solid rgba(255, 255, 255, .32); border-radius: 10px; background: transparent; color: #fff; font-size: 15px; text-decoration: none; white-space: nowrap; transition: border-color .2s ease, background-color .2s ease; }
.legal-center .site-cta .cta-row .lg-cta-ghost:hover { border-color: #fff; background: rgba(255, 255, 255, .08); }

/* 矮屏：侧栏只留目录，联系方式在正文最后一节 */
@media (max-height: 800px) {
  .lg-help { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-tab::after, .lg-main .lg-toc a, .lg-toc-mobile > summary::after { transition: none; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1050px) {
  body.legal-center { --t-display: 44px; --t-h2: 26px; --t-h3: 19px; --t-lead: 17px; }
  .lg-layout { grid-template-columns: 208px minmax(0, 1fr); gap: 48px; }
}

@media (max-width: 900px) {
  .lg-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .lg-side { display: none; }
  .lg-toc-mobile { display: block; }
  .lg-doc { max-width: none; }
}

@media (max-width: 760px) {
  body.legal-center { --t-display: 34px; --t-h2: 22px; --t-h3: 18px; --t-lead: 16px; --t-body: 15px; --lg-sticky: 84px; }
  .lg-hero { padding-top: 72px; }
  .lg-crumbs { margin-bottom: 16px; }
  .lg-hero p.lg-meta { margin-top: 16px; }
  .lg-tabs { gap: 28px; margin-top: 28px; }
  .lg-main a.lg-tab { height: 48px; font-size: 15px; }
  .lg-body { padding: 28px 0 80px; }
  .lg-sec { margin-top: 44px; }
  .lg-sec > h2 { gap: 10px; margin-bottom: 16px; }
  .lg-contact > div { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 14px 16px; }
  .lg-cards { grid-template-columns: minmax(0, 1fr); }
  .lg-card { padding: 18px; }
  .legal-center .site-cta .cta-row { flex-direction: column-reverse; align-items: stretch; }
  .legal-center .site-cta .cta-row > a { width: 100%; }
}

/* 打印：只保留文档本身 */
@media print {
  .nav-wrap, .lg-side, .lg-toc-mobile, .lg-tabs, .closing-section, .cookie-consent-banner, [class^="global-advisor"] { display: none !important; }
  .lg-hero { padding: 0; background: none; }
  .lg-layout { display: block; }
  .lg-body { padding: 24px 0 0; }
  .lg-card, .lg-contact { break-inside: avoid; }
}
