/* =============================================================
   LEGAL PAGES — legal-pages.css
   Standalone stylesheet for /terms and /privacy pages.
   Completely isolated from the main app CSS.
   Uses system fonts — no dependency on app's font loading.
   ============================================================= */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: "Georgia", "Times New Roman", Times, serif;
  font-size: 1rem;
  line-height: 1.8;
  color: #1a1a2e;
  background-color: #fafafa;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Layout ---------- */
.legal-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.legal-header {
  background-color: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.legal-header-logo {
  height: 36px;
  width: auto;
  display: block;
}

.legal-header-brand {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a2e;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.legal-header-brand:hover {
  color: #5a4fcf;
}

.legal-main {
  flex: 1;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

/* ---------- Document Header ---------- */
.legal-doc-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid #e8e4f8;
}

.legal-doc-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 2.25rem;
  font-weight: 800;
  color: #1a1a2e;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.legal-doc-meta {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 0.875rem;
  color: #6b7280;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.legal-doc-meta span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legal-doc-meta strong {
  color: #374151;
  font-weight: 600;
}

.legal-doc-intro {
  margin-top: 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #374151;
  background: #f3f0ff;
  border-left: 4px solid #7c6cf5;
  padding: 1rem 1.25rem;
  border-radius: 0 6px 6px 0;
}

/* ---------- Table of Contents ---------- */
.legal-toc {
  background: #f9f9fb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 3rem;
}

.legal-toc-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 1rem;
}

.legal-toc-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 2rem;
}

.legal-toc-list li a {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 0.875rem;
  color: #5a4fcf;
  text-decoration: none;
  line-height: 1.6;
}

.legal-toc-list li a:hover {
  text-decoration: underline;
  color: #3b2fc9;
}

/* ---------- Sections ---------- */
.legal-section {
  margin-bottom: 3rem;
  scroll-margin-top: 80px;
}

.legal-section-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
  line-height: 1.3;
}

.legal-paragraph {
  font-size: 0.9375rem;
  line-height: 1.85;
  color: #374151;
  margin-bottom: 1rem;
}

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

/* Highlight ALL-CAPS notices (e.g. disclaimers) */
.legal-paragraph:has-text {
  font-size: 0.875rem;
}

/* Indented sub-items (paragraphs starting with a letter and paren) */
.legal-paragraph.is-sub-item {
  padding-left: 1.5rem;
  color: #4b5563;
}

/* Contact block styling */
.legal-contact-block {
  background: #f9f9fb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-top: 0.5rem;
}

.legal-contact-block .legal-paragraph {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
  color: #374151;
}

/* ---------- Footer ---------- */
.legal-footer {
  background-color: #ffffff;
  border-top: 1px solid #e0e0e0;
  padding: 1.75rem 2rem;
  text-align: center;
}

.legal-footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-bottom: 0.75rem;
}

.legal-footer-links a {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 0.875rem;
  color: #5a4fcf;
  text-decoration: none;
}

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

.legal-footer-copy {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 0.8125rem;
  color: #9ca3af;
}

/* ---------- Loading state ---------- */
.legal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: #9ca3af;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 0.9375rem;
  gap: 1rem;
}

.legal-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #7c6cf5;
  border-radius: 50%;
  animation: legal-spin 0.8s linear infinite;
}

@keyframes legal-spin {
  to { transform: rotate(360deg); }
}

.legal-error {
  padding: 2rem;
  text-align: center;
  color: #dc2626;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 0.9375rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  .legal-header {
    padding: 1rem 1.25rem;
  }

  .legal-main {
    padding: 2rem 1.25rem 3rem;
  }

  .legal-doc-title {
    font-size: 1.625rem;
  }

  .legal-toc-list {
    grid-template-columns: 1fr;
  }

  .legal-doc-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .legal-footer-links {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* ---------- Print ---------- */
@media print {
  .legal-header,
  .legal-footer,
  .legal-toc {
    display: none;
  }

  body {
    font-size: 11pt;
    color: #000;
    background: #fff;
  }

  .legal-main {
    max-width: 100%;
    padding: 0;
  }

  .legal-doc-title {
    font-size: 18pt;
  }

  .legal-section-title {
    font-size: 13pt;
    page-break-after: avoid;
  }

  .legal-section {
    page-break-inside: avoid;
  }

  .legal-paragraph {
    font-size: 10.5pt;
    line-height: 1.6;
  }

  a {
    color: #000;
    text-decoration: none;
  }
}
