/* ============================================================
   Articles (layouts/article.njk)
   Builds on styles.css tokens. A reading layout: left-aligned masthead,
   sticky rail (table of contents + CTA card) beside a ~70ch reading
   column, FAQ accordion, related cards, then the shared closing CTA.
   Body components: .vc-callout (--tip/--note/--warn/--product),
   .vc-figure, wrapped tables (.art-table), code, ordered steps.
   ============================================================ */

.art-page { --art-col: 700px; --art-rail: 248px; --art-warn: #FFF5E1; --art-warn-line: #B57A00; }

/* ---------- Reading progress (driven by article.js) ---------- */
.art-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; pointer-events: none; }
.art-progress span { display: block; height: 100%; width: 100%; background: var(--brand); transform: scaleX(0); transform-origin: 0 50%; }

/* ---------- Breadcrumb (same treatment as reference / case-study) ---------- */
.crumb { border-bottom: 1px solid var(--line); }
.crumb .wrap { display: flex; align-items: center; gap: 10px; padding-top: 18px; padding-bottom: 18px; font-size: 13px; font-weight: 500; color: var(--ink-3); flex-wrap: wrap; }
.crumb a { color: var(--ink-3); }
.crumb a:hover { color: var(--brand-strong); }
.crumb .sep { color: var(--line-strong); }
.crumb .cur { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60ch; }

/* ---------- Masthead ---------- */
.art-head { background: var(--light-cream); border-bottom: 1px solid var(--line); }
.art-head-inner { padding-top: 64px; padding-bottom: 56px; }
.art-head-inner > * { max-width: 860px; }
.art-kicker { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.art-kicker-shape {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 12.5px; font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-2);
}
.art-kicker-shape::before { content: ""; width: 26px; height: 2px; background: var(--brand); }
.art-kicker-chip {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 11px; background: var(--white);
}
.art-title { font-size: clamp(34px, 4.6vw, 56px); line-height: 1.06; letter-spacing: -0.02em; text-wrap: balance; }
.art-dek { margin-top: 20px; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.5; color: var(--ink-2); max-width: 62ch; text-wrap: pretty; }
.art-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 28px; font-size: 14px; color: var(--ink-2); }
.art-byline .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
.art-author { display: inline-flex; align-items: center; gap: 10px; }
.art-author img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.art-author a, .art-author-card a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.art-author-card { margin-top: 48px; display: flex; gap: 18px; align-items: flex-start; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
.art-author-card img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; }
.art-author-card-k { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.art-author-card-n { margin-top: 4px; font-size: 17px; color: var(--ink); }
.art-author-card-b { margin-top: 6px; font-size: 15px; line-height: 1.55; color: var(--ink-2); }

/* ---------- Two-column body ---------- */
.art-grid {
  display: grid;
  grid-template-columns: var(--art-rail) minmax(0, var(--art-col));
  gap: 72px;
  padding-top: 56px; padding-bottom: 88px;
  justify-content: start;
}
.art-rail { position: relative; }
.art-rail-sticky { position: sticky; top: 96px; }
.art-toc-toggle { display: none; }
.art-toc-label {
  font-size: 12px; font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 14px;
}
.art-toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); max-height: calc(100vh - 400px); overflow-y: auto; }
.art-toc-list a {
  display: block; padding: 7px 0 7px 16px; margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 14px; line-height: 1.4; color: var(--ink-2);
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.art-toc-list a:hover { color: var(--ink); }
.art-toc-list a[aria-current="true"] { color: var(--ink); font-weight: 600; border-left-color: var(--brand); }
.art-rail-cta {
  margin-top: 32px; padding: 20px; border-radius: var(--r-md);
  background: var(--dark-ash); color: #fff;
}
.art-rail-cta-h { font-size: 16px; font-weight: 700; line-height: 1.3; }
.art-rail-cta-b { margin-top: 8px; font-size: 14px; line-height: 1.5; color: rgba(255,255,255,.82); }
.art-rail-cta-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 14px; font-size: 14px; font-weight: 700; color: var(--light-turq); }
.art-rail-cta-link:hover { color: #fff; }

/* ---------- Reading column ---------- */
.art-body { font-size: 18px; line-height: 1.72; color: var(--ink-2); }
.art-body > * + * { margin-top: 1.15em; }
.art-body h2 {
  font-size: clamp(26px, 2.4vw, 32px); line-height: 1.18; color: var(--ink);
  margin-top: 2.4em; padding-top: 1.1em; border-top: 1px solid var(--line);
  scroll-margin-top: 96px; text-wrap: balance;
}
.art-body > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.art-body h3 { font-size: 21px; line-height: 1.3; color: var(--ink); margin-top: 1.9em; scroll-margin-top: 96px; }
.art-body h2 + *, .art-body h3 + * { margin-top: .7em; }
.art-body p { text-wrap: pretty; }
.art-body strong { color: var(--ink); font-weight: 700; }
.art-body a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--brand); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.art-body a:hover { color: var(--brand-strong); }
.art-body ul, .art-body ol { padding-left: 1.3em; }
.art-body li + li { margin-top: .45em; }
.art-body li::marker { color: var(--brand-strong); font-weight: 700; }
.art-body hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.art-body blockquote { margin-left: 0; padding-left: 20px; border-left: 3px solid var(--brand); color: var(--ink); font-size: 19px; }

