/**
 * Article TOC — «در این مقاله می‌خوانید»
 * Loaded only on single posts.
 */

.dp-article-toc {
  --dp-toc-navy: #003566;
  --dp-toc-muted: #5c5c5c;
  --dp-toc-border: rgba(210, 215, 222, 0.55);
  --dp-toc-active: #00b4d8;
  direction: rtl;
  text-align: right;
  box-sizing: border-box;
}

.dp-article-toc *,
.dp-article-toc *::before,
.dp-article-toc *::after {
  box-sizing: border-box;
}

.dp-article-toc--desktop {
  position: sticky;
  top: 100px;
  z-index: 5;
  width: 100%;
  margin-bottom: 20px;
  padding: 18px 16px;
  border-radius: 24px;
  border: 1px solid var(--dp-toc-border);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 255, 255, 0.55) 0%, transparent 55%),
    linear-gradient(160deg, #dfe5ec 0%, #eef1f5 42%, #d8dee6 100%);
  background-color: #dee4ea;
  box-shadow: 0 2px 6px rgba(102, 102, 102, 0.08);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.dp-article-toc__title {
  margin: 0 0 14px;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--dp-toc-navy);
}

.dp-article-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dp-article-toc__item {
  margin: 0;
  padding: 0;
}

.dp-article-toc__link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--dp-toc-muted);
  border: 1px solid transparent;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.dp-article-toc__link:hover {
  color: var(--dp-toc-navy);
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(0, 53, 102, 0.12);
}

.dp-article-toc__link.is-active {
  color: var(--dp-toc-navy);
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 180, 216, 0.35);
  box-shadow: inset -3px 0 0 0 var(--dp-toc-active);
}

.dp-article-toc__num {
  flex: 0 0 auto;
  min-width: 1.6em;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--dp-toc-navy);
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.dp-article-toc__link.is-active .dp-article-toc__num {
  color: var(--dp-toc-active);
  opacity: 1;
}

.dp-article-toc__label {
  flex: 1 1 auto;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
}

/* Mobile accordion */
.dp-article-toc--mobile {
  display: none;
  margin: 0 0 20px;
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--dp-toc-border);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 255, 255, 0.55) 0%, transparent 55%),
    linear-gradient(160deg, #dfe5ec 0%, #eef1f5 42%, #d8dee6 100%);
  background-color: #dee4ea;
  overflow: hidden;
}

.dp-article-toc__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--dp-toc-navy);
  user-select: none;
}

.dp-article-toc__summary::-webkit-details-marker {
  display: none;
}

.dp-article-toc__chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--dp-toc-navy);
  border-bottom: 2px solid var(--dp-toc-navy);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-top: -4px;
}

.dp-article-toc--mobile[open] .dp-article-toc__chevron {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.dp-article-toc--mobile .dp-article-toc__list {
  padding: 0 10px 12px;
}

.dp-article-toc--mobile .dp-article-toc__link {
  padding: 10px 10px;
}

@media (max-width: 991.98px) {
  .dp-article-toc--desktop {
    display: none !important;
  }

  .dp-article-toc--mobile {
    display: block;
  }
}

@media (min-width: 992px) {
  .dp-article-toc--mobile {
    display: none !important;
  }
}
