/* TaleWalk 法律页样式。色彩与字体沿用 Figma 定稿「视觉与佈局基准」：
   底色 #111827 · 边线 #374151 · 主文字 #F6F7FB · 辅助文字 #A9B1C2 · 操作 #FF9578
   中文 Noto Sans，品牌与英文 Inter。深色为产品唯一主题，打印时切浅色。 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;800&family=Noto+Sans+SC:wght@400;500;600;800&family=Noto+Sans+TC:wght@400;500;600;800&display=swap');

:root {
  color-scheme: dark;
  --canvas: #111827;
  --canvas-deep: #0b1020;
  --surface: #171e2e;
  --surface-2: #1c2436;
  --line: #374151;
  --line-soft: rgba(55, 65, 81, .55);
  --text: #f6f7fb;
  --text-2: #a9b1c2;
  --text-3: #a9b1c2;
  --accent: #ff9578;
  --accent-strong: #ff7a55;
  --accent-soft: rgba(255, 149, 120, .14);
  --ok: #69dcac;
  --lavender: #d2beff;
  --brand: #7149f5;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-family: var(--sans);
  background: var(--canvas);
  color: var(--text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
html:lang(zh-Hant) { --sans: 'Inter', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', -apple-system, sans-serif; }
html:lang(zh-Hans) { --sans: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  font-size: 16px;
  line-height: 1.75;
  background:
    radial-gradient(900px 480px at 50% -160px, rgba(255, 149, 120, .065), transparent 70%),
    linear-gradient(180deg, var(--canvas-deep) 0%, var(--canvas) 420px);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
::selection { background: var(--accent-soft); color: var(--text); }
[hidden] { display: none !important; }
.locale-block { display: none; }
html:lang(en) .locale-block[lang="en"],
html:lang(zh-Hant) .locale-block[lang="zh-Hant"],
html:lang(zh-Hans) .locale-block[lang="zh-Hans"] { display: block; }

.skip-link { position: absolute; left: 16px; top: -60px; padding: 10px 14px; background: var(--accent); color: #1a0f0a; border-radius: 999px; font-weight: 600; z-index: 10; }
.skip-link:focus { top: 16px; }

.shell { width: min(1160px, calc(100% - 96px)); margin-inline: auto; }

/* 页头 */
.site-header { display: flex; align-items: center; justify-content: space-between; min-height: 96px; gap: 24px; }
.wordmark { display: inline-flex; align-items: center; flex-shrink: 0; gap: 11px; font-weight: 800; font-size: 22px; letter-spacing: -.025em; white-space: nowrap; color: var(--text); }
.brand-mark { display: block; width: 36px; height: 36px; object-fit: contain; }
.language-switch { display: inline-flex; flex-shrink: 0; padding: 4px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.language-switch a { min-height: 34px; min-width: 48px; display: grid; place-items: center; padding: 0 13px; border-radius: 999px; font-size: .875rem; line-height: 1.2; font-weight: 500; color: var(--text-2); transition: color .15s, background .15s; }
.language-switch a:hover { color: var(--text); background: var(--surface-2); }
.language-switch a[aria-current="true"] { background: var(--accent); color: #1a0f0a; font-weight: 600; }
.language-switch a:focus-visible { outline-offset: 2px; }
html:not(.js-enhanced) .language-switch { display: none; }

/* 文档头 */
.document-header { padding: 64px 0 44px; border-bottom: 1px solid var(--line-soft); margin-bottom: 48px; }
.eyebrow { margin: 0 0 14px; font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.document-header h1 { margin: 0; font-size: clamp(38px, 6vw, 64px); line-height: 1.05; font-weight: 800; letter-spacing: -.035em; color: var(--text); }
html:lang(zh-Hant) .document-header h1, html:lang(zh-Hans) .document-header h1 { letter-spacing: 0; }
.document-deck { margin: 18px 0 0; max-width: 60ch; font-size: 17px; color: var(--text-2); }
.document-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 26px; font-size: .875rem; color: var(--text-2); }
.version-badge { display: inline-flex; align-items: center; padding: 3px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: .75rem; line-height: 1.7; font-weight: 500; font-variant-numeric: tabular-nums; }

/* 两栏：目录 + 正文 */
.legal-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 64px; align-items: start; }
.desktop-toc { position: sticky; top: 28px; max-height: calc(100vh - 56px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; padding: 5px 8px 24px 5px; margin-left: -5px; }
.toc-label { margin: 0 0 18px; font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line-soft); }
.toc-list a { display: flex; gap: 12px; align-items: baseline; padding: 8px 0 8px 16px; margin-left: -1px; border-left: 2px solid transparent; font-size: .875rem; line-height: 1.45; color: var(--text-2); transition: color .15s, border-color .15s; }
.toc-list a:hover { color: var(--text); }
.toc-list a[aria-current="location"] { color: var(--accent); border-left-color: var(--accent); }
.toc-list .toc-number { flex: 0 0 20px; font-size: .75rem; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text-3); }
.toc-list a[aria-current="location"] .toc-number { color: var(--accent); }

.mobile-toc { display: none; }
.legal-article { width: 100%; max-width: 72ch; min-width: 0; padding-bottom: 72px; }
.legal-section { padding: 36px 0 32px; border-top: 1px solid var(--line-soft); scroll-margin-top: 24px; }
.legal-section:first-of-type { border-top: 0; padding-top: 0; }
.legal-section h2 { display: flex; gap: 14px; align-items: baseline; margin: 0 0 20px; font-size: 1.5rem; line-height: 1.35; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.section-number { flex: 0 0 28px; font-size: .875rem; font-weight: 500; letter-spacing: 0; color: var(--accent); font-variant-numeric: tabular-nums; }
.legal-section h3 { margin: 26px 0 10px; font-size: 16.5px; font-weight: 600; color: var(--text); }
.legal-article p { margin: 0 0 16px; color: var(--text-2); }
.legal-article p:last-child { margin-bottom: 0; }
.legal-article strong { color: var(--text); font-weight: 600; }
.legal-article ul, .legal-article ol { margin: 0 0 16px; padding-left: 22px; color: var(--text-2); }
.legal-article li { margin: 0 0 8px; padding-left: 4px; }
.legal-article li::marker { color: var(--accent); }
.legal-article a { color: var(--accent); overflow-wrap: anywhere; text-decoration: underline; text-decoration-color: rgba(255, 149, 120, .45); text-decoration-thickness: 1px; text-underline-offset: .2em; transition: text-decoration-color .15s; }
.legal-article a:hover { text-decoration-color: var(--accent); }
/* The mobile TOC is inside the article; keep navigation distinct from prose. */
.legal-article .toc-list { margin: 0; list-style: none; }
.legal-article .toc-list li { margin: 0; padding: 0; }
.legal-article .toc-list a { color: var(--text-2); text-decoration: none; }
.legal-article .toc-list a:hover { color: var(--text); }
.legal-article .toc-list a[aria-current="location"] { color: var(--accent); }

.table-scroll { overflow-x: auto; margin: 20px 0 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; line-height: 1.65; }
th, td { padding: 14px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); color: var(--text-2); }
th { font-weight: 500; color: var(--text); background: var(--surface-2); font-size: .875rem; }
tbody tr:nth-child(even) { background: rgba(169, 177, 194, .025); }
tr:last-child td { border-bottom: 0; }
th:first-child { width: 34%; }
th:last-child { width: 28%; }

.document-end { display: flex; justify-content: space-between; gap: 16px; margin-top: 8px; padding-top: 28px; border-top: 1px solid var(--line-soft); font-size: 14px; }
.document-end a { color: var(--text-2); }
.document-end a:hover { color: var(--accent); }

/* 页脚 */
.site-footer { margin-top: 24px; padding: 36px 0 40px; border-top: 1px solid var(--line-soft); font-size: .875rem; color: var(--text-2); }
.footer-top { display: flex; justify-content: space-between; gap: 32px; align-items: flex-start; }
.footer-company { margin: 0 0 4px; font-weight: 600; color: var(--text); }
.site-footer address { font-style: normal; max-width: 430px; }
.footer-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-nav a:hover, .footer-emails a:hover { color: var(--accent); }
.footer-emails { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 18px; }
.copyright { margin: 22px 0 0; font-size: .75rem; color: var(--text-3); }

/* 首页 */
.home-content { min-height: calc(100svh - 340px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 68px 0 76px; }
.home-emblem { position: relative; isolation: isolate; width: 128px; height: 128px; margin-bottom: 30px; display: grid; place-items: center; }
.home-emblem::before { content: ''; position: absolute; z-index: -1; width: 240px; height: 180px; top: 10px; left: 50%; transform: translateX(-50%); background: radial-gradient(ellipse at 44% 42%, rgba(113, 73, 245, .17), transparent 64%), radial-gradient(ellipse at 58% 65%, rgba(255, 149, 120, .1), transparent 58%); pointer-events: none; }
.home-emblem img { display: block; width: 128px; height: 128px; object-fit: contain; }
.home-title { margin: 0; font-size: clamp(52px, 10vw, 96px); line-height: 1; font-weight: 800; letter-spacing: -.04em; color: var(--text); }
.home-description { margin: 22px 0 36px; max-width: 480px; font-size: 17px; color: var(--text-2); }
.home-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: min(100%, 560px); text-align: left; }
.home-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 60px; padding: 12px 22px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .9375rem; font-weight: 500; color: var(--text); transition: border-color .15s, background .15s; }
.home-link:hover { border-color: var(--accent); background: var(--surface-2); }
.link-number { margin-right: 10px; font-size: .75rem; color: var(--accent); font-weight: 500; font-variant-numeric: tabular-nums; }
.home-link .arrow { color: var(--accent); font-size: 16px; }
.home-contact { margin: 32px 0 0; font-size: 14px; color: var(--text-2); }
.home-contact a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(255, 149, 120, .45); text-decoration-thickness: 1px; text-underline-offset: .2em; }
.home-contact a:hover { text-decoration-color: var(--accent); }

/* 响应式 */
@media (max-width: 900px) {
  .shell { width: calc(100% - 48px); }
  .document-header { padding: 40px 0 32px; margin-bottom: 32px; }
  .legal-layout { display: block; }
  .desktop-toc { display: none; }
  .mobile-toc { display: block; margin: 0 0 32px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
  .mobile-toc summary { padding: 14px 18px; font-size: 14px; font-weight: 500; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; }
  .mobile-toc summary::-webkit-details-marker { display: none; }
  .mobile-toc summary::before { content: ''; width: 8px; height: 8px; border-right: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); transform: rotate(-45deg); transition: transform .15s; }
  .mobile-toc[open] summary::before { transform: rotate(45deg); }
  .mobile-toc .toc-list { border-left: 0; padding: 0 18px 14px; }
  .mobile-toc .toc-list a { padding: 8px 0; border-left: 0; margin-left: 0; font-size: 14px; }
}
@media (max-width: 540px) {
  .shell { width: calc(100% - 40px); }
  .site-header { min-height: 76px; gap: 12px; }
  .wordmark { font-size: 19px; gap: 8px; }
  .brand-mark { width: 34px; height: 34px; }
  .language-switch { padding: 3px; }
  .language-switch a { min-width: 40px; padding: 0 9px; font-size: .875rem; }
  .document-header { padding-top: 32px; }
  .document-deck { font-size: 1rem; }
  .legal-section h2 { font-size: 1.3125rem; gap: 10px; }
  .legal-section { padding-top: 30px; }
  .legal-article { font-size: 1rem; }
  .table-scroll table { min-width: 560px; }
  .footer-top { flex-direction: column; gap: 18px; }
  .home-content { padding: 48px 0 56px; min-height: calc(100svh - 340px); }
  .home-emblem, .home-emblem img { width: 112px; height: 112px; }
  .home-links { grid-template-columns: 1fr; }
  .home-description { font-size: 1rem; }
}
@media (max-width: 360px) {
  .shell { width: calc(100% - 32px); }
  .site-header { gap: 8px; }
  .wordmark { font-size: 17px; gap: 6px; }
  .brand-mark { width: 30px; height: 30px; }
  .language-switch a { min-width: 36px; padding-inline: 7px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

/* 打印：浅色、单栏、三语全文展开 */
@media print {
  :root { color-scheme: light; --canvas: #fff; --surface: #fff; --surface-2: #f3f4f6; --line: #d1d5db; --line-soft: #e5e7eb; --text: #111827; --text-2: #374151; --text-3: #4b5563; --accent: #9a3412; }
  body { background: #fff; font-size: 11pt; }
  .site-header, .language-switch, .desktop-toc, .mobile-toc, .document-end, .skip-link { display: none !important; }
  .shell { width: 100%; }
  .locale-block { display: block !important; page-break-before: always; }
  .locale-block:first-of-type { page-break-before: auto; }
  .legal-layout { display: block; }
  .legal-article { max-width: none; padding-bottom: 20px; font-size: 10pt; }
  .table-scroll { overflow: visible; border: 0; }
  .table-scroll table { min-width: 0; font-size: 9pt; }
  .document-header { padding-top: 20px; margin-bottom: 28px; }
  .document-header h1 { font-size: 28pt; }
  .legal-section h2, .legal-section h3 { break-after: avoid; }
  tr { break-inside: avoid; }
  .home-emblem::before { display: none; }
  a { color: inherit; border: 0; text-decoration-color: currentColor; }
}
