Off and on states are pretty maleable for switches. You can take a switch that’s “normally open” or “normally closed” ( normally on or normally off if you will ) and invert it simply by sticking a
! or a
not before it in your code.
So, pick the switch that works best for you mechanically and fix the rest in code!
You could probably use a simple momentary tactile switch like this: https://shop.pimoroni.com/products/tactile-switches
It will technically be
on when the box is closed, with the lid resting on it, and
off when the box is open but that’s just details!
If you want something a bit more discrete you could look into reed switches or hall effect sensors and magnets, but they may be a little trickier to find. I’m guessing this project is for Halloween? So it’ll be dark and nobody is going to notice a tactile switch in the corner of the box while they’re fleeing in terror.