The Sun always lights half of the Moon. The phase is how much of that lit half is turned toward Earth. Steps follow the 30 tithis of the lunar month.
Tithis. A tithi is the time the Moon takes to move 12° further ahead of the Sun, so 30 tithis make one lunar month: 15 in Shukla paksha ending at Pournami, then 15 in Krishna (Bahula) paksha ending at Amavasya. Each step here stops at the end of a tithi. A tithi averages a little under a day, so tithis and calendar dates do not line up one to one.
Tilt with latitude. The inset is drawn with "up in your sky" at the top. The lit fraction is the same everywhere on Earth; only the tilt changes, with latitude and with where the Moon is in the sky. The red dot on Earth is you; the box shows the Moon as you see it when you look up at it. This is a simplified model that puts the Sun and Moon over Earth's equator, so the real tilt also shifts somewhat with the season.
Why the two views can look opposite. The main view looks at the Moon from outside its orbit, while the box looks from Earth. For the near half of the orbit those are opposite sides of the Moon, so left and right swap and the outside view sees a different share of the lit half. The default camera, "From where you stand", sits behind Earth and stays fixed with you, so on that side of the orbit it sees the same face of the Moon as the box.
The Moon crossing your sky. With "At dusk or dawn" selected, each step shows the sky at the same hour one tithi later. Earth and the camera stay still and the Moon moves: after Amavasya it starts in the west beside the setting Sun and shifts east each evening until Pournami, when it rises as the Sun sets. The view then swings to the dawn side for the waning fortnight. The green disc is your horizon and the red line points straight up. With moonrise, highest or moonset selected, the Moon is by definition at the same place in your sky every time, so it stays put and the Sun's direction changes instead.
Orange ring: the edge of the Moon's Earth-facing half. Sizes and distances are not to scale, and Earth's shadow is not drawn. Keys: ← → step, space plays or pauses.