/* Legal pages: simplified layout with sticky table of contents. */

/* The theme wraps all content in a global overflow-hidden div (header.php:55).
   An ancestor with overflow:hidden turns into a scroll container and breaks
   position: sticky (the TOC scrolls away). This stylesheet loads only on legal
   templates, so relaxing that wrapper here is scoped to legal pages.
   overflow-x: clip still hides horizontal overflow but does NOT create a
   scroll container, so sticky keeps working. */
.w-full.bg-white.overflow-hidden {
  overflow: visible;
  overflow-x: clip;
}

.legal-page {
  background: #fff;
}

.legal-container {
  max-width: 1152px;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Hero */
.legal-hero {
  padding-top: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 3rem;
}
.legal-title {
  margin: 0;
  font-size: 2.75rem;
  line-height: 1.1;
  font-weight: 700;
  color: #111827;
}
.legal-updated {
  margin: 0.75rem 0 0;
  font-size: 1rem;
  color: #6b7280;
}

/* Layout */
.legal-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 3rem;
  padding-bottom: 5rem;
}
.legal-layout--full {
  grid-template-columns: 1fr;
}

/* Table of contents */
.legal-toc {
  align-self: start;
  position: sticky;
  top: 88px;
  padding: 1.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #fff;
}
.legal-toc__summary {
  list-style: none;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
}
.legal-toc__summary::-webkit-details-marker {
  display: none;
}
.legal-toc__list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.legal-toc__item {
  margin: 0;
}
.legal-toc__link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid transparent;
  border-radius: 0 0.375rem 0.375rem 0;
  color: #374151;
  font-size: 0.9375rem;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}
.legal-toc__link:hover {
  color: #0357ee;
}
.legal-toc__link.is-active {
  background: #f3f4f6;
  border-left-color: #111827;
  color: #111827;
  font-weight: 600;
}

/* Content typography */
.legal-content {
  color: #374151;
  font-size: 1.0625rem;
  line-height: 1.75;
}
.legal-content > *:first-child {
  margin-top: 0;
}
.legal-content h2 {
  margin: 2.5rem 0 1rem;
  color: #111827;
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.3;
  scroll-margin-top: 80px;
}
.legal-content h3 {
  margin: 1.75rem 0 0.5rem;
  color: #111827;
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.35;
}
.legal-content p {
  margin: 0 0 1.25rem;
}
.legal-content a {
  color: #0357ee;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}
.legal-content a:hover {
  color: #023288;
}
.legal-content strong,
.legal-content b {
  color: #111827;
  font-weight: 600;
}
.legal-content ul,
.legal-content ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
}
.legal-content ul {
  list-style: disc;
}
.legal-content ol {
  list-style: decimal;
}
.legal-content li {
  margin-bottom: 0.5rem;
}
.legal-content li::marker {
  color: #111827;
}

/* Desktop: TOC is a static card. The "Table of Contents" heading stays visible
   but is not a toggle (pointer-events disabled so it can't collapse the card).
   The card is capped to the viewport height; the heading stays fixed while the
   list scrolls internally when there are too many items to fit. */
@media (min-width: 1024px) {
  .legal-toc__summary {
    pointer-events: none;
    cursor: default;
  }
  /* Cap the list to the viewport and scroll it internally when there are many
     items. The cap goes directly on the scroll element (nav): flex on <details>
     does not reliably constrain its children's height. 7rem ≈ card padding +
     heading + a small bottom gap, on top of the 88px sticky offset. */
  .legal-toc > nav {
    max-height: calc(100vh - 88px - 7rem);
    overflow-y: auto;
  }
}

/* Mobile: single column, TOC collapsible and not sticky. */
@media (max-width: 1023px) {
  .legal-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .legal-toc {
    position: static;
    margin-bottom: 1rem;
  }
  .legal-title {
    font-size: 2rem;
  }
}
