:root {
  --bg: #0B0E14;
  --bg-soft: #0F1420;
  --bg-panel: #121828;
  --border: #242C44;
  --border-soft: #1C2338;
  --text: #E8EAED;
  --text-muted: #A7AEC2;
  --text-dim: #7C849C;
  --accent: #A78BFA;
  --accent-soft: #C4B5FD;
  --accent-deep: #8B5CF6;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

/* ============ BODY (DEFINED HERE — legal pages load only this stylesheet) ============ */

.legal-page {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

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

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

.legal-page h1, .legal-page h2, .legal-page h3, .legal-page p {
  margin-top: 0;
}

/* ============ LEGAL HEADER (must be div/header, never a section) ============ */

.legal-header {
  background: linear-gradient(135deg, #121828 0%, #171E31 55%, #1A1033 100%);
  border-bottom: 1px solid var(--border-soft);
  padding: 0 24px;
}

.legal-header-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.legal-brand {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.legal-brand span {
  color: var(--accent);
}

.legal-header-crumb {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.legal-header-title {
  max-width: 1000px;
  margin: 0 auto;
  padding: 48px 0 44px;
}

.legal-header-title h1 {
  margin: 0 0 10px;
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #FFFFFF;
}

.legal-header-title p {
  margin: 0;
  font-size: 1rem;
  color: var(--accent-soft);
}

/* ============ BODY LAYOUT (TOC + content) ============ */

.legal-body {
  max-width: 1000px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  align-items: start;
}

/* ============ TABLE OF CONTENTS ============ */

.toc {
  position: sticky;
  top: 24px;
  padding: 26px 24px;
  background-color: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

.toc-title {
  margin-bottom: 18px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.toc-list li {
  margin-bottom: 10px;
}

.toc-list a {
  font-size: 0.92rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.toc-list a:hover {
  color: var(--accent-soft);
  text-decoration: none;
}

/* ============ LEGAL CONTENT ============ */

.legal-content {
  min-width: 0;
}

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

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

.legal-content section {
  padding: 0 0 44px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.legal-content section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.legal-content h2 {
  margin-bottom: 18px;
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent-soft);
  scroll-margin-top: 24px;
}

.legal-content p {
  margin-bottom: 16px;
  font-size: 1rem;
  color: var(--text-muted);
}

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

/* ============ FOOTER ============ */

.legal-footer {
  background-color: var(--bg-soft);
  border-top: 1px solid var(--border-soft);
  padding: 0 24px;
}

.legal-footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.legal-footer-inner p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.legal-footer-links {
  display: flex;
  gap: 24px;
}

.legal-footer-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.legal-footer-links a:hover {
  color: var(--accent-soft);
}

/* ============ RESPONSIVE ============ */

@media (max-width: 860px) {
  .legal-body {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px 24px 48px;
  }

  .toc {
    position: static;
  }
}