/* Ordered lists as numbered steps */
.art-body ol { list-style: none; padding-left: 0; counter-reset: step; }
.art-body ol > li { position: relative; padding-left: 44px; counter-increment: step; }
.art-body ol > li::before {
  content: counter(step); position: absolute; left: 0; top: .15em;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-tint-2); color: var(--ink); font-size: 14px; font-weight: 700; line-height: 1;
}

/* Code */
.art-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; background: var(--brand-tint); color: var(--ink); padding: .12em .38em; border-radius: var(--r-sm); overflow-wrap: anywhere; }
.art-body pre { background: var(--dark-ash); color: #F3EBE6; padding: 18px 20px; border-radius: var(--r-md); overflow-x: auto; font-size: 14.5px; line-height: 1.6; }
.art-body pre code { background: none; color: inherit; padding: 0; font-size: inherit; }

/* Tables (wrapped by the articleParts filter so they scroll in the column) */
.art-table { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.art-table:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }
.art-table table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.art-table th, .art-table td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.art-table th { background: var(--light-cream); color: var(--ink); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.art-table tr:last-child td { border-bottom: 0; }
.art-table td:first-child { color: var(--ink); font-weight: 600; }

/* Figures */
.vc-figure { margin: 2em 0; }
.vc-figure img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--white); }
.vc-figure figcaption { margin-top: 10px; font-size: 14px; line-height: 1.5; color: var(--ink-3); }

/* Callouts */
.vc-callout { position: relative; padding: 18px 20px 18px 22px; border-radius: var(--r-md); border-left: 3px solid; font-size: 16.5px; line-height: 1.6; }
.vc-callout > * + * { margin-top: .6em; }
.vc-callout--tip { background: var(--brand-tint); border-color: var(--brand); }
.vc-callout--note { background: var(--light-cream); border-color: var(--ink-3); }
.vc-callout--warn { background: var(--art-warn); border-color: var(--art-warn-line); }
.vc-callout--product {
  background: var(--dark-ash); color: rgba(255,255,255,.86); border: 0;
  padding: 26px 28px; margin: 2.2em 0;
  background-image: radial-gradient(120% 90% at 100% 0%, rgba(63,193,199,.22), transparent 60%);
}
.vc-callout--product strong { color: #fff; }
.vc-callout--product a { color: var(--light-turq); text-decoration-color: var(--light-turq); }
.vc-callout--product a:hover { color: #fff; }
.vc-callout--product::before {
  content: "VividCharts"; display: block; margin-bottom: 10px;
  font-size: 11.5px; font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--light-turq);
}

/* ---------- FAQ ---------- */
.art-faq { margin-top: 72px; padding-top: 40px; border-top: 2px solid var(--ink); scroll-margin-top: 96px; }
.art-faq-h { font-size: clamp(26px, 2.4vw, 32px); line-height: 1.18; }
.art-faq-list { margin-top: 20px; }
.art-faq-item { border-bottom: 1px solid var(--line); }
.art-faq-item summary {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  padding: 20px 0; cursor: pointer; list-style: none;
  font-size: 18px; font-weight: 700; line-height: 1.4; color: var(--ink);
}
.art-faq-item summary::-webkit-details-marker { display: none; }
.art-faq-item summary:hover .q { color: var(--brand-strong); }
.art-faq-item summary:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 4px; }
.art-faq-icon { position: relative; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); margin-top: 1px; }
.art-faq-icon::before, .art-faq-icon::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 2px; background: var(--ink); transform: translate(-50%, -50%); transition: transform .2s var(--ease); }
.art-faq-icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.art-faq-item[open] .art-faq-icon { background: var(--brand); border-color: var(--brand); }
.art-faq-item[open] .art-faq-icon::after { transform: translate(-50%, -50%) rotate(0deg); }
.art-faq-a { padding: 0 46px 22px 0; font-size: 17px; line-height: 1.65; color: var(--ink-2); }
.art-faq-a a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--brand); text-underline-offset: 3px; }

