Nanoscale etching of resists in view of a mechanistic framework