/* ==========================================================================
   shared/bws-chips.css — THE CHIP / PILL / BADGE COMPONENT'S TOKENS (P2042)
   --------------------------------------------------------------------------
   docs/design-system-plan-2026-09-10.md §4c names Chip/pill and Badge as
   component pieces; §6's P2042 row scopes this piece to two things: (1) a
   shared token vocabulary a chip/pill/badge control reads, following
   shared/bws-buttons.css's own shape exactly, and (2) resolving the `.pill`
   naming collision the plan's own recon found — `.pill` meant the
   marketing feature-list chip on stackdesign-home.html AND the per-tab
   count badge on modules/cut-list-optimizer/cut-list-optimizer.html, two
   unrelated meanings sharing one class name across the two adopting pages.
   cut-list-optimizer.html's meaning is renamed to `.tab-badge`;
   stackdesign-home.html keeps `.pill` for its own (the one this file's
   tokens are literally named after).

   TOKENS ONLY — this file declares no selector that paints an element.
   Every visual rule stays where the markup already is. A page adopts this
   component by rewriting ITS OWN existing selectors to read these custom
   properties, each with the page's original literal kept as the var()
   fallback — so a page never repaints if this file is ever missing or
   fails to load, and the piece ships with a hard "no measured change"
   guarantee instead of asking anyone to trust a diff. See:
     - modules/cut-list-optimizer/cut-list-optimizer.html's `.tab-badge`
       rule (the renamed tab-count meaning; mapping layer, source of the
       sm size tier)
     - stackdesign-home.html's `.pill` rule (the marketing feature-list
       chip; mapping layer, source of the md size tier)
     - docs/design-system/components/chip-pill.md and badge.md (the filled
       component pages)
     - tests/bws-chips.test.cjs (pins this file's own declared tokens, the
       two pages' mapping layers, the link include order, and the measured
       boundary contrast against a fixture parent in both themes)

   WHAT "NO MEASURED CHANGE" ACTUALLY MEANS HERE, STATED PLAINLY SO IT IS
   NEVER READ AS MORE THAN IT IS: the two controls this piece adopted -
   `.tab-badge` above and `.pill` above - keep their PRE-EXISTING,
   already-ratcheted look, unchanged, on purpose. Neither one consumes
   --chip-neutral-bg/-border/-fg, --chip-border-width or --chip-ring-inset
   (below); `.tab-badge`'s own background is a carried, under-3:1 offender
   in tests/control-surface-contrast-floor.json today, exactly as `.pill`
   (its collision partner) was before the rename, and this piece did not
   touch that number - fixing it would have been a real visual change,
   which this piece's own bar (zero measured change) rules out. The
   boundary/ring/neutral-variant tokens below exist for the NEXT chip - a
   future colour-coded variant, or a follow-up piece that gives
   `.tab-badge` its own real 3:1 fix - not for either control this piece
   shipped. That follow-up is filed separately (the records lane's job,
   not this commit's).

   Requires shared/theme.css to be linked first (for --accent/--gold/
   --radius-pill/etc.). Link this file after theme.css (and after
   shared/bws-buttons.css where that file is also present) in every page's
   <head> (docs/page-scaffold.html).

   WHY THIS FILE STAYS OUT OF THE PLACEMENT/GROUP/RUN COLOUR FAMILY. The
   Systainer planner's state-coloured chips (`.shelf-pref-chip`/
   `.box-pri-pill`'s `chip-place-*`/`chip-group-*`/`chip-run-*` classes,
   modules/festool-systainer-cabinet-width/systainer-bank.html) are a
   distinct, already-built colour vocabulary with their own hue-separation
   floor (rules.md R-04/R-11) and their own live palette table
   (docs/design-system/stackdesign-placement-priority.md). systainer-
   bank.html is pinned/read-only for this piece, and that page's own
   comment trail already documents why (a light-anchor hue wheel that is
   fully packed, an inversion trick for the DARK tier). Migrating that
   family into this shared file is real, scoped work for a later piece,
   not a rename this one should absorb — see that doc's own note. This
   file's tokens cover the STRUCTURAL half every chip needs (size, boundary,
   motion, glyph spacing) plus the one NEUTRAL colour variant this piece
   actually ships; a page that needs a colour-coded state family keeps
   building it the way the planner already does, on top of these same
   structural tokens.
   ========================================================================== */
