/* ==========================================================================
   TRENDWRITES - ARTICLE PAGE STYLESHEET
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ARTICLE PAGE LAYOUT (3-COLUMN: LEFT TOC | CENTER | RIGHT SIDEBAR)
   -------------------------------------------------------------------------- */
.article-page-wrapper {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  grid-template-areas: "left-sidebar article-body right-sidebar";
  gap: 2rem;
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  align-items: start;
}

/* ---- Left Sidebar (TOC) ---- */
.left-sidebar {
  grid-area: left-sidebar;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  scrollbar-width: none;
  scrollbar-color: transparent transparent;
}
.left-sidebar::-webkit-scrollbar { display: none; }

/* ---- Right Sidebar ---- */
.right-sidebar {
  grid-area: right-sidebar;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  scrollbar-width: none;
  scrollbar-color: transparent transparent;
}
.right-sidebar::-webkit-scrollbar { display: none; }

/* ---- Center Article Body ---- */
.article-body {
  grid-area: article-body;
  min-width: 0;
  max-width: 780px;
}

/* --------------------------------------------------------------------------
   2. READING PROGRESS INDICATOR
   -------------------------------------------------------------------------- */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, #7c3aed 100%);
  z-index: 10000;
  transition: width 0.1s linear;
  border-radius: 0 3px 3px 0;
}

/* --------------------------------------------------------------------------
   3. BREADCRUMB
   -------------------------------------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.breadcrumb a {
  color: var(--text-muted);
  transition: color 0.15s;
}
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep {
  color: var(--text-light);
  font-size: 0.7rem;
}
.breadcrumb-current { color: var(--text-main); font-weight: 600; }

/* --------------------------------------------------------------------------
   4. ARTICLE HEADER
   -------------------------------------------------------------------------- */
.article-category-badge {
  margin-bottom: 0.75rem;
}
.article-headline {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}
.article-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-weight: 400;
}

/* Article Meta Row */
.article-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.article-author-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.article-author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}
.article-author-info strong {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}
.article-author-info a:hover { color: var(--primary); }
.article-author-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Article Date/Meta */
.article-meta-details {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.825rem;
  color: var(--text-muted);
}
.article-meta-details span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* --------------------------------------------------------------------------
   5. FEATURED IMAGE
   -------------------------------------------------------------------------- */
.article-featured-img-wrapper {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.75rem;
  position: relative;
  background-color: var(--bg-subtle);
}
.article-featured-img-wrapper img {
  width: 100%;
  height: auto;
  max-height: 440px;
  object-fit: cover;
  display: block;
}
.article-featured-img-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem 0;
  font-style: italic;
}

/* --------------------------------------------------------------------------
   6. SOCIAL SHARE BUTTONS
   -------------------------------------------------------------------------- */
.share-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.25rem 0;
}
.share-bar-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
  color: var(--text-main);
  background-color: var(--bg-card);
}
.share-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.share-btn.twitter:hover { background-color: #1da1f2; color: #fff; border-color: #1da1f2; }
.share-btn.linkedin:hover { background-color: #0a66c2; color: #fff; border-color: #0a66c2; }
.share-btn.facebook:hover { background-color: #1877f2; color: #fff; border-color: #1877f2; }
.share-btn.copy-link.copied { background-color: #10b981; color: #fff; border-color: #10b981; }

/* --------------------------------------------------------------------------
   7. ARTICLE BODY PROSE STYLES
   -------------------------------------------------------------------------- */
.article-prose {
  color: var(--text-main);
  font-size: 1.05rem;
  line-height: 1.85;
  font-weight: 400;
}
.article-prose h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 2.75rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-light);
  color: var(--text-main);
  scroll-margin-top: 100px;
}
.article-prose h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  color: var(--text-main);
  scroll-margin-top: 100px;
}
.article-prose h4 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  scroll-margin-top: 100px;
}
.article-prose p {
  margin-bottom: 1.25rem;
  color: var(--text-main);
}
.article-prose ul, .article-prose ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}
.article-prose ul { list-style: none; }
.article-prose ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
}
.article-prose ul li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}
.article-prose ol {
  list-style: decimal;
  counter-reset: none;
}
.article-prose ol li {
  padding-left: 0.5rem;
  margin-bottom: 0.5rem;
}
.article-prose a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.article-prose a:hover { color: var(--primary-hover); }

.article-prose strong { font-weight: 700; }
.article-prose em { font-style: italic; }

