Dinosaurs must have had sex to reproduce but how they did it -- with their neck frills, armored plates and tails tipped with spikes -- isn't exactly clear.
No fossil has revealed two dinosaurs caught in the act -- the only known vertebrates to be unequivocally preserved mating are a pair of 47 million-year-old turtles that were attached by their genitals as they got buried alive.
It's also not possible to easily determine whether a dinosaur is male or female from fossilized bones.
Fossils that preserve elements of dinosaur behavior are very rare. However, with close analysis and insights from what we know about living animals, particularly birds, paleontologists are beginning to piece together the sex lives of dinosaurs.
Many species of animals show a difference in appearance between the sexes -- what's called sexual dimorphism. Think of a lion's mane, a peacock's feathers or a stag's antlers. Such features are surprisingly difficult to determine in extinct species.
Despite many earlier claims, including that female T. rexes were bigger than males, such findings are now thought inconclusive. Differences in anatomy could point to a young and old individual or two separate species, or just variations that have nothing to do with sex.
"We really don't know, 100%. I could not confidently hold my hands up and say you know what, this T. rex is male, this T. rex is female. It's unfortunate because as a paleontologist it's a fascinating and fun area to explore," said paleontologist Dean Lomax, a visiting scientist at The University of Manchester's department of Earth and environmental sciences.
One exception to this is Confuciusornis, a 125 million-year-old dinosaur that has many features in common with modern bird species and shows a remarkable difference in plumage between male and female specimens.
Some fossils show body-length ribbonlike tail feathers -- a feature that had been interpreted as being used for sexual display. Scientists were able to find indisputable proof that females did not have this ornamental plumage.
Researchers identified evidence of the medullary bone -- calcium-rich tissue present during a short period of time in a reproductively active female bird used to make eggshells -- in the ancient birds that did not sport the long plumage.
Work in the past decade on the cells that contain color pigments in the exquisitely preserved fossils of feathered dinosaurs have revealed that some dinosaurs were brightly colored -- perhaps surprisingly so, given how popular culture historically portrayed them as grayish green. Lomax believes it's possible that in the future we'll find a fossil that shows clear evidence of sexual dimorphism.
"In the future, probably from China, I imagine you'll find two distinct dinosaurs found with color, their anatomies will match, but they'll be very different in their coloration," said Lomax, who is also the author of "Locked in Time: Animal Behavior Unearthed in 50 Extraordinary Fossils."
Thanks largely to the discovery of once-controversial feathered fossils from China in the 1990s, we now know that birds are the only living relative of dinosaurs -- specifically, therapods, part of the same family as T. rex and Velociraptor.
"You go back 20 or 30 years, and you still have scientists saying birds aren't dinosaurs, but now we have so much more evidence that they are. So you can look at the behavior of birds and work out how some of these dinosaurs behaved," Lomax said.
Case in point is a type of scratching that male ground-nesting birds do to signal they are strong and good nest builders. It's part of behavior called lekking, when males, typically in groups, competitively dance and perform other courtship rituals to attract the attention of females.
Dinosaurs engaged in similar mating behavior, according to fossilized "scrapes" left behind in 100 million-year-old rocks in the prehistoric Dakota Sandstone of western Colorado. One site revealed more than 60 distinct scrapes in a single area of up to 164 feet (50 meters) long and 49 feet (15 meters) wide.
"The scrape evidence has significant implications," Martin Lockley, professor emeritus of geology at the University of Colorado Denver, said when the study was released in 2016.
"This is physical evidence of prehistoric foreplay that is very similar to birds today. Modern birds using scrape ceremony courtship usually do so near their final nesting sites. So the fossil scrape evidence offers a tantalizing clue that dinosaurs in 'heat' may have gathered here millions of years ago to breed and then nest nearby."
The large bony frill that skirts the skull of Protoceratops dinosaurs, part of the same family as Triceratops, is also thought to be used as a signal to prospective mates, a recent study of 30 complete skulls suggested.
It's not a feature found in living animals today, and paleontologists have long debated what the function was of the diverse array of frills and horns in ceratopsians. Perhaps, scientists thought, it was to regulate body heat or defense.
Three-dimensional analysis showed that the frill formed an independent region of the skull that grew much more rapidly than any other region of the head -- a pattern that is often seen with sexual selection -- the idea that certain traits are favored by the opposite sex and so over time become more elaborate.
In the case of Protoceratops, however, the researchers concluded that both males and females would have sported the distinctive frill and that it wouldn't have varied dramatically between the sexes.
So what would dinosaur mating have actually looked like?
While most mammals have separate holes for bodily functions, many other animals -- including birds and reptiles -- have just one and it's known as the cloaca.
A big clue to understanding dinosaur sex was revealed earlier this year when paleontologists at the University of Bristol and the University of Massachusetts Amherst announced in the journal Current Biology that they had found a dinosaur cloaca belonging to a Psittacosaurus, a Labrador-size dinosaur.
Most birds mate by "cloacal kissing" -- by pressing together their openings. Some paleontologists think dinosaurs may have mated like this.
Jakob Vinther, a paleontologist and senior lecturer at the University of Bristol's School of Earth Sciences, however, believes that male Psittacosaurus would have had a penis -- the fossilized opening is more similar to a crocodile's, which do, and some birds, like ostriches and ducks, that also have penises.
"From what we can see, this cloaca would not have been suitable for cloacal kissing," Vinther said. "It looks like it would have been penetrative sex."
But this was the first time a dinosaur cloaca had been studied, and much of the mechanics of dinosaur sex defies the imagination, particularly for creatures like the Stegosaurus, with its armored plates and pointed tail.
"If the female doesn't like the male, and it's swinging its spiked tail around, that's a problem. You look at the potential angles. It could be that they moved together tail to tail for a cloacal kiss -- a quick bang and that's it," Lomax said.
"Potentially it could have mounted at the back but (I) think that's more unlikely because of the friction of the spikes. Another possibility is that the female Stegosaurus could have lied down and the male mounted from the side.
"But it's hard to know. We really don't know the sex lives of these animals."