/* Article detail — light tech theme */
body.site-body:has(.site-main--article) {
  overflow-x: clip;
}

.site-main--article {
  padding: 0 !important;
  width: 100%;
}

/* فاصله از لبه صفحه — موبایل و دسکتاپ */
.site-main--article .article-page-container {
  width: 100%;
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 4vw, 1.25rem);
  padding-right: clamp(1rem, 4vw, 1.25rem);
}

.article-body-wrap,
.article-body-wrap .row {
  min-width: 0;
}

.article-body-wrap [class*="col-"] {
  min-width: 0;
}

.article-hero {
  position: relative;
  overflow: hidden;
  padding: 2rem 0 2.5rem;
  background:
    radial-gradient(ellipse 70% 60% at 15% 0%, rgba(14, 165, 233, 0.1), transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 20%, rgba(185, 28, 28, 0.07), transparent 50%),
    linear-gradient(180deg, #fff 0%, var(--bg, #f8fafc) 100%);
  border-bottom: 1px solid var(--border, rgba(15, 23, 42, 0.08));
}
.article-hero__grid {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.1) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
  pointer-events: none;
}

.article-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted, #64748b);
  margin-bottom: 1rem;
}
.article-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.article-breadcrumb a:hover { color: var(--brand, #b91c1c); }
.article-breadcrumb .bi { font-size: 0.7rem; opacity: 0.6; }

.article-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #0369a1;
  background: var(--accent-soft, #e0f2fe);
  border: 1px solid rgba(14, 165, 233, 0.2);
  margin-bottom: 0.85rem;
}
.article-hero__badge .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #0ea5e9);
  box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.45);
  animation: articlePulse 2s infinite;
}
@keyframes articlePulse {
  0% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.45); }
  70% { box-shadow: 0 0 0 10px rgba(14, 165, 233, 0); }
  100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0); }
}

.article-hero__title {
  font-weight: 800;
  line-height: 1.45;
  font-size: clamp(1.45rem, 3.5vw, 2.15rem);
  color: var(--text, #0f172a);
  max-width: 920px;
  margin-bottom: 1rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.article-meta__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
}
.article-meta__chip i { color: var(--brand); }

.article-body-wrap {
  padding: 2rem 0 3.5rem;
}

.article-layout-row {
  --bs-gutter-x: 1.75rem;
}

.article-featured {
  position: relative;
  border-radius: var(--radius, 16px);
  overflow: hidden;
  margin-bottom: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow, 0 10px 40px rgba(15, 23, 42, 0.08));
}
.article-featured img {
  width: 100%;
  height: auto;
  display: block;
}
.article-featured__fade {
  display: none;
}

.article-sheet {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow);
}