/* ---------- End-of-article CTA ---------- */
.art-end { margin-top: 48px; display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.art-end-h { font-size: 20px; font-weight: 700; line-height: 1.3; color: var(--ink); margin: 0 0 -10px; }
.art-end-t { font-size: 16px; line-height: 1.55; color: var(--ink-2); max-width: 56ch; margin: 0; }

/* ---------- Related ---------- */
.art-related { border-top: 1px solid var(--line); padding: 64px 0 80px; }
.art-related-h { font-size: clamp(24px, 2.2vw, 30px); }
.art-related-grid { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.art-related-card {
  position: relative; display: flex; flex-direction: column; gap: 8px; height: 100%;
  padding: 22px 56px 22px 22px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--white);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.art-related-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.art-related-card .t { font-size: 17px; font-weight: 700; line-height: 1.35; color: var(--ink); }
.art-related-card .n { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.art-related-card .go { position: absolute; right: 20px; top: 24px; color: var(--brand-strong); transition: transform .2s var(--ease); }
.art-related-card:hover .go { transform: translateX(3px); }

/* ---------- More in this series ---------- */
.art-series { border-top: 1px solid var(--line); padding: 64px 0 8px; }
.art-series + .art-related { border-top: 0; }
.art-series-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.art-series-all { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 700; color: var(--ink); border-bottom: 2px solid var(--brand); padding-bottom: 2px; }
.art-series-all:hover { color: var(--brand-strong); }
.art-series-list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: 40px; }
.art-series-list li { display: flex; flex-direction: column; gap: 2px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.art-series-list a { font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--ink); }
.art-series-list a:hover { color: var(--brand-strong); }
.art-series-list span { font-size: 14px; color: var(--ink-3); }

/* ---------- Narrow screens: rail becomes a collapsible "On this page" box ---------- */
@media (max-width: 1040px) {
  .art-grid { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 28px; }
  .art-col { max-width: var(--art-col); }
  .art-rail-sticky { position: static; }
  .art-rail-cta { display: none; }
  .art-toc { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 36px; max-width: var(--art-col); }
  .art-toc-list { max-height: none; }
  .js .art-toc-label { display: none; }
  .js .art-toc-toggle {
    display: flex; width: 100%; align-items: center; justify-content: space-between;
    background: none; border: 0; padding: 0; cursor: pointer; font: inherit;
    font-size: 13px; font-weight: 700; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--ink-2);
  }
  .js .art-toc-toggle svg { transition: transform .2s var(--ease); }
  .js .art-toc-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
  .js .art-toc-toggle[aria-expanded="false"] + .art-toc-label + .art-toc-list { display: none; }
  .js .art-toc-toggle[aria-expanded="true"] + .art-toc-label + .art-toc-list { margin-top: 12px; }
}
@media (max-width: 640px) {
  .art-head-inner { padding-top: 40px; padding-bottom: 36px; }
  .art-body { font-size: 17px; }
  .vc-callout--product { padding: 22px 20px; }
  .art-faq-a { padding-right: 0; }
  .art-related-card { padding-right: 48px; }
  .art-series-list { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .art-progress { display: none; }
}
@media (max-width: 480px) {
  .art-byline { flex-direction: column; align-items: flex-start; gap: 4px; }
  .art-byline .dot { display: none; }
}
