/* ==============================================
   GreenBranch — Legal Pages Stylesheet
   Shared for privacy.html and terms-of-service.html
   ============================================== */

:root {
  --legal-bg: #FEFDFB;
  --legal-text: #24222C;
  --legal-muted: #5E5B66;
  --legal-accent: #DC2626;
  --legal-accent2: #0EA5E9;
  --legal-dark: #1B1B24;
  --legal-border: #E8E4DE;
  --legal-surface: #F8F6F2;
  --legal-footer: #14131C;
  --legal-footer-text: #C5C3CC;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--legal-bg);
  color: var(--legal-text);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

/* ==============================================
   LEGAL HEADER — MUST be <header> tag, not <section>
   MUST have solid/gradient background with strong h1 contrast
   ============================================== */

.legal-header {
  background: linear-gradient(160deg, var(--legal-dark) 0%, #232138 100%);
  padding: 56px 24px 52px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.legal-header .container {
  max-width: 800px;
  margin: 0 auto;
}

.legal-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ABABB2;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 20px;
  transition: color 0.3s ease;
}

.legal-header .back-link:hover {
  color: var(--legal-accent2);
}

.legal-header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.legal-header .last-updated {
  font-size: 0.85rem;
  color: #85848F;
}

/* ==============================================
   SCOPE ISOLATION — protect legal pages from
   homepage section styling pollution
   ============================================== */

.legal-page .legal-content section {
  background-color: transparent !important;
}

.legal-page .legal-content section#toc {
  background-color: var(--legal-surface) !important;
}

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

/* ==============================================
   TABLE OF CONTENTS (toc)
   ============================================== */

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

.legal-content section#toc {
  margin-bottom: 48px;
}

.toc-box {
  background: var(--legal-surface);
  border: 1px solid var(--legal-border);
  border-radius: 12px;
  padding: 32px;
}

.toc-box h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--legal-dark);
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-list li {
  counter-increment: toc-counter;
}

.toc-list li a {
  display: block;
  padding: 8px 14px;
  color: var(--legal-muted);
  text-decoration: none;
  font-size: 0.925rem;
  border-radius: 6px;
  transition: all 0.25s ease;
  border-left: 3px solid transparent;
}

.toc-list li a::before {
  content: counter(toc-counter) ". ";
  font-weight: 600;
  color: var(--legal-accent);
}

.toc-list li a:hover {
  background: rgba(220, 38, 38, 0.04);
  color: var(--legal-accent);
  border-left-color: var(--legal-accent);
}

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

.legal-content section {
  padding: 0 0 40px;
}

.legal-content section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--legal-dark);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--legal-border);
  letter-spacing: -0.01em;
}

.legal-content section h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--legal-text);
  margin: 20px 0 10px;
}

.legal-content section p {
  font-size: 0.95rem;
  color: var(--legal-muted);
  line-height: 1.85;
  margin-bottom: 14px;
}

.legal-content section ul,
.legal-content section ol {
  margin: 10px 0 16px 20px;
}

.legal-content section ul li,
.legal-content section ol li {
  font-size: 0.95rem;
  color: var(--legal-muted);
  line-height: 1.85;
  margin-bottom: 8px;
}

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

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

.legal-footer .container {
  max-width: 800px;
  margin: 0 auto;
}

.legal-footer p {
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.legal-footer a {
  color: var(--legal-accent2);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.legal-footer a:hover {
  color: #38BDF8;
}

.legal-footer .footer-links {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.legal-footer .footer-links a {
  font-size: 0.85rem;
}

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

@media (max-width: 640px) {
  .legal-header h1 {
    font-size: 1.7rem;
  }

  .legal-content {
    padding: 32px 0 40px;
  }

  .legal-content section h2 {
    font-size: 1.15rem;
  }

  .toc-box {
    padding: 20px;
  }

  .legal-footer {
    padding: 32px 16px;
  }
}
