Why is the top layer of the ocean the warmest?

Why is the top layer of the ocean the warmest?