/* Table of Contents Sidebar Styles */
.post-content-wrapper {
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
  margin-top: var(--content-gap);
}

.post-content-wrapper:not(.has-toc) {
  display: block;
}

.toc-sidebar {
  flex: 0 0 220px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  margin-bottom: var(--content-gap);
  min-width: 220px;
}

.toc-sidebar .toc {
  margin-bottom: 0;
  position: sticky;
  top: 0;
}

.post-content-main {
  flex: 1;
  min-width: 0;
}

/* Responsive: Hide sidebar on smaller screens */
@media (max-width: 768px) {
  .post-content-wrapper {
    flex-direction: column;
  }
  
  .toc-sidebar {
    flex: 1;
    position: relative;
    top: 0;
    max-height: none;
    width: 100%;
  }
  
  .toc-sidebar .toc {
    position: relative;
  }
}

/* TOC styling improvements */
.toc-sidebar .toc {
  border: 1px solid var(--border);
  background: var(--code-bg);
  border-radius: var(--radius);
  padding: 1em;
  font-size: 14px;
}

[data-theme="dark"] .toc-sidebar .toc {
  background: var(--entry);
}

.toc-sidebar .toc details summary {
  font-weight: 600;
  font-size: 16px;
  /* margin-bottom: 0.5em; */
}

.toc-sidebar .toc .inner {
  margin: 0;
  padding: 0;
  opacity: 1;
}

.toc-sidebar .toc .inner ul {
  list-style: none;
  padding-left: 0;
}

.toc-sidebar .toc .inner li {
  margin: 0.3em 0;
}

.toc-sidebar .toc .inner a {
  color: var(--secondary);
  text-decoration: none;
  display: block;
  padding: 0.2em 0;
  transition: color 0.2s;
}

.toc-sidebar .toc .inner a:hover {
  color: var(--primary);
}

.toc-sidebar .toc .inner li ul {
  margin-left: 1em;
  margin-top: 0.2em;
}

