/* Standalone legal / policy pages (privacy, terms) */

/* Inter-first body text（zh: Inter + system CJK）；文本层级：白 + 透明度 */
body.legal-doc {
  --legal-fg-page: rgba(255, 255, 255, 0.7);
  --legal-fg-title: rgba(255, 255, 255, 0.96);
  --legal-fg-h2: rgba(255, 255, 255, 0.92);
  --legal-fg-h3: rgba(255, 255, 255, 0.82);
  --legal-fg-prose: rgba(255, 255, 255, 0.68);
  --legal-fg-strong: rgba(255, 255, 255, 0.88);
  --legal-fg-muted: rgba(255, 255, 255, 0.52);

  min-height: 100vh;
  background: var(--bg);
  color: var(--legal-fg-page);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  font-size: var(--t-body);
  line-height: var(--t-prose-lh);
}

html[data-locale='zh'] body.legal-doc,
html:lang(zh-CN) body.legal-doc {
  font-family: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui,
    sans-serif;
}

.legal-doc__wrap {
  box-sizing: border-box;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  /* 勿用 --align-pad-x：该值含「视口减 page-max」的一半，叠在已限宽 1280 的容器上会把正文挤得过窄 */
  padding: 32px max(var(--page-pad-x), env(safe-area-inset-right, 0px)) 64px
    max(var(--page-pad-x), env(safe-area-inset-left, 0px));
}

.legal-doc__top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.legal-doc__brand {
  display: flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
  color: inherit;
  opacity: 0.95;
  transition: opacity 0.15s;
}
.legal-doc__brand:hover {
  opacity: 1;
}
.legal-doc__brand img {
  display: block;
  height: 22px;
  width: auto;
  max-width: min(159px, 42vw);
}

.legal-back {
  position: relative;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 0;
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--legal-fg-muted);
  text-decoration: none;
  background: transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
/* 与首页线框按钮 .hero-figma-btn-outline:hover 同一套 hover 填充 */
.legal-back:hover {
  color: rgba(255, 255, 255, 1);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.1);
}
.legal-back:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.legal-back__icon {
  display: block;
  flex-shrink: 0;
}
.legal-back__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.legal-doc main,
.legal-doc__main {
  max-width: 1280px;
  width: 100%;
}

/* Privacy uses .legal-doc__title; terms placeholder uses plain h1 in main */
.legal-doc main > h1,
.legal-doc__title {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 32px;
  line-height: 48px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0;
  text-align: center;
  color: var(--legal-fg-title);
}

html[data-locale='zh'] .legal-doc main > h1,
html[data-locale='zh'] .legal-doc__title,
html:lang(zh-CN) .legal-doc main > h1,
html:lang(zh-CN) .legal-doc__title {
  font-family: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui,
    sans-serif;
}

.legal-doc__updated {
  font-size: var(--t-body-sm);
  color: var(--legal-fg-muted);
  margin-bottom: 28px;
}

.legal-doc__h2 {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--t-step-title);
  line-height: var(--t-step-title-lh);
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
  color: var(--legal-fg-h2);
}

html[data-locale='zh'] .legal-doc__h2,
html:lang(zh-CN) .legal-doc__h2 {
  font-family: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui,
    sans-serif;
}

.legal-doc__h2:first-of-type {
  margin-top: 24px;
}

.legal-doc__h3 {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--t-body);
  line-height: var(--t-body-lh);
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 10px;
  color: var(--legal-fg-h3);
}

html[data-locale='zh'] .legal-doc__h3,
html:lang(zh-CN) .legal-doc__h3 {
  font-family: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui,
    sans-serif;
}

.legal-prose {
  color: var(--legal-fg-prose);
  margin-bottom: 14px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.legal-prose strong {
  color: var(--legal-fg-strong);
  font-weight: 700;
}

.legal-prose:last-child {
  margin-bottom: 0;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .legal-doc__wrap {
    padding-top: 24px;
    padding-bottom: 56px;
    padding-left: max(24px, env(safe-area-inset-left, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
  }

  .legal-doc__h2 {
    margin-top: 28px;
  }
}

@media (max-width: 768px) {
  .legal-doc__wrap {
    padding-top: 20px;
    padding-bottom: 48px;
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-right: max(20px, env(safe-area-inset-right, 0px));
  }

  .legal-doc main > h1,
  .legal-doc__title {
    font-size: 22px;
    line-height: 30px;
  }

  .legal-doc__h2 {
    font-size: 15px;
    line-height: 22px;
    margin-top: 26px;
    margin-bottom: 12px;
  }

  .legal-doc__h3 {
    font-size: 15px;
    line-height: 22px;
  }

  body.legal-doc {
    font-size: 15px;
    line-height: 26px;
  }
}

@media (max-width: 480px) {
  .legal-doc__wrap {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }

  .legal-doc__top {
    margin-bottom: 20px;
    gap: 12px;
  }

  .legal-doc__updated {
    margin-bottom: 22px;
  }
}
