Text this: Nonequilibrium thermodynamics of porous electrodes for lithium-ion batteries