The right mental model
Think of `:has()` as a boolean condition applied to the current element.
In `.card:has(img)`, you are not selecting the image. You are selecting the card if it contains an image. That changes the way CSS can reason about structure, because now the container can react to what happens inside it.
In forms, `:has()` enables broader state rules such as `form:has(:invalid)` or `.field:has(input:focus)`. The result is less JavaScript and fewer temporary state classes.
- Select parents based on content or internal state.
- Build visual feedback without depending on JavaScript events.
- Reduce helper classes and keep HTML cleaner.