During the total solar eclipse on Aug. 21, skywatchers will direct most of their attention to the sun, but don't forget about the moon: Its slow progress away from Earth means these celestial events won't keep happening forever.

Next month's total solar eclipse will sweep across the continental U.S. from Oregon to South Carolina along a stretch of land about 70 miles (113 kilometers) wide. A total solar eclipse occurs only when the disk of the moon passes between the Earth and the sun, briefly blocking the sun's bright light and casting a long shadow on the planet.

"A total eclipse is a dance with three partners: the moon, the sun and Earth," Richard Vondrak, a lunar scientist at NASA's Goddard Space Flight Center in Maryland, said in a statement. "It can only happen when there is an exquisite alignment of the moon and the sun in our sky." [The Best ISO-Certified Gear to See the 2017 Solar Eclipse]

Total solar eclipses occur because the moon and the sun have the same apparent size in Earth's sky — the sun is about 400 times wider than the moon, but the moon is about 400 times closer.

But the moon is slowly moving away from Earth by about 1-1/2 inches (4 centimeters) per year, according to the NASA statement. As a result, total solar eclipses will cease to exist in the very distant future, because the apparent size of the moon in Earth's sky will be too small to cover the sun completely.

"Over time, the number and frequency of total solar eclipses will decrease," Vondrak said in the statement. "About 600 million years from now, Earth will experience the beauty and drama of a total solar eclipse for the last time."

A total solar eclipse occurs during an alignment of the Earth, the moon and the sun. (Image credit: NASA)

For now, a total solar eclipse is visible from somewhere on the Earth's surface about once every 18 months, on average. However, seeing a total solar eclipse from a specific location is rare, because the moon's inner shadow is relatively small, which limits the total area from which the total eclipse is visible, according to a video from NASA about the moon's role in a solar eclipse.

"You have to be on the sunny side of the planet, and you have to be in the path of the moon's shadow," NASA officials said in the video. "So, if you find your area in the path of totality one year, you've hit the jackpot, because on average, that same spot on Earth will only get to see a solar eclipse every 375 years."

But note that partial solar eclipses, in which the moon obscures only part of the sun, are visible across a much larger area. The two parts of the moon's shadow, the umbra and penumbra, determine which kind of eclipse an observer sees on Earth. The moon's umbra, or the dark inner shadow, is the part of the moon's shadow where the entire sun is blocked by the moon. The penumbra is where only part of the sun's disk is obscured.

Most eclipse maps highlighting the path of totality show a dark circle that represents the umbra. However, the "true shape of the umbra is more like an irregular polygon with slightly curved edges," according to the video. Features on the surface of the moon determine the shape of the umbra.

Using data from NASA's Lunar Reconnaissance Orbiter (LRO), NASA scientists were able to map the lunar surface in unprecedented detail, showing the mountains and valleys that affect the passing sunlight and subsequent shape of the moon's shadow during a total solar eclipse, according to the video.

These topographic maps, along with Earth elevation data, allow scientists to determine the exact areas on Earth that fall in the path of totality for the Aug. 21 solar eclipse.

"With this new visualization, we can represent the umbral shadow with more accuracy by accounting for the influence of elevation at different points on Earth, as well as the way light rays stream through lunar valleys along the moon's ragged edge," Ernie Wright, a NASA visualizer at Goddard, said in the statement.

The LRO data also helps scientists better predict when and where skywatchers will see "Baily's beads," the irregular dots of light visible around the edge of the moon during a total solar eclipse. This phenomenon is caused by the last rays of sunlight streaming through the moon's rugged mountain valleys, and it occurs for just a few seconds before and after totality.

So when you look up for the solar eclipse on Aug. 21 — whether you are seeing a total or partial eclipse — be sure to admire the moon as well as the sun.

Editor's note: Space.com has teamed up with Simulation Curriculum to offer this awesome Eclipse Safari app to help you enjoy your eclipse experience. The free app is available for Apple and Android, and you can view it on the web.