The statement that photons are massless means that photons do not have rest mass. In particular, this means that, in units where $c=1$, the magnitude of the photon 3-momentum must be equal to the total energy of the photons, rather than the standard relationship where $m^{2} = E^{2}-p^{2}$.
But, you can create multi-photon systems where the net momentum is zero, since momentum adds as a vector. When you do this, however, since the energy of a non-bound state is always non-negative, the energies just add. So, this system looks just like the rest frame of a massive particle, which has energy associated with its mass and nothing else.
The statement about gravity is a little bit more subtle, but all photon states will interact with the gravitational field, thanks to the positive results of the light-bending observations that have been made over the past century. So you don't even need a construction like this to get photons "falling" in a gravitational field.
You are not correct in your latter part of the analysis; the chemical properties (which is mostly what matters in ordinary matter) almost only depend on the electron shell, and in particular the outermost electrons (called the valence electrons).
So more protons mean more electrons and a different electron shell, meaning different chemical properties.
Why there is such a diversity of properties just by changing around the electron shell, is one of the wonders of chemistry! Due to quantum mechanics, the electrons don't simply spin around the nucleus like planets around the sun, but arrange themselves in particular, complicated patterns. By having different patterns, you can achieve a lot of different atom<->atom binding geometries, at a lot of different energies. This is what gives the diversity of chemical properties of matter (see the periodic table).
You can add or remove electrons to an atom to make the electron shells look more like the shells of another atom (with a different number of protons), but then the atom as a whole is then no longer electrically neutral, and due to the strength of the electromagnetic force, the resulting ion does not imitate the other atom type very well (I'm not a chemist - I'm sure there are properties that indeed could become similar).
Many physical properties are also mostly due to the electron shells, like photon interactions including color. Mass obviously is almost only due to the nucleus though, and I should add that in many chemical processes the mass of the atoms are important for the dynamics of processes, even if it isn't directly related to the chemical bindings.
This was just a small introduction to chemistry and nuclear physics ;)
Best Answer
Carbon12 is 12 unified amu by definition (see David's comment below).
The masses you quote for free protons and neutrons are not the same as their mass when bound in a nucleus. The binding energy of C12 is around 92MeV which accounts for the missing 0.064amu in your example.