Modeling the Attack: Detecting AI-Generated Text by Quantifying Adversarial Perturbations