/* ──────────────────────────────────────────────────────────────────────────
   Legal pages — shared design system
   Used by: terms, privacy-policy, cookies, currency-policy, imprint,
            aml-kyc-policy, affiliate-terms, affiliate-privacy-notice
   Replaces the per-page inline styles these templates used to carry so the
   look stays consistent and is maintained in one place.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --legal-bg: #f9fafb;
  --legal-muted: #717680;
  --legal-body: #414651;
  --legal-hairline: #f2f4f7;
  --legal-link: #4a7dff;
  --legal-radius: 12px;
  --legal-max-width: 800px;
}

/* ── Page canvas ─────────────────────────────────────────────────────────── */
#legal-main {
  background: var(--legal-bg);
}

.legal-container {
  max-width: var(--legal-max-width);
  margin: 0 auto;
  padding: 40px 24px 80px;
  width: 100%;
  box-sizing: border-box;
}

/* Affiliate pages run a touch wider. */
.legal-container--wide {
  max-width: 860px;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.legal-header {
  margin-bottom: 32px;
}

.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--legal-muted);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 16px;
  transition: color 0.15s ease;
}

.legal-back:hover {
  color: var(--page-title-color);
}

.legal-back svg path {
  stroke: currentColor;
}

.legal-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--page-title-color);
  margin: 16px 0 8px;
  line-height: 1.2;
}

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

.legal-company {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 4px 0 0;
}

/* ── Auto-generated Table of Contents (legal-enhancements.js) ────────────── */
#legal-toc {
  background: var(--card-bg);
  border: 1px solid var(--table-border-color);
  border-radius: var(--legal-radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  line-height: 1.8;
}

#legal-toc h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--page-title-color);
  margin: 0 0 12px;
}

#legal-toc ol {
  padding-left: 22px;
  margin: 0;
  list-style: decimal;
}

#legal-toc li {
  margin-bottom: 4px;
}

#legal-toc a {
  color: var(--legal-link);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

#legal-toc a:hover {
  text-decoration: underline;
}

/* ── Content card ────────────────────────────────────────────────────────── */
.legal-card {
  background: var(--card-bg);
  border: 1px solid var(--table-border-color);
  border-radius: var(--legal-radius);
  padding: 32px;
  line-height: 1.7;
  color: var(--legal-body);
  font-size: 15px;
}

.legal-card > :first-child {
  margin-top: 0;
}

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

.legal-card p {
  margin: 0 0 16px;
}

/* Lead paragraphs sit a little more open before the first section. */
.legal-card .legal-lead {
  margin-bottom: 20px;
}

.legal-card h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--page-title-color);
  margin: 28px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--legal-hairline);
}

.legal-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--page-title-color);
  margin: 20px 0 8px;
}

.legal-card ul,
.legal-card ol {
  padding-left: 20px;
  margin: 0 0 16px;
}

.legal-card li {
  margin-bottom: 8px;
}

.legal-card a {
  color: var(--legal-link);
  text-decoration: none;
}

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

.legal-card strong {
  color: var(--page-title-color);
}

/* ── Disclaimer / footer card ────────────────────────────────────────────── */
.legal-disclaimer {
  background: var(--card-bg);
  border: 1px solid var(--table-border-color);
  border-radius: var(--legal-radius);
  padding: 24px 32px;
  margin-top: 24px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.legal-disclaimer p {
  margin: 0 0 12px;
}

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

.legal-disclaimer strong {
  color: var(--page-title-color);
}

/* ── Mobile ──────────────────────────────────────────────────────────────
   The shared `.marketplace-main` mobile rule only reserves 16px of top
   padding, but the fixed `.mobile-header` is 64px tall — so legal content
   slid up underneath it. Reserve header height (+ iOS safe area) here, and
   clear the fixed bottom nav at the foot of the page. ID + !important is
   required to beat `.marketplace-main`'s own !important padding. */
@media (max-width: 768px) {
  #legal-main.marketplace-main,
  #legal-main {
    padding-top: calc(64px + 16px + env(safe-area-inset-top)) !important;
    padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
  }

  .legal-container {
    padding: 8px 16px 96px;
  }

  .legal-title {
    font-size: 24px;
  }

  .legal-card {
    padding: 24px 20px;
  }

  .legal-disclaimer {
    padding: 20px;
  }
}
