/* Ivywell legal pages — dark theme, warm-gold accent */
:root {
  --bg: #0C0F14;
  --bg-soft: #12161D;
  --surface: #161B24;
  --surface-2: #1B2130;
  --line: #242B38;
  --line-strong: #313A4C;
  --text: #E8EAED;
  --text-muted: #9AA3B2;
  --gold: #D9A441;
  --gold-soft: #E0B45C;
}

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

html {
  scroll-behavior: smooth;
}

.legal-page {
  background-color: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
.legal-header {
  background: linear-gradient(135deg, #141821 0%, #1B2130 100%);
  border-bottom: 1px solid var(--line);
}

.legal-header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 64px 24px 48px;
  text-align: center;
}

.legal-brand {
  display: inline-block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--gold);
  margin-bottom: 22px;
  text-decoration: none;
}

.legal-brand:hover {
  color: var(--gold-soft);
}

.legal-header h1 {
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 12px;
}

.legal-header-sub {
  font-size: 15px;
  color: var(--text-muted);
}

/* ---------- Content layout ---------- */
.legal-content {
  padding: 56px 0 0;
}

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

/* Scope isolation: keep homepage section styling from leaking into legal text */
.legal-page .legal-content section {
  background-color: transparent !important;
}

/* ---------- Table of contents ---------- */
.toc {
  max-width: 800px;
  margin: 0 auto 48px;
  padding: 28px 32px;
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}

.toc h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

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

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

.toc a {
  color: var(--text-muted);
  font-size: 14.5px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero) ". ";
  color: var(--gold);
  font-weight: 600;
}

.toc a:hover {
  color: var(--gold-soft);
}

/* ---------- Sections ---------- */
.legal-content section {
  margin-bottom: 56px;
  scroll-margin-top: 24px;
}

.legal-content section h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.legal-content section h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-soft);
  margin: 22px 0 10px;
}

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

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

.legal-content section a {
  color: var(--gold);
  text-decoration: none;
}

.legal-content section a:hover {
  color: var(--gold-soft);
  text-decoration: underline;
}

.legal-content ul,
.legal-content ol {
  margin: 0 0 16px 24px;
  color: var(--text-muted);
  font-size: 16px;
}

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

/* ---------- Footer ---------- */
.legal-footer {
  background-color: #090B0F;
  border-top: 1px solid var(--line);
  margin-top: 32px;
}

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

.legal-footer p {
  font-size: 14px;
  color: var(--text-muted);
}

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

.legal-footer-links a {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .toc ol {
    columns: 1;
  }

  .legal-header-inner {
    padding: 48px 20px 36px;
  }

  .legal-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
