Localized concentration reversal of lithium during intercalation into nanoparticles