Photosynthesis is the process by which plants, algae, and some bacteria use sunlight, water, and carbon dioxide to produce oxygen and energy in the form of sugars. It occurs in two stages - the light reactions where light is absorbed to produce ATP and NADPH using chlorophyll, and the Calvin cycle where ATP and NADPH are used to fix carbon and produce sugars. The light reactions take place in the thylakoid membranes of chloroplasts and involve two photosystems that absorb different wavelengths of light and an electron transport chain that creates a proton gradient to produce ATP.