Nuclear-matter approach to the optical potential for 12C-12C scattering