Imac randomly shuts off/wont wake up
I have a 2015 Imac 27inch 5 K Retina with a 3.3 quad core i5 chip. Its been great until the last few weeks. I noticed one day when it went to sleep, it would not wake up. I had to turn its surge protector off and start. The power button did nothing when tried restarting it. This basic pattern has only increased and now sometimes, when without putting it to sleep, everything just goes black. Like it turns off. But again, it does not respond to the power button at all, I have to cut the surge protector, and start it up.
I have tried getting it into safe mode and it did seem to help but it went down all the same. I also tried resetting the NDram, if I am saying it correctly. I wonder if its some software. Basically I mostly do basic internet stuff, and apart from Steam and Adobe CC running in the background, I cannot imagine what it might be.
I think perhaps the power is going, or needs some work. But before I take it in to get checked, is there anything else you'd advise? I was considering doing a factory reset and just bringing back the stuff I need. Any suggestions will be helpful. I have been using apple for so long and this is the first time I had a real issue like this.
I am off of apple care and thanks in advance for any tips or advice, I appreciate it.
iMac 27″, macOS 11.1