/* Clean article typography */
.article-content {
  font-size: 18px;
  line-height: 1.8;
  color: #374151;
}
.article-content > *:first-child {
  margin-top: 1.5rem;
}
/* First image after intro paragraph needs more space */
.article-content > p:first-child + p > img:only-child,
.article-content > p:first-child + figure,
.article-content > p + p > img {
  margin-top: 2rem;
}
.article-content h2 {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin: 3rem 0 1rem;
  padding-top: 1rem;
}
.article-content h3 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  color: #111827;
  margin: 1.75rem 0 0.75rem;
}
.article-content p {
  margin-bottom: 1.5rem;
}
/* Backlinko-style lead paragraph */
.article-content > p:first-of-type {
  font-size: 19px;
  line-height: 1.75;
}
.article-content ul, .article-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}
.article-content ul { list-style-type: disc; }
.article-content ol { list-style-type: decimal; }
.article-content li {
  margin-bottom: 0.5rem;
}
.article-content a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.article-content a:hover {
  color: #1d4ed8;
}
.article-content strong {
  color: #111827;
  font-weight: 600;
}
/* Images */
.article-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  margin: 2rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.article-content .not-prose img {
  display: inline-block;
  border: 0;
  margin: 0;
  box-shadow: none;
  border-radius: 2px;
}
/* Tables */
.article-content table,
.prose table {
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.5rem 0;
  font-size: 14px;
  border: 1px solid #e0e1e9;
  border-radius: 12px;
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
}
.article-content table thead,
.article-content table tbody,
.prose table thead,
.prose table tbody {
  display: table;
  width: 100%;
}
.article-content th,
.prose th {
  background: #f4f5f9;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a1af;
  border-bottom: 1px solid #ccd3e8;
}
.article-content td,
.prose td {
  padding: 12px 16px;
  border-bottom: 1px solid #e0e1e9;
}
/* Reset letter-spacing/uppercase for not-prose tables (e.g. benchmark data tables) */
.article-content .not-prose th {
  letter-spacing: 0;
  text-transform: none;
}
.article-content td:first-child,
.prose td:first-child {
  color: #16a34a;
  font-weight: 600;
}
.article-content tr:last-child td,
.prose tr:last-child td {
  border-bottom: none;
}
.article-content tr:hover td,
.prose tr:hover td {
  background: rgba(248,249,254,0.5);
}
/* Code - inline */
.article-content code {
  background: #f3f4f6 !important;
  padding: 0.2em 0.4em !important;
  border-radius: 4px !important;
  font-size: 0.875em !important;
  font-family: ui-monospace, 'SF Mono', Monaco, monospace !important;
  color: #1f2937 !important;
}
/* Code blocks */
.article-content pre {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  padding: 1rem 1.25rem !important;
  border-radius: 8px !important;
  overflow-x: auto !important;
  margin: 1.5rem 0 !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
  border: 1px solid #334155 !important;
}
.article-content pre code {
  background: transparent !important;
  padding: 0 !important;
  color: #e2e8f0 !important;
  font-size: 14px !important;
}
/* Syntax highlighting colors */
.article-content pre .hljs-keyword,
.article-content pre .hljs-selector-tag { color: #c792ea !important; }
.article-content pre .hljs-string,
.article-content pre .hljs-attr { color: #c3e88d !important; }
.article-content pre .hljs-comment { color: #676e95 !important; }
.article-content pre .hljs-number { color: #f78c6c !important; }
.article-content pre .hljs-built_in { color: #82aaff !important; }
/* Blockquotes */
.article-content blockquote {
  border-left: 4px solid #d1d5db;
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: #6b7280;
  font-style: italic;
}
/* Section dividers */
.article-content hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid #e5e7eb;
}
/* Highlighted stat badges */
.article-content .cite-stat {
  margin: 1.5rem 0;
}

/* ========== Figure shortcode ========== */
.figure-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.figure-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 14px;
  color: #6b7280;
  text-align: center;
}
.figure-credit {
  font-size: 12px;
  color: #9ca3af;
}
.figure-credit a {
  color: #9ca3af;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.figure-credit a:hover {
  color: #6b7280;
}

/* ========== Screenshot shortcode ========== */
.screenshot-frame {
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  overflow: hidden;
  background: #fff;
}
.screenshot-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}
.screenshot-dots {
  display: flex;
  gap: 6px;
}
.screenshot-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
}
.screenshot-title {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
  text-align: center;
}
.screenshot-img {
  display: block;
  width: 100%;
  height: auto;
  border: 0 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
}

/* ========== Video embed shortcode ========== */
.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ========== Lightbox overlay ========== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.lightbox-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}
.lightbox-overlay.is-active img {
  transform: scale(1);
}
.article-content img:not(.no-lightbox),
.prose img:not(.no-lightbox),
.figure-img:not(.no-lightbox) {
  cursor: zoom-in;
}

/* ========== Sidebar ========== */

