/* =========================================================================
   Article layout: sticky TOC left, body center, related right.
   ========================================================================= */
.article-layout {
  display: grid;
  /* Side rails reduced ~25% so the center column has more room. */
  grid-template-columns: 172px minmax(0, 1fr) 210px;
  gap: 38px;
  align-items: start;
  padding: 20px 0 40px;
}

/* Left table of contents */
.toc { position: sticky; top: 86px; }
.toc-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 12px; font-weight: 600; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.toc a { display: block; padding: 7px 12px; border-radius: 9px; color: var(--muted); font-size: 0.9rem; border-left: 2px solid transparent; }
.toc a:hover { background: rgba(17,24,39,0.04); color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* Center body. Reading text dropped to 15px for a denser, calmer read. */
.article-body { min-width: 0; font-size: 15px; }
.article-body p, .article-body li { font-size: 15px; line-height: 1.65; }
.article-body strong { font-weight: 650; color: var(--text); }
.article-body em { font-style: italic; }
.article-body h1 { margin-bottom: 10px; }
.article-meta-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; color: var(--muted); font-size: 0.85rem; margin-bottom: 22px; }
.article-meta-row .reviewed { display: inline-flex; align-items: center; gap: 6px; }
.article-meta-row svg { width: 15px; height: 15px; }

.summary-card { padding: 18px 20px; border-radius: var(--radius-md); margin-bottom: 22px; background: var(--surface); }
.summary-card p { margin: 0; color: var(--text); }

.quick-answer {
  border-radius: var(--radius-md); padding: 20px 22px; margin: 0 0 28px;
  background: var(--accent-soft);
  border: 1px solid rgba(109,74,255,0.18);
}
.quick-answer .qa-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--accent); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px; }
.quick-answer .qa-label svg { width: 18px; height: 18px; }
.quick-answer p { margin: 0; }

.article-cta { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--text); }
.article-section { margin: 30px 0; scroll-margin-top: 86px; }
.article-section h2 { margin-bottom: 12px; }
.article-section ul, .article-section ol { padding-left: 22px; }
.article-section li { margin-bottom: 7px; }

/* Inline SVG bar chart */
.chart-card { padding: 22px; border-radius: var(--radius-md); margin: 24px 0; }
.chart-card h3 { margin: 0 0 16px; font-size: 1.05rem; }
.chart-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
.bar-line { display: grid; grid-template-columns: 200px 1fr 44px; align-items: center; gap: 12px; font-size: 0.9rem; }
.bar-track { height: 14px; background: rgba(17,24,39,0.06); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.bar-val { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }

/* What to do next */
.next-card { padding: 22px; border-radius: var(--radius-md); margin: 28px 0; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.next-card .next-text { flex: 1; min-width: 220px; }
.next-card h3 { margin: 0 0 6px; }
.next-card p { margin: 0; color: var(--muted); }

/* FAQ */
.faq { margin: 32px 0; }
.faq h2 { margin-bottom: 14px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-solid); margin-bottom: 10px; overflow: hidden; }
.faq-item summary { cursor: pointer; padding: 16px 18px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .chev { width: 18px; height: 18px; color: var(--muted); transition: transform .2s var(--ease); flex: none; }
.faq-item[open] summary .chev { transform: rotate(180deg); }
.faq-item .faq-a { padding: 0 18px 16px; color: var(--muted); }

/* Right related rail */
.article-rail { position: sticky; top: 86px; display: grid; gap: 18px; }
.rail-title { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 12px; font-weight: 600; }
.rail-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rail-card ul a { display: block; padding: 8px 10px; border-radius: 9px; color: var(--text); font-size: 0.92rem; }
.rail-card ul a:hover { background: rgba(17,24,39,0.04); color: var(--accent); text-decoration: none; }
.rail-tool { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.rail-tool .ri { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none; }
.rail-tool .ri svg { width: 19px; height: 19px; }
.rail-tool .rt-name { font-weight: 600; font-size: 0.92rem; }
.rail-tool .rt-go { font-size: 0.8rem; color: var(--accent); font-weight: 600; }

/* Bottom related grid + internal link cluster */
.related-bottom { padding: 30px 0 10px; border-top: 1px solid var(--border); margin-top: 30px; }
.link-cluster { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* Mobile TOC */
.mobile-toc { display: none; margin-bottom: 20px; }
.mobile-toc summary { cursor: pointer; padding: 14px 16px; font-weight: 600; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-solid); list-style: none; }
.mobile-toc summary::-webkit-details-marker { display: none; }
.mobile-toc ol { margin: 8px 0 0; padding: 8px 0 0 20px; }
.mobile-toc a { color: var(--muted); }

@media (max-width: 1080px) {
  .article-layout { grid-template-columns: 150px minmax(0,1fr); }
  .article-rail { display: none; }
}
@media (max-width: 820px) {
  .article-layout { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .mobile-toc { display: block; }
  .bar-line { grid-template-columns: 130px 1fr 40px; font-size: 0.82rem; }
}

/* Example hero image (a real output made with the tool) */
.article-hero { margin: 0 0 22px; }
.article-hero img {
  width: 100%; height: auto; display: block;
  border-radius: 14px; border: 1px solid var(--border, rgba(17,24,39,0.08));
  background: #0f172a; aspect-ratio: 1200 / 630;
}
.article-hero figcaption {
  margin-top: 8px; font-size: 0.82rem; color: var(--muted); text-align: center;
}
