The problem
A card component is used twice on the same page. The page grid gives the sidebar 250px and the main column the rest, 700px. With no layout rules yet, both cards stack the image above the text.
@media (min-width: 600px) asks about the viewport, the browser window. It is 1000px wide, so the answer is yes for both cards. Both go side by side, and the sidebar card is squashed: the window cannot tell a narrow slot from a wide one.
Container queries
Swap @media for @container, and give each .slot container-type: inline-size. Each slot becomes a query container: the browser tracks its inline size, its width in horizontal text. The sidebar is 250px, the main column 700px.
@container (min-width: 400px) asks the card's nearest ancestor that is a container, not the window. The sidebar card asks its slot: 250px is under 400px, so no. The main card asks its slot: 700px, so yes.
.card { display: flex; } applies only where the answer was yes. The main card puts its 160px image beside the text. The sidebar card stays stacked. Same HTML, same CSS, two layouts, each right for its space.
Resizing
Now the grid gives the sidebar 450px; the main column shrinks to 500px. The window is still 1000px wide. The sidebar slot passes 400px, its card's query now says yes, and the card goes side by side. A media query would not notice.
container-type also turns on inline-size containment: the slot's width cannot depend directly on its contents. So when the card changes layout, the slot stays 450px and the answer cannot flip back. A query styles what is inside a container, never the container itself.
What happens
;; step 1/7 · one-card window 1000px wide .page grid: 250px 1fr, gap 50px <aside class="slot"> 250px <main class="slot"> 1000 - 250 - 50 = 700px each slot holds the same <article class="card"> no query rules yet: both cards stacked
A real browser does all of this at once, every time it lays out the page: it finds each container, sizes it, answers the queries and applies the matching rules. The figure does it one step at a time so you can see each part. The page drawing is to scale across (1000px of window) but approximate in height. The cards in the figure show only the lines that matter; the full style.css also sets body { margin: 0; }, the image size (120px tall, flex: 0 0 160px beside the text) and the text padding.