/* =============================================
   LEGAL PAGE
   Mirrors the about page layout — sidebar
   scrollspy on desktop, pill nav on mobile.
   ============================================= */

.legal-page {
  min-height: calc(100vh - var(--header-height));
  background: var(--bg-base);
  padding-bottom: var(--space-20);
}

/* ----- Layout ----- */

.legal-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
  max-width: var(--container-xl, 1320px);
  margin: 0 auto;
  padding: var(--space-10) var(--space-8);
}

/* ----- Sidebar ----- */

.legal-sidebar {
  display: none;
}

.legal-sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-subtle);
}

.legal-sidebar-nav a {
  display: block;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-tertiary);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition:
    color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.legal-sidebar-nav a:hover {
  color: var(--text-primary);
}

.legal-sidebar-nav a.active {
  color: var(--text-primary);
  border-left-color: var(--accent);
  font-weight: var(--weight-semibold);
}

/* ----- Mobile pill nav ----- */

.legal-mobile-nav {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-6);
}

.legal-mobile-nav::-webkit-scrollbar {
  display: none;
}

.legal-mobile-nav a {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  text-decoration: none;
  white-space: nowrap;
  transition:
    color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.legal-mobile-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.legal-mobile-nav a.active {
  color: var(--accent-text);
  background: var(--accent-subtle);
  border-color: var(--accent);
}

/* ----- Intro block ----- */

.legal-intro {
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  max-width: 78ch;
}

.legal-effective {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin: 0 0 var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--weight-semibold);
}

.legal-intro p:not(.legal-effective) {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin: 0;
}

/* ----- Sections ----- */

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

.legal-section {
  margin-bottom: var(--space-16);
  scroll-margin-top: calc(var(--header-height, 80px) + var(--space-6));
}

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

.legal-section-heading {
  margin: 0 0 var(--space-6);
  font-size: var(--text-2xl);
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  letter-spacing: -0.03em;
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

.legal-section-body {
  max-width: 78ch;
}

.legal-section-body p {
  margin: 0 0 var(--space-5);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

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

.legal-section-body strong {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.legal-section-body a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-section-body a:hover {
  color: var(--accent-hover);
}

/* ----- Subsection headings ----- */

.legal-subsection-heading {
  margin: var(--space-8) 0 var(--space-3);
  font-size: var(--text-base);
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: var(--leading-snug);
}

.legal-subsection-heading:first-child {
  margin-top: 0;
}

/* ----- Responsive ----- */

@media (min-width: 1025px) {
  .legal-layout {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: var(--space-16);
  }

  .legal-sidebar {
    display: block;
    position: sticky;
    top: calc(var(--header-height, 80px) + var(--space-6));
    align-self: start;
  }

  .legal-mobile-nav {
    display: none;
  }
}

@media (max-width: 720px) {
  .legal-layout {
    padding: var(--space-6) var(--space-5) var(--space-10);
  }

  .legal-section-heading {
    font-size: var(--text-xl);
  }
}
