@media only looks at the browser window. So the same card component gets identical styles whether it sits in a wide main area or a narrow sidebar, and it can visually break in the tight spot. @container instead styles based on how many pixels wide the box the card is actually sitting in really is.
Using it takes two steps: give the parent container-type: inline-size to declare "this is a query target," then in the child write @container (min-width: 400px) { … } against that container's width.
Because it makes true component-level responsiveness possible, it's often called one of the most practical additions to recent CSS. All major browsers supported it by 2023, so it's safe to use in production today.
When to use
Essential when a reusable card or widget has to sit in spots of different widths — main area, sidebar, modal. For whole-page layout switches, plain media queries are still simpler.