Being in an offside position is not a foul by itself. The referee only blows the whistle if the attacker is involved in active play, meaning they touch the ball, block the goalkeeper's view, or distract a defender. The critical freeze-frame moment is when a teammate last plays the ball forward. Watch a through ball in slow motion: the striker might start behind the line, but if they were level when the pass left the foot, the goal stands. Great strikers master this timing, and that is why you hear commentators shout "he timed that run perfectly!"
⚡ NO OFFSIDE RESTARTS
You cannot be offside directly from a throw-in, a goal kick, or a corner kick. That is why crowded penalty boxes after corners are so chaotic and exciting!