Recomputes a theme's per-stop worst-hue chroma caps from its own hues and
the palette lightness each stop resolves to, then emits palette_chroma_NN
overrides wherever the baked caps no longer fit - the fix for a theme
(rotated hues, a monochrome collapse, a moved lightness ramp) whose gamut
headroom the baked worst-hue table misjudges.
Each stop's cap is computed at the lightness the resolution core resolves
for palette_lightness_NN in that scheme - a pinned intermediate stop when
the theme pins one, the endpoint-and-curve ramp otherwise - so the caps
describe the same colors check_theme gates.
A stop is emitted when either scheme's recomputed cap is tighter than the
baked value, or looser by more than the emit epsilon, and the theme doesn't
already pin that stop. Nothing is emitted when a hue fails to resolve to a
number, since caps computed without it could overshoot its gamut, and a
stop whose lightness fails to resolve is skipped. An override emits both
slots together, so a one-scheme override can't silently kill the base
default's other slot by cascade-layer order, collapsing to a single slot
in the base position when the two rendered values coincide.
A stanced theme's two schemes resolve to the stanced appearance through the
mirror, so its caps are baselined against the stanced scheme's baked table -
the values the mirror already re-slots - and a stance alone (hues and
lightness unmoved) emits nothing. Its overrides coincide across schemes and
emit single-slot unless the theme authors a dark slot that splits them. A
stanced theme's scheme_mirror is recomputed over the emitted variables,
so the output is render-ready even when the input wasn't resolved.
The caps bound the requested chroma only: chroma_scale and the per-slot
*_chroma_scale multipliers apply above the clamp. A theme that raises one
past 1 clips by design - its gamut failures survive the compile, and a cap
the compile loosens can add to them, since the multiplier then pushes more
stops past the looser cap. The input theme is never mutated. The report
re-checks the emitted theme, whose compiled-cap overrides the resolution
core recognizes.