/* Table of Contents Styles */
.article-toc {
  background: var(--color-gray);
  border: 1px solid var(--color-gray-light);
  border-radius: 8px;
  padding: 0;
  margin: 32px 0;
  position: relative;
  overflow: hidden;
}

.article-toc::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #0066cc, #004999);
  border-radius: 4px 0 0 4px;
}

.article-toc-header {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-gray-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.2s ease;
}

.article-toc-header:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.article-toc-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-toc-arrow {
  transition: transform 0.2s ease;
  color: #666;
}

.article-toc-arrow.expanded {
  transform: rotate(180deg);
}

.article-toc-content {
  padding: 24px;
}


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

.article-toc-item {
  margin: 0;
  padding: 0;
}

.article-toc-item.toc-h2 {
  margin-bottom: 8px;
}

.article-toc-item.toc-h3 {
  margin-left: 20px;
  margin-bottom: 6px;
}

.article-toc-link {
  display: block;
  color: #555;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
}

.article-toc-item.toc-h2 .article-toc-link {
  font-weight: 500;
  font-size: 15px;
}

.article-toc-item.toc-h3 .article-toc-link {
  font-weight: 400;
  /*color: #666;*/
}

/*.article-toc-link:hover {
  background: #e3f2fd;
  color: #0066cc;
  text-decoration: none;
  transform: translateX(4px);
}*/

.article-toc-link:focus {
  outline: 2px solid #0066cc;
  outline-offset: 2px;
}

/* Styling for headings with scroll margin for better UX */
.article-content h2[id],
.article-content h3[id] {
  scroll-margin-top: 80px;
  position: relative;
}

.article-content h2[id]:target,
.article-content h3[id]:target {
  animation: highlight-heading 2s ease-in-out;
}

@keyframes highlight-heading {
  0% {
    background-color: #fff3cd;
    transform: scale(1.02);
  }
  100% {
    background-color: transparent;
    transform: scale(1);
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .article-toc-header {
    padding: 20px;
  }
  
  .article-toc-content {
    padding: 20px;
  }
  
  .article-toc-title {
    font-size: 16px;
  }
  
  .article-toc-item.toc-h3 {
    margin-left: 16px;
  }
  
  .article-toc-link {
    padding: 8px 10px;
    font-size: 13px;
  }
  
  .article-toc-item.toc-h2 .article-toc-link {
    font-size: 14px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .article-toc {
    background: #2d3748;
    border-color: #4a5568;
  }
  
  .article-toc-header {
    border-bottom-color: #4a5568;
  }
  
  .article-toc-header:hover {
    background-color: rgba(255, 255, 255, 0.05);
  }
  
  .article-toc-title {
    color: #f7fafc;
  }
  
  .article-toc-arrow {
    color: #cbd5e0;
  }
  
  .article-toc-link {
    color: #e2e8f0;
  }
  
  .article-toc-item.toc-h3 .article-toc-link {
    color: #cbd5e0;
  }
  
  /*.article-toc-link:hover {
    background: #4a5568;
    color: #63b3ed;
  }*/
}