Newer
Older
express-blog / src / css / toc.css
.toc {
  background: var(--bg-body);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-sizing: border-box;
  margin-bottom: 1em;
  padding: 1.5em;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.toc.sticky {
  position: fixed;
  top: 20px;
  z-index: 1000;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border-color: var(--border-medium);
}

.toc.sticky.bottom-boundary {
  position: fixed;
  max-height: none;
  overflow-y: auto;
}

/* Scrollbar */
.toc::-webkit-scrollbar {
  width: 6px;
}

.toc::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

.toc::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  transition: background 0.3s ease;
}

.toc::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.4);
}

/* Firefox Scrollbar */
.toc {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* TOC Content Styles */
.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin: 0.5rem 0;
  position: relative;
}

.toc li.h3 {
  margin-left: 1rem;
  font-size: 0.9rem;
}

.toc a {
  display: block;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--text-muted-dark);
  border-radius: 4px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  word-wrap: break-word;
  line-height: 1.4;
}

.toc a:hover {
  background-color: var(--bg-hover);
  color: var(--accent-primary);
  border-left-color: var(--accent-blue-bright);
  transform: translateX(2px);
}

.toc a:focus {
  outline: 2px solid var(--accent-blue-bright);
  outline-offset: 2px;
}

/* Active link highlighting */
.toc a.active {
  background-color: var(--bg-tag);
  color: var(--accent-tag);
  border-left-color: var(--accent-tag);
  font-weight: 600;
}

.toc-header {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--accent-primary);
  border-bottom: 2px solid var(--border-medium);
  padding-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Ensure proper spacing between sidebar sections */
.sidebar nav > * + .toc {
  margin-top: 2rem;
  border-top: 1px solid var(--border-medium);
  padding-top: 1.5rem;
}

/* Animation for smooth transitions */
.toc {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toc.sticky {
  animation: slideInSticky 0.3s ease-out;
}

@keyframes slideInSticky {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}