/* ══════════════════════════════════════════════════════════════
   ZamaniAuto — Blog Features v3.0 (Lazy Load / Enhancements)
   Non-critical enhancements loaded after core styles.
   Zero side effects on home / portfolio / shop pages.
   ══════════════════════════════════════════════════════════════ */

/* ── Blog Results Info ── */
.blog-results-info {
  grid-column: 1 / -1; padding: 12px 16px;
  background: var(--bl-accent-soft); border-radius: 8px;
  font-size: 0.88rem; color: var(--bl-text-soft);
  border-right: 3px solid var(--bl-accent);
}
[dir="ltr"] .blog-results-info { border-right: none; border-left: 3px solid var(--bl-accent); }

/* ── Show/Hide utility for filtered cards ── */
.article-show { display: flex; }
.article-hidden { display: none !important; }

/* ── Sticky Desktop TOC Sidebar (post page, wide screens) ── */
@media (min-width: 1200px) {
  .post-layout { display: flex; gap: 32px; align-items: flex-start; max-width: 1300px; margin: 32px auto 0; padding: 0 24px; }
  .post-layout .post-page { flex: 1; max-width: 820px; }
  .post-sticky-toc { display: block; width: 260px; flex-shrink: 0; position: sticky; top: 100px; max-height: calc(100vh - 140px); overflow-y: auto; scrollbar-width: thin; }
}
@media (max-width: 1199px) {
  .post-sticky-toc { display: none; }
}
.post-sticky-toc {
  background: var(--bl-surface); border-radius: 16px;
  border: 1px solid var(--bl-border); box-shadow: var(--bl-card-shadow);
  padding: 16px 0; direction: rtl; font-family: 'Vazirmatn', sans-serif;
}
[dir="ltr"] .post-sticky-toc { direction: ltr; }
.post-sticky-toc .sticky-toc-header {
  padding: 0 18px 12px; font-weight: 800; font-size: 0.82rem;
  color: var(--bl-text); border-bottom: 1px solid var(--bl-border);
  margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.post-sticky-toc .sticky-toc-list { list-style: none; padding: 0; margin: 0; }
.post-sticky-toc .sticky-toc-link {
  display: block; padding: 6px 18px; font-size: 0.78rem;
  color: var(--bl-text-soft); text-decoration: none; transition: var(--bl-transition);
  border-right: 2px solid transparent; line-height: 1.6;
}
[dir="ltr"] .post-sticky-toc .sticky-toc-link { border-right: none; border-left: 2px solid transparent; }
.post-sticky-toc .sticky-toc-link:hover { color: var(--bl-accent); background: var(--bl-accent-soft); }
.post-sticky-toc .sticky-toc-link.toc-active { color: var(--bl-accent); font-weight: 700; background: var(--bl-accent-soft); border-right-color: var(--bl-accent); }
[dir="ltr"] .post-sticky-toc .sticky-toc-link.toc-active { border-right-color: transparent; border-left-color: var(--bl-accent); }
.post-sticky-toc .sticky-toc-link.toc-h3 { padding-right: 32px; }
[dir="ltr"] .post-sticky-toc .sticky-toc-link.toc-h3 { padding-right: 18px; padding-left: 32px; }

/* ── Back to Top ── */
#backToTop {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bl-accent); color: #fff; border: none;
  font-size: 1.2rem; cursor: pointer; opacity: 0; visibility: hidden;
  transition: all 0.3s; box-shadow: 0 4px 16px rgba(13,115,119,0.3);
  display: flex; align-items: center; justify-content: center;
}
[dir="rtl"] #backToTop { right: auto; left: 24px; }
#backToTop.show { opacity: 1; visibility: visible; }
#backToTop:hover { transform: translateY(-3px); }

/* ── Portfolio-related cards in blog posts ── */
.blog-portfolio-related { max-width: 1100px; margin: 0 auto 48px; }
.blog-portfolio-related h3 { font-size: 1.1rem; font-weight: 800; color: var(--bl-text); text-align: center; margin-bottom: 18px; }
.blog-portfolio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.blog-portfolio-card {
  display: block; text-decoration: none; padding: 16px;
  background: var(--bl-surface); border-radius: 14px;
  border: 1px solid var(--bl-border); box-shadow: var(--bl-card-shadow);
  transition: var(--bl-transition);
}
.blog-portfolio-card:hover { transform: translateY(-3px); box-shadow: var(--bl-card-shadow-hover); border-color: var(--bl-card-hover-border); }
.blog-portfolio-card img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; }
.blog-portfolio-card .pf-title { font-weight: 700; color: var(--bl-text); font-size: 0.88rem; margin-bottom: 4px; }
.blog-portfolio-card .pf-summary { color: var(--bl-text-soft); font-size: 0.75rem; line-height: 1.6; }

/* ── Reveal Animation ── */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.revealed { opacity: 1; transform: translateY(0); }

/* ── Focus visible ── */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--bl-accent); outline-offset: 2px; border-radius: 4px;
}

/* ── Print ── */
@media print {
  .sticky-share, .post-share, .post-toc, .post-sticky-toc, .post-cta,
  .scroll-progress, #backToTop, .mobile-dark-toggle, .blog-toolbar { display: none !important; }
  .post-content { font-size: 14px; line-height: 1.7; }
}