/* Sidebar: scroll when content exceeds viewport */
aside .sticky {
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
aside .sticky::-webkit-scrollbar {
  display: none;
}

/* TOC nav styling */
.toc-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-nav li {
  margin-bottom: 0;
}
.toc-nav a {
  color: #6b7280;
  text-decoration: none;
  display: block;
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.4;
  transition: color 0.15s ease, font-weight 0.15s ease;
}
.toc-nav a:hover {
  color: #111827;
}
/* Active scroll-spy state */
.toc-nav a.toc-active {
  color: #111827;
  font-weight: 600;
}
/* Also style manual toc-link class (guide/comparison pages) */
a.toc-link.toc-active {
  color: #111827;
  font-weight: 600;
}
/* Comparison page TOC: border-left indicator uses category color via CSS var */
a.toc-link.toc-active[style*="--comp-active-color"] {
  color: #1f2124;
  font-weight: 600;
  border-left: 3px solid var(--comp-active-color, #3a50cc);
  margin-left: -2px;
  background: rgba(0,0,0,0.03);
}
/* Hub sidebar TOC active state */
.hub-sidebar a.toc-link.toc-active {
  font-weight: 700;
}
.toc-nav > nav > ul > li > a {
  font-size: 14px;
}
.toc-nav ul ul {
  padding-left: 14px;
  margin-top: 0;
}
.toc-nav ul ul a {
  font-size: 13px;
  color: #9ca3af;
}
.toc-nav ul ul a.toc-active {
  color: #111827;
  font-weight: 600;
}

/* ========== Guide TOC — left border style ========== */
.guide-toc-list {
  border-left: 1px solid #e5e7eb;
}
.guide-toc-item {
  margin-left: -1px;
  border-left: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease, font-weight 0.15s ease;
}
.guide-toc-item.toc-active {
  border-left-color: var(--toc-active-color, #3a50cc);
  color: #111827;
  font-weight: 600;
}
/* Auto-generated TOC variant */
.guide-toc-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid #e5e7eb;
}
.guide-toc-nav li {
  margin-bottom: 0;
}
.guide-toc-nav a {
  color: #6b7280;
  text-decoration: none;
  display: block;
  padding: 8px 0 8px 16px;
  font-size: 14px;
  line-height: 1.4;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: border-color 0.15s ease, color 0.15s ease, font-weight 0.15s ease;
}
.guide-toc-nav a:hover {
  color: #111827;
}
.guide-toc-nav a.toc-active {
  border-left-color: var(--toc-active-color, #3a50cc);
  color: #111827;
  font-weight: 600;
}
.guide-toc-nav ul ul {
  border-left: none;
  padding-left: 12px;
}
.guide-toc-nav ul ul a {
  font-size: 13px;
  color: #9ca3af;
}
.guide-toc-nav ul ul a.toc-active {
  color: #111827;
  font-weight: 600;
  border-left-color: var(--toc-active-color, #3a50cc);
}

/* H2-only TOC — hide nested H3+ items */
.toc-h2-only ul ul { display: none; }

/* ========== TOC sidebar scroll ========== */
.toc-scroll { scrollbar-width: thin; scrollbar-color: #d1d5db transparent; }
.toc-scroll::-webkit-scrollbar { width: 4px; }
.toc-scroll::-webkit-scrollbar-track { background: transparent; }
.toc-scroll::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }
.toc-scroll::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ========== Sidebar collapsible groups ========== */
.sidebar-group summary::-webkit-details-marker { display: none; }
.sidebar-group summary::marker { display: none; content: ""; }
.sidebar-group[open] .sidebar-chevron { transform: rotate(90deg); }

/* ========== Expert quote shortcode ========== */
.article-content .bg-blue-50 img {
  border: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  border-radius: 50% !important;
}
.article-content .bg-blue-50 blockquote {
  border-left: none !important;
  padding-left: 0 !important;
  margin: 0 !important;
  color: #374151 !important;
}

/* ========== CandyShop heatmap table ========== */
.heatmap td { text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.heatmap td.heat-0 { background-color: #f0fdf4; color: #6b7280; }
.heatmap td.heat-low { background-color: #dcfce7; }
.heatmap td.heat-med { background-color: #fef9c3; }
.heatmap td.heat-high { background-color: #fed7aa; }
.heatmap td.heat-vhigh { background-color: #fecaca; }
.heatmap td.heat-extreme { background-color: #f87171; color: white; }

/* ========== Collapsible target details ========== */
.article-content details.target-detail { border: 1px solid #e5e7eb; border-radius: 12px; margin-bottom: 12px; }
.article-content details.target-detail summary { padding: 12px 16px; cursor: pointer; font-weight: 600; font-size: 16px; color: #111827; list-style: none; display: flex; align-items: center; gap: 8px; }
.article-content details.target-detail summary::before { content: '\25B8'; transition: transform 0.2s; display: inline-block; font-size: 14px; color: #9ca3af; }
.article-content details.target-detail[open] summary::before { transform: rotate(90deg); }
.article-content details.target-detail .detail-body { padding: 0 16px 16px; font-size: 15px; line-height: 1.7; }
.article-content details.target-detail .detail-body ul { margin-bottom: 0; }