/* Auto TOC (hidden when article already has embedded TOC) */
.article-toc {
  margin: 0 0 1.75rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.article-toc[hidden] { display: none !important; }
.article-toc-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.15rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  user-select: none;
}
.article-toc-summary::-webkit-details-marker { display: none; }
.article-toc-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.article-toc-title i {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft, #e0f2fe);
  color: var(--accent, #0ea5e9);
}
.article-toc-chevron {
  color: var(--text-muted);
  transition: transform 0.22s ease;
}
.article-toc[open] .article-toc-chevron { transform: rotate(180deg); }
.article-toc-nav {
  border-top: 1px solid var(--border);
  padding: 0.5rem 0.65rem 0.75rem;
}
.article-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.article-toc-list li + li { margin-top: 0.08rem; }
.article-toc-list a {
  position: relative;
  display: block;
  padding: 0.58rem 0.85rem 0.58rem 0.65rem;
  border-radius: 10px;
  text-decoration: none;
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.55;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, padding 0.15s ease;
}
.article-toc-list a::before {
  content: '';
  position: absolute;
  top: 0.65rem;
  bottom: 0.65rem;
  right: 0.35rem;
  width: 2px;
  border-radius: 99px;
  background: transparent;
  transition: background 0.15s ease;
}
.article-toc-list a:hover {
  background: var(--brand-soft, #fef2f2);
  color: var(--brand, #b91c1c);
}
.article-toc-list a.is-active {
  background: rgba(185, 28, 28, 0.08);
  color: var(--brand-dark, #991b1b);
  font-weight: 600;
  padding-right: 1.05rem;
}
.article-toc-list a.is-active::before { background: var(--brand, #b91c1c); }

.article-prose h2.is-active-heading {
  scroll-margin-top: 96px;
}

/* Fallback: hide duplicate WP TOC if JS did not strip it */
.article-prose #ez-toc-container,
.article-prose .ez-toc-container,
.article-prose .ez-toc,
.article-prose [id^="ez-toc"],
.article-prose [class*="ez-toc"],
.article-prose .lwptoc,
.article-prose .lwptoc_i,
.article-prose .table-of-contents,
.article-prose .toc-container,
.article-prose div[id*="toc_container"],
.article-prose .wp-block-toc {
  display: none !important;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.25rem 0;
}

/* Prose — imported content */
.article-prose {
  direction: rtl;
  text-align: right;
  line-height: 1.9;
  font-size: 1.05rem;
  color: #334155;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.article-prose img,
.article-prose table,
.article-prose iframe,
.article-prose video,
.article-prose embed,
.article-prose figure,
.article-prose .wp-block-image,
.article-prose div[class*="wp-"] {
  max-width: 100% !important;
  box-sizing: border-box;
}
.article-prose table {
  width: 100% !important;
  table-layout: fixed;
}
.article-prose td,
.article-prose th {
  word-break: break-word;
}
.article-prose > *:first-child { margin-top: 0; }
.article-prose > *:last-child { margin-bottom: 0; }

.article-prose p { margin-bottom: 1.15rem; }
.article-prose h1, .article-prose h2, .article-prose h3,
.article-prose h4, .article-prose h5, .article-prose h6 {
  margin-top: 1.75rem;
  margin-bottom: 0.85rem;
  font-weight: 800;
  line-height: 1.4;
  color: var(--text);
}
.article-prose h2 {
  font-size: 1.45rem;
  padding-right: 0.85rem;
  border-right: 4px solid var(--brand);
}
.article-prose h3 { font-size: 1.25rem; }

.article-prose ul, .article-prose ol {
  padding-right: 1.5rem;
  padding-left: 0;
  margin-bottom: 1.15rem;
}
.article-prose li { margin-bottom: 0.5rem; }

.article-prose img {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  display: block;
  margin: 1.75rem auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.article-prose figure { margin: 1.75rem 0; text-align: center; }
.article-prose figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.article-prose blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-right: 4px solid var(--accent);
  border-left: none;
  background: linear-gradient(90deg, var(--accent-soft), #fff);
  border-radius: 0 12px 12px 0;
  color: #475569;
}

.article-prose a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.article-prose a:hover { color: var(--brand-dark, #991b1b); }

.article-prose table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
}
@media (min-width: 768px) {
  .article-prose table { display: table; }
}
.article-prose th, .article-prose td {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  text-align: right;
}
.article-prose th {
  background: var(--bg-muted, #f1f5f9);
  font-weight: 700;
}

.article-prose pre {
  direction: ltr;
  text-align: left;
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.88rem;
}
.article-prose code {
  direction: ltr;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.article-prose p code, .article-prose li code {
  background: var(--bg-muted);
  padding: 0.15em 0.4em;
  border-radius: 6px;
  font-size: 0.88em;
  color: #be123c;
}

.article-prose iframe,
.article-prose video {
  max-width: 100%;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  min-height: 220px;
  border: none;
  border-radius: 12px;
  margin: 1.5rem 0;
}

.article-prose [dir="ltr"] {
  direction: ltr !important;
  text-align: left !important;
}

.article-bottom-cta {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-soft), #fff 60%, var(--accent-soft));
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.article-bottom-cta__text h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
}
.article-bottom-cta__text p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Sidebar — sticky while scrolling (needs no overflow:hidden on ancestors) */
@media (min-width: 992px) {
  .article-sidebar {
    align-self: flex-start;
    position: sticky;
    top: var(--article-sticky-top, 7.5rem);
    z-index: 2;
  }
}

.article-sidebar__sticky {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.article-side-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.article-side-card--accent {
  background: linear-gradient(160deg, #fff 0%, var(--brand-soft) 100%);
  border-color: rgba(185, 28, 28, 0.15);
}
.article-side-card h4 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}
.article-side-card__phone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #ef4444);
  color: #fff !important;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.25s var(--ease, ease), box-shadow 0.25s;
}
.article-side-card__phone:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(185, 28, 28, 0.3);
  color: #fff;
}

.article-related-link {
  display: block;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  transition: color 0.2s, padding 0.2s;
}
.article-related-link:last-child { border-bottom: none; padding-bottom: 0; }
.article-related-link:hover {
  color: var(--brand);
  padding-right: 4px;
}
.article-related-link small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.article-side-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}
.article-side-links a:hover { color: var(--brand); }

.article-mobile-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1035;
  box-sizing: border-box;
  width: 100%;
  max-width: 100vw;
  padding:
    0.5rem
    max(0.75rem, env(safe-area-inset-right, 0px))
    calc(0.5rem + env(safe-area-inset-bottom, 0px))
    max(0.75rem, env(safe-area-inset-left, 0px));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.08);
}
.article-mobile-bar a {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #ef4444);
  color: #fff;
  font-weight: 800;
  font-size: clamp(0.8125rem, 3.6vw, 0.9375rem);
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}
.article-mobile-bar a i {
  flex-shrink: 0;
  font-size: 1.05rem;
}
.article-mobile-bar__sep {
  opacity: 0.85;
  font-weight: 700;
}
.article-mobile-bar__phone {
  direction: ltr;
  unicode-bidi: embed;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
@media (max-width: 991.98px) {
  .article-mobile-bar { display: block; }
  .site-body:has(.site-main--article) {
    padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
  }
  /* نوار تماس پایین کافی است — FAB تکراری و روی متن نمی‌افتد */
  .site-body:has(.site-main--article) .fab-cta {
    display: none;
  }
}
@media (max-width: 380px) {
  .article-mobile-bar a {
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.55rem 0.65rem;
  }
  .article-mobile-bar__sep { display: none; }
}

/* Comments */
.article-comments {
  scroll-margin-top: 6rem;
}
.article-comments-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.article-comments__title {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
}
.article-comments-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent, #0ea5e9);
  background: var(--accent-soft, #e0f2fe);
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
}
.comment-flash { margin-bottom: 1rem; }
.comment-flash-success {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.22);
  color: #047857;
  font-size: 0.92rem;
  font-weight: 600;
}
.comment-compose {
  background: linear-gradient(180deg, #f8fafc, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.2rem 1.35rem;
  margin-bottom: 1.75rem;
}
.comment-compose-intro h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
}
.comment-compose-intro p {
  margin: 0 0 1.1rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.comment-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
@media (max-width: 575.98px) {
  .comment-form-grid { grid-template-columns: 1fr; }
}
.comment-field { margin-bottom: 0.9rem; }
.comment-field label,
.comment-rating-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
}
.comment-optional {
  font-weight: 500;
  color: var(--text-muted);
}
.comment-field:has(.comment-star-rating) { text-align: center; }
.comment-field:has(.comment-star-rating) .comment-rating-label { text-align: center; }
.comment-star-rating {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.1rem;
  direction: ltr;
  width: 100%;
  margin-inline: auto;
}
.comment-star-rating input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.comment-star-rating label {
  display: flex;
  margin: 0;
  padding: 0.15rem;
  font-size: 1.55rem;
  line-height: 1;
  color: #cbd5e1;
  cursor: pointer;
  transition: color 0.12s ease, transform 0.12s ease;
}
.comment-star-rating input:checked ~ label,
.comment-star-rating label:hover,
.comment-star-rating label:hover ~ label {
  color: #f59e0b;
}
.comment-star-rating label:hover { transform: scale(1.08); }
.comment-card-stars {
  display: inline-flex;
  align-items: center;
  gap: 0.06rem;
  direction: rtl;
  color: #f59e0b;
  font-size: 0.78rem;
  line-height: 1;
}
.comment-input {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm, 12px);
  padding: 0.78rem 0.95rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.comment-input:focus {
  outline: none;
  border-color: rgba(14, 165, 233, 0.55);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
}
.comment-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.7;
}
.comment-field.has-error .comment-input {
  border-color: rgba(185, 28, 28, 0.45);
}
.comment-field-error,
.comment-form-errors {
  display: block;
  margin-top: 0.35rem;
  color: var(--brand, #b91c1c);
  font-size: 0.8rem;
}
.comment-form-actions {
  display: flex;
  justify-content: flex-start;
}
.comment-submit {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  border-radius: var(--radius-sm, 12px);
  padding: 0.8rem 1.25rem;
  background: linear-gradient(135deg, var(--accent, #0ea5e9), #38bdf8);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(14, 165, 233, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.comment-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(14, 165, 233, 0.28);
}
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.comment-card {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
}
.comment-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--accent-soft), var(--brand-soft));
  color: var(--brand-dark, #991b1b);
  font-weight: 800;
  font-size: 1rem;
}
.comment-card-body { min-width: 0; flex: 1; }
.comment-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.4rem;
}
.comment-card-meta strong { font-size: 0.92rem; }
.comment-card-meta time {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.comment-card-text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.75;
  color: #334155;
}
.comment-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.comment-empty i {
  display: block;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  opacity: 0.45;
}

@media (max-width: 575.98px) {
  .article-hero { padding: 1.25rem 0 1.75rem; }
  .article-sheet { padding: 1rem; }
  .article-prose { font-size: 1rem; line-height: 1.85; }
}
