/*
 * Tables and fixed-width blocks inside question text (problems/statement.py).
 * Needs tokens.css. Values follow design_system/component_system.md §7 (tables)
 * and typography_system.md §4 (data cells, overline headers, mono blocks).
 */

/* ── Pipe tables ─────────────────────────────────────────────────────────── */

/* The wrapper scrolls sideways on narrow screens; tabindex lets keyboard users scroll it. */
.stmt-table-wrap {
  max-width: 100%;
  margin: var(--bb-space-3) 0;
  overflow-x: auto;
  border: 1px solid var(--bb-border);
  border-radius: var(--bb-radius-xs);
}

.stmt-table-wrap:focus-visible {
  outline: 2px solid var(--bb-focus-ring);
  outline-offset: 2px;
}

.stmt-table {
  width: auto;
  min-width: 50%;
  border-collapse: collapse;
  color: var(--bb-text);
  font-family: var(--bb-font-sans);
  font-size: var(--bb-fs-body);
  line-height: 22px;
  /* Some statement boxes allow breaking anywhere; table cells should break between words. */
  overflow-wrap: normal;
}

.stmt-table th {
  padding: var(--bb-space-2) var(--bb-space-3);
  background: var(--bb-surface-subtle);
  color: var(--bb-text-secondary);
  font-size: var(--bb-fs-overline);
  font-weight: var(--bb-weight-semibold);
  line-height: 16px;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.stmt-table td {
  padding: var(--bb-space-2) var(--bb-space-3);
  border-top: 1px solid var(--bb-border);
  text-align: left;
  vertical-align: top;
}

/* Numbers are right-aligned and use even-width digits. */
.stmt-table td.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ── Box tables and ``` blocks: shown exactly as typed ───────────────────── */

.stmt-pre {
  max-width: 100%;
  margin: var(--bb-space-3) 0;
  padding: var(--bb-space-3);
  overflow-x: auto;
  background: var(--bb-surface-subtle);
  border-radius: var(--bb-radius-xs);
  color: var(--bb-text);
  font-family: var(--bb-font-mono);
  font-size: var(--bb-fs-body-sm);
  line-height: 20px;
  white-space: pre;
  overflow-wrap: normal;
}
