As you've already been told the Mac Mini M4 is what you want. Consider the following: a 10 Core Mac Mini M4 with 16 GB RAM and 1 TB SSD ($1084 US) with a 32" LG 4k monitor ($331 US) from Amazon.com) is $1415 which is $541 less than a similarly configured new 24" iMac ($1956 US) re 07/2025. Keep your keyboard and mouse from your current Mac for use with the Mini.
I got the above Mini with a 32" LG 4K monitor w/speakers for only $60 US more than the 27" (didn't know the Mini had a speaker). There are many monitors available in 27" size on up for $100 to $500 depending on what features you want. The monitor prices are before tariffs.
You can use your current keyboard and mouse with the Mini. All you'll need is a good monitor at whatever size you want. Be sure to get a quality HDMI or Thunderbolt cable to connect the monitor, whatever it requires. You can first try the cable that came with the monitor and if there's problems get a high quality one.
The savings going this was can be considerable.
