The basic solution I envision would be as follows: remove the term and state of 'Marriage' completely from the government sphere, and replace it word for word in law with the term 'Civil Union.' Return 'Marriage' to its religious roots and control. Stated differently, all Marriages would be civil unions, but not all civil unions would be Marriages. In this way, the bundle of State assigne legal rights formerly associated only with Marriages would devolve seamlessly onto all civil unions, and the term Marriage would be assigned to the civil union via religious authority. Even the terminology could be differentiated in that the members of a simple civil union would be legally referred to as 'partners,' whereas in a Marriage they would be 'husband' and 'wife'.
To those of you who are religious, this would be a simple application of "Render unto Caesar the things that are Caesar's, and unto God the things that are God's." while allowing other Americans the right to live a moral life as they see fit.