/* Core Business Check: only what shell.css lacks. Palette and faces come from shell.css tokens. */

/* Form: the "if you can't split your marketing" group under the two marketing fields, a Soft Mint tile (A1).
   Cool Gray fails 4.5:1 on mint, so its notes use Deep Plum. */
.cbc-alt { margin-top: 24px; padding: 24px; border-radius: var(--radius-tile); background: var(--soft-mint); }
.cbc-alt__title { font-weight: 500; font-size: 1.125rem; margin: 0 0 4px; }
.cbc-alt > .field-help { margin-bottom: 16px; }
.cbc-alt .field-help, .cbc-alt .field-optional { color: var(--deep-plum); }
.cbc-flow-help { margin: 0 0 16px; }

/* Verdict: the two tests as plain lines, each with a dot (the words say pass or fail, so colour is never alone) */
.cbc-tests { list-style: none; margin: 18px 0 16px; padding: 0; display: grid; gap: 8px; }
.cbc-tests li + li { margin-top: 0; }
.cbc-tests li { display: flex; gap: 12px; align-items: baseline; font-weight: 500; }
.cbc-tests li::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--deep-teal); transform: translateY(-1px); }
.cbc-tests li.is-fail::before { background: var(--amber); }
.cbc-tests li.is-unknown::before { background: var(--lavender-gray); }
.verdict__sub.cbc-add { font-size: 0.9375rem; }

/* Charts: one white card each, stacked on screen (the 920px column is too narrow for two 36px card headings side by
   side); side by side again in print. The chart title is the card heading, with its 56px icon to the left. */
.cbc-charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--card-gap); }
.cbc-charts--one { grid-template-columns: minmax(0, 1fr); }
.results-body .cbc-charts > * + *, .cbc-charts > .card + .card { margin-top: 0; }
.bar-fixed { fill: var(--lavender-gray); }
.swatch.bar-fixed { background: var(--lavender-gray); }
.cbc-chart-card .chart-title.cbc-chart-head {
  display: flex; align-items: center; gap: 16px; margin: 0 0 24px;
  font-family: var(--font-display); font-weight: 500; font-size: clamp(1.8125rem, 1.45rem + 1.1vw, 2.25rem);
  line-height: 1.1; letter-spacing: -0.005em; text-wrap: balance;
}
.cbc-chart-head > .card-head__icon { flex: none; }
/* The two bar charts (drawn in core-business-check.js): labels and values at body size, as in A1. */
.cbc-svg .cbc-row-label { font-size: 16px; }
.cbc-svg .cbc-value { font-size: 16px; }
.cbc-svg .chart-tick { font-size: 13px; }

/* Key numbers: 5 to 7 tiles. The shell's auto-fit grid left 7 tiles as 4 + 3 with an empty slot and rows of
   different heights. Here every row is filled edge to edge (7 = 4 + 3 wider, 6 = 3 + 3, 5 = 3 + 2) and rows match. */
@media screen and (min-width: 641px) {
  .key-numbers { grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 1fr; }
  .key-numbers > .stat { grid-column: span 4; }
  .key-numbers:has(> .stat:nth-child(5)):not(:has(> .stat:nth-child(6))) > .stat:nth-child(n+4),
  .key-numbers:has(> .stat:nth-child(7)) > .stat:nth-child(n+4) { grid-column: span 6; }
}
@media screen and (min-width: 860px) {
  .key-numbers:has(> .stat:nth-child(7)) > .stat:nth-child(-n+4) { grid-column: span 3; }
  .key-numbers:has(> .stat:nth-child(7)) > .stat:nth-child(n+5) { grid-column: span 4; }
}

/* What would change the result (a white card with its icon heading) */
.cbc-intro { margin-bottom: 8px; max-width: 48rem; }
.cbc-change { margin-top: 32px; }
.cbc-change h4 { font-size: 1.125rem; margin-bottom: 2px; }
.cbc-change > .small { margin-bottom: 8px; }
.cbc-change-table th[scope="row"] { min-width: 12rem; }
.cbc-sub { display: block; white-space: normal; font-size: 0.8125rem; color: var(--cool-gray); max-width: 15rem; margin-left: auto; }
.cbc-status { color: var(--cool-gray); }
.cbc-badge {
  display: inline-block; margin-left: 8px; padding: 1px 10px; border-radius: 999px;
  background: var(--soft-mint); color: var(--forest-dark); font-size: 0.8125rem; font-weight: 500; white-space: nowrap;
}
.cbc-row--star th, .cbc-row--star td { background: rgba(199, 235, 225, 0.35); }
.cbc-change-table .cbc-row--star th:first-child { padding-left: 10px; }
.cbc-change-table .cbc-row--star td:last-child { padding-right: 10px; }

/* Full numbers: a collapsed white card holding the waterfall, styled like "How this works" */
details.cbc-full { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 var(--card-pad); }
details.cbc-full > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 44px; padding-block: 28px; color: var(--deep-plum);
  font-family: var(--font-display); font-weight: 500; font-size: clamp(1.8125rem, 1.45rem + 1.1vw, 2.25rem); line-height: 1.1;
}
details.cbc-full > summary::after {
  content: ""; flex: none; width: 12px; height: 12px;
  border-right: 2px solid var(--deep-teal); border-bottom: 2px solid var(--deep-teal);
  transform: rotate(45deg) translate(-3px, -3px); transition: transform 0.2s ease;
}
details[open].cbc-full > summary::after { transform: rotate(-135deg) translate(-3px, -3px); }
.cbc-full__body { padding-bottom: var(--card-pad); }

/* Customer base flow */
.cbc-reading { font-weight: 500; font-size: 1.125rem; }
.cbc-flow-note { margin-bottom: 16px; }
.cbc-flow--muted .cbc-reading, .cbc-flow--muted .data-table, .cbc-flow--muted .data-table th { color: var(--cool-gray); }
.cbc-flow--muted .card-head__icon { opacity: 0.5; }

/* What to do next: mint steps inside the card (shell), the reason under them, then the hand-off text link */
.cbc-why { color: var(--cool-gray); max-width: 48rem; margin-top: 20px; }

@media (max-width: 640px) {
  .cbc-alt { padding: 20px 16px; }
  .cbc-chart-card .chart-title.cbc-chart-head { gap: 12px; margin-bottom: 20px; }
  .cbc-chart-head > .card-head__icon { width: 48px; height: 48px; }
  /* Phones: each change row stacks, with its column name beside each value, so nothing scrolls sideways. */
  .cbc-change-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .cbc-change-table, .cbc-change-table tbody, .cbc-change-table tr, .cbc-change-table th, .cbc-change-table td { display: block; width: auto; }
  .cbc-change-table tr { padding: 12px 0; border-bottom: 1px solid rgba(188, 182, 206, 0.6); }
  .cbc-change-table tbody th, .cbc-change-table td { border: 0; padding: 2px 0; }
  .cbc-change-table tbody th { margin-bottom: 4px; min-width: 0; }
  .cbc-change-table td.num { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; text-align: right; white-space: normal; }
  .cbc-change-table td.num::before { content: attr(data-label); color: var(--cool-gray); text-align: left; margin-right: auto; }
  .cbc-change-table td.cbc-status { padding-top: 4px; }
  .cbc-row--star th, .cbc-row--star td { background: none; }
  .cbc-row--star { background: rgba(199, 235, 225, 0.35); border-radius: 10px; }
  .cbc-change-table tr.cbc-row--star > th, .cbc-change-table tr.cbc-row--star > td { padding-left: 12px; padding-right: 12px; }
  .cbc-sub { flex-basis: 100%; max-width: none; text-align: right; }
  .cbc-badge { margin-left: 0; }
}

@media (min-width: 641px) {
  /* In the 920px column a long change ("−3.8 points (−7.3%)") leaves no room for the badge beside it: the badge
     sits under the figure, right-aligned, so the table never needs to scroll. */
  .cbc-change-table .cbc-badge { display: block; width: fit-content; margin: 6px 0 0 auto; }
  /* The two change tables share column widths so their numbers line up. */
  .cbc-change-table { table-layout: fixed; }
  .cbc-change-table th:nth-child(1) { width: 36%; }
  .cbc-change-table th:nth-child(2) { width: 16%; }
  .cbc-change-table th:nth-child(3) { width: 24%; }
  .cbc-change-table th:nth-child(4) { width: 24%; }
}

@media print {
  .verdict__headline { font-size: 12pt; margin-bottom: 4pt; }
  .verdict__sub { font-size: 9.5pt; line-height: 1.35; }
  .stat__label { line-height: 1.25; }
  .cbc-tests { margin: 4pt 0 0; gap: 1pt; }
  .key-numbers { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4pt; }
  .stat { padding: 4pt 6pt; border-radius: 6pt; }
  .stat__value { font-size: 11pt; }
  .stat__label { font-size: 7.5pt; line-height: 1.3; }
  .cbc-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6pt; }
  .cbc-charts--one { grid-template-columns: minmax(0, 1fr); }
  .cbc-charts .card { padding: 6pt 8pt; }
  .cbc-charts > .card + .card { margin-top: 0; }
  .cbc-chart-card .chart-title.cbc-chart-head { font-family: var(--font-text); font-size: 9.5pt; font-weight: 500; gap: 6pt; margin-bottom: 4pt; }
  .cbc-chart-head > .card-head__icon { width: 16pt; height: 16pt; }
  .cbc-why { margin-top: 4pt; }
  .cbc-charts .data-table th, .cbc-charts .data-table td { padding: 1.5pt 4pt; }
  .cbc-charts .data-table caption { padding-bottom: 2pt; }
  .results-body > * + * { margin-top: 5pt; }
  .verdict { padding: 6pt 12pt; }
  .next-step, .card .next-step { padding: 4pt 8pt; border-radius: 6pt; font-size: 9pt; line-height: 1.35; border: 0; }
  .next-step p { font-size: 9pt; }
  /* The A1 card heads and padding cost about a third of a page in print; keep the summary to one page. */
  .results .card { padding: 6pt 10pt; }
  .card-head { margin-bottom: 4pt; gap: 6pt; }
  .card-head__icon { width: 16pt; height: 16pt; }
  .card-head .card-title { font-family: var(--font-text); font-size: 10.5pt; font-weight: 500; }
  .cbc-charts .chart-table caption { display: none; }
  .cbc-svg .cbc-row-label, .cbc-svg .cbc-value { font-size: 11px; }
  .cbc-svg .chart-tick { font-size: 9px; }
  .cbc-charts { align-items: start; }
  main > * + * { margin-top: 6pt; }
  .results-body > * + * { margin-top: 4pt; }
  .verdict__sub { font-size: 9pt; }
  .print-title { font-size: 16pt; }
  .print-sub { margin-bottom: 6pt; }
  .next-step h4 { font-size: 9.5pt; margin-bottom: 1pt; }
  .next-steps > * + * { margin-top: 4pt; }
  .cbc-why { font-size: 8pt; }
  .cbc-charts .data-table th, .cbc-charts .data-table td { font-size: 8.5pt; }
}
