Microscopic origin of MXenes derived from layered MAX phases