.content-section {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 4rem;
  margin-top: 12rem;
  padding-bottom: 6rem;
  align-items: start;
}

.toc {
  position: sticky;
  top: calc(var(--header-offset) + 3.5rem);
  align-self: start;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toc-list a {
  display: block;
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--text-muted);
  transition: color 180ms ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-list a:hover {
  color: var(--text-l1);
}

.toc-list li.active a {
  color: var(--text-l1);
  font-weight: 500;
}

.toc-mobile-toggle {
  display: none;
}

.content {
  min-width: 0;
  max-width: 80ch;
}

.content > * + * {
  margin-top: 1rem;
}

.content h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 500;
  color: var(--text-l1);
  margin-top: 3rem;
}

.content h2:first-child {
  margin-top: 0;
}

.content h3 {
  font-size: 1rem;
  line-height: 1.3;
  font-weight: 500;
  color: var(--text-l1);
  margin-top: 1.5rem;
}

.content p {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-l1);
}

.content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.content a:hover {
  text-decoration-thickness: 2px;
}

.content ul {
  list-style: none;
  padding-left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.content ul li {
  position: relative;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-l1);
  padding-left: 0.25rem;
}

.content ul li::before {
  content: '•';
  position: absolute;
  left: -1rem;
  top: 0;
  color: var(--text-l1);
  font-weight: 500;
}

@media (max-width: 1024px) {
  .content-section {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 5rem;
  }

  .toc {
    position: sticky;
    top: var(--header-offset);
    z-index: 50;
    padding: 0;
    border-radius: var(--radius-card);
    overflow: hidden;
  }

  .toc-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-l1);
    background: #fff;
    text-align: left;
  }

  .toc-mobile-toggle .chevron {
    width: 16px;
    height: 16px;
    transition: transform 220ms ease;
  }

  .toc.open .toc-mobile-toggle .chevron {
    transform: rotate(180deg);
  }

  .toc-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 280ms ease, padding 280ms ease;
    padding: 0 1.5rem;
    gap: 0.75rem;
    border-top: 0 solid var(--border);
  }

  .toc.open .toc-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 1024px) {
  html {
    scroll-padding-top: calc(var(--header-offset) + 4rem);
  }
}

@media (max-width: 768px) {
  .content h2 {
    margin-top: 2.5rem;
  }
}
