.card.inverted
The card consumes --ui-*, so it inverts as a surface.
Surface contracts
.inverted creates a contrasting surface context. Bare
content and transparent treatments follow its foreground; components
with their own surface keep it unless the treatment is applied directly
to a component that consumes --ui-*. Use
data-theme when a whole subtree needs another theme.
.inverted works on any block. The base paint flips the
background and foreground; headings follow through --heading.
This is a bare <header class="inverted">. Text and headings inherit the contrasting foreground.
Components that consume the shared --ui-* surface contract
invert as a whole when .inverted is on them.
The card consumes --ui-*, so it inverts as a surface.
The alert composes through --ui-* too.
A compact component with the treatment applied directly:
.inverted paints the base surface and remaps the tokens,
but explicit variants and component states outrank it by specificity.
.card.subtle (0,2,0) beats the base paint, and an active
.nav-link keeps its own chip.
The whole surface inverts.
Competing treatments — do not combine. Shown here to
fix precedence: .subtle keeps the background while the
foreground stays inverted.
The active .nav-link[aria-current] keeps its explicit chip on
an inverted navbar — a more specific state outranks the base paint.
Surface-owning components reset --ui-* with a
:where() boundary. Their own surface stops the contrasting
treatment; transparent descendants then follow that local foreground.
Use data-theme="dark", data-theme="light", or a
named theme when every surface, form control, intent, and state in a
subtree must use another palette. .inverted is deliberately
narrower: it creates one contrasting surface context.