Smart Contracts and Global State Storage

Hello, It is my understanding that the Stacks blockchain is highly scalable because it stores very little information on the chain itself. However, I’ve also heard that the chain stores Smart Contracts and the state variables of these smart contracts. I don’t understand how the chain can be lightweight, while still storing all smart contract code and smart contract state. Could someone please clarify for me the information that is stored on chain and the information that is stored off-chain in Gaia or in the Atlas Peer Network?