/* The article body, styled the way the artboard styles its own.

   BlogPost.jsx writes the body as two components — P and H2 — each carrying its inline style,
   and nothing else: no list, no table, no figure, no quote, because its demo article has
   none. A CMS post has all of them. So the two rules the canvas does have are restated here
   verbatim as rules for a subtree, and everything it does not have is built from the same
   tokens at the same rhythm, rather than left to the browser's defaults, which would put
   Times New Roman lists inside a Poppins article.

   Restated, not invented: `.bp-body > p` and `.bp-body h2` below are the declarations
   BlogPost.jsx sets on P and H2. legacy-prose.mjs reduces every body to exactly the elements
   this sheet covers, so a rule here and an element there are two halves of one contract. */

.bp-body {
  /* The canvas' own article element: a flex column at --space-5. Set again here because bare
     text can survive a reduced body — a Divi row that wrapped its copy in a div rather than a
     paragraph — and it should read as body copy rather than inherit from the page. */
  font: var(--type-body-lg);
  color: var(--text-body);
  text-wrap: pretty;
  /* What lets the table below scroll in its own frame instead of widening the page.
     This element is the article column's grid item, and a grid item's automatic minimum is
     its min-content width — which a five-column table sets to 581px. The track grew to that
     inside a 279px column, so at 390px the whole document scrolled sideways and the table's
     own `overflow-x` never engaged. Nothing else needs it: once this can shrink, the figure
     stretches to it and the table's `width: 100%` finally resolves against the column. */
  min-width: 0;
}

.bp-body > p,
.bp-body blockquote p,
.bp-body li,
.bp-body dd,
.bp-body td,
.bp-body th {
  margin: 0;
  font: var(--type-body-lg);
  color: var(--text-body);
  text-wrap: pretty;
}

.bp-body h2,
.bp-body h3,
.bp-body h4,
.bp-body h5,
.bp-body h6 {
  margin: var(--space-4) 0 0;
  letter-spacing: var(--tracking-heading);
  color: var(--text-strong);
  /* Clears the sticky header when the contents rail jumps to a heading — the canvas' number. */
  scroll-margin-top: 100px;
  text-wrap: balance;
}

.bp-body h2 { font: var(--type-h2); }
.bp-body h3 { font: var(--type-h3); }
.bp-body h4,
.bp-body h5,
.bp-body h6 { font: var(--type-h4); }

.bp-body a {
  color: var(--text-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.bp-body a:hover { color: var(--text-link-hover); }

.bp-body strong,
.bp-body b { color: var(--text-strong); font-weight: var(--weight-semibold); }

/* Lists need their markers put back, twice over.
 *
 * The design system's base sheet resets `ul,ol{list-style:none}` — right for a marketing
 * page, where every list is a layout — and a body out of the CMS is the one place where a
 * bulleted list means the bullets. They also stay block-level: a flex column spaces the items
 * just as well but suppresses their markers in Chrome. The first pass had both faults, and
 * shipped an indented list with nothing marking it. */
.bp-body ul,
.bp-body ol {
  margin: 0;
  padding-left: 22px;
  list-style: revert;
}

.bp-body li { list-style: inherit; }

.bp-body li + li,
.bp-body ul ul,
.bp-body ol ol,
.bp-body ul ol,
.bp-body ol ul { margin-top: 10px; }

.bp-body li::marker { color: var(--green-600); }

.bp-body dl { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.bp-body dt { font: var(--weight-semibold) var(--text-md)/1.4 var(--font-body); color: var(--text-strong); }
.bp-body dd { margin: 0; }

/* The quote takes the callout's frame — the one bordered, tinted block this page already
   has — rather than a second treatment of the same idea. */
.bp-body blockquote {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: var(--space-6);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--green-500);
  border-radius: var(--radius-card);
  background: var(--green-50);
}

.bp-body blockquote p { color: var(--ink-800); font: var(--type-body); }

.bp-body figure { margin: 0; display: flex; flex-direction: column; gap: 10px; }

.bp-body figcaption {
  font: var(--type-body-sm);
  color: var(--text-muted);
  text-align: center;
}

/* Pictures sit in the frame the hero panel uses, so a body image and the panel above it are
   the same object on the page. */
.bp-body img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-md);
}

.bp-body hr {
  height: 1px;
  margin: var(--space-4) 0;
  border: 0;
  background: var(--border-subtle);
}

/* A wide table scrolls inside its own frame; the page itself never scrolls sideways. */
.bp-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

.bp-body th,
.bp-body td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font: var(--type-body);
  text-align: left;
  vertical-align: top;
}

/* The column rules. Without them the body's tables read as stacked rows rather than a grid,
   which on a comparison table — the shape most of these posts use — leaves the reader to
   guess which column a cell belongs to. Drawn between cells rather than on every one, so the
   outer edges stay the table's own border and no line is painted twice. */
.bp-body th + th,
.bp-body td + td { border-left: 1px solid var(--border-subtle); }

/* The edge that says there is more table than the frame shows — the listing's chip row does
   exactly this, and post.js sets the attributes the same way blog.js does. A page without
   JavaScript keeps a table that still scrolls, it just goes unfaded. */
.bp-body table[data-overflow-start="true"] { mask-image: linear-gradient(90deg, transparent 0, #000 24px); }
.bp-body table[data-overflow-end="true"] { mask-image: linear-gradient(270deg, transparent 0, #000 24px); }
.bp-body table[data-overflow-start="true"][data-overflow-end="true"] { mask-image: linear-gradient(90deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%); }

.bp-body th { color: var(--text-strong); font-weight: var(--weight-semibold); background: var(--surface-page-alt); }
.bp-body tr:last-child td { border-bottom: 0; }
.bp-body caption { padding-bottom: 8px; font: var(--type-body-sm); color: var(--text-muted); text-align: left; }

.bp-body pre {
  margin: 0;
  padding: var(--space-5);
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--ink-900);
  color: var(--white);
}

.bp-body code,
.bp-body kbd,
.bp-body samp {
  font: var(--type-mono);
  font-size: 0.92em;
}

.bp-body :not(pre) > code {
  padding: 2px 6px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  background: var(--surface-page-alt);
  color: var(--text-strong);
}

.bp-body pre code { padding: 0; border: 0; background: none; color: inherit; }

/* The reading-progress bar the artboard fixes to the top of the viewport. Its fill is inline,
   because the runtime sets its width; only the reduced-motion case belongs in a sheet. */
@media (prefers-reduced-motion: reduce) {
  [data-post-progress] > * { transition: none !important; }
}

/* The CMS FAQ that closes the article (post-faq.mjs).

   The artboard draws no FAQ, so this is built from the tokens the rest of this sheet uses
   and from the accordion the product pages already ship (`.pp-acc` in product-page.css,
   which a post does not load): a rule between questions, the question in the strong text
   colour, a chevron that turns as the answer opens. The markup is the homepage accordion's
   (faq-accordion.mjs), folded by `initFaq`. */
.bp-faq { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-4); }
.bp-faq > h2 { margin-top: 0; }
.bp-faq-list { border-top: 1px solid var(--border-subtle); }
.bp-faq-item { border-bottom: 1px solid var(--border-subtle); scroll-margin-top: 100px; }

/* The homepage accordion's markup (button + grid-row panel, driven by `initFaq`). */
.bp-faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  min-height: 60px;
  padding: 14px 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font: var(--weight-semibold) var(--text-lg)/1.4 var(--font-body);
  color: var(--text-strong);
  text-wrap: pretty;
}

.bp-faq-q:hover { color: var(--text-link-hover); }
.bp-faq-q:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; border-radius: var(--radius-xs); }
.bp-faq-i { flex: 0 0 auto; color: var(--green-600); transition: transform .22s cubic-bezier(.2,.7,.2,1); }

/* The answer is prose too, one level deeper than `.bp-body > p` reaches. */
.bp-faq-a { display: flex; flex-direction: column; gap: 12px; padding: 0 0 22px; }
.bp-faq-a p { margin: 0; font: var(--type-body-lg); color: var(--text-body); text-wrap: pretty; }

@media (prefers-reduced-motion: reduce) {
  .bp-faq-i { transition: none; }
}
