/* Code chips (bsa-codes.mjs → codeChip). One shape per kind of thing, the code in monospace, then name and place.
   Colour: the BSA palette only (navy ink, slate edges, orange only for 待核实). Kinds differ by SHAPE, never by hue, so
   the chip reads the same on paper, on dark and in a black-and-white print. Opaque fills, no blur, no gradient.
   Tokens fall back to the palette's own values; --bsa-* come from bsa-buttons.css when it is loaded. */
:root {
  --bsa-code-ink: var(--bsa-ink, #011b3e);
  --bsa-code-sub: #334155;
  --bsa-code-fill: var(--bsa-fill, #fdfcfa);
  --bsa-code-edge: #64748b;
  --bsa-code-shape: #295579;
  --bsa-code-warn: #ba4310;
  --bsa-code-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.bsa-code {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 2px 8px 2px 6px;
  border: 1px solid var(--bsa-code-edge);
  border-radius: 6px;
  background: var(--bsa-code-fill);
  color: var(--bsa-code-ink);
  font: inherit;
  font-size: 0.875em;
  line-height: 1.35;
  text-align: left;
  vertical-align: baseline;
}
button.bsa-code { cursor: help; }
button.bsa-code:focus-visible { outline: 2px solid var(--bsa-code-ink); outline-offset: 2px; }
.bsa-code__shape { flex: none; color: var(--bsa-code-shape); }
.bsa-code__id {
  flex: none;
  font-family: var(--bsa-code-mono);
  font-weight: 600;
  font-variant-numeric: slashed-zero;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
/* 0 and O, 1 and I never look alike: a slashed zero, an I with bars. */
.bsa-code__zero { position: relative; display: inline-block; font-style: normal; }
.bsa-code__zero::after { content: ''; position: absolute; left: 14%; right: 14%; top: 50%; border-top: 1.5px solid currentColor; transform: rotate(-62deg); }
.bsa-code__letter-i { padding: 0 0.12em; border-top: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; font-style: normal; line-height: 1; }
.bsa-code__letter-o { font-style: normal; font-weight: 700; }
.bsa-code__name, .bsa-code__location, .bsa-code__size { min-width: 0; color: var(--bsa-code-sub); white-space: nowrap; }
.bsa-code__name { color: var(--bsa-code-ink); }
.bsa-code__location::before, .bsa-code__size::before, .bsa-code__name::before { content: '·'; margin-right: 6px; color: var(--bsa-code-edge); }
/* Worked out from a drawing or from model positions, not printed on the thing: shown, but marked 待核实. */
.bsa-code__derived { color: var(--bsa-code-warn); text-decoration: underline dotted; text-underline-offset: 3px; }
.bsa-code[data-code-derived] { background: var(--bsa-code-fill); border-color: var(--bsa-code-edge); }
.bsa-code[data-code-length='short'] { padding-right: 6px; }
.bsa-code--suggested { border-style: dashed; }
@media (forced-colors: active) {
  .bsa-code { border-color: CanvasText; }
  .bsa-code__derived { color: LinkText; }
}
