Azimuthal transverse single-spin asymmetries of inclusive jets and charged pions within jets from polarized-proton collisions at sqrt(s) = 500 GeV