/* ============================================================================
   RPACPC — Article / detail reading template
   Shared by: blog post · case study · whitepaper detail pages.
   Extends css/styles.css tokens + css/insights.css (reuses .insights-grid etc).
   All classes prefixed art-/cs-/wp- to avoid collisions.
   ============================================================================ */

/* ── Reading progress bar (sits under the sticky nav) ───────────────────── */
.read-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--green));
  z-index: 1200; transition: width .08s linear;
}

/* ── Article hero ───────────────────────────────────────────────────────── */
.art-hero { position: relative; padding: calc(48px * var(--pad)) 0 calc(34px * var(--pad)); overflow: hidden; border-bottom: 1px solid var(--line); }
.art-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(760px 420px at 10% -16%, var(--acc-tint, var(--primary-tint)) 0%, transparent 60%),
    radial-gradient(620px 400px at 98% -8%, var(--green-tint) 0%, transparent 64%);
  opacity: .6;
}
.art-hero .container { max-width: 1200px; }
.art-cat {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--acc, var(--primary)); background: var(--acc-tint, var(--primary-tint));
  padding: 6px 12px; border-radius: 20px; margin: 14px 0 18px;
}
.art-cat .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--acc, var(--primary)); }
.art-title { max-width: 900px; font-family: var(--f-display); font-weight: 600; font-size: clamp(30px, 4.2vw, 50px); letter-spacing: -.03em; line-height: 1.05; text-wrap: balance; color: var(--ink); }
.art-dek { font-size: clamp(17px, 1.6vw, 20px); color: var(--body); line-height: 1.55; max-width: 680px; margin-top: 18px; }
.art-lead-img { margin: 0 0 30px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #EAF1FB; box-shadow: var(--shadow-sm); }
.art-lead-img img { display: block; width: 100%; height: auto; }

/* ── Byline + meta row ──────────────────────────────────────────────────── */
.art-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 26px; margin-top: 28px; }
.art-author { display: flex; align-items: center; gap: 12px; }
.art-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display); font-weight: 600; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}
.art-byline-name { display: block; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.art-byline-sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.art-meta-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.art-meta-facts .f { display: inline-flex; align-items: center; gap: 7px; }
.art-meta-facts .f svg { width: 14px; height: 14px; stroke: var(--muted); }
.art-meta-facts .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--line); }
.art-share { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.art-share-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface);
  display: flex; align-items: center; justify-content: center; color: var(--body);
  box-shadow: var(--shadow-sm); transition: border-color .15s, color .15s, transform .15s;
}
.art-share-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.art-share-btn svg { width: 17px; height: 17px; }
.art-share-btn.copied { border-color: var(--green); color: var(--green-strong); }

/* ── Two-column shell: sticky TOC + body ────────────────────────────────── */
.art-shell { padding: calc(50px * var(--pad)) 0 calc(40px * var(--pad)); }
.art-shell .container { max-width: 1200px; display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 60px; align-items: start; }

.art-toc { position: sticky; top: 92px; }
.art-toc-title { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; padding-left: 14px; }
.art-toc-list { list-style: none; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); }
.art-toc-list a {
  display: block; font-size: 13.5px; line-height: 1.4; color: var(--muted);
  padding: 7px 14px; margin-left: -1px; border-left: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.art-toc-list a:hover { color: var(--ink); }
.art-toc-list a.active { color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.art-toc-cta { margin-top: 22px; display: flex; flex-direction: column; gap: 9px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.art-toc-cta h5 { font-family: var(--f-display); font-size: 14.5px; font-weight: 600; color: var(--ink); }
.art-toc-cta p { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.art-toc-cta .btn { width: 100%; justify-content: center; padding: 10px 14px; font-size: 13.5px; }

/* ── Body typography ────────────────────────────────────────────────────── */
.art-body { max-width: none; }
.art-body > * + * { margin-top: 24px; }
.art-body h2 { font-family: var(--f-display); font-weight: 600; font-size: clamp(24px, 2.4vw, 30px); letter-spacing: -.02em; line-height: 1.16; color: var(--ink); scroll-margin-top: 92px; margin-top: 48px; }
.art-body h2:first-child { margin-top: 0; }
.art-body h3 { font-family: var(--f-display); font-weight: 600; font-size: 20px; letter-spacing: -.01em; color: var(--ink); scroll-margin-top: 92px; margin-top: 36px; }
.art-body p { font-size: 17px; line-height: 1.75; color: var(--body); }
.art-body p .lead-in { font-weight: 600; color: var(--ink); }
.art-body a:not(.btn) { color: var(--primary); font-weight: 500; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--primary) 35%, transparent); text-underline-offset: 3px; transition: text-decoration-color .15s; }
.art-body a:not(.btn):hover { text-decoration-color: var(--primary); }
.art-body strong { color: var(--ink); font-weight: 600; }
.art-body ul, .art-body ol { padding-left: 4px; display: flex; flex-direction: column; gap: 12px; }
.art-body li { position: relative; font-size: 17px; line-height: 1.65; color: var(--body); padding-left: 30px; list-style: none; }
.art-body ul li::before { content: ""; position: absolute; left: 4px; top: 10px; width: 8px; height: 8px; border-radius: 2px; background: var(--acc, var(--primary)); }
.art-body ol { counter-reset: li; }
.art-body ol li { counter-increment: li; }
.art-body ol li::before { content: counter(li); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 6px; background: var(--acc-tint, var(--primary-tint)); color: var(--acc, var(--primary)); font-family: var(--f-mono); font-size: 11.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.art-body li b { color: var(--ink); font-weight: 600; }

/* ── Key takeaways box ──────────────────────────────────────────────────── */
.art-takeaways { border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(160deg, var(--primary-tint-2), var(--surface)); padding: 24px 26px; box-shadow: var(--shadow-sm); }
.art-takeaways-h { display: flex; align-items: center; gap: 9px; font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); margin-bottom: 14px; }
.art-takeaways-h svg { width: 16px; height: 16px; }
.art-takeaways ul { padding: 0; display: flex; flex-direction: column; gap: 11px; }
.art-takeaways li { position: relative; padding-left: 28px; font-size: 15px; line-height: 1.55; color: var(--body); list-style: none; }
.art-takeaways li::before { content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--green-tint); box-shadow: inset 0 0 0 1.5px var(--green); }
.art-takeaways li::after { content: ""; position: absolute; left: 5px; top: 8px; width: 6px; height: 3px; border-left: 1.6px solid var(--green-strong); border-bottom: 1.6px solid var(--green-strong); transform: rotate(-45deg); }
.art-takeaways li b { color: var(--ink); }

/* ── Pull quote ─────────────────────────────────────────────────────────── */
.art-quote { border: none; padding: 8px 0 8px 26px; border-left: 3px solid var(--acc, var(--primary)); margin: 36px 0; }
.art-quote p { font-family: var(--f-display); font-size: clamp(20px, 2vw, 25px); font-weight: 500; line-height: 1.4; letter-spacing: -.01em; color: var(--ink); }
.art-quote cite { display: block; margin-top: 12px; font-style: normal; font-family: var(--f-mono); font-size: 12px; letter-spacing: .03em; color: var(--muted); }

/* ── Callout ────────────────────────────────────────────────────────────── */
.art-callout { display: flex; gap: 14px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.art-callout .c-ico { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--acc-tint, var(--primary-tint)); color: var(--acc, var(--primary)); }
.art-callout .c-ico svg { width: 19px; height: 19px; }
.art-callout-body h4 { font-family: var(--f-display); font-size: 15.5px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.art-callout-body p { font-size: 14.5px; line-height: 1.6; color: var(--body); }

/* ── Code / API snippet ─────────────────────────────────────────────────── */
.art-code { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.art-code-bar { display: flex; align-items: center; gap: 8px; padding: 11px 16px; background: var(--ink); border-bottom: 1px solid rgba(255,255,255,.08); }
.art-code-bar .m { font-family: var(--f-mono); font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 5px; background: var(--primary); color: #fff; letter-spacing: .04em; }
.art-code-bar .ep { font-family: var(--f-mono); font-size: 12px; color: #C7D3F5; }
.art-code-bar .tag { margin-left: auto; font-family: var(--f-mono); font-size: 10.5px; color: var(--faint); }
.art-code pre { margin: 0; padding: 18px 18px; background: #0B1330; overflow-x: auto; }
.art-code code { font-family: var(--f-mono); font-size: 12.5px; line-height: 1.7; color: #C9D4F2; white-space: pre; }
.art-code .k { color: #7E9BFF; } .art-code .s { color: #6FD7A8; } .art-code .n { color: #E0A87E; } .art-code .c { color: #5E6B92; }

/* ── Figure / placeholder ───────────────────────────────────────────────── */
.art-figure { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.art-figure .ph { aspect-ratio: 16 / 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(135deg, var(--acc-tint, var(--primary-tint)), var(--surface) 140%); color: var(--acc, var(--primary)); }
.art-figure .ph svg { width: 46px; height: 46px; opacity: .5; }
.art-figure .ph span { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.art-figure figcaption { font-size: 13px; color: var(--muted); padding: 13px 18px; border-top: 1px solid var(--line-2); }

/* ── Divider ────────────────────────────────────────────────────────────── */
.art-divider { height: 1px; background: var(--line); border: none; margin: 44px 0; }

/* ── Topic tags ─────────────────────────────────────────────────────────── */
.art-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 36px; }
.art-tags .t { font-family: var(--f-mono); font-size: 12px; color: var(--body); background: var(--surface-2); border: 1px solid var(--line); padding: 6px 13px; border-radius: 20px; transition: border-color .15s, color .15s; }
.art-tags .t:hover { border-color: var(--primary); color: var(--primary); }

/* ── Author bio card ────────────────────────────────────────────────────── */
.art-author-card { display: flex; gap: 18px; align-items: flex-start; margin-top: 40px; padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.art-author-card .art-avatar { width: 56px; height: 56px; font-size: 19px; }
.art-author-card .ac-name { font-family: var(--f-display); font-size: 17px; font-weight: 600; color: var(--ink); }
.art-author-card .ac-role { font-family: var(--f-mono); font-size: 12px; color: var(--primary); margin-top: 2px; }
.art-author-card .ac-bio { font-size: 14px; color: var(--body); line-height: 1.6; margin-top: 10px; }

/* ── Case study: metrics panel ──────────────────────────────────────────── */
.cs-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm); }
.cs-metric { background: var(--surface); padding: 24px 22px; }
.cs-metric-v { font-family: var(--f-display); font-size: clamp(26px, 3vw, 36px); font-weight: 600; letter-spacing: -.03em; color: var(--acc, var(--primary)); line-height: 1; font-variant-numeric: tabular-nums; }
.cs-metric-k { font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.4; }

/* ── Case study: client snapshot (sidebar card) ─────────────────────────── */
.cs-snapshot { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.cs-snapshot-h { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 16px 18px 10px; }
.cs-snapshot dl { padding: 0 18px 16px; }
.cs-snap-row { display: flex; flex-direction: column; gap: 2px; padding: 11px 0; border-top: 1px solid var(--line-2); }
.cs-snap-row:first-child { border-top: none; }
.cs-snap-row dt { font-size: 11.5px; color: var(--muted); font-family: var(--f-mono); letter-spacing: .03em; }
.cs-snap-row dd { font-size: 14px; font-weight: 600; color: var(--ink); }
.cs-stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cs-stack .chip { font-family: var(--f-mono); font-size: 11px; font-weight: 500; padding: 4px 9px; border-radius: 6px; background: var(--surface-2); color: var(--body); border: 1px solid var(--line); }

/* ── Whitepaper: report cover + download panel ──────────────────────────── */
.wp-panel { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-md); }
.wp-panel-body { padding: 32px 34px; }
.wp-panel-body h2 { font-family: var(--f-display); font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 8px; }
.wp-panel-body > p { font-size: 14.5px; color: var(--body); line-height: 1.6; }
.wp-form { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.wp-form input { font-family: var(--f-body); font-size: 14.5px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.wp-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.wp-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wp-form .btn { justify-content: center; }
.wp-form .fine { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.wp-cover { position: relative; background: linear-gradient(150deg, var(--ink), var(--ink-3)); display: flex; align-items: center; justify-content: center; padding: 30px; }
.wp-cover-doc { width: 200px; aspect-ratio: 1 / 1.32; background: linear-gradient(160deg, #1A2B66, #0E1A45); border: 1px solid rgba(255,255,255,.12); border-radius: 6px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); padding: 26px 22px; display: flex; flex-direction: column; }
.wp-cover-doc .badge { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: #7E9BFF; }
.wp-cover-doc h4 { font-family: var(--f-display); font-size: 21px; font-weight: 600; color: #fff; line-height: 1.15; margin-top: 16px; letter-spacing: -.02em; }
.wp-cover-doc .yr { margin-top: auto; font-family: var(--f-display); font-size: 30px; font-weight: 700; color: rgba(255,255,255,.25); letter-spacing: -.03em; }
.wp-cover-doc .rule { height: 2px; width: 44px; background: var(--green); margin: 14px 0; }

.wp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.wp-stat { background: var(--surface); padding: 22px; text-align: center; }
.wp-stat-v { font-family: var(--f-display); font-size: clamp(24px, 2.6vw, 32px); font-weight: 600; color: var(--ink); letter-spacing: -.02em; }
.wp-stat-k { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* report contents list */
.wp-contents { list-style: none; counter-reset: ch; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; padding: 0; gap: 0 !important; }
.wp-contents li { counter-increment: ch; display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--line-2); font-size: 15.5px; color: var(--ink); font-weight: 500; list-style: none; }
.wp-contents li:first-child { border-top: none; }
.wp-contents li::before { content: counter(ch, decimal-leading-zero); font-family: var(--f-mono); font-size: 12px; font-weight: 600; color: var(--primary); width: 30px; flex-shrink: 0; }
.wp-contents li .pg { margin-left: auto; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }

/* ── Related reading + cross-section CTA ────────────────────────────────── */
.art-related { background: var(--surface); border-top: 1px solid var(--line); padding: calc(56px * var(--pad)) 0; }
.art-related .container { max-width: 1200px; }
.art-related-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.art-related-head h2 { font-family: var(--f-display); font-size: clamp(22px, 2.4vw, 30px); font-weight: 600; letter-spacing: -.02em; }
.art-related-head a { font-family: var(--f-mono); font-size: 13px; font-weight: 500; color: var(--primary); display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; transition: gap .15s; }
.art-related-head a:hover { gap: 10px; }

.art-crosscta {
  margin-top: 36px; display: flex; flex-wrap: wrap; align-items: center; gap: 22px;
  background: var(--ink); border-radius: 18px; padding: 32px 36px; position: relative; overflow: hidden;
}
.art-crosscta::before { content: ""; position: absolute; inset: 0; background: radial-gradient(520px 300px at 88% -40%, rgba(21,66,211,.5), transparent 60%); pointer-events: none; }
.art-crosscta-body { position: relative; flex: 1; min-width: 280px; }
.art-crosscta-tag { font-family: var(--f-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #7E9BFF; }
.art-crosscta-body h3 { font-family: var(--f-display); font-size: clamp(20px, 2.2vw, 26px); font-weight: 600; color: var(--d-text); letter-spacing: -.02em; margin: 8px 0 8px; }
.art-crosscta-body p { font-size: 14.5px; color: var(--d-body); line-height: 1.6; max-width: 540px; }
.art-crosscta .btn { position: relative; margin-left: auto; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .art-shell .container { grid-template-columns: 1fr; gap: 0; }
  .art-toc { display: none; }
  .cs-metrics { grid-template-columns: repeat(2, 1fr); }
  .wp-panel { grid-template-columns: 1fr; }
  .wp-cover { order: -1; min-height: 240px; }
}
@media (max-width: 560px) {
  .art-share { margin-left: 0; width: 100%; }
  .cs-metrics, .wp-stats { grid-template-columns: 1fr 1fr; }
  .art-crosscta { padding: 26px 24px; }
  .art-crosscta .btn { margin-left: 0; }
  .wp-form .row { grid-template-columns: 1fr; }
}
