/* Table of Contents Styles */
/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.3);
  border-radius: 20px;
}

.custom-scrollbar:hover::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
}

/* Floating TOC List */
.gh-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.gh-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.gh-toc li {
  margin: 0;
  padding: 0;
}

/* TOC Link Styles */
.gh-toc a {
  display: block;
  text-decoration: none;
  color: #4b5563; /* text-gray-600 */
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  line-height: 1.5;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  margin-bottom: 2px;
}

/* Dark mode support handled via parent class usually, but explicit hex for fallback */
.dark .gh-toc a {
  color: #9ca3af; /* text-gray-400 */
}

.gh-toc a:hover {
  color: #2563eb; /* text-blue-600 */
  background-color: rgba(37, 99, 235, 0.05); /* bg-blue-600/5 */
}

.dark .gh-toc a:hover {
  color: #60a5fa; /* text-blue-400 */
  background-color: rgba(96, 165, 250, 0.1);
}

/* Active State */
.is-active-link {
  color: #2563eb !important; /* text-blue-600 */
  font-weight: 600;
  background-color: rgba(37, 99, 235, 0.08) !important;
  border-left-color: #2563eb !important;
}

.dark .is-active-link {
  color: #60a5fa !important; /* text-blue-400 */
  background-color: rgba(96, 165, 250, 0.15) !important;
  border-left-color: #60a5fa !important;
}

/* Nested Items Indentation */
.gh-toc ol ol a {
  padding-left: 1.5rem;
  font-size: 0.9rem;
  opacity: 0.9;
}

.gh-toc ol ol ol a {
  padding-left: 2.25rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Base Styles necessary for tocbot */
.toc-list.is-collapsed {
  display: none;
}

.is-collapsible {
  max-height: 1000px;
  overflow: hidden;
  transition: all 300ms ease-in-out;
}

.is-collapsed {
  max-height: 0;
}

/* Mobile responsive tweak */
@media (max-width: 768px) {
  .gh-toc a {
    padding: 0.75rem 1rem;
  }
}

/* ───────────────────────────────────────────────────────────
   Legal layout TOC — Linear-style minimalism
   Overrides base .gh-toc styles when nav has .legal-toc class.
   Hover: ultra-subtle tint (4% alpha) for tactile feedback.
   Active: text + bold + left border ONLY, no bg.
   ─────────────────────────────────────────────────────────── */

.legal-toc a {
  background-color: transparent;
  border-radius: 0;
  font-size: 0.875rem;
  padding: 0.4rem 0.875rem;
  border-left: 2px solid transparent;
  margin-bottom: 0;
  transition: color 0.15s ease, border-left-color 0.15s ease, background-color 0.15s ease;
}

.legal-toc a:hover {
  color: #2563eb; /* blue-600 */
  background-color: rgba(37, 99, 235, 0.04);
  border-left-color: rgba(37, 99, 235, 0.3);
}

.dark .legal-toc a:hover {
  color: #60a5fa; /* blue-400 */
  background-color: rgba(96, 165, 250, 0.04);
  border-left-color: rgba(96, 165, 250, 0.3);
}

.legal-toc .is-active-link {
  color: #2563eb !important;
  background-color: transparent !important;
  border-left-color: #2563eb !important;
  font-weight: 600;
}

.dark .legal-toc .is-active-link {
  color: #60a5fa !important;
  background-color: transparent !important;
  border-left-color: #60a5fa !important;
}

/* Mobile padding adjustment for .legal-toc (override base mobile rule) */
@media (max-width: 768px) {
  .legal-toc a {
    padding: 0.5rem 0.875rem;
  }
}

/* ───────────────────────────────────────────────────────────
   Legal layout TOC — Collapsible behavior
   Mobile (default): closed, button-controlled max-height.
   Desktop (lg+, ≥1024px): always-open, button is visual label.
   Icon `[+]` / `[−]` swapped by JS on click.
   ─────────────────────────────────────────────────────────── */

.legal-toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  margin-bottom: 1rem;
  text-align: left;
}

.legal-toc-toggle:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 2px;
}

.legal-toc-icon {
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
  font-size: 0.875rem;
  color: rgb(107, 114, 128);
  transition: color 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.dark .legal-toc-icon {
  color: rgb(156, 163, 175);
}

.legal-toc-toggle:hover .legal-toc-icon {
  color: #2563eb;
}

.dark .legal-toc-toggle:hover .legal-toc-icon {
  color: #60a5fa;
}

.legal-toc-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}

.legal-toc-toggle[aria-expanded="true"] + .legal-toc-content {
  max-height: 2000px;
}

/* Desktop (lg+): always-open, button is non-interactive visual label */
@media (min-width: 1024px) {
  .legal-toc-toggle {
    cursor: default;
    pointer-events: none;
    margin-bottom: 1rem;
  }

  .legal-toc-icon {
    display: none;
  }

  .legal-toc-content {
    max-height: none !important;
    overflow: visible;
  }
}
