First-principles study of a MXene terahertz detector.