Photosynthesis uses energy from sunlight to convert carbon dioxide and water into oxygen and energy-rich organic compounds like glucose. It occurs in two stages: the light-dependent reactions capture solar energy to produce ATP and NADPH, and the light-independent Calvin cycle uses these products to fix carbon from carbon dioxide into organic molecules like glucose. Chlorophyll and other pigments in plant leaves absorb sunlight, driving electron transport that establishes a proton gradient used to produce ATP. The electrons continue through photosystems I and II to ultimately reduce NADP+ to NADPH.