I always *love* @emilkowalski's UI tips! Here's the native browser way to achieve this effect:
View transitions do this "fade-out-while-rearranging" behavior by default. You can also customize the transition with CSS (see demo)
::view-transition-old(*):only-child { ... }