Nitrogen-containing mesoporous carbons via nanocasting for CO2 capture and energy storage applications