Principles of the light-limited chemostat: theory and ecological applications