/* TOC: Fenx-like rail style for desktop + mobile */

:root {
  --toc-sticky-top: 100px;
  --toc-columns-anchor-offset: 0px;
}

.js-post-content.has-toc {
  --toc-columns-anchor-offset: 0px;
}

.article-sidebar {
  display: none;
}

.article-sidebar[hidden] {
  display: none !important;
}

.js-post-body h2[id],
.js-post-body h3[id] {
  scroll-margin-top: calc(var(--toc-sticky-top) + 8px);
}

/* Ghost may render code-card captions as figcaption > p.
   Reset paragraph typography so caption follows figcaption style instead of body paragraph style. */
.l-post-content figure figcaption > p {
  font-size: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  margin: 0;
}

.gh-toc {
  font-size: 0.9rem;
}

.gh-toc .toc-list {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.gh-toc > .toc-list {
  margin: 0;
  padding-left: 18px;
  position: relative;
  --toc-active-top: 0px;
  --toc-active-height: 0px;
}

.gh-toc > .toc-list::before {
  background: var(--secondary-border-color);
  border-radius: 999px;
  bottom: 0;
  content: "";
  left: 0;
  position: absolute;
  top: 0;
  width: 3px;
}

.gh-toc > .toc-list::after {
  background: var(--primary-subtle-color);
  border-radius: 999px;
  content: "";
  height: var(--toc-active-height);
  left: 0;
  opacity: 0;
  position: absolute;
  top: var(--toc-active-top);
  transition: top 0.2s ease, height 0.2s ease, opacity 0.2s ease;
  width: 4px;
}

.gh-toc > .toc-list.has-active-marker::after {
  opacity: 1;
}

.gh-toc .toc-list-item {
  margin: 0;
  padding: 0;
}

.gh-toc .toc-list-item + .toc-list-item {
  margin-top: 9px;
}

.gh-toc .toc-list .toc-list {
  display: none;
  margin-top: 6px;
  padding-left: 14px;
}

.gh-toc .toc-list-item.is-expanded > .toc-list {
  display: block;
}

.gh-toc .toc-link {
  color: var(--primary-foreground-color);
  display: block;
  font-size: 0.9rem;
  letter-spacing: 0.12px;
  line-height: 1.42;
  padding: 2px 0 2px 10px;
  position: relative;
  text-decoration: none;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.gh-toc .toc-link:hover {
  color: var(--titles-color);
}

.gh-toc .toc-list .toc-list .toc-link {
  font-size: 0.84rem;
  line-height: 1.38;
  opacity: 0.95;
  padding-left: 8px;
}

.gh-toc .toc-link.is-active-link {
  color: var(--titles-color);
  font-weight: 700;
}

@media only screen and (max-width: 1299px) {
  .article-sidebar {
    display: block;
    margin: 0 0 24px;
    position: relative;
    width: 100%;
  }

  .article-sidebar .gh-toc {
    max-height: 40vh;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .article-sidebar .gh-toc::-webkit-scrollbar {
    display: none;
  }
}

@media only screen and (min-width: 1300px) {
  .js-post-content.has-toc .m-share {
    top: var(--toc-columns-anchor-offset);
  }

  .article-sidebar {
    bottom: 0;
    display: block;
    font-size: 0.9rem;
    left: -230px;
    margin-top: 0;
    padding-left: 0 !important;
    position: absolute;
    top: 0;
    width: 190px;
    z-index: 1;
  }

  .js-post-content.has-toc .article-sidebar {
    top: var(--toc-columns-anchor-offset);
  }

  .article-sidebar .gh-toc {
    left: 0;
    max-height: calc(100vh - var(--toc-sticky-top) - 24px);
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 6px;
    position: sticky;
    top: var(--toc-sticky-top);
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .article-sidebar .gh-toc::-webkit-scrollbar {
    display: none;
  }
}

@media only screen and (min-width: 1400px) {
  .article-sidebar {
    left: -250px;
    width: 205px;
  }
}

@media only screen and (min-width: 1300px) {
  .rtl .article-sidebar {
    left: auto;
    right: -230px;
  }
}

.rtl .gh-toc > .toc-list {
  padding-left: 0;
  padding-right: 18px;
}

.rtl .gh-toc > .toc-list::before {
  left: auto;
  right: 0;
}

.rtl .gh-toc > .toc-list::after {
  left: auto;
  right: 0;
}

.rtl .gh-toc .toc-list .toc-list {
  padding-left: 0;
  padding-right: 14px;
}

.rtl .gh-toc .toc-link {
  padding-left: 0;
  padding-right: 10px;
}

.rtl .gh-toc .toc-list .toc-list .toc-link {
  padding-left: 0;
  padding-right: 8px;
}

@media only screen and (min-width: 1400px) {
  .rtl .article-sidebar {
    right: -250px;
  }
}

@media only screen and (min-width: 64rem) {
  .m-share__content {
    top: var(--toc-sticky-top);
  }
}
