How do criticals interact with degrees of success for attacks in PF2E?


Let’s say my character Strikes an enemy with AC 40. My attack bonus is only +10, so barring crits, it’s impossible for me to get through his AC.

I roll a natural 20, making my total 30 vs his 40 AC. Is this attack treated as a regular hit, because it would have been a failure but the nat 20 improves the degree of success by one step? Or is it treated as a critical hit, because it’s a nat 20?

Similarly, if I’m subjected to a spell with a saving throw I can only fail at, and I roll a nat 20, does that mean I reach a success on the saving throw or a critical success?