You may find something you can use in this project: ATtiny1614 based Under Bed Light. It is also uses a LDR (actually a phototransistor)/ PIR combination to control a light. It does, however, use an ATTINY1614 and not an ATMEGA328P. It is optimised for long battery life.