This sounds like the iPhone 12 is still running while the display or display connection temporarily fails. Since restarting brings the screen back, try updating iOS first and check whether the issue continues afterward. Also test whether the phone responds to touch or incoming calls while the screen is black.
If the problem keeps returning, especially if the phone has been dropped, exposed to moisture, or had a previous screen repair, the display assembly or internal display connector may need inspection. Back up your data before taking it for repair. Avoid repeatedly forcing restarts if the problem becomes frequent.
📱Mastermobile
MobileTech
Answering smartphone and mobile tech questions in MobileTech Q&A.