See exactly what cn() keeps and what it throws away when a caller's className meets a component's own classes, with the losing classes listed.
rounded-lg py-2 font-medium text-primary-foreground bg-destructive px-6 text-base
It joins class strings with clsx, then hands the result to tailwind-merge, which knows which utilities belong to the same group and keeps only the last one in each. That is why a caller can pass bg-destructive and beat the component's own bg-primary without any !important.
Because a later class claimed the same group. px-6 beats px-4, text-base beats text-sm, and both of those beat nothing else. The list of dropped classes on this page names every one it removed and the order that decided it.
Two reasons, usually. The class was placed before the one it should beat, since order is what decides here rather than specificity. Or it is an arbitrary value tailwind-merge cannot group, in which case both survive and the CSS cascade picks the winner instead.
A little: it parses every class to work out which group it belongs to. Not worth thinking about for a page of components, worth thinking about inside a list that renders thousands of rows, where hoisting the constant part out of the loop is the easy win.