Nanoconfinement-driven electronic structure and local microenvironment modulation for electrochemical nitrate reduction to ammonia synthesis