@layer base {
  .tableOfContents {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-6);
    position: sticky;
    top: var(--spacing-6);
    max-height: calc(100vh - var(--spacing-12));
    overflow-y: auto;
  }

  .title {
    font-family: var(--font-family-heading);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0 0 var(--spacing-4) 0;
    padding-bottom: var(--spacing-3);
    border-bottom: 1px solid var(--border);
  }

  .sectionList {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .sectionItem {
    margin-bottom: var(--spacing-2);
  }

  .sectionLink {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: var(--spacing-2) var(--spacing-3);
    font-family: var(--font-family-base);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    text-decoration: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--animation-duration-fast) ease;
  }

  .sectionLink:hover {
    background: var(--muted);
    color: var(--primary);
  }

  .sectionLink.active {
    background: var(--primary);
    color: var(--primary-foreground);
  }

  .subsectionList {
    list-style: none;
    margin: var(--spacing-2) 0 0 0;
    padding: 0;
    border-left: 2px solid var(--border);
    margin-left: var(--spacing-3);
  }

  .subsectionItem {
    margin-bottom: var(--spacing-1);
  }

  .subsectionLink {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: var(--spacing-1) var(--spacing-3);
    font-family: var(--font-family-base);
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--muted-foreground);
    text-decoration: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--animation-duration-fast) ease;
  }

  .subsectionLink:hover {
    background: var(--muted);
    color: var(--foreground);
  }

  .subsectionLink.active {
    background: var(--primary);
    color: var(--primary-foreground);
  }

  /* Mobile responsiveness */
  @media (max-width: 1024px) {
    .tableOfContents {
      position: static;
      max-height: none;
      margin-bottom: var(--spacing-6);
    }
  }

  /* Scrollbar styling */
  .tableOfContents::-webkit-scrollbar {
    width: 4px;
  }

  .tableOfContents::-webkit-scrollbar-track {
    background: var(--muted);
    border-radius: var(--radius-full);
  }

  .tableOfContents::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-full);
  }

  .tableOfContents::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
  }
}