/* ===========================
   INLINE TOC (Mobile)
   =========================== */

.Article_page__tableOfContents {
  border: 1px solid #e2e2e4;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.Article_page__tableOfContents .mainItems {
  padding-top: 16px;
}

.Article_page__tableOfContents .mainItems:first-of-type {
  padding-top: 0;
}

.Article_page__tableOfContents-content .mainItems a {
  color: #2a2b32;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  text-decoration: none;
  transition: color 0.25s ease-in-out;
}

.Article_page__tableOfContents-content .mainItems a:hover {
  color: #254AFF;
}

.Article_page__tableOfContents-content .nestedItems {
  border-left: 1px solid #e2e2e4;
  padding-left: 16px;
  padding-top: 8px;
}

.Article_page__tableOfContents-content .nestedItems a {
  color: #6c6d75;
  cursor: pointer;
  font-size: 14px;
  line-height: 21px;
  text-decoration: none;
  transition: color 0.25s ease-in-out;
}

.Article_page__tableOfContents-content .nestedItems a:hover {
  color: #254AFF;
}

.Article_page__tableOfContents-content .mainItems + .nestedItems {
  margin-top: 8px;
  padding-top: 0;
}

.Article_page__tableOfContents-title {
  color: #2a2b32;
  font-size: 20px;
  font-weight: 600;
  line-height: 30px;
}

.Article_page__tableOfContents-content.isHidden {
  display: none;
}

.Article_page__tableOfContents-content.isHidden .mainItems:first-of-type {
  padding-top: 16px;
}

.Article_page__tableOfContents.expanded .Article_page__tableOfContents-content.isHidden {
  display: block;
}

.Article_page__show-all-button {
  align-items: center;
  align-self: center;
  background-color: transparent;
  border: none;
  color: #254AFF;
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: center;
  width: fit-content;
}

.Article_page__show-all-button__text,
.Article_page__show-all-button__text-close {
  line-height: 24px;
}

.Article_page__show-all-button__text:hover,
.Article_page__show-all-button__text-close:hover {
  font-weight: 600;
}

.Article_page__show-all-button__arrow,
.Article_page__show-all-button__arrow-close {
  border: 1px solid #254AFF;
  border-width: 1px 1px 0 0;
  display: inline-block;
  height: 8px;
  width: 8px;
  transition: transform 0.25s ease;
}

.Article_page__show-all-button__arrow {
  margin-bottom: 5px;
  transform: rotate(135deg);
}

.Article_page__show-all-button__arrow-close {
  margin-bottom: -5px;
  transform: rotate(315deg);
}

.Article_page__show-all-button .hidden {
  display: none;
  visibility: hidden;
}

/* ===========================
   INLINE TOC — SCROLL SPY
   =========================== */

.Article_page__tableOfContents-content .mainItems a.toc-link--active {
  color: #254AFF;
  font-weight: 600;
}

.Article_page__tableOfContents-content .nestedItems a.toc-link--active {
  color: #254AFF;
  font-weight: 600;
  border-left-color: #254AFF;
}

/* ===========================
   DESKTOP SIDEBAR TOC
   =========================== */

.toc-desktop-sidebar {
  position: fixed;
  top: 120px;
  width: 280px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  border: 1px solid #e2e2e4;
  border-radius: 12px;
  padding: 24px;
  background: #fff;
  z-index: 100;
  box-sizing: border-box;
}

.toc-desktop-sidebar__title {
  color: #2a2b32;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  margin-bottom: 16px;
}

.toc-desktop-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-desktop-sidebar__item {
  padding-top: 8px;
}

.toc-desktop-sidebar__item:first-child {
  padding-top: 0;
}

.toc-desktop-sidebar__item--nested {
  padding-left: 16px;
  border-left: 1px solid #e2e2e4;
}

.toc-desktop-sidebar__link {
  color: #2a2b32;
  font-size: 14px;
  font-weight: 500;
  line-height: 21px;
  text-decoration: none;
  display: block;
  padding: 2px 0;
  border-left: 3px solid transparent;
  padding-left: 12px;
  transition: color 0.25s ease-in-out, border-color 0.25s ease-in-out;
}

.toc-desktop-sidebar__link:hover {
  color: #254AFF;
}

.toc-desktop-sidebar__link--active {
  color: #254AFF;
  font-weight: 600;
  border-left-color: #254AFF;
}

.toc-desktop-sidebar::-webkit-scrollbar {
  width: 4px;
}

.toc-desktop-sidebar::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

/* ===========================
   RESPONSIVE VISIBILITY
   =========================== */

@media (max-width: 1400px) {
  .toc-desktop-sidebar {
    display: none !important;
  }
}

@media (min-width: 1401px) {
  [data-section="Table of Contents"] {
    display: none !important;
  }
}
