MacBook login screen repeatedly turns on and off at login
My screen is turning off and on at login. My Macbook was perfectly fine before, but when I restarted it, the login screen turns on for a moment, then turns off for several seconds. This process repeats and it does not let me type in my password. I don't think it is a hardware issue because the screen works perfectly fine in recovery mode. I tried running first aid on the disk and booting into safe mode, but these still don't work. I don't want to erase it either; I didn't back up my data using time machine. Please help!
MacBook Air 13″, macOS 15.7