body {
  font-family: system-ui, sans-serif;
  margin: 2rem;
}

.wrap {
  container-type: inline-size;
  margin-block-end: 2rem;
  border: 1px dashed #ccc;
  padding: 1rem;
}

.wrap--narrow {
  max-width: 20rem;
}

.wrap--wide {
  max-width: 40rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #eee;
  border-radius: 0.5rem;
  overflow: hidden;
}

.thumb {
  background: #30a6e6;
  aspect-ratio: 16 / 9;
}

.body {
  padding: 1rem;
}

.body h2 {
  margin: 0 0 0.5rem;
}

.body p {
  margin: 0;
}

/* Container-Query statt Media-Query: dieselbe .card-Komponente layoutet
   anders, je nachdem wie breit ihr eigener Container ist — nicht wie breit
   der Viewport ist. So funktioniert die Karte identisch in einer schmalen
   Sidebar und einem breiten Hauptbereich, ohne zwei Varianten zu pflegen. */
@container (width > 28rem) {
  .card {
    flex-direction: row;
  }

  .thumb {
    flex: 0 0 40%;
    aspect-ratio: auto;
  }

  .body {
    flex: 1;
  }
}
