/* ── Shared article layout and components ─────────────────────────────────── */

/* Article component tokens (defaults = light mode) */
:root {
  --art-code-bg: var(--surface2);
  --art-callout-bg: rgba(91,111,166,0.06);
  --art-callout-warn-bg: rgba(200,149,74,0.07);
}

/* Layout */
.article-layout {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  align-items: start;
  flex: 1;
}
.article-main { min-width: 0; }
.article-sidebar { position: sticky; top: 80px; padding-top: 68px; }

/* Article header */
.article-header {
  padding: 44px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.article-eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.cat-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 20px;
  line-height: 1.4;
}
.article-title {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 16px;
}
.article-deck {
  font-size: 18px;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 400;
  margin-bottom: 24px;
  max-width: 620px;
}
.article-byline { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.byline-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.byline-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.byline-meta { font-size: 12px; color: var(--muted); }
.article-tag {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 500;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
}
.data-notice {
  margin-top: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(200,149,74,0.07);
  border: 1px solid rgba(200,149,74,0.25);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* Article body */
.article-body { font-family: var(--font); font-size: 17px; line-height: 1.75; color: var(--text); }
.article-body h2 { font-size: 22px; font-weight: 800; margin: 44px 0 14px; color: var(--text); letter-spacing: -0.2px; line-height: 1.3; }
.article-body h3 { font-size: 19px; font-weight: 700; margin: 30px 0 10px; color: var(--text); }
.article-body p { margin-bottom: 20px; }
.article-body strong { font-weight: 700; color: var(--text); }
.article-body ul { margin: 0 0 20px 24px; }
.article-body li { margin-bottom: 8px; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 36px 0; }
.article-body table { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 14px; }
.article-body table th {
  background: var(--surface2);
  padding: 10px 14px;
  font-weight: 700;
  text-align: left;
  border-bottom: 2px solid var(--border2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.article-body table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.article-body table tr:last-child td { border-bottom: none; }
.article-body table td:not(:first-child),
.article-body table th:not(:first-child) { text-align: right; }

/* Sidebar */
.sidebar-block {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.sidebar-block-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}
.sidebar-block-body { padding: 16px 18px; }
.toc-link {
  display: block;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.12s;
}
.toc-link:last-child { border-bottom: none; }

/* Share bar */
.share-bar {
  margin-top: 40px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s;
  text-decoration: none;
}
.share-btn:hover { background: var(--surface2); }

/* Author bio */
.author-bio-block {
  margin-top: 60px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.author-bio-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}
.author-bio-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.author-bio-text { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* Figures */
.fig {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 22px 22px 14px;
  margin: 28px 0;
}
.fig-ey { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 3px; }
.fig-ti { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.fig-su { font-size: 12px; color: var(--muted); margin-bottom: 14px; line-height: 1.5; }
.fig-no { font-size: 11px; color: var(--muted); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); line-height: 1.5; }

/* Stat row */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 24px 0; }
.sp {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 12px 16px;
  text-align: center;
  flex: 1;
  min-width: 100px;
}
.sp-num { font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 3px; }
.sp-lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; color: var(--muted); line-height: 1.3; }

/* Callouts */
.callout { border-radius: 10px; padding: 18px 20px; margin: 28px 0; font-size: 15px; }
.callout strong { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.callout-warn {
  background: var(--art-callout-warn-bg);
  border: 1px solid rgba(200,149,74,0.3);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 28px 0;
  font-size: 15px;
}
.callout-warn strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gold);
  margin-bottom: 8px;
}

/* Progress bar */
#progress-bar { position: fixed; top: 0; left: 0; z-index: 200; height: 3px; width: 0%; transition: width 0.1s linear; }

/* Responsive */
@media (max-width: 900px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { display: none; }
  .article-title { font-size: 28px; }
  .article-deck { font-size: 16px; }
}
@media (max-width: 600px) {
  .article-title { font-size: 23px; }
  .article-body { font-size: 16px; }
}

/* ── Dark mode overrides for article components ────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --art-code-bg: #2B2A3B;
    --art-callout-bg: rgba(138,159,212,0.08);
    --art-callout-warn-bg: rgba(212,168,96,0.08);
  }
}
:root[data-theme="dark"] {
  --art-code-bg: #2B2A3B;
  --art-callout-bg: rgba(138,159,212,0.08);
  --art-callout-warn-bg: rgba(212,168,96,0.08);
}
