/*
 * 우측 목차(TOC) — Retype "On this page" 스타일
 * 단일 문서 글에서만 노출. 본문 h2/h3 를 수집해 우측 고정 사이드바로 표시.
 * 좁은 화면(<1280px)에서는 자리가 없어 숨김.
 */
.cc-toc {
  position: fixed;
  top: 130px;
  right: 1.5rem;
  width: 220px;
  max-height: calc(100vh - 170px);
  overflow-y: scroll; /* auto 아님 — 스크롤바 자리 항상 확보(UI 흔들림 방지) */
  font-family: var(--font-sans);
  display: none;
  z-index: 20;
}
/* 본문을 920px로 좁힌(≥1500px) 뒤, 우측 목차를 본문 오른쪽에 40px 간격으로 붙인다. */
@media (min-width: 1500px) {
  .cc-toc { display: block; right: auto; left: calc(50vw + 500px); }
}
.cc-toc__title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--coal-heading);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}
.cc-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--coal-border);
}
.cc-toc__item { margin: 0; }
.cc-toc__item a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.9rem;
  margin-left: -1px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--coal-text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  word-break: keep-all;
  transition: color 0.15s, border-color 0.15s;
}
.cc-toc__item--h3 a {
  padding-left: 1.6rem;
  font-size: 0.8rem;
}
.cc-toc__item a:hover { color: var(--coal-accent); }
.cc-toc__item a.is-active {
  color: var(--coal-accent);
  border-left-color: var(--coal-accent);
  font-weight: 600;
}

/* ============================================================
   우측 TOC 접기/펼치기 토글 (넓은 화면 ≥1500px)
   ============================================================ */
.cc-toc-toggle { display: none; }
@media (min-width: 1500px) {
  .cc-toc-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    position: fixed;
    top: 94px;
    left: calc(50vw + 500px);
    height: 30px;
    padding: 0 0.65rem;
    border: 1px solid var(--coal-border, #e5e7eb);
    border-radius: 8px;
    background: #fff;
    color: var(--coal-text-secondary, #4a4a4a);
    font-family: var(--cc-font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    z-index: 21;
  }
  .cc-toc-toggle:hover { border-color: var(--coal-accent, #3f63f4); color: var(--coal-accent, #3f63f4); }
  /* 접힘: 목차만 숨기고 토글 버튼은 같은 자리 유지(위치 안 바뀜). */
  body.cc-toc-collapsed .cc-toc { display: none; }
}