:root{
  /* ---- Size scale: sm / md — padding, type, weight, radius ----
     sm is HARVESTED from modules/cut-list-optimizer/cut-list-optimizer.html's
     shipped `.tab .pill` rule (now `.tab .tab-badge` — the collision this
     piece renames); md is HARVESTED from stackdesign-home.html's shipped
     `.pill` rule. Both are pre-existing, already-shipped literals, not
     invented numbers — the same "harvest the best existing pattern" rule
     shared/bws-buttons.css's own header documents. */
  --chip-pad-y-sm: 1px;
  --chip-pad-x-sm: 8px;
  --chip-fs-sm: 0.7rem;
  --chip-weight-sm: 800;
  --chip-radius-sm: 999px;

  --chip-pad-y-md: 8px;
  --chip-pad-x-md: 15px;
  --chip-fs-md: 0.85rem;
  --chip-weight-md: 700;
  --chip-radius-md: var(--radius-pill, 999px);   /* stackdesign-home.html's own `.pill` already reads var(--radius-pill, 999px) verbatim; kept as the same expression here so the fallback chain stays identical either way */

  --chip-min-target: 24px;   /* WCAG 2.2 SC 2.5.8 floor for an INTERACTIVE chip. Neither of this piece's two adopted controls is independently clickable today (the tab-badge lives inside its own already-24px+ <button class="tab">; the marketing `.pill` is decorative), so nothing here needs the extender yet — this token and --chip-ring-inset below exist for the next chip that IS clickable on its own, the same way .box-pri-pill's own ::before inset already solves it on the (pinned, untouched) planner. */

  /* ---- Motion / interaction state ----
     One shared shape across every chip on the site, matching what
     .shelf-pref-chip/.box-pri-pill already ship (systainer-bank.html,
     read-only reference for this piece) — a brightness lift on hover,
     never a translucent-wash swap (that was P2027's own fix, and a new
     chip family should not have to relearn it), and the same focus ring
     and disabled opacity shared/bws-buttons.css already standardized on. */
  --chip-hover-filter: brightness(1.06);
  --chip-disabled-opacity: 0.45;
  --chip-focus-ring-width: 2px;
  --chip-focus-ring-color: var(--gold);
  --chip-focus-ring-offset: 1px;

  /* ---- Boundary (rules.md R-01) ----
     A chip's own fill OR its own border/ring must read at least 3:1
     against the surface it sits on, in every theme — text contrast alone
     never proves it. Two shapes are both valid, whichever the caller's own
     box can afford: a real 1px border (`.shelf-pref-chip`'s shape) or a
     same-width inset box-shadow ring (`.box-pri-pill`'s shape, for a chip
     too small or positioned to spend a real border without moving other
     pixels). --chip-ring-inset is the invisible hit-area extender for a
     CLICKABLE chip under the 24px target (`.box-pri-pill::before`'s own
     figure); see the min-target note above for why neither adopted
     control needs it turned on yet. */
  --chip-border-width: 1px;
  --chip-ring-inset: -6px;

  /* ---- Glyph slot (R-04/R-11) ----
     A state-carrying chip's colour difference is never the only cue — it
     also carries a small leading or trailing glyph, and this is the
     spacing around that glyph. The glyph's own shape and any state's
     actual colour choice stay with the caller; the placement/group/run
     state family stays page-local for now (see the header note above and
     docs/design-system/stackdesign-placement-priority.md for the why). */
  --chip-glyph-gap: 4px;

  /* ---- Neutral/default variant — the one colour family this piece ships.
     Promoted from `.shelf-pref-chip`'s own P2027-fixed triple
     (docs/design-system/components/chip-pill.md's "best existing pattern
     to promote"): a light fill against a dark ink border/text pair. The
     pack's own later measured table (docs/design-system/PORTABLE-PACK/
     components.md, "Known gap: neither adopted control clears this
     pack's own boundary floor either") shows this pair clears the 3:1
     R-01 boundary by fill OR border individually in each theme (border
     in Linen, fill in Midnight Oak), never by the same channel in both
     themes at once - not the blanket "compliant" this comment used to claim.
     These alias the SAME theme.css tokens `.shelf-pref-chip` reads
     (--gold-soft/--walnut-line/--walnut-deep) — never a new colour — so
     this variant carries zero palette decisions of its own and repaints
     for free if theme.css's palette ever moves. P2081 gave both this
     piece's own adopted controls their real R-01 boundary by moving them
     onto this exact variant: stackdesign-home.html's `.pill` and
     modules/cut-list-optimizer/cut-list-optimizer.html's `.tab .tab-badge`
     / `.tab.on .tab-badge` all now read fill/border/text from these three
     custom properties (each with its own prior literal kept as the var()
     fallback, per the mapping-layer rule below) - this is no longer a
     variant waiting for its first consumer. tests/bws-chips.test.cjs
     measures this pair's actual boundary contrast against a fixture parent
     AND the WCAG 1.4.3 text contrast of --chip-neutral-fg on
     --chip-neutral-bg, in both themes; tests/p2081-chip-boundaries.test.cjs
     measures both real consumers' own real fill-or-border-vs-container
     contrast, live in Chromium. */
  --chip-neutral-bg: var(--gold-soft);
  --chip-neutral-border: var(--walnut-line);
  --chip-neutral-fg: var(--walnut-deep);
}
