I know it's a few days old, but it's been on my mind.
For me, it's covered pretty well in law here -
a player in an offside position is moving towards the ball with the intention of playing the ball and is fouled before playing or attempting to play the ball, or challenging an opponent for...