/* =====================================================================
   D - Content Block — generic rich-text block (Figma 10159:3723 /
   10159:3724 / 10159:3764). Heading (H2/H3) + optional rich body +
   optional list. Designed to be rendered ~20x per page via {{#each}}.
   Desktop locked to the 1240 content area; fluid below via --container.
   Tokens only.
   ===================================================================== */

.content-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--cb-gap);
  color: var(--cb-text);
  word-break: break-word;
  /* The FIRST content-block in a run follows a different section (a title-banner,
     stats band, etc.) which owns its own padding-block; without this the heading
     butts right against that section. Consecutive blocks reset it (rule below) and
     keep the tight --cb-block-gap rhythm instead. */
  padding-block-start: var(--cb-section-pad-top);
}

/* Vertical rhythm BETWEEN consecutive blocks. Each block is its own <section>,
   so the internal flex gap doesn't separate one block from the next — without
   this, a heading butts against the previous block's last paragraph. (Mobile
   separates blocks via padding-block, so this is reset there.) */
.content-block + .content-block { margin-top: var(--cb-block-gap); padding-block-start: 0; }
/* A content-block that ends the page needs bottom padding so it doesn't butt the footer. */
.content-block:last-child { padding-block-end: var(--cb-section-pad-top); }

/* ---- Heading (Axiforma Medium) ---- */
.content-block__heading {
  margin: 0;
  font-weight: var(--fw-medium);
  color: var(--cb-text);
}
.content-block__heading--h2 {
  font-size: var(--fs-32);
  line-height: var(--lh-45);
}
.content-block__heading--h3 {
  font-size: var(--fs-24);
  line-height: 1.2;
}
.content-block__heading--h4 {
  font-size: var(--fs-20);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
}

/* ---- Body (Axiforma Regular 16/normal); rich text via {{{raw}}} ---- */
.content-block__body {
  font-size: var(--fs-16);
  font-weight: var(--fw-regular);
  line-height: normal;
}
.content-block__body p {
  margin: 0 0 var(--cb-gap);
}
.content-block__body p:last-child {
  margin-bottom: 0;
}
/* Inline emphasis runs inside the body (e.g. lead term set in bold). */
.content-block__body strong,
.content-block__body b {
  font-weight: var(--fw-bold);
  font-size: var(--fs-18);
  line-height: var(--lh-25);
}
.content-block__body a {
  color: var(--dusty-blue);
  text-decoration: underline;
}

/* ---- Comparison tables (e.g. ETF tickers + expense ratios) ---- */
.content-block__body table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--cb-gap) 0;
  font-size: var(--fs-16);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-10);
  overflow: hidden;
}
.content-block__body th,
.content-block__body td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  line-height: var(--lh-25);
}
.content-block__body thead th {
  background: var(--pale-blue);
  font-weight: var(--fw-semibold);
  color: var(--gray-8);
}
.content-block__body tbody tr:last-child td { border-bottom: 0; }
.content-block__body tbody tr:nth-child(even) { background: var(--pale-blue); }
/* horizontal scroll for wide tables on small screens */
@media (max-width: 767.98px) {
  .content-block__body table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ---- Optional list ---- */
.content-block__list {
  display: flex;
  flex-direction: column;
  gap: var(--cb-list-gap);
  font-size: var(--fs-16);
  line-height: normal;
}
.content-block__item {
  position: relative;
  padding-left: var(--cb-bullet-pad);
}
.content-block__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: var(--cb-bullet-size);
  height: var(--cb-bullet-size);
  border-radius: 50%;
  background: var(--cb-text);
}

/* ---- Tablet (768–1023): step heading and section padding ---- */
@media (max-width: 1023.98px) {
  .content-block__heading--h2 {
    font-size: var(--fs-28);
    line-height: 1.3;
  }
  .content-block {
    padding-block-start: 48px;
  }
  .content-block:last-child {
    padding-block-end: 48px;
  }
}

/* =====================================================================
   Mobile — M - Content Block (Figma 10159:4439…) 360-wide.
   Block gap 10px, vertical pad 20px. H2 is the OG-Mobile H2 (26/36).
   Body stays 16px; the inline bold lead drops from 18px to 16px (mobile
   has no enlarged lead run). New tokens reported: --fs-26, --lh-36.
   ===================================================================== */
@media (max-width: 767.98px) {
  .content-block { gap: 10px; padding-block: 20px; }
  .content-block + .content-block { margin-top: 0; } /* padding-block already separates blocks */
  .content-block__heading--h2 { font-size: 26px; line-height: 36px; }
  .content-block__heading--h3 {
    font-size: clamp(20px, 5.6vw, var(--fs-24));
  }
  .content-block__body strong,
  .content-block__body b {
    font-size: var(--fs-16);
    line-height: normal;
  }
}

/* ---- Phone (≤599): restore last-child padding-block-end — matches main ≤599 ---- */
@media (max-width: 599.98px) {
  .content-block:last-child {
    padding-block-end: var(--cb-section-pad-top); /* 56px — tablet's 48px leaked via 1023.98 */
  }
}

/* =====================================================================
   Data-article extras (first used by the UK vaulted-gold cost comparison).
   Opt-in classes inside .content-block__body; existing articles unaffected.
   ===================================================================== */

/* Intro paragraphs one step larger than body copy */
.content-block__body .content-block__lede { font-size: var(--fs-18); line-height: var(--lh-25); }

/* Bold figure inside a table cell: keep the cell's size (body <strong> is 18px) */
.content-block__body .content-block__num { font-size: inherit; line-height: inherit; }

/* Horizontal bar chart: label | bar | value. Bar widths are set inline per row. */
.content-block__chart {
  margin: var(--cb-gap) 0;
  padding: clamp(16px, 2vw, 24px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-10);
  background: var(--gray-0);
  width: 100%;
}
.content-block__chart-title {
  margin: 0 0 12px;
  font-size: var(--fs-20);
  font-weight: var(--fw-semibold);
  color: var(--gray-8);
}
.content-block__chart-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.content-block__chart-row { display: grid; grid-template-columns: 180px 1fr 150px; align-items: center; gap: 12px; font-size: var(--fs-16); }
.content-block__chart-label { text-align: right; color: var(--gray-8); }
.content-block__chart-track { display: block; height: 28px; background: var(--pale-blue); border-radius: 4px; overflow: hidden; }
.content-block__chart-bar { display: block; height: 100%; background: var(--og-blue); border-radius: 4px; }
.content-block__chart-value { color: var(--gray-8); font-variant-numeric: tabular-nums; white-space: nowrap; }
.content-block__body .content-block__chart-note { margin: 8px 0 0; font-size: var(--fs-14); color: var(--gray-7); }

/* Cost table with "variable" vs "fixed" column groups, colour-banded */
.content-block__body .content-block__cost-table thead th { vertical-align: bottom; }
.content-block__body .content-block__cost-table tbody tr:nth-child(even) { background: transparent; }
.content-block__body .content-block__cost-table th.is-group { text-align: center; font-size: var(--fs-14); letter-spacing: 0.02em; }
.content-block__body .content-block__cost-table th.is-var { background: #d6ebfd; }
.content-block__body .content-block__cost-table th.is-fix { background: #dfe4ea; }
.content-block__body .content-block__cost-table td.is-var { background: #f0f7ff; }
.content-block__body .content-block__cost-table td.is-fix { background: #f3f5f7; }
.content-block__body .content-block__cost-table .is-plat { background: var(--gray-0); font-weight: var(--fw-semibold); }
.content-block__body .content-block__cost-table .is-var + .is-fix { border-left: 2px solid var(--gray-0); }

@media (max-width: 767.98px) {
  .content-block__body .content-block__lede { font-size: var(--fs-16); line-height: normal; }
  /* Chart stacks: label + value on one line, the bar full-width below */
  .content-block__chart-row { grid-template-columns: 1fr auto; gap: 4px 8px; }
  .content-block__chart-label { text-align: left; }
  .content-block__chart-track { grid-column: 1 / -1; grid-row: 2; height: 20px; }
  .content-block__chart-value { grid-column: 2; grid-row: 1; font-size: var(--fs-14); }
  /* The cost table's long BullionVault cell would make a very wide single line under
     the generic nowrap rule; let its cells wrap at a readable width instead. */
  .content-block__body .content-block__cost-table td,
  .content-block__body .content-block__cost-table th { white-space: normal; min-width: 150px; }
  .content-block__body .content-block__cost-table tbody td:nth-child(2) { min-width: 260px; } /* long trading-cost notes */
}
