/* v1.5.4: article reading experience (TOC, reading progress, FAQ, latest articles). */

/* ---------- sidebar: TOC sticks while the article is read; other widgets sit at the bottom */
@media (min-width: 992px) {
  .blog-single-area .col-lg-4 > .sidebar { display: flex; flex-direction: column; height: 100%; }
  .blog-single-area .wsp-toc-sticky { flex: 1 1 auto; margin-bottom: 30px; }
  .blog-single-area .wsp-toc-side { position: sticky; top: 110px; }
  body.admin-bar .blog-single-area .wsp-toc-side { top: 142px; }
}

/* ---------- TOC card */
.wsp-toc {
  background: #fff;
  border: 1px solid #e6ebf2;
  border-radius: 18px;
  padding: 22px 22px 14px;
  box-shadow: 0 10px 30px rgba(5, 38, 78, .06);
}
.wsp-toc-head { display: flex; align-items: center; gap: 14px; }
.wsp-toc-icon {
  flex: 0 0 48px; width: 48px; height: 48px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #e9f6e4; color: var(--theme-color);
}
.wsp-toc-titles { display: flex; flex-direction: column; min-width: 0; }
.wsp-toc-title { font-weight: 800; font-size: 19px; color: var(--color-dark); line-height: 1.25; }
.wsp-toc-meta { font-size: 14px; color: #6b7a8c; margin-top: 2px; }
.wsp-toc-progress { height: 4px; border-radius: 4px; background: #e8edf3; margin: 16px 0 10px; overflow: hidden; }
.wsp-toc-progress span { display: block; height: 100%; width: 0; background: var(--theme-color); border-radius: 4px; transition: width .15s linear; }
.wsp-toc-list { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 290px); overflow-y: auto; }
.wsp-toc-list li { margin: 0 !important; list-style: none !important; }
.wsp-toc-list a {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 9px 10px; border-radius: 10px;
  color: #3b4656; font-size: 15.5px; line-height: 1.4; text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.wsp-toc-list a:hover { background: #f3f7f1; color: var(--color-dark); }
.wsp-toc-num {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid #d5dde7; color: #6b7a8c; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; margin-top: -1px;
  transition: all .2s ease;
}
.wsp-toc-list a.is-active { background: #edf7e8; color: var(--color-dark); font-weight: 700; }
.wsp-toc-list a.is-active .wsp-toc-num { background: var(--theme-color); border-color: var(--theme-color); color: #fff; }
.wsp-toc-list a.is-done .wsp-toc-num { border-color: var(--theme-color); color: var(--theme-color); }

/* mobile: collapsible card above the text */
.wsp-toc-inline { margin: 0 0 28px; padding: 16px 18px 10px; }
.wsp-toc-inline > summary { list-style: none; cursor: pointer; }
.wsp-toc-inline > summary::-webkit-details-marker { display: none; }
.wsp-toc-caret { margin-left: auto; width: 10px; height: 10px; border-right: 2px solid #6b7a8c; border-bottom: 2px solid #6b7a8c; transform: rotate(45deg); transition: transform .2s ease; }
.wsp-toc-inline[open] .wsp-toc-caret { transform: rotate(-135deg); }
.wsp-toc-inline .wsp-toc-list { max-height: none; }
@media (min-width: 992px) { .wsp-toc-inline { display: none; } }
@media (max-width: 991.98px) { .wsp-toc-sticky { display: none; } }

/* thin progress bar at the top of the screen on phones/tablets */
.wsp-read-progress { position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 10000; pointer-events: none; }
.wsp-read-progress span { display: block; height: 100%; width: 0; background: var(--theme-color); }
@media (min-width: 992px) { .wsp-read-progress { display: none; } }

/* headings are anchor targets under the fixed header */
.blog-details .entry-content h2[id], .blog-details .entry-content h3[id], .wsp-faq { scroll-margin-top: 120px; }

/* ---------- FAQ accordion */
.wsp-faq { margin: 48px 0 10px; }
.wsp-faq-title { font-size: 32px; font-weight: 800; margin-bottom: 22px; color: var(--color-dark); }
.wsp-faq-item { background: #fff; border: 1px solid #e6ebf2; border-radius: 14px; margin-bottom: 14px; transition: box-shadow .2s ease; }
.wsp-faq-item[open] { box-shadow: 0 8px 24px rgba(5, 38, 78, .06); }
.wsp-faq-item > summary {
  list-style: none; cursor: pointer; position: relative;
  padding: 20px 60px 20px 24px; font-weight: 700; font-size: 17px; color: var(--color-dark); line-height: 1.4;
}
.wsp-faq-item > summary::-webkit-details-marker { display: none; }
.wsp-faq-item > summary:focus-visible { outline: 2px solid var(--theme-color); outline-offset: 2px; border-radius: 14px; }
.wsp-faq-icon { position: absolute; right: 24px; top: 50%; width: 16px; height: 16px; margin-top: -8px; }
.wsp-faq-icon::before, .wsp-faq-icon::after { content: ''; position: absolute; left: 0; top: 7px; width: 16px; height: 2px; background: var(--theme-color); border-radius: 2px; transition: transform .2s ease; }
.wsp-faq-icon::after { transform: rotate(90deg); }
.wsp-faq-item[open] .wsp-faq-icon::after { transform: rotate(0deg); }
.wsp-faq-answer { padding: 0 24px 20px; color: #4a5565; line-height: 1.7; }
.wsp-faq-answer p:last-child { margin-bottom: 0; }

/* ---------- latest articles */
.wsp-recent .wsp-recent-list { list-style: none; margin: 0; padding: 0; }
.wsp-recent .wsp-recent-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid #e3e8ef; margin: 0 !important; list-style: none !important; }
.wsp-recent .wsp-recent-item:first-child { padding-top: 0; }
.wsp-recent .wsp-recent-item:last-child { border-bottom: 0; padding-bottom: 0; }
.wsp-recent .wsp-recent-thumb { flex: 0 0 72px; width: 72px; height: 72px; border-radius: 12px; overflow: hidden; background: #e8edf3; display: block; }
.wsp-recent .wsp-recent-thumb img { width: 72px; height: 72px; object-fit: cover; display: block; transition: transform .3s ease; }
.wsp-recent .wsp-recent-item:hover .wsp-recent-thumb img { transform: scale(1.06); }
.wsp-recent .wsp-recent-noimg { display: block; width: 100%; height: 100%; }
.wsp-recent .wsp-recent-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.wsp-recent .wsp-recent-title {
  font-weight: 600; font-size: 15.5px; line-height: 1.4; color: var(--color-dark);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.wsp-recent .wsp-recent-title:hover { color: var(--theme-color); }
.wsp-recent time { font-size: 13px; color: #6b7a8c; }
.wsp-recent .widget-title { margin-top: 0; }

/* reading time in the meta line */
.blog-meta .wsp-readtime i { margin-right: 5px; }

