New theory of superconducting copper oxides—from electronic structure to the d-wave pairing mechanism