/* ───────────────────────────────────────────
   Content blocks
   Rendered by build.mjs from `:::name` markers in markdown.

   Monochrome by constraint, not by preference: the design tokens in global.css
   define a greyscale system, so these blocks separate by ICON, LABEL and RULE
   WEIGHT rather than by hue. That also means they stay legible in greyscale
   print and for colour-blind readers without a second code path.

   Mobile-first throughout. Every interactive target is >= 44px.
   ─────────────────────────────────────────── */

/* ── Token bridge ────────────────────────────────────────────────────────────
   This file arrived from another project and reads `--color-*`. NONE of those
   names exist in site.css, whose tokens are `--ink`, `--line`, `--surface-*`.
   Every var() below was therefore silently falling through to its hardcoded
   grey fallback, so the blocks rendered in a palette the rest of the site does
   not use (#111 instead of #1c1c1e, #5b5b5b instead of #55555c, and so on).

   Mapping them here rather than renaming 60 var() calls keeps this file a
   drop-in from the kit, and keeps site.css — the design system — untouched.

   `--color-border` does NOT map to `--line` (#ececee). That token is for
   hairlines between blocks of text on white; these blocks use their border as
   the visible edge of a container, and #ececee is invisible at that job. It
   maps instead to the same #d9d9de site.css already uses for form-field edges,
   which is the existing site's "this is a real boundary" grey.
   ──────────────────────────────────────────────────────────────────────────── */
:root {
  --color-text-primary: var(--ink, #1c1c1e);
  --color-text-secondary: var(--ink-3, #55555c);
  --color-surface: var(--surface-2, #f5f5f7);
  --color-bg: var(--surface, #ffffff);
  --color-border: #d9d9de;
}

/* ── Callouts (:::key :::tip :::warning :::money :::legal) ───────────────── */

.cb {
  margin: 1.75rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--color-border, #d1d5db);
  border-left-width: 4px;
  border-left-color: var(--color-text-primary, #111);
  border-radius: 0 10px 10px 0;
  background: var(--color-surface, #f5f5f5);
}

.cb-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-primary, #111);
}

.cb-icon {
  width: 0.9rem;
  height: 0.9rem;
  flex: none;
  fill: currentColor;
}

/* The callout owns its vertical rhythm, so the last paragraph must not add a
   trailing margin — otherwise every callout looks bottom-heavy. */
.cb-body > :last-child,
.cb-col > :last-child,
.cb-stat-note > :last-child {
  margin-bottom: 0;
}

.cb-body > :first-child {
  margin-top: 0;
}

/* `warning` is the one that must not be missed: solid dark, inverted. */
.cb--warning {
  background: var(--color-text-primary, #111);
  border-color: var(--color-text-primary, #111);
  color: #fff;
}
.cb--warning .cb-label {
  color: #fff;
}
.cb--warning .cb-body,
.cb--warning .cb-body :where(p, li, td, th) {
  color: rgba(255, 255, 255, 0.88);
}
.cb--warning .cb-body :where(strong) {
  color: #fff;
}
.cb--warning .cb-body :where(a) {
  color: #fff;
}

/* `key` is the quiet emphasis: no fill, heavier rule. */
.cb--key {
  background: transparent;
  border-left-width: 5px;
}

/* ── Two-up columns (::::columns + :::col) ───────────────────────────────── */

.cb-cols {
  display: grid;
  gap: 0.5rem 2rem;
  margin: 1.75rem 0;
}

@media (min-width: 768px) {
  .cb-cols {
    grid-template-columns: 1fr 1fr;
  }
}

/* Stacked on mobile, two columns are just two paragraphs — so give the second
   one a rule to show the split was intentional. */
.cb-col + .cb-col {
  padding-top: 1rem;
  border-top: 1px solid var(--color-border, #d1d5db);
}

@media (min-width: 768px) {
  .cb-col + .cb-col {
    padding-top: 0;
    border-top: 0;
  }
}

/* A heading inside a column should not inherit the full 2rem section gap. */
.cb-col :where(h2, h3, h4):first-child {
  margin-top: 0;
  font-size: 1rem;
}

/* ── Numbered steps (:::steps) ───────────────────────────────────────────── */

.cb-steps {
  margin: 1.75rem 0;
  counter-reset: cb-step;
}

.cb-steps ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cb-steps ol > li {
  counter-increment: cb-step;
  position: relative;
  margin: 0 0 1rem;
  padding: 0 0 0 2.75rem;
  min-height: 1.9rem;
}

.cb-steps ol > li::before {
  content: counter(cb-step);
  position: absolute;
  left: 0;
  top: -0.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: var(--color-text-primary, #111);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ── Tickable checklist (:::checklist) ───────────────────────────────────── */

.cb-check {
  margin: 1.75rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 12px;
  background: var(--color-bg, #fff);
}

.cb-check-title {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text-primary, #111);
}

.cb-check-progress {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary, #5b5b5b);
}

.cb-check ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cb-check ul > li {
  margin: 0;
  border-top: 1px solid var(--color-border, #d1d5db);
}

.cb-check ul > li:first-child {
  border-top: 0;
}

/* The whole row is the hit area, comfortably past the 44px minimum. */
.cb-check label {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-height: 44px;
  padding: 0.6rem 0;
  cursor: pointer;
  line-height: 1.55;
}

.cb-check input[type="checkbox"] {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  accent-color: var(--color-text-primary, #111);
}

.cb-check input:checked + span {
  color: var(--color-text-secondary, #5b5b5b);
  text-decoration: line-through;
}

.cb-check-reset {
  margin-top: 0.75rem;
  min-height: 44px;
  padding: 0 0.25rem;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.75rem;
  color: var(--color-text-secondary, #5b5b5b);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ── Pull statistic (:::stat) ────────────────────────────────────────────── */

.cb-stat {
  margin: 1.75rem 0;
  padding: 1.1rem 1.25rem;
  border-top: 2px solid var(--color-text-primary, #111);
  border-bottom: 1px solid var(--color-border, #d1d5db);
  background: var(--color-surface, #f5f5f5);
}

.cb-stat-value {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-primary, #111);
}

.cb-stat-label {
  margin: 0.3rem 0 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-primary, #111);
}

.cb-stat-src {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--color-text-secondary, #5b5b5b);
}

.cb-stat-note {
  margin-top: 0.6rem;
  font-size: 0.9375rem;
}

.cb-stat-note:empty {
  margin-top: 0;
}

/* ── Figures (:::figure) ─────────────────────────────────────────────────── */

.cb-fig {
  margin: 1.75rem 0;
}

.cb-fig-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: var(--color-surface, #f5f5f5);
}

.cb-fig-cap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  justify-content: space-between;
  margin-top: 0.55rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--color-text-secondary, #5b5b5b);
}

.cb-fig-text {
  flex: 1 1 14rem;
}

/* Attribution is not decoration — it is the licence condition. Never hide it. */
.cb-fig-credit {
  flex: none;
  opacity: 0.8;
}

.cb-fig-cap a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Tables (wrapped automatically by the plugin) ────────────────────────── */

.cb-tbl {
  /* Scrolls inside its own box. The PAGE must never scroll sideways. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.75rem 0;
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 12px;
}

.cb-tbl table {
  width: 100%;
  min-width: 30rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.cb-tbl :where(th, td) {
  padding: 0.7rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border, #d1d5db);
  line-height: 1.55;
}

.cb-tbl thead th {
  position: sticky;
  top: 0;
  background: var(--color-text-primary, #111);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.cb-tbl tbody tr:last-child :where(th, td) {
  border-bottom: 0;
}

.cb-tbl tbody tr:nth-child(even) {
  background: var(--color-surface, #f5f5f5);
}

/* First column carries the row's identity — keep it readable while scrolling. */
.cb-tbl tbody :where(td, th):first-child {
  font-weight: 600;
  color: var(--color-text-primary, #111);
}

/* ── Build-time errors ───────────────────────────────────────────────────── */

/* Loud on purpose. A missing image credit or an uncited pulled stat should be
   impossible to miss in review — far better than shipping it quietly. */
.cb-err {
  outline: 2px dashed #b91c1c;
  outline-offset: 2px;
  color: #b91c1c !important;
  font-weight: 700;
}

