like nitrogen acts as a EWG and increase the positive charge on the conjugate acid which makes imidazole more basic since the pyrolle nitrogen is further away than pyrazole, it's a good explanation of the bascicity but im not convinced as to why it is an EWG as you seem to agree with...