Foundations of Grothendieck Duality for Diagrams of