Newish iMac keeps shutting down randomly
I have a iMac desktop purchased in 2021 which keeps shutting off randomly. Just immediatly goes black. Very frustrating! Every time it happens I have to disconnect the power plug and then hit restart. Sometimes the internal fan goes on before the screen comes back on. Took to the store and it never happened there (of course it never would!) so Apple Genius Bar was not able to troubleshoot. Does anyone have any suggestions? It seems to be an electrical or mechanical error, like a false contact or something. Any feedback would be useful. Thanks.
iMac Line (2012 and Later)