/* ═══════════════════════════════════════════════════════════════
   n-toc.css — Sticky top navigation (Table of Contents) for the
   narrative dashboard. Stays pinned under the header; highlights
   the section currently in view; click to scroll smoothly.
═══════════════════════════════════════════════════════════════ */

.n-toc {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  padding: 0.55rem 1.25rem;
  background: var(--n-surface-1, rgba(10, 14, 24, 0.85));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--n-border-subtle, rgba(255, 255, 255, 0.08));
  font-size: 0.82rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.n-toc::-webkit-scrollbar { display: none; }

.n-toc-label {
  color: var(--n-text-muted, rgba(255, 255, 255, 0.5));
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.n-toc-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: var(--n-text-muted, rgba(255, 255, 255, 0.65));
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.n-toc-link:hover {
  background: var(--n-surface-2, rgba(255, 255, 255, 0.05));
  color: var(--n-text-strong, #fff);
}

.n-toc-link--active {
  background: var(--n-accent-primary-soft, rgba(79, 195, 247, 0.14));
  color: var(--n-accent-primary, #4fc3f7);
  border-color: var(--n-accent-primary, rgba(79, 195, 247, 0.35));
}

.n-toc-link-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.n-toc-link--active .n-toc-link-dot {
  opacity: 1;
  box-shadow: 0 0 6px currentColor;
}

/* Light theme */
body.theme-light .n-toc {
  background: rgba(255, 255, 255, 0.88);
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

body.theme-light .n-toc-link {
  color: rgba(15, 23, 42, 0.7);
}

body.theme-light .n-toc-link:hover {
  background: rgba(15, 23, 42, 0.05);
  color: rgba(15, 23, 42, 0.95);
}

body.theme-light .n-toc-link--active {
  background: rgba(14, 116, 144, 0.12);
  color: #0e7490;
  border-color: rgba(14, 116, 144, 0.35);
}

/* Smooth scroll target offset so anchors don't hide under the sticky TOC */
.n-section,
[id] {
  scroll-margin-top: 60px;
}

/* Compact responsive */
@media (max-width: 720px) {
  .n-toc {
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
  }
  .n-toc-label { display: none; }
  .n-toc-link {
    padding: 0.3rem 0.6rem;
  }
}
