There are lots of discussions on this forum, which show reasons and working of the ArM5 rules about light and invisibility. You can start with Mark Shirley's explanation here, then continue here and here.