No women ever saw the ad, so how could they apply? The courts have ruled it's the same as denying qualified people the job. The opportunity was unfairly hidden from them.
Imagine the job posting was in the men's toilet. The company would have a hard time arguing women had fair notice.
It's one thing to target a gender in your advertisement. It's another to deny someone a job based on their gender.