/* =====================================================================
   Ze Yuan Trade — legal.css (Privacy Policy & Terms of Service)
   Loaded ONLY by the legal pages. Light theme, matches homepage body.
   ===================================================================== */

:root {
  --legal-bg: #F7F6F1;
  --legal-ink: #17191E;
  --legal-muted: #5B5F68;
  --legal-line: #E3E1D7;
  --legal-card: #FFFFFF;
  --legal-accent: #1B4FD8;
  --legal-accent-deep: #12338F;
  --legal-accent-soft: #E8EEFB;
  --legal-on-accent: #FFFFFF;
  --legal-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --legal-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

/* Body background is defined here because legal pages never load style.css */
.legal-page {
  background-color: var(--legal-bg);
  color: var(--legal-ink);
  font-family: var(--legal-sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.legal-page a {
  color: var(--legal-accent);
  text-decoration: none;
}

.legal-page a:hover {
  text-decoration: underline;
}

/* ---------- Header (a <header>, never a <section>) ---------- */

.legal-header {
  background: linear-gradient(135deg, var(--legal-accent) 0%, var(--legal-accent-deep) 100%);
  padding: 96px 24px 60px;
  text-align: center;
}

.legal-header .brand {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--legal-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--legal-on-accent);
  margin-bottom: 26px;
}

.legal-header .brand .brand-mark {
  font-weight: 700;
}

.legal-header h1 {
  font-family: var(--legal-serif);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 600;
  color: var(--legal-on-accent);
  line-height: 1.15;
  margin-bottom: 16px;
}

.legal-header .updated {
  font-size: 0.9rem;
  color: #d7e0fa;
}

/* ---------- Table of contents ---------- */

nav.toc {
  background: var(--legal-card);
  border: 1px solid var(--legal-line);
  border-radius: 8px;
  max-width: 820px;
  margin: -40px auto 0;
  padding: 28px 32px;
  position: relative;
  z-index: 5;
  box-shadow: 0 18px 40px #1a1c2010;
}

nav.toc .toc-title {
  font-family: var(--legal-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--legal-ink);
  margin-bottom: 16px;
}

nav.toc ol {
  list-style: none;
  counter-reset: toc;
  columns: 2;
  column-gap: 40px;
}

nav.toc ol li {
  counter-increment: toc;
  margin-bottom: 10px;
  break-inside: avoid;
}

nav.toc ol li a {
  color: var(--legal-muted);
  font-size: 0.92rem;
  line-height: 1.5;
  display: inline-flex;
  gap: 10px;
}

nav.toc ol li a::before {
  content: counter(toc, decimal-leading-zero);
  font-weight: 700;
  color: var(--legal-accent);
  font-size: 0.82rem;
}

nav.toc ol li a:hover {
  color: var(--legal-accent);
}

/* ---------- Content ---------- */

.legal-content .container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Scope isolation: never let homepage section styling bleed into legal text */
.legal-page .legal-content section {
  background-color: transparent !important;
}

.legal-content {
  padding: 64px 0 80px;
}

.legal-content section {
  margin-bottom: 56px;
}

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

.legal-content h2 {
  font-family: var(--legal-serif);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--legal-ink);
  line-height: 1.25;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--legal-line);
}

.legal-content h3 {
  font-family: var(--legal-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--legal-ink);
  margin: 24px 0 10px;
}

.legal-content p {
  color: var(--legal-muted);
  margin-bottom: 16px;
}

.legal-content ul,
.legal-content ol {
  margin: 0 0 16px 24px;
}

.legal-content ul {
  list-style: disc;
}

.legal-content ol {
  list-style: decimal;
}

.legal-content li {
  color: var(--legal-muted);
  margin-bottom: 8px;
}

.legal-content strong {
  color: var(--legal-ink);
  font-weight: 600;
}

.legal-content .highlight-box {
  background: var(--legal-accent-soft);
  border-left: 4px solid var(--legal-accent);
  padding: 20px 24px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 20px;
}

.legal-content .highlight-box p {
  color: var(--legal-ink);
  margin-bottom: 0;
}

/* ---------- Footer ---------- */

.legal-footer {
  background: var(--legal-ink);
  color: #c4c8cf;
  padding: 56px 24px 40px;
  text-align: center;
}

.legal-footer .brand {
  font-family: var(--legal-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 14px;
}

.legal-footer p {
  font-size: 0.88rem;
  color: #9ba0a9;
  max-width: 640px;
  margin: 0 auto 22px;
}

.legal-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 26px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.legal-footer .footer-links a {
  color: #9ba0a9;
  font-size: 0.9rem;
}

.legal-footer .footer-links a:hover {
  color: #ffffff;
}

.legal-footer .footer-links a.primary {
  color: var(--legal-on-accent);
  font-weight: 600;
}

.legal-footer .copyright {
  font-size: 0.8rem;
  color: #6c7079;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  nav.toc ol {
    columns: 1;
  }

  nav.toc {
    margin-left: 24px;
    margin-right: 24px;
    padding: 22px 24px;
  }

  .legal-header {
    padding: 84px 24px 52px;
  }

  .legal-content {
    padding: 48px 0 64px;
  }
}