/* --------------------------------------------------------------------------
   8. CALLOUT BOXES (Important / Warning / Tip / Info)
   -------------------------------------------------------------------------- */
.callout {
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  border-left: 4px solid transparent;
}
.callout-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 0.1rem;
}
.callout-content h4 {
  font-size: 0.925rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.callout-content p { margin: 0; font-size: 0.95rem; }

.callout-tip    { background-color: rgba(13, 148, 136, 0.08); border-color: var(--teal);   color: var(--text-main); }
.callout-tip h4 { color: var(--teal); }

.callout-warning    { background-color: rgba(217, 119, 6, 0.08); border-color: var(--amber); }
.callout-warning h4 { color: var(--amber); }

.callout-important    { background-color: rgba(30, 64, 175, 0.06); border-color: var(--primary); }
.callout-important h4 { color: var(--primary); }

.callout-danger    { background-color: rgba(225, 29, 72, 0.07); border-color: var(--rose); }
.callout-danger h4 { color: var(--rose); }

/* --------------------------------------------------------------------------
   9. CODE BLOCKS
   -------------------------------------------------------------------------- */
.code-block-wrapper {
  position: relative;
  margin: 1.75rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.code-block-header {
  background-color: #1e2d3e;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 600;
}
.code-block-header .dots {
  display: flex;
  gap: 6px;
}
.code-block-header .dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.code-block-header .dots span:nth-child(1) { background: #ff5f57; }
.code-block-header .dots span:nth-child(2) { background: #ffbd2e; }
.code-block-header .dots span:nth-child(3) { background: #28c840; }
.copy-code-btn {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  color: #94a3b8;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
}
.copy-code-btn:hover { background: rgba(255,255,255,0.2); }
.code-block-body {
  background-color: #0d1117;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
}
.code-block-body pre {
  margin: 0;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.875rem;
  line-height: 1.7;
  color: #c9d1d9;
}
.code-kw  { color: #ff7b72; }
.code-str { color: #a5d6ff; }
.code-cmt { color: #8b949e; font-style: italic; }
.code-fn  { color: #d2a8ff; }

/* --------------------------------------------------------------------------
   10. COMPARISON TABLE
   -------------------------------------------------------------------------- */
.comparison-table-wrapper {
  overflow-x: auto;
  margin: 1.75rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.comparison-table th {
  background-color: var(--bg-subtle);
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 700;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  color: var(--text-main);
}
.comparison-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-muted);
}
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table tr:hover td { background-color: var(--bg-surface); }
.check-yes { color: #10b981; font-weight: 700; }
.check-no  { color: var(--rose); font-weight: 700; }

/* --------------------------------------------------------------------------
   11. FAQ ACCORDION
   -------------------------------------------------------------------------- */
.faq-section { margin: 2rem 0; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.65rem;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.faq-item.active { box-shadow: var(--shadow-md); border-color: var(--primary); }
.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.975rem;
  color: var(--text-main);
  user-select: none;
  transition: background 0.15s;
  background-color: var(--bg-card);
}
.faq-question:hover { background-color: var(--bg-subtle); }
.faq-question.active { background-color: var(--primary-light); color: var(--primary); }
.faq-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
  transition: transform 0.25s;
}
.faq-item.active .faq-icon { transform: rotate(45deg); background: var(--primary); color: #fff; }
.faq-answer {
  display: none;
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
  border-top: 1px solid var(--border);
}
.faq-item.active .faq-answer { display: block; }

/* --------------------------------------------------------------------------
   12. TABLE OF CONTENTS (LEFT SIDEBAR COMPONENT)
   -------------------------------------------------------------------------- */
.toc-widget {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
}
.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-main);
}
.toc-toggle-icon {
  transition: transform 0.25s;
  color: var(--text-muted);
}
.toc-widget.collapsed .toc-toggle-icon { transform: rotate(-90deg); }
.toc-body {
  padding: 0.75rem 0;
  transition: all 0.3s ease;
}
.toc-widget.collapsed .toc-body { display: none; }

.toc-list { padding: 0; margin: 0; }
.toc-item { display: block; }
.toc-link {
  display: block;
  padding: 0.4rem 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.15s;
  border-left: 3px solid transparent;
  font-weight: 500;
}
.toc-link:hover { color: var(--primary); background-color: var(--bg-subtle); }
.toc-link.active {
  color: var(--primary);
  border-left-color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 700;
}
.toc-link.indent-2 { padding-left: 2rem; font-size: 0.825rem; }

/* Reading Progress in Left Sidebar */
.reading-progress-widget {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.progress-bar-track {
  height: 6px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-full);
  margin-top: 0.5rem;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, #7c3aed 100%);
  border-radius: var(--radius-full);
  transition: width 0.25s ease;
}

/* Back To Top - Left Sidebar */
.back-to-top-sidebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-top: 0.5rem;
}
.back-to-top-sidebar:hover { color: var(--primary); background-color: var(--primary-light); border-color: var(--primary); }

/* --------------------------------------------------------------------------
   13. ARTICLE AUTHOR BIO CARD (bottom of article)
   -------------------------------------------------------------------------- */
.author-bio-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin: 2.5rem 0;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.author-bio-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  flex-shrink: 0;
}
.author-bio-name a { color: var(--text-main); }
.author-bio-name a:hover { color: var(--primary); text-decoration: underline; }
.author-bio-role { font-size: 0.85rem; color: var(--primary); font-weight: 700; margin-bottom: 0.65rem; }
.author-bio-desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.65; margin-bottom: 0.75rem; }
.author-social-links {
  display: flex;
  gap: 0.5rem;
}
.author-social-link {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s;
}
.author-social-link:hover { background-color: var(--primary); color: #fff; border-color: var(--primary); }

/* --------------------------------------------------------------------------
   14. TAGS
   -------------------------------------------------------------------------- */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0;
}
.article-tags-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   15. PREV / NEXT ARTICLE NAVIGATION
   -------------------------------------------------------------------------- */
.article-nav-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2rem 0;
}
.article-nav-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: all 0.2s ease;
}
.article-nav-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.article-nav-direction {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.article-nav-card.next { text-align: right; }
.article-nav-card.next .article-nav-direction { justify-content: flex-end; }
.article-nav-title { font-weight: 700; font-size: 0.9rem; color: var(--text-main); line-height: 1.3; }

/* --------------------------------------------------------------------------
   16. RELATED ARTICLES SECTION
   -------------------------------------------------------------------------- */
.related-articles-section {
  margin: 2.5rem 0;
  padding: 2rem 0;
  border-top: 2px solid var(--border);
}
.related-articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1.25rem;
}

/* --------------------------------------------------------------------------
   17. INLINE ARTICLE NEWSLETTER CTA
   -------------------------------------------------------------------------- */
.article-newsletter-cta {
  background: linear-gradient(135deg, var(--primary) 0%, #1e1b4b 100%);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem;
  color: #fff;
  margin: 2.5rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.article-newsletter-cta h3 {
  color: #fff;
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}
.article-newsletter-cta p {
  color: #cbd5e1;
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}
.article-nl-form {
  display: flex;
  gap: 0.65rem;
  max-width: 420px;
  margin: 0 auto;
}
.article-nl-form input {
  flex: 1;
  background: rgba(255,255,255,0.92);
  color: #0f172a;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  border: none;
}

/* --------------------------------------------------------------------------
   18. RIGHT SIDEBAR WIDGET SPECIFIC
   -------------------------------------------------------------------------- */
.sidebar-popular-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.sidebar-popular-item {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-popular-item:last-child { border-bottom: none; }
.sidebar-popular-num {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  opacity: 0.3;
  line-height: 1;
  min-width: 30px;
}
.sidebar-popular-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
}
.sidebar-popular-title:hover { color: var(--primary); }
.sidebar-popular-meta { font-size: 0.775rem; color: var(--text-muted); margin-top: 0.25rem; }

.sidebar-recent-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.sidebar-recent-item:last-child { border-bottom: none; }
.sidebar-recent-img {
  width: 64px;
  height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}
.sidebar-recent-title { font-size: 0.85rem; font-weight: 600; line-height: 1.35; }
.sidebar-recent-title:hover { color: var(--primary); }

.sidebar-categories-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.sidebar-category-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.sidebar-category-link:hover { color: var(--primary); }
.sidebar-category-count {
  font-size: 0.75rem;
  font-weight: 700;
  background-color: var(--bg-subtle);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

/* Comments Placeholder */
.comments-placeholder {
  background: var(--bg-surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  margin: 2rem 0;
}

/* Jump Links */
.jump-links-bar {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0 1.75rem;
}
.jump-links-bar strong {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.jump-links-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.jump-link {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--primary);
  background-color: var(--primary-light);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  transition: background 0.15s;
}
.jump-link:hover { background-color: var(--primary); color: #fff; }
