/* =========================================================
   SWELL Sidebar TOC Highlighter
========================================================= */

.widget_swell_index {
  max-height: var(--ssth-max-height, 72vh);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.widget_swell_index::-webkit-scrollbar {
  width: 4px;
}

.widget_swell_index::-webkit-scrollbar-thumb {
  background: rgba(100, 100, 100, 0.18);
  border-radius: 10px;
}

/* 通常 */
.widget_swell_index a {
  color: var(--color_text);
  opacity: 0.40;
  transition:
    color 0.2s ease,
    opacity 0.2s ease,
    font-weight 0.2s ease;
}

/* H2 */
.widget_swell_index .p-toc__list > li > a {
  opacity: 0.44;
  font-size: 1em;
  font-weight: 600;
}

/* H2 左アイコン：通常 */
.widget_swell_index .p-toc__list > li::before {
  color: #c7cbd1 !important;
  border-color: #c7cbd1 !important;
}

/* 現在のH2グループ */
.widget_swell_index .p-toc__list > li.toc-current > a {
  opacity: 0.95;
  color: var(--ssth-current-text, var(--color_text));
  font-weight: 700;
}

/* 現在のH2 左アイコン */
.widget_swell_index .p-toc__list > li.toc-current::before {
  color: var(--ssth-accent, var(--color_main)) !important;
  border-color: var(--ssth-accent, var(--color_main)) !important;
}

/* 現在読んでいるH2 */
.widget_swell_index .p-toc__list > li > a.toc-active {
  opacity: 1 !important;
  color: var(--ssth-current-text, var(--color_text)) !important;
  font-weight: 700 !important;
  background: transparent !important;
}

/* H3 */
.widget_swell_index li li {
  position: relative;
  padding-left: 0.9em;
}

/* H3 L字：通常 */
.widget_swell_index li li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-left: 2px solid #cfd3d9 !important;
  border-bottom: 2px solid #cfd3d9 !important;
}

/* 通常のH3 */
.widget_swell_index li li > a {
  opacity: 0.34;
  font-size: 0.94em;
  font-weight: 400;
}

/* 現在のH2配下のH3 */
.widget_swell_index .p-toc__list > li.toc-current li li > a {
  opacity: 0.52;
}

/* 現在読んでいるH3 */
.widget_swell_index li li > a.toc-active {
  opacity: 1 !important;
  color: var(--ssth-current-text, var(--color_text)) !important;
  font-weight: 700 !important;
  background: transparent !important;
  text-decoration: underline;
  text-decoration-color: var(--ssth-accent, var(--color_main));
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* 現在のH3 L字 */
.widget_swell_index li li.toc-item-active::before {
  border-left-color: var(--ssth-accent, var(--color_main)) !important;
  border-bottom-color: var(--ssth-accent, var(--color_main)) !important;
}

/* 固定ヘッダー補正 */
.post_content h2,
.post_content h3,
.post_content h4 {
  scroll-margin-top: 100px;
}

@media (prefers-reduced-motion: reduce) {
  .widget_swell_index a {
    transition: none;
  }
}
