/* ===== Article/Work TOC ===== */
body.has-toc .toc-floating {
  position: fixed;
  top: 96px;
  left: 50%;
  transform: translateX(calc(-1 * (var(--measure) / 2 + 232px)));
  z-index: 3000;
  pointer-events: none;
  transition: top 200ms ease;
}

body.has-toc .toc-floating.toc-docked {
  top: 16px;
}

body.has-toc .toc-floating-inner {
  width: 200px;
  pointer-events: auto;
}

body.has-toc .toc-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #2d1a0a;
  font-family: var(--font-family-ui);
  font-size: 1rem;
  text-decoration: none;
}

body.has-toc .toc-back:hover {
  color: var(--color-hibiscus);
}

body.has-toc .toc-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.has-toc .toc-link {
  color: rgba(0, 0, 0, 0.5);
  font-family: var(--font-family-ui);
  font-weight: var(--font-weight-regular);
  font-size: 1rem;
  line-height: 1.4;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.has-toc .toc-link:hover {
  color: var(--color-hibiscus);
  opacity: 1;
}

body.has-toc .toc-link.toc-level-h3 {
  padding-left: 18px;
  font-size: 0.95rem;
  opacity: 0.8;
}

body.has-toc .toc-link[data-active="true"] {
  background-color: #ffe8de;
}

body.has-toc .toc-link[data-active="false"] {
  background-color: transparent;
}

body.has-toc .toc-anchor {
  scroll-margin-top: 96px;
}

@media (max-width: 900px) {
  body.has-toc .toc-floating {
    top: 72px;
    left: 1em;
    right: 1em;
    transform: none;
  }

  body.has-toc .toc-floating.toc-docked {
    top: 6px;
  }

  body.has-toc .toc-floating-inner {
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid #e9e8ea;
    border-radius: 10px;
    padding: 10px 12px;
  }

  body.has-toc .toc-list {
    gap: 6px;
  }

  body.has-toc .toc-link {
    padding: 3px 4px;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}
