The origin of endothermy in synapsids and archosaurs and arms races in the Triassic

Abstract Birds and mammals are key elements of modern ecosystems, and many biologists explain their great success by their endothermy, or warm-bloodedness. New palaeontological discoveries point to the origins of endothermy in the Triassic, and that birds (archosaurs) and mammals (synapsids) likely acquired endothermy in parallel. Here, a further case is made, that the emergence of endothermy in a stepwise manner began in the Late Permian but accelerated in the Early Triassic. The trigger was the profound destruction wrought by the Permian-Triassic mass extinction (PTME). In the oceans, this was the beginning of the Mesozoic Marine Revolution (MMR), and a similar revolution occurred on land, termed here the Triassic Terrestrial Revolution (TTR). Among tetrapods, both synapsids and archosaurs survived into the Triassic, but numbers were heavily depleted. However, the survivors were marked by the acquisition of endothermy, as shown by bone histology, isotopic analyses, and the acquisition of insulating pelage. Both groups before the PTME had been sprawlers; after the event they adopted parasagittal (erect) gait. The new posture and the new physiology enabled both groups to compete in their ecosystems at a faster rate than before the PTME. The new world of the Triassic was characterised by a fast-paced arms race between synapsids and archosauromorphs in which the latter, as both dinosaurs and pterosaurs, initially prevailed.


Introduction
There are several candidates for pivotal events in vertebrate evolution, and cases have been made for the importance of the origin of tetrapods in the Devonian and the origin of bird flight in the Jurassic. To many physiologists and ecologists, however, endothermy would be the winner. As Lovegrove, 2017Lovegrove, p. 1214) says, 'The evolution of endothermy was the most significant event in the evolutionary history of the birds and mammals.' From a functional point of view, the suite of physiological, ecological and behavioural changes wrought by the transition from ectothermy to endothermy profoundly altered the scale and scope of vertebrate life. Further, this claim matches the perception of palaeontologists who have long pointed to the profound revolution in life on land and in the sea triggered by the huge Permian-Triassic mass extinction (PTME), 252 million years ago (Ma).
Could the two be linked? According to traditional understandings, mammals arose in the Late Triassic, 220 Ma, and birds in the Late Jurassic, 150 Ma. Therefore, there is no evident link in the separate origins of endothermy in these two clades. However, recent palaeontological discoveries have pointed to earlier origins of some of the markers of endothermy, such as hair in mammals and feathers in dinosaurs, and these are bringing the origins of endothermy in the two wider lineages of birds and dinosaurs, namely archosaurs and synapsids, into line and back to the Triassic. Could the new evidence, coupled with considerable advances in understanding of crocodilian physiology, as well as new evidence from bone histology and anatomy of extinct animals, provide a comprehensive model for the origin of endothermy?
Previous theories for the origin of endothermy include niche expansion allowing activity during the day and night (Crompton et al., 1978;Lovegrove, 2019a, b), aerobic capacity massively expanded (Bennett and Ruben, 1979), parental care and enhanced adaptability (Farmer, 2000(Farmer, , 2020Koteja, 2000), and body-size miniaturisation (Hopson, 1973;McNab, 1978). All of these hypotheses are likely true and the various components, such as miniaturisation, parental care, and nocturnality can interact (Farmer, 2020). In seeking to answer the question, it is useful to understand the timing of events through a combination of modern understandings of anatomy, physiology and behaviour, as well as palaeontological information on the origins of endothermic adaptation in the cardiovascular and respiratory systems, all analysed through new phylogenetic statistical tools.
The focus on the Triassic brings together themes that were formerly seen as separate. If the endothermy of birds did not originate with birds, but with their distant ancestors among early archosaurs, then we move the focus back to the Triassic and the origin of dinosaurs. Further, the origin of dinosaurs shifts back some 20-30 million years, from the Late to the Early Triassic, thanks to new discoveries, and that brings the origin of endothermy into the time of the recovery of life after the PTME. So, three formerly distinct large research questions (origin of endothermy, origin of dinosaurs, recovery from the PTME) come together as one.
In the initial part of the review, I draw together these disparate strands, and explore how vertebrate palaeontologists came to understand the events of the Triassic in the past 70 years. The changes in understanding have been profound thanks to new fossil collections and new means of dating the rock successions. Further, the widespread application of cladistics to all the tetrapod taxa helped palaeontologists determine which taxa belonged where, and this then enabled wider macroevolutionary studies. Also, a consideration of ecological factors enabled palaeontologists to explore the rise and fall of different major groups.
Understanding of the PTME has also advanced hugely, from an imprecise model in 1990 of an event that might have spanned 10 Myr to a more forensic understanding today of two or three extinction pulses, separated by some 60,000 years. Several tetrapod clades survived the PTME; earliest Triassic faunas include temnospondyls (amphibians), procolophonids (parareptiles), dicynodonts and cynodonts (synapsids) and basal archosaurs (archosauromorphs). The temnospondyls and parareptiles never achieved ecological significance except in particular environmental settings. The focus in the rebuilding of terrestrial tetrapod ecosystems is on synapsids (mammals and their ancestors) and archosauromorphs (birds and their ancestors). The recent work converges on a single model, suggesting that the PTME triggered an arms race between members of these two clades and that they both acquired erect posture and endothermy from the earliest Triassic onwards. Contrasting with Late Permian ecosystems just before the PTME, the new Triassic ecosystems were more energetic and faster-moving. This stepup in the use of energy marks the beginning of modern terrestrial ecosystems, largely dominated by mammals and birds, and we can term the time from 252 to 201 Ma, bookended by the PTME at the start and the end-Triassic mass extinction (ETME) at the end, the Triassic Terrestrial Revolution (TTR).
In this review, I explore some of the earlier debates and discussions, and show how the discovery of new fossils, but particularly the application of new database and computational approaches to phylogeny, macroevolution, macroecology, and functional palaeobiology have revolutionised our understanding of how the key tetrapods interacted, and how they acquired the fundamentals of a fast-moving endothermic lifestyle in the Triassic. New discoveries in bone histology, skeletal anatomy and functional experiments have enabled rapid advances in a new discipline, palaeophysiology, and these discoveries, coupled with a phylogenetic approach to macroevolution enable us to map the origin of traits associated with endothermy in a rather precise manner. New data and new methods now enable a multidisciplinary study of one of the most profound steps in the expansion of life on Earth.

Competitive or opportunistic origin of dinosaurs?
Understanding the evolution of tetrapods through the Triassic was resolved through a debate about the origin of dinosaurs that began in the 1960s. Early in the twentieth century, palaeontologists such as Robert Broom and Friedrich von Huene had speculated about the relative timing and succession of Triassic tetrapod faunas. Then in the 1960s and 1970s, a new generation of palaeontologists (Fig. 1), including Al Romer (1894Romer ( -1973, Ned Colbert (1905-2001, Alan Charig (1927Charig ( -1997, José Bonaparte (1928Bonaparte ( -2020, and Barry Cox (born 1931), were opening up new fossiliferous sites in North America, South America, Africa, and Antarctica, and enhancing knowledge of the fossil record. In a series of review papers (e.g. Cox, 1967Cox, , 1973Colbert, 1971Colbert, , 1975Romer, 1970Romer, , 1975Charig, 1980), these researchers identified the global similarity of the faunas, so providing strong evidence for continental drift, a debate topic at the time.
These authors also noted that there was a succession of distinctive faunas that showed some matching worldwide, and corresponded broadly to the Early, Middle and Late Triassic. Discoveries in South America (Bonaparte, 1978) helped establish a stratigraphic sequence against which the known tetrapod faunas from Europe, North America, India, and Australia could be compared, and these seemed to show that in the Early Triassic, synapsids dominated, with rare archosauromorphs as predators. Then in the Middle Triassic, rhynchosaurs, a clade of archosauromorphs, emerged as key herbivores and continued into the Late Triassic. Finally, the archosaurs themselves diversified as predators through the Middle and Late Triassic and, among them, dinosaurs gradually emerged as dominant herbivores and carnivores within ecosystems worldwide.
In their papers (Cox, 1967(Cox, , 1973Colbert, 1971Colbert, , 1975Romer, 1970Romer, , 1975Charig, 1980), these authors all read the story as one of gradual replacement, in which the dinosaurs took over from precursor synapsids and archosauromorphs. They identified the process as having lasted for a span of 30-40 Myr through the Early to early Late Triassic, and that it was presumably broadly competitive. Charig (1972Charig ( , 1980, for example, explained the eventual success of the dinosaurs as a result of their upright (erect) posture, based on his observation that many Early Triassic archosauromorphs retained a sprawling posture, those of the Middle Triassic were semi-erect (or 'semi-improved', as he termed them) and the dinosaurs and close kin were fully erect ('improved'). He argued that erect posture enabled the animals to take longer strides and to sustain running for longer. Such advantages are confirmed from studies of modern animals, among which, although the cost of transport is the same in both mammals and lizards (Garland Jr. and Alburquerque, 2017), at larger sizes mammals can sprint faster, travel six times as far each day and expend 11 times as much energy as lizards. Further, erect posture and gait, where the upper limb bones, the humerus and femur, project more vertically than horizontally, also enables two opportunities for later evolution, namely bipedalism (walking on two limbs) and greater body mass, both of which are characteristic of dinosaurs. Initially of course erect posture evolved for its immediate advantages (sustained running; greater speed), but the fact that it later enabled heavier body masses and bipedalism opened opportunities for dinosaurs to diversify and achieve new modes of life (see Section 5).
As these ideas were being expounded in the 1970s and 1980s, there were three further currents of somewhat revolutionary thought under debate, namely dinosaurian endothermy, the cladistic revolution, and a sharpening of macroevolutionary methods.
(1) First, Bakker (1971Bakker ( , 1972 suggested that dinosaurs had risen to dominance thanks to their endothermy (warm-bloodedness), and he cited extensive evidence from posture, bone histology, predator-prey ratios and other sources. His views were widely disputed by the above-named experts and me (Benton, 1979) at the time, arguing that all the lines of evidence cited by Bakker were open to other interpretations and that in fact being ectothermic gave dinosaurs many advantages at a time of generally warm climates. Bakker propounded his ideas of dinosaurian endothermy vigorously, and they were debated in the public arena (Bakker, 1975(Bakker, , 1986Desmond, 1976), but the conclusion of the palaeontological community at the time was that Bakker was wrong and the ideas were based on somewhat tenuous evidence. Ironically, the community view has now moved completely in favour of what Bakker said in the 1970s and supported by extensive work on bone histology (see Section 8.1).
(2) Second, there was a revolution in systematics that led to greater rigour. Cladistics had emerged in the 1960s as an objective, testable way to discover phylogenetic trees, and it quickly became apparent that Dinosauria was a clade, as suggested by Bakker and Galton (1974), although they had not constructed a cladogram. Bakker and Galton (1974) recognised that all dinosaurs shared unique features of the skeleton and skull, and these and other characters were deployed by Benton (1984aBenton ( ,b, 1985, Gauthier (1984Gauthier ( , 1986, and Sereno (1984Sereno ( , 1986 in the first independently analysed cladograms of dinosaurs. The diagnostic characters provided a yardstick for the first time that enabled palaeontologists to identify which taxa were inside the clade Dinosauria, and which outside. This then led to the re-examination of many Triassic fossils, and it turned out that most or all of the Early and Middle 'dinosaur' fossils, including footprints, cited by Cox, Colbert, Romer and Charig were equivocal or not dinosaurian (Benton, 1983(Benton, , 1986aKing and Benton, 1996). These revisions were based on the fact that the specimens of unexpectedly early dinosaur species were often poor-quality and misinterpreted. Further, they lacked cladistically-determined apomorphic characters of Dinosauria, or indeed in many cases they lacked any apomorphic characters of any archosaurian clade. (3) In the 1980s also, new ways were being developed to conduct macroevolutionary analyses, not least the use of databases and improved stratigraphy. Benton (1983) presented a first such survey of the tetrapod faunas of the Triassic, attempting to identify more precise time bands for each fossiliferous formation, and counting species and individual specimens present in each fauna. Admittedly, many of the stratigraphic decisions made then have proved erroneous, but at least the time scale was more refined than simply Early, Middle and Late Triassic, as used before by Romer, Colbert, and others. This is particularly germane for the Late Triassic, as it was 36 Myr in duration, a huge span of time in which much evolution could occur. Nonetheless, commonalities in faunas, such as those dominated by the rhynchosaur Hyperodapedon, were identified, even if they were then all allocated an early Norian age (now dated as mid-late Carnian). Benton's (1983) conclusion was that all the earliest dinosaurs appeared at essentially the same time, in the early part of the Late Triassic, and that the dinosaurs had in fact diversified rapidly after an extinction event when floras were replaced worldwide and the dominant herbivores, the rhynchosaurs and dicynodonts crashed. This was an ecological argument, based on the discovery that those herbivore groups were massively abundant in their faunas, sometimes representing 70-80% of tetrapod specimens. When palaeontologists simply tracked diversity (i.e. species or genus richness), they found that only a handful of species died out, but these species dominated their faunas ecologically, sometimes comprising 50-80% of all specimens. By exploring relative abundances, it became clear that a massive ecological reorganisation had occurred, and this pointed to a non-competitive model for dinosaurian dominance, as expressed in the title of Benton's (1983) paper, and not a long drawn-out competitive process where dinosaurs had vanquished other groups, including synapsids, rhynchosaurs, and basal archosaurs. All these new ideas of the 1970s and 1980s have gained acceptance. For example, although Romer, Colbert, Charig and others rejected the idea that dinosaurs had been endothermic, even though it supported their idea that dinosaurs had prevailed in a broadly competitive way because of superior adaptations, the evidence of bone histology and insulating feathers confirms that Bakker was right. The war against cladistics is long past, and earlier ideas that dinosaurs maybe had multiple somewhat mysterious origins among basal archosaurs (e.g. Charig, 1972Charig, , 1980 have been comprehensively rejected. Irmis (2011) was sceptical of the idea that extinction and opportunism heralded the diversification of dinosaurs in the Carnian, but subsequent work (e.g. Brusatte et al., 2008a,b;Brusatte et al., 2010Brusatte et al., , 2011bLanger et al., 2010;Sookias et al., 2012;Bernardi et al., 2018) has provided more evidence for the non-competitive, rapid take-over ecological model, and the re-identification of the Carnian Pluvial Event as coincident with the explosion of dinosaur faunas in South America (see Section 4) provides much more data on the trigger event.
Finally, the need to improve stratigraphic precision is widely understood, and the combination of constantly critically reviewed stratigraphic and cladistic hypotheses produces better and better databases (e.g. Benton et al., 2013a) that are fundamental in enabling the protagonists of macroevolutionary analyses to provide ever better analyses. However, in a further irony, the record of Early and Middle Triassic dinosaurs, vociferously denied by Benton (1983Benton ( , 1986a and King and Benton (1996), has filled up with convincing new specimens that demonstrate that dinosaurs did originate in the Early Triassic, not the Late Triassic.

Early origin of dinosaurs
The oldest confidently identified dinosaurs occur in the Carnian. The most famous source is the late Carnian lower Ischigualasto Formation of Argentina, dated at 231.4 ± 0.3 to 225.9 ± 0.9 Ma, and source of dinosaurs such as Panphagia, Eoraptor, and Herrerasaurus (Fig. 2C;Martínez et al., 2011;Ezcurra et al., 2017). This corresponds to the time of high abundance of the rhynchosaur Hyperodapedon, termed the Hyperodapedon Assemblage Zone (HAZ), and includes the Santa Maria Formation of southern Brazil, dated as 233.23 ± 0.73 Ma (Langer et al., 2018), and source of the dinosaurs Saturnalia and Staurikosaurus. The lower (and upper) Maleri Formation of India, the Pebbly Arkose Formation of Zimbabwe, and the Lossiemouth Sandstone Formation of Scotland may all correlate with the HAZ, but independent age evidence is lacking, and they have also yielded dinosaur remains. In all these cases, the dinosaurs comprise less than 5% of the faunas in terms of abundance of specimens (Benton, 1983;Brusatte et al., 2010;. This led to claims that the dinosaurs had indeed originated, perhaps rather rapidly, in the Late Triassic (e.g. Benton, 1983Benton, , 1986bBenton, , 1999Brusatte et al., 2008aBrusatte et al., ,b, 2010Langer et al., 2010).
However, the picture has changed completely, and there is now substantial evidence that dinosaurs originated in the Early Triassic following several discoveries in . First, Nesbitt et al. (2010 described a small, slender-limbed, herbivorous archosaur, Asilisaurus, from the Manda Formation (Anisian, 247-242 Ma) of Tanzania, and postulated that this was a representative of a new group called the silesaurids, close to dinosaurs. The Silesauridae were a long-lasting lineage, already well known from the Late Triassic Silesaurus from Poland (Fig. 2B), and they share with dinosaurs aspects of their slender limbs, and especially the closely bunched elongate metatarsals in the ankle region, and other features, and so were a key component of Dinosauromorpha, the wider clade that includes dinosaurs and their closest relatives (Fig. 3). As sister group of Dinosauria, if the first Silesauridae date back to the end of the Early Triassic, 247 Ma, then dinosaurs too must have originated at that time. This implies a ghost range for dinosaurs from say 247 to 233 Ma (14 Myr) during which we know dinosaurs existed but have yet to be found. Most recent phylogenetic analyses are in favour of this view, but significant doubts still exist, based on cladistic analyses in which the various 'silesaurids', including Asilisaurus, emerge as unresolved members of a stem group to Dinosauria, and so say nothing about the date of origin of the clade, and indeed would be consonant with an origin of Dinosauria in the Late Triassic (Langer, 2014).
Second, Brusatte et al. (2011a) described several trackways of slender, three-toed footprints from the Early and Middle Triassic of Poland, assigned to the ichnogenera Protodactylus and Sphingopus. Such tracks had been reported before from the Middle Triassic of the Germanic basin, and their makers were uncertain. Brusatte et al. (2011a) presented convincing arguments that they were dinosauromorph prints because of cladistically derived characters of the shapes, numbers and organisation of the digit imprints.
Third, the world's oldest putative dinosaur, Nyasasaurus, was reported by Nesbitt et al. (2012) from the Manda Formation of Tanzania, based on a humerus and some vertebrae. These authors suggested Nyasasaurus could be a dinosaur: the humerus bears a long deltopectoral crest with a deflected tip, it has elongated neck vertebrae with hollowed-out sides, and possibly three sacral vertebrae. These are all diagnostic of Dinosauria, but the last two characters are uncertain because the vertebrae assigned to Nyasasaurus might not belong to the same individual as the holotype humerus. However, even if Nyasasaurus is not a dinosaur, it and Asilisaurus are close outgroups of Dinosauria, and so the lineage very   3. Evolution of archosaurs, and evidence for early origin of dinosaurs. The oldest certain dinosaurs are mid-Carnian in age, but their sister group, the Silesauridae, date back to the Anisian, demonstrating a 15-Myr ghost range fort Dinosauria. Related taxa such as Aphanosauria confirm the minimally Early Triassic origin of clade Avemetatarsalia, as well as Pterosauria and Dinosauria. Original figures kindly provided by Sterling Nesbitt. close to dinosaurs, if not dinosaurs themselves, arose some 15 Myr before the first relatively abundant dinosaurs of the Santa Maria and Ischigualasto formations. These discoveries were cemented by a third discovery from the Manda Formation, the slender archosaur Teleocrater ( Fig. 2A). Nesbitt et al. (2017) showed that Teleocrater was dinosaur-like in various ways but lying more basally in the cladogram than the Silesauridae and Dinosauromorpha in general. In fact, Teleocrater was part of a wider clade they named Aphanosauria, basal members of the clade Avemetatarsalia that had been named by Benton (1999) for Dinosauromorpha, Pterosauria, Scleromochlus and relatives (Fig. 3). The aphanosaurs, all of them Middle Triassic in age, were long-necked, slender, short-limbed and carnivorous (Nesbitt et al., 2017). They possess a number of characters once thought to be unique to dinosaurs, including the fact their limbs were tucked under their bodies, so giving them an erect gait. However, they were quadrupedal, with short arms and legs, and plantigrade (hands and feet flat on the ground), and it was only the ornithodirans (=pterosaurs and dinosauromorphs) that became bipedal and digitigrade (standing up on their toe tips), the pterosaurs evolving to use their forelimbs as wings and the dinosaurs and relatives using their arms and hands for occasional quadrupedal walking, but also for grasping.
Some authors have suggested that all these clades originated in the Permian. For example, Simões et al. (2018), in their study of a Middle Triassic squamate, produced a comprehensive cladogram of early diapsids in which the roots of Archosauriformes were projected deep into the Permian based on a combined morphological-molecular phylogenetic analysis. Indeed, the first archosauriforms such as Archosaurus are known from the latest Permian and other stem-group diapsid fossils date from the Late Permian and earlier. However, in the absence of fossil evidence for crown archosaurs (i.e. avemetatarsalians and pseudosuchians) before the Olenekian (Early Triassic), we prefer to posit an acceleration of the molecular clock across the Permian-Triassic crisis interval and not to extend the roots of avemetatarsalians and dinosaurs into the Permian.
The backwards shift of dinosaurian origins from the Late Triassic to the end of the Early Triassic is in line with other evidence about early archosaurian evolution, particularly that the sister clade of Avemetatarsalia, the Pseudosuchia, also originated in the Early Triassic, based on earlyappearing taxa such as ctenosauriscids (Butler et al., 2011;Nesbitt, 2011;Ezcurra, 2016;Foth et al., 2016;Ezcurra et al., 2017). Therefore, the geometry of the phylogenetic tree, and these numerous Early and Middle Triassic avemetatarsalians and pseudosuchians strongly suggest that dinosaurs did originate at this time, but we have yet to find them. Their absence (or near absence, if Nyasasaurus is really a dinosaur), might at least suggest that they were rare. Evidently dinosaurs did not 'take over the world' at this point, or if they did, they were very discrete about it. Likely the pre-Ischigualasto dinosaurs were of modest size, rare, and possibly geographically restricted.
The startling finding then is that dinosaurs probably originated in the Early Triassic, in the aftermath of the devastating PTME. It is well known that this event, around 252 Ma, saw the loss of some 80-95% of species and among these, tetrapods were as hard hit as other animals and plants (Benton et al., 2004;Erwin, 2006;Benton, 2015). The recovery of life after this huge extinction was prolonged, mainly because of continuing turmoil in environmental conditions. The extinction had been caused by one or more sharp episodes of global warming driven by eruptions of the Siberian Traps large igneous province. The eruptions pumped huge volumes of greenhouse gases (carbon dioxide, methane, water vapour) into the atmosphere, and these forced a sudden temperature rise of 10-15°C which drove all life out of a broad climatic belt around the equator. Acid rain caused by the mixing of volcanic gases with atmospheric water killed plant life and swept forests from the landscape, leading to mass wasting, in which soils and rocks were washed into the sea in huge volumes. Oceans were acidified and deprived of oxygen. These devastating heating spikes were repeated at least three further times through the 5 Myr of the Early Triassic and stable tetrapod ecosystems are not encountered until the mid Anisian, some 7-8 Myr after the PTME (Irmis and Whiteside, 2011;Chen and Benton, 2012;Roopnarine and Angielczyk, 2015;Ezcurra and Butler, 2018).
Dinosaurs, and numerous other archosaurian clades, including pterosaurs, aphanosaurians, silesaurids, and pseudosuchians all arose at this time, and not later than the late Early Triassic (Olenekian), and yet some key groups such as pterosaurs and dinosaurs evidently remained at low diversity and low abundance. If dinosaurs originated at least in the Early Triassic, but have a minimal fossil record until the Carnian, what happened at that point early in the Late Triassic to expand their fossil record?

The Carnian Pluvial Event
The 14 Myr ghost range of dinosaurs, from say 247 to 233 Ma (Fig. 3), could be a failure of samplingin other words, a gap in the fossil record when in fact dinosaurs existed in reasonable abundance in some region of the world. This cannot be disproved, but the findings of abundant similarly sized archosaurs and other tetrapods in fossil deposits in many regions of the world dated as falling during this gap suggests dinosaurs ought to be found if they were present in any numbers. Further of course there is a strong premium for any palaeontologist who were to find such a fossil, so it is unlikely somebody has found an unusually early dinosaur but has not made it known to the world.
Two strands of thought in the 1980s laid the foundations for the recognition of a previously unrecognised mass extinction event in the Carnian. First, Benton (1983Benton ( , 1986c pointed to a 'second' mass extinction in the early part of the Late Triassic, close to the Carnian-Norian boundary, now dated at 227 Ma, based on his studies of ecological abundance of tetrapod faunas on land and on the palaeodiversity of ammonoid species through time. He also linked the peak in extinctions somewhere in the Carnian to the marine Rheingraben event in a later review (Benton, 1991); the Rheingraben event had long been recognised by palaeontologists studying the marine beds of Italy, Germany and areas round the Alps as a major turnover of benthic and nektonic organisms. At the same time, Ruffell (1989, 1990) identified a pluvial episode in the Carnian based on their studies of sedimentology and palaeoclimate in the Late Triassic of the UK and correlative regions of Europe. These ideas were opposed by some, and largely downplayed as at best a regional phenomenon in western Europe.
Then, two things happened in 2015-2016 to re-establish the importance of the Carnian Pluvial Episode (CPE): Dal Corso et al. (2015) provided the trigger and the model, the Wrangellia basalts in western Canada, and Ruffell et al. (2016) showed that the event was global in extent based on comparisons of sedimentary successions across many continents. The model for the extinction was the same as for the PTME and end-Triassic mass extinctions: huge eruptions of fissure lavas pumping greenhouse gases into the atmosphere, causing sharp global warming and acid rain, as well as ocean acidification and anoxia. There were as many as five pulses of warming and consequent humidity during the c. 1 Myr interval (Miller et al., 2017). The CPE was marked by a switch from arid to humid and then back to arid conditions, and it seems to have triggered ecological turnover both in the sea and on land (Simms and Ruffell, 1989;Dal Corso et al., 2015;Ruffell et al., 2016), and with improved radioisotopic dating, it was identified as having occurred from 233 to 232 Ma, in the mid-Carnian.
The link between the CPE and dinosaurian radiation was made by Bernardi et al. (2018), and they termed this phenomenon the 'dinosaur diversification event' (DDE). These authors provided evidence for stratigraphic correlation between the CPE and the base of the HAZ, matching the earliest part of the Ischigualasto Formation. Therefore, if the dating of the CPE at 233-232 Ma is correct, the HAZ in the Santa Maria Formation (233.23 ± 0.73 Ma) and lower Ischigualasto Formation (229.25 ± 0.10 Ma; 228.97 ± 0.22 Ma) follow the humid-to-arid switch, and represents a time when dicynodonts and rhynchosaurs were the dominant herbivores, but with the early dinosaurs Herrerasaurus, Eoraptor and others present as relatively rare components of the faunas (Desojo et al., 2020). When the Wrangellia eruptions stopped, the warmth and humidity abated, and conditions became unusually arid in much of the world. This was associated with a switch in Gondwanan floras from those dominated by the seed fern Dicroidium to conifers. More detail is needed to document when and how the floral change happened, as the rhynchosaurs Hyperodapedon and then Teyumbaita were key herbivores through to the end of the Carnian. As Desojo et al. (2020) note, the Teyumbaita-rich faunas of Brazil and Argentina experienced dry conditions that persisted into the Norian, and as climates became more humid, they were replaced by new tetrapod assemblages including the oldest plateosaurian sauropodomorphs, dating from about 226 Ma (Desojo et al., 2020). Dinosaurs built their ecological dominance stepwise through the remaining 25 Myr of the Late Triassic before the end-Triassic mass extinction (201 Ma) saw the end of various predatory pseudosuchian clades and the third step in the dinosaurian takeover (Benton, 1983;Langer et al., 2010;Benton et al., 2014Bernardi et al., 2018).
Key characters of dinosaurs and their relatives concern posture and gait. Indeed, it seems that both archosauromorphs and synapsids underwent a revolution in locomotion, starting in the Early Triassic, and this was part of the huge physiological shift in tetrapods that dominated the Triassic arms races between predators and prey.

Posture shift
In earlier studies, Charig (1972) had identified the posture shift that differentiated dinosaurs and later archosaurs from their forebears. Following the ideas of stepwise, gradual changes throughout the Triassic (Cox, 1967(Cox, , 1973Colbert, 1971Colbert, , 1975Romer, 1970Romer, , 1975Charig, 1980), Charig understood the posture shift to have occurred in stages through the Triassic. He noted that the early archosaurs possessed a sprawling posture in which their limbs were arranged more or less as in modern salamanders and lizards. In sprawlers, the upper limb bones (humerus, femur) are held almost horizontally out to the sides, and the limb joints (elbow and knee, wrist and ankle) are complex, allowing the lower parts of the arm and leg to swing partly sideways as the animal makes a stride. At the same time, its whole body swings laterally in a kind of serpentine motion as the stride is completed. Sprawlers today can generally only run short distances at speed, and then they are exhausted. Also, they are mainly quite small animals as the effort of hoisting their bodies clear of the ground is considerable; after running or walking, lizards and salamanders flop down and rest their bellies on the ground. Charig (1972) noted that dinosaurs, like birds and mammals today, had a fully upright or erect or parasagittal posture. The arms and legs are tucked beneath the body and they are nearly vertical. This means that the humerus and femur run straight down beneath the body and a stride is made by the entire length of the limb, not just the distal part; effectively a limb of the same length as in an equivalent sprawler can make a much longer stride. Also, the elbow and knee, and wrist and ankle, joints are simpler, allowing generally a back-and-forward motion about a hinge-like joint. Studies of modern mammals and lizards, however, do not show great differences in speeds; indeed, lizards are just as fast or faster for a given body size as mammals (Bennett, 1991). The difference is in stamina: animals with parasagittal posture such as birds or mammals can run for longer distances than sprawlers because they breathe while running (Carrier, 1987a). The endotherms thus generate ATP through oxidative phosphorylation in the mitochondria, whereas much ATP is generated through glycolosis in lizards, producing lactic acid. Mammals and birds do not become exhausted so rapidly, they don't generally rest their bellies on the ground between runs, and they do not have to throw their bodies into such extreme lateral bends during locomotion.
Finally, Charig (1972) noted that many Triassic archosaurs showed a semi-erect posture, perhaps like a crocodilian today, where they can sprawl when resting or when moving slowly but can hitch their bodies higher off the ground for moving faster. Indeed, the young of Crocodilus johnstoni can gallop along with an almost parasagittal gait. Charig saw the evolution of posture in archosaurs as passing from sprawling in Permian and Early Triassic forms, to semi-erect in Middle and early Late Triassic forms, and to fully erect in dinosaurs and other archosaurs of the late Late Triassic. So, the postural transition spanned most of the Triassic (Fig. 4).
A study of a large sample of Permian-Triassic fossil tracks by Kubo and Benton (2009) cast doubt on this model. They showed that there had been an instant switch from sprawling to parasagittal locomotion across the Permian-Triassic boundary (PTB). Even if the maker of all the tracks could not be identified, it seemed as if medium-and largesized tetrapods (those measuring >1 m in body length) as a whole had switched posture overnight . The tracks provide unequivocal evidence on posture, whereas skeletons can only provide hypothetical postures and gaits; the tracks record actual locomotion. In sprawlers, the hand and foot prints are far out to the side, whereas in animals with erect posture, the prints are close to the midline (Fig. 4A, B). Postural differences between animals with sprawling and erect posture can be determined by measuring the pace angulation, which is the angle measured from identical points on any pair of imprints from the left side or right side, to the same point on a single imprint from the other side (Fig. 4D). In sprawlers, the angle is low because the tracks of righthand and left-hand imprints are far apart, whereas in parasagittal animals, the angle is much more oblique as the right-hand and left-hand footprints lie closer to a single line. From studies of living animals, Kubo and Benton (2009) established that sprawlers such as salamanders, lizards and turtles show pace angulations below 107°, and erectpostured birds and mammals show pace angulations above 138°. From measurements of 461 fossil tetrapod trackways, these authors found that pace angulations averaged 88 and 87.5°in the Middle and Late Permian, and 139.5, 149 and 156.5°in the Early, Middle and Late Triassic. There was a slight increase in the degree of parasagittal posture (drawing of limbs inwards towards the midline) through the Triassic, but the shift from mean values of 87.5 to 139.5°across the PTB was substantial and unexpected (Fig. 4C). Kubo and Kubo (2013) later showed that stride length increased, on average, among all archosauriforms and among dinosauromorphs, based on their fossilised tracks, throughout the Triassic. This could reflect overall increasing body size among archosauriforms, but the authors regressed stride length against foot length, which is broadly proportional to body size, and so the increase in stride length to foot length from Middle to Late Triassic (Anisian to Carnian) likely indicates an overall increase in speed or increase in relative leg length, or both. Dinosauromorphs had relatively longer stride lengths than other archosauriforms of their day, which enabled them to cover the ground with fewer steps and so lower expenditure of energy (Pontzer, 2007). Further, the relative elongation of the hindlimb of dinosauromorphs by the acquisition of a digitigrade foot posture and elongate metatarsals from the Early Triassic onwards, assuming Asilisaurus is a dinosauromorph, reduced the cost of locomotion, as shown by studies across all living terrestrial animals (Pontzer, 2007). Indeed, the digitigrade posture of dinosaurs may well have enabled their eventual huge sizes (Kubo and Kubo, 2016).
This sharp shift in posture of all medium-sized and larger tetrapods across the PTB seems to have happened instantly, and among both synapsids and archosauromorphs. Such a sharp shift had not been predicted, and certainly does not match the three-stage evolution from sprawling to semi-erect to erect through Early, Middle and Late Triassic, as proposed by Charig (1972) from his study of archosaur skeletons (Fig. 4E). Our suggestion is not that the postural shift happened in a steady or gradual manner in multiple lineages, but that the shock of the PTME killed off all the sprawling lineages such as pareiasaurs, gorgonopsians, and most anomodonts, and the new lineages switched posture immediately. Some, such as the cynodonts and archosauriforms had originated only in the latest Permian, and many were small; their few surviving lineages might already have had parasagittal posture or adopted it during competition in the earliest Triassic recovery episode. Surviving anomodonts included medium-sized forms such as Lystrosaurus, and these must have switched posture too before they diversified again. It may be that the drop in atmospheric oxygen levels across the PTB provided a selective driver in favour of tetrapods that could breathe while running and so for the switch in posture.
This was not allactivity levels apparently continued to increase through the Triassic. The evidence for increased stride length, and perhaps increased leg length and speed, in archosaurs through the Triassic (Kubo and Kubo, 2013) points to an escalation in activity levels, consonant with the idea of an 'arms race', typically a co-evolutionary set of changes driven by ecological factors, such as predator-prey interactions, whereby both predator and prey become faster at the same time. If such a thing was happening, can we say whether these Triassic tetrapods were warm-blooded or not? We review the evidence first in synapsids, then in archosauromorphs, and then look at common themes in bone histology and isotopic studies and consider steps in increasing metabolic rates in both clades through the Triassic.

Ectothermy and endothermy
Living ectotherms, those that rely on 'external heat', include most fishes, amphibians and reptiles; classic examples are lizards that bask on rocks in the morning to absorb environmental heat, and hide in shady spots to avoid overheating when the sun is high. Endothermy, meaning 'internal heat', is a term applied typically to living mammals and birds, both of which use considerable amounts of the food they eat to maintain constant body temperatures (Lovegrove, 2017;Farmer, 2020;Goslau, 2020). Endotherms can generate warmth  Kubo and Benton (2009), and E is original. physiologically so they can function on cold days or in cold regions, and they use a variety of means to shed heat in hot conditions. Between these extremes are many intermediate thermophysiological conditions, but the discussion about the origin of endothermy has revolved around animals that would have shown a high basal metabolic rate.
In modern animals, there is not necessarily a sharp cut-off between ectothermy and endothermy. Clearly a modern bird or mammal is very different from a lizard or a turtle in terms of body temperature, ranges and stability, and in terms of physiology and behaviour in regard to control of the body temperature. However, it is well documented that some sharks, bony fishes and turtles can generate physiological body heat in certain circumstances, and that certain living mammals (e.g. monotremes, marsupials) regulate their body temperature at lower levels than most mammals. Further, some mammals down-regulate their body temperature to achieve adaptive hypothermia during hibernation, for example (Lovegrove, 2017). Body temperature ranges in modern mammals (30-40°C) and birds (35-45°C) are broad.
Endothermy has many advantages, including that animals are always alert, they can function during cool nights, they can live at many latitudes including in cold climates, they can show sustained highenergy movement to escape predators or catch prey, and they can occupy a broad range of ecological niches (Lovegrove, 2017;Goslau, 2020). However, endothermy has huge costs, the most notable being the need for endotherms to consume about ten times as much food as ectotherms of the same body mass, ranging from a 16-fold increase in a mammal weighing 30 g to a 4.7-fold increase in a 30 kg mammal (Nagy, 2001). In many conditions, especially warm climates that do not show much variation, ectothermy can be a more efficient strategy than endothermy, using behavioural temperature control (e.g. basking to warm up, hiding to cool down).
There are many correlates of thermophysiology among modern vertebrates, and Lovegrove (2017Lovegrove ( , p. 1215 lists numerous indicators of endothermy that are generally not seen in ectotherms: internal organ heat production, non-shivering thermogenesis, shivering thermogenesis, aerobic capacity (diaphragm in mammals; one-way breathing in birds and crocodilians; secondary palate), lactation, nasal cooling, cardiovascular function (four-chambered heart; small red blood cells; high levels of vascularisation of bone), energetics and skeletal form of locomotion (erect posture and gait), parental care, nocturnality, body-size miniaturisation, high growth rate, bone structure (fibrolamellar microanatomy, Haversian reconstruction in larger forms, intense microvascularisation), encephalization (large brain), and adaptive heterothermy (daily torpor and hibernation). Several of these have been noted earlier in debates among palaeobiologists on endothermy in fossil vertebrates. Can these features be tracked in the fossil record to determine when endothermy arose?

Introduction
The focus in understanding the origin of endothermy has long been on synapsids, the so-called 'mammal-like reptiles', that originated in the early Late Carboniferous. The Late Carboniferous and Early Permian synapsids, sometimes called informally 'pelycosaurs' are usually regarded as having been 'reptilian' in physiology and habits, whereas the clade Therapsida, known from the Middle and Late Permian onwards, showed a series of ever more mammalian features. Hints of endothermy in these extinct animals were noted over 100 years ago.
Permian-Triassic synapsid endothermy was proposed by Watson (1913Watson ( , 1931, and the idea became mainstream through a series of papers in the 1950s. Brink (1957), Olson (1959), and Van Valen (1960) presented a convincing case that Triassic synapsids at least were already substantially mammalian in anatomy and physiology. Based on a variety of fossil evidence seen in the rich Permian-Triassic synapsid fossils of South Africa, Brink (1957) speculated whether these synapsids gave birth to live young rather than laying eggs, and whether they had diphyodont teeth (single replacement between juvenile and adult dentitions), rather than multiple tooth replacements, as in most reptiles. Olson (1959) agreed with much of what Brink said and suggested that the transition from ectothermy to endothermy coincided with the evolutionary step from sphenacodont 'pelycosaurs' of the Early Permian to therapsids of the Middle Permian. Van Valen (1960) likewise accepted Brink's arguments, so much so that he proposed that all Therapsida, dating from the Middle Permian onwards, should be assigned to Mammalia, reflecting the view at the time that the key physiological transition to endothermy had taken place at that point in the evolutionary tree.

Vibrissae and muscular lips
The first solid evidence for endothermy in Triassic synapsids came from detailed studies of therocephalians and cynodonts. Watson (1913), in describing the skull and endocranium of the Middle Triassic cynodont Diademodon, noted its mammalian-type brain, ethmoturbinals in the nasal cavity, and concluded (p. 228): "Many of the differences between a mammal and a reptilethe soft skin, the increased bodytemperature, the hair and all it implies, the more perfect joints in the limbsare directly connected with increased activity and precision of movement, and these in turn are dependent on cerebellar improvement. The importance of the Diademodon brain, ear, and nose lies in the evidence which they afford that this change was actually taking place in the Therapsids, and that it is to all appearances a very gradual one and may to a large extent have preceded the development of a mammalian structure." He later (Watson, 1931) interpreted the numerous fine pits on the snouts of Late Permian and Triassic synapsids (therocephalians and cynodonts) as evidence for vibrissae, sensory whiskers, and hence for hair more generally. He noted the very mammalian-like limbs, vertebral column, brain, and presumed sensory organs of the snout in the Early Triassic therocephalian Ericiolacerta, and wrote (Watson, 1931(Watson, , p. 1200: "The general outer surface of the maxilla of Ericiolacerta is exceptionally richly provided with small foramina, whose existence goes to show that the skin of the face was sensory or required a large blood-supply, a condition only understandable if it were muscular. Thus any possible interpretation of these foramina in the maxilla of Ericiolacerta leads to the conclusion that the animals' skin was mammal-like, in that it possessed specially developed sense-organs (? hairs) and was movable and muscular." Such heavily perforated snouts have been noted in many other Triassic cynodonts (Fig. 5A).
Brink (1957, p. 86) expanded on Watson's evidence, noting that "[v] ibrissae are obviously specialized hair [so] that ordinary hair must have been present even in earlier forms." He suggested hair had evolved to shield these synapsids from absorbing too much heat from the sun, appropriate perhaps during a time that was as hot and arid as the earliest Triassic, but also to retain heat (insulation) at cooler times. Further, Brink (1957, p. 87) speculated that early synapsids had sweat glands associated with their hair, as well as mammary glands, which are usually interpreted as modified sweat glands.
The story of the early origins of synapsid hair has taken an interesting twist more recently. Smith and Botha-Brink (2011) and Bajdek et al. (2016) independently reported fossil finds of possible hairs in coprolites from South Africa and Russia respectively. These finds suggest the origin of hair during the Late Permian. In future, it will be helpful to determine whether specimens such as these show conclusive evidence of hair characters, such as melanosomes embedded in the structures. Melanosomes, the capsules that contain the pigment melanin in modern birds and mammals, could also give suggestions of the colours of the hair of early synapsids.
A recent study has suggested a much later origin for hair. In their investigation of synapsid brains, Benoit et al. (2017) argued that the presence of a true infraorbital canal in derived cynodonts suggests that they had a mobile rhinarium and whiskers. These authors used evidence of pleiotropic genetic linkage, through the homeogene Msx2 in mice, between the ossification of the parietal fontanelle and development of the cerebellum with the development of mammary glands and hair, to suggest that the first two characters seen in derived cynodonts confirms the presence of mammary glands and hair at least by that point in the Middle Triassic, before the origin of mammaliaforms. Some current researchers are less convinced by Watson's arguments about snout vessels and vibrissae and indicate that hair evolved in the early Late Triassic (Botha-Brink et al., 2018). However, the evidence from cranial nerves provides a conservative estimate, and the coprolites give tantalising evidence for the origin of hair in the Late Permian.

Differentiated teeth
Brink (1957, p. 77) noted that a suite of mammalian characters was already present in Triassic synapsids: "the significance of the mammalian single dental succession, secondary palate, ethmoturbinals, as related to a high constant blood temperature; the latter's relationship, in turn, to hair and sweat glands; the origin of milk glands; and the mode and significance of mammalian birth." He argued that it was unlikely that such an array of uniquely mammalian characters emerged all at once, and that they must have been acquired piecemeal over a long span of time, but which came first?
There is no question that differentiated teeth, with incisors, canines and cheek teeth (Fig. 5A), were present in most Middle and Late Permian synapsids. This adaptation enabled them to broaden their diets and, coupled with rotatory, propalinal (back-and-forwards), and lateral movements of the jaws in many forms, helped them improve their ability to crush food and extract nourishment. As Brink (1957) noted, these adaptations suggest that Middle and Later Permian synapsids already had elevated metabolic rates which passed on to their descendants in the Triassic. The other indicator of endothermy that evidently arose early in the evolution of therapsids was the diaphragm, associated with modifications of the vertebrae and ribsa major modification that coupled posture with metabolic rate.

Diaphragm
Modifications to the thorax, and especially the lumbar region, imply the presence of a diaphragm in Late Permian synapsids. The diaphragm is a muscular sheet that divides the guts from the lung compartment in mammals, and its origin is associated with increased flexibility of the vertebral column for dorsoventral bending.
The diaphragm is not preserved in any fossils, but its presence has been assumed based on the nature of the ribs. Early therapsids had similar ribs along the entire length of the torso (Fig. 5B), whereas derived therapsids showed differentiation of the dorsal vertebrae into thoracic and lumbar (Fig. 5C); the lumbar vertebrae bore very short ribs, or none at all, and this is the same as in modern mammals and the main reason is associated with the presence of a diaphragm. Lambertz et al. (2016) even suggested that a diaphragm arose earlier in synapsid evolution, among caseid 'pelycosaurs' in the Early Permian, as a means for these often-large animals to inhale enough oxygen to maintain an adequate throughput and a sufficiently high metabolic rate.
The diaphragm enabled synapsids to overcome 'Carrier's constraint' (see Section 5) that in most reptiles, the axial musculature can operate in respiration or locomotion, but not in both (Fig. 6A, B). The assumption that modern reptiles such as lizards do not breathe while running has been demonstrated, as no air moves in or out through the nostrils in locomotion experiments in several species (Carrier, 1987b). The evolution of lumbar ribs and the diaphragm resolved the conflicting functions of the axial (vertebral-rib) musculature, and from this point, the axial musculature drove locomotion and respiration in concert (Fig. 5B, C).
In modern mammals, the diaphragm enables pumping of high volumes of oxygen into the lungs, and it is driven during high-speed running by the up-and-down bowing of the vertebral column (Fig. 6C, D). Racehorses and cheetahs extend their stride by bowing the backbone down as arms and legs are at maximum stretch, and they bow the vertebral column up as the limbs come together and hit the ground. During this up-and-down bowing of the backbone, air is forced out of the lungs as the body scrunches up and the limbs come together, and air is forced in as the body stretches at maximum stride. Many Late Permian synapsids were chewing and breathing like modern mammals, although probably without the extreme adaptations for forcible breathing seen in fast-running modern mammals.
New studies of synapsid vertebral column evolution by Jones et al. (2019) suggest that a critical point was reached with the origin of Cynodontia, when the muscular diaphragm, which had originated earlier, was supplemented by evolution of the vertebral column to prevent lateral movements of the body, a separation of the musculature of the ribs and vertebral column, and sagittal ('up-and-down') bending. Up to that point, reptiles, like fish, showed mainly lateral bending of the body, but whereas this is crucial in driving a fish through the water, it has lost that function in terrestrial vertebrates. By stopping all lateral movement of the torso, cynodonts could move forward in a straight line, coupling limb movements and breathing efficiently for the first time. The coincidence of the origins of parasagittal gait (see Section 5), suppression of lateral movement of the torso, and the diaphragm confirms their interdependence and the switch from slow-moving sprawlers to fast-moving parasagittal animals in the Late Permian and Early Triassic.

Secondary palate and ethmoturbinals
Other anatomical indications of endothermy include the secondary palate which separates mouth from nose and allows the animal to breathe and eat at the same time, whereas most reptiles have to stop breathing as they feed (Fig. 7A). As the secondary palate extended in the roof of the mouth, the nasal cavity enlarged, and Early and Middle Triassic cynodonts such as Thrinaxodon (Fig. 7B) and Diademodon had mammal-like nasal cavities, in which the respiratory chamber opened into a nasopharyngeal passage that passed to a more posterior olfactory chamber. Importantly, these early forms already possessed cartilaginous respiratory turbinals to enable evaporative cooling during exercise and reflecting the high environmental temperatures of the time. In later cynodonts, these cartilaginous turbinals ossified as the ethmoturbinals, scrolls of thin bone inside the nasal cavity that carried mucous membranes in life (Fig. 7C, D). The ethmoturbinals function as countercurrent heat exchangers, removing heat from exhaled air, and warming inhaled air. They also help retain moisture in dry climates and can improve the sense of smell. Crompton et al. (2017) used CT scan data to show that Early and Middle Triassic cynodonts such as Thrinaxodon have a turbinate ridge on the inside of the maxilla (Fig. 7B) that supported the cartilaginous turbinals. CT scans of the skulls of Late Triassic cynodonts also showed the intricate detail in their ossified ethmoturbinals. Apart from further extension backward of the secondary palate, the first mammaliaforms of the Late Triassic and Early Jurassic had ossified nasal turbinates which provided a larger area of respiratory epithelium in the nasal cavity (Fig. 7C). Owerkowicz et al. (2015) confirm the early origin of nasal turbinates in synapsids, and their importance for mammalian-type endothermy, but note that birds have frequently reduced or lost their nasal turbinates, and so these structures are of less importance for archosauromorph endothermy.

Brain and complex behaviour
The brain of synapsids shows considerable variation in the different regions relating to intelligence and sensory functions, but their relative sizes lie on the boundary between that of modern reptiles and modern mammals, as might be expected (Benoit et al., 2017). Further, whereas early synapsids had smaller brain sizes (in proportion to body size) and in the reptilian range, Triassic cynodonts often had mammal-sized brains. Palaeoneurological data derived from CT scans of numerous synapsid skulls provide alternative evidence about the origins of other soft tissue characters, such as the presence of muscular, flexible lips and vibrissae (see Section 7.2).
At this critical moment around the PTB, several authors, including Groenewald et al. (2001), have suggested that synapsids adopted extended parental care, a key mammalian feature linked to their enlarged brain and complex behaviour, but also to their endothermy, as tiny babies need help in finding food as they grow large enough to regulate their body temperature safely. Groenewald et al. (2001) reported a find of 18-20 individuals of the cynodont Trirachodon preserved in the terminal chamber of a complex burrow system in the late Early Triassic of South Africa and suggested this was a communally-living family group. This was interpreted as evidence that the burrow system was used by a large colony of Trirachodon, evidence perhaps for temperature control at a time when palaeoclimates included very hot and very cold phases, as well as for physical protection from predators, and for parental care of the young. A number of such burrow systems have been found in the Early and Middle Triassic of South Africa and Antarctica, with evidence that they were occupied by different synapsids. Farmer (2000Farmer ( , 2020 has made a strong case that parental care and endothermy went hand in hand. Her argument is that the high cost of being an endotherm was offset by the advantages of complex social behaviour, and this in turn required prolonged parental care, as seen in mammals and birds. The costs are the need for additional food to generate heat through the visceral organs, but the benefits include an ability to incubate offspring thereby shortening the period of time between conception and sexual maturity. First endothermy and parental care for egg incubation evolved, followed by care of neonates that, in mammals, universally includes feeding offspring. Elevated food requirements because of this care of the young then led to selection for high aerobic capacity in the mammalian ancestors. Therefore, the origin of endothermy enabled both archosaurs and synapsids to maintain the aerobic metabolism required for a greatly expanded suite of complex behaviours. She argues that parental care, enlarged brain size and endothermy are closely linked, and this is confirmed by the fact that similar suites of physiological and behavioural changes arose independently in synapsids and archosaurs.

Nocturnality
Nocturnality, the property of being active mainly at night, is often linked with endothermyafter all, atmospheric temperatures are usually lower at night than during the day and endothermy enables an animal to remain active, whereas ectothermic lizards generally become torpid. Nocturnality has often been associated with mammalian origins a nocturnal lifestyle is a correlate of their large eyes, and small size and endothermy can be helpful preadaptations (Kielan-Jaworowska et al., 2004). But why did nocturnality evolve? There are currently two hypotheses that posit temperature as the driver, but one cites high temperatures, and the other low temperatures.
The high temperature hypothesis was proposed by Lovegrove, (2019a, b) who argues that nocturnality in mammals arose in the Late Triassic when the first mammals were seeking to avoid overheating, evaporative water loss, and poor sperm quality. He noted that without externalised testes, these early mammals would have struggled to keep the spermproduction temperature at the optimum value of 36°C. This became less of a problem when the testes were moved outside the body wall into the scrotum, either at the time of origin of marsupials in the Jurassic or with the origin of Boreoeutheria in the Cenozoic. A major problem with this idea is that the bulk of evidence indicates that synapsid nocturnality arose long before the origin of mammals.
The low temperature hypothesis of Angielczyk and Schmitz (2014) was that nocturnality had been a characteristic of numerous early synapsids, particularly the smaller insectivores and carnivores, but not exclusively, and dating back to the Early Permian (Fig. 8). They assessed different conditions from full nocturnality to full diurnality, and intermediates, from measurements of the eye socket (orbit) and the sclerotic ring within the orbit, both of which correlate with eyeball size and function: broadly speaking, larger eyes and larger sclerotic rings mean more nocturnal adaptations (scotopic), and relatively smaller eyes imply diurnal adaptations (photopic). These authors suggest that nocturnal adaptations might have evolved several times in different synapsid lineages and could have been linked to widespread endothermy. The timing of these metrics of nocturnality matches well with other indicators of endothermy, in positing origins through the Late Permian and Triassic, but there have even been suggestions of much earlier origins, in the Carboniferous (see Section 11.1).

Introduction
Traditionally, it was assumed that the only archosauromorphs exhibiting endothermy were the birds, whereas crocodilians and dinosaurs and other extinct forms were regarded as having been ectothermic throughout their evolution. The origin of avian endothermy was marked by the oldest bird, Archaeopteryx from the Late Jurassic, some 150 Ma, at the time the oldest occurrence of feathers. The fact that crocodilians were ectotherms showed they had retained the primitive condition, and that ectothermy was the general state among archosaurs. However, there were two lines of evidence that suggested the need for caution, namely the close resemblance of theropod dinosaurs to early birds, and the insulated pterosaurs.
On theropods, Thomas Henry Huxley and other nineteenth-century palaeontologists, noted strong anatomical similarities between the skeletons of small theropod dinosaurs and Archaeopteryx, and commented on their likely agility and speed. With this in mind, Huxley could not draw a clear morphological line between dinosaurs and birds. However, following his work, there was a century of confusion over bird origins which masked discussion of whether dinosaurs might have been warm-blooded or not. Through most of the twentieth century, birds were seen as so functionally unique that it could not be conceived that they had arisen from theropod dinosaurs in the Late Jurassic, and their origins were sought among mysterious parts of the phylogeny of Triassic archosauromorphs some 50-100 Myr before Archaeopteryx.
The second reason that Huxley and other nineteenth-century palaeontologists might have doubted the standard view of archosaurian endothermy was that the pterosaurs, now known to be close relatives of dinosaurs, had long been regarded as endothermic. It may be surprising to recall that a hair-like pelt had been reported on an exceptionally preserved pterosaur specimen as early as 1831 (Goldfuss, 1831). Further early records of pterosaurs with 'hair' included specimens of Scaphognathus and Rhamphorhynchus from the Late Jurassic of southern Germany, which showed pits on the wing bones for bristles (e.g. Broili, 1927). Fur-like structures preserved as external moulds were later reported in specimens of Anurognathus, Pterodactylus, and Dorygnathus, mostly from the Upper Jurassic Solnhofen Limestone of southern Germany, the source of the 'first bird' Archaeopteryx with its feathers. After these nineteenth century finds, pterosaur fluff was reported from another source, the Upper Jurassic Karatau Formation of Kazakhstan, from which specimens of Sordes showed carbonaceous impressions of fibres all over the body, which were interpreted as hair-like structures (Sharov, 1971;Unwin and Bakhurina, 1994).
Numerous such finds from the Jurassic and Cretaceous of China (see below) confirmed that pterosaurs all bore fluff over their bodies, but the point here is that all that evidence up to 1970 did not contribute to a reasonable understanding of archosauromorph phylogeny, nor an understanding of when and how endothermy might have arisen in the clade. This was partly because the phylogenetic position of pterosaurs was unclear until the first cladistic analyses in the 1980s (Gauthier, 1986) showed that they were close relatives of dinosaurs, and birds were commonly seen as entirely distinct in their origins from dinosaurs.
Then, with the work of John Ostrom, everything changed. In describing excellent new specimens of the paravian dinosaur Deinonychus, Ostrom (1969) showed how bird-like it was in possessing some 30 characters, including the fused clavicle (wishbone), the semilunate carpal (which allows the wings to be folded), the large hand, and many more. In subsequent papers (e.g. Ostrom, 1973Ostrom, , 1974 he showed powerfully that Huxley had been right and that birds were dinosaurs. This provided evidence for Bakker and Galton (1974) to name Dinosauria as a clade comprising dinosaurs and birds, as noted earlier (Section 2), and also provided the basis for Robert Bakker's arguments that dinosaurs had been endothermic. Further, as noted earlier (Section 2), the first cladograms in the 1980s showed that Dinosauria was indeed a clade, that birds were theropod dinosaurs (Gauthier, 1986), and that pterosaurs were a close sister group of Dinosauria.
The outcry at the time against Bakker's views seemed to have resolved the debate about endothermy in dinosaurs, and more widely among Archosauromorpha: endothermy arose just with Archaeopteryx and birds, and the marker for the origin of endothermy was feathers. Pterosaurs were also generally accepted as having been endothermic, but presumably their endothermy had arisen independently of birds because of the substantial phylogenetic separation between the two groups. But the consensus against Bakker has entirely crumbled, and this began around the year 2000 with a spectrum of studies on the physiology of modern birds and crocodilians.

Crocodilian hearts
First came the suggestion from Seymour et al. (2004) that the Triassic ancestors of crocodilians had been active and endothermic, and that the group subsequently became ectothermic, as they are today. It had long been noted that modern reptiles have a two-chambered heart and modern endotherms (birds, mammals) have a four-chambered heart, although some pythons and lizards, as well as crocodilians, have functionally separated left and right ventricles. The four-chambered heart of modern endotherms functions to keep the oxygenated blood (pulmonary blood) from the lungs separate from the deoxygenated blood returning from all parts of the body (systemic blood). The pulmonary blood is at low pressure and the systemic blood is at high pressure and a separation between right atrium and ventricle and left atrium and ventricle is essential to maintain high rates of movement of the blood and high efficiency in distributing oxygen and removing carbon dioxide. Such efficiency is necessary to enable the high metabolic rates of endotherms.
Modern endotherms such as mammals and birds have much larger hearts relative to body size than modern ectotherms such as fishes, amphibians and reptiles, and they pump the blood at overall much higher pressures (Seymour et al., 2004). Systemic arterial blood pressures are 16-19 kPa for birds, 12-16 kPa for mammals, and 2-6 kPa for fishes, amphibians and reptiles; estimated values for some dinosaurs are 10-25 kPa (Seymour et al., 2004), very much in the endotherm range and some perhaps even higher then modern mammals and birds. Keeping the two blood flows separate, and lacking the ability to shunt blood past the lungs is important for endotherms, but what are the advantages of the incomplete separation of blood flows in ectotherms, especially crocodilians?
In the crocodilian heart ( Fig. 9) there are four chambers, as in the bird and mammalian heart, two ventricles and two atria. Like most tetrapods, crocodilians have two aortae, a right aorta and a left aorta. The left aorta leaves the right ventricle, adjacent to the pulmonary artery, while the right aorta leaves the left ventricle. Birds and mammals are derived in having only one aorta, birds retain the right and mammals the left, but in both birds and mammals the aorta leaves the left ventricle. The crocodilian heart (Fig. 9) is unique in several ways: (1) it has a neurologically controlled, cog-tooth valve in the pulmonary artery in addition to the leaf or semilunar valves, and (2) the lumen of the aortae are connected by a foramen, the foramen of Panizza. When crocodiles are excited, such as when they are swimming or walking, the cogtooth valve is open and blood flow is the same as in birds and mammals, where oxygenated blood is pumped by the left ventricle to the body, and deoxygenated blood is pumped by the right ventricle to the lungs through the pulmonary artery. In between heart beats, blood flows though the foramen from the right to the left aorta. This right-to-left shunt was explained as an adaptation to diving (reviewed Seymour et al., 2004;Farmer et al., 2008), either enabling the uptake of oxygen from the lungs and retaining the better oxygenated blood of the left ventricle for the brain and heart, or in suppressing metabolism and extending dive times. Therefore, the reversal in crocodilian hearts from the two-closed-systems of modern endotherms to the ability to shunt from atrium to atrium had been explained in relation to their strong adaptations to marine life and diving through diversification of the clade Thalattosuchia in the Jurassic.
However, the shunt seems to have more to do with overall levels of activity rather than with diving (Farmer et al., 2008). When crocodilians are very calm and when they are digesting a meal, the cog-tooth valve closes and reduces blood flow to the lungs. Deoxygenated blood is instead ejected, or shunted, into the left aorta, and flows to the stomach and other digestive organs. Also, when calm, crocodiles have long periods in which they hold their breath (apnoea), and they do not require much blood flow to the lungs during these periods. Oxygen continues to be slowly drawn from the lungs, while carbon dioxide largely accumulates in the tissues as bicarbonate. Although it was thought that the shunt might allow crocodiles to dive for longer periods, animals in which the shunt was disabled do not dive for shorter periods than those that can shunt (Eme et al., 2009). Seymour et al. (2004) presented developmental evidence that these adaptations are secondarily derived, and they proposed that Triassic crocodilians likely had a simple four-chambered heart, as in modern birds and mammals, and would therefore have been endothermic. They linked this interpreted physiology with the erect posture of the earliest crocodilians, and indeed the fact some such as Saltoposuchus and Terrestrisuchus from the Late Triassic were even bipedal. Further evidence is that crocodilian lungs are bird-like in many ways, being multichambered and with complex internal tubes, and crocodilians are capable of breathing and running at the same time, so overcoming Carrier's (1987a) constraint, as in mammals (see Section 7.4). Further, juvenile alligators produce fibrolamellar bone, a characteristic of endotherms (Seymour et al., 2004).
In physiological terms, ectotherms can remain submerged underwater for longer than endotherms because of their lower oxygen demand; indeed, they can dive for up to ten times as long as an endotherm of similar body mass, reflecting the order-of-magnitude difference in metabolic rates (Verberk et al., 2020). This provides evidence for a selective advantage in becoming ectothermic to enable long submersion times. Further, dive duration is proportional to body size, but the body mass-dive duration relationship is steeper for endotherms than for ectotherms, which explains why the largest deep-divers today are endotherms (whales) and this was likely true also in the Mesozoic (ichthyosaurs, plesiosaurs, mosasaurs).
This seemingly contrary evolutionary interpretation, that modern crocodilians came from endothermic ancestors, and became secondarily ectothermic and lost a perfect four-chambered heart, was challenged by Hillenius and Ruben (2004). However, more recent work (e.g. Seymour, 2016;Cook et al., 2017) confirms the suggestion that crocodilians primitively had a four-chambered heart as in birds and mammals, and that their Triassic ancestors were endothermic. This is supported by new work on crocodilian respiration.

Archosaurian air sacs and crocodilian respiration
Respiration in dinosaurs has been a subject of speculation for some time. Indeed, almost from the beginning of the anatomical study of dinosaur skeletons, palaeontologists have noted evidence of pneumatic structures in vertebrae and ribs, indicated by specialised pneumatic foramina (e.g. von Meyer, 1837;Owen, 1856;Seeley, 1870). These early anatomists compared the details of the dinosaurian vertebrae with Fig. 8. Evolution of nocturnality in synapsids. The evidence from sizes of eye sockets and other measurements are that synapsids were nocturnal (scotopic) ancestrally, in the Carboniferous and Early and Middle Permian, and then became variously adapted to full daylight conditions (photopic) or an intermediate condition (mesopic). Perhaps this is related to foraging ecology: small herbivores tend to be diurnal, whereas carnivores are predominantly nocturnal or active both at night and in the daytime. Typical skulls show larger eye sockets in nocturnal forms (upper) and relatively smaller orbits in diurnal herbivores (lower skulls). Based on data from Ken Angielczyk and Lars Schmitz. modern birds. Postcranial pneumatic structures (PSP) in modern birds comprise foramina (holes) that enter vertebrae, ribs and limb bones (e.g. humerus), or fossae, hollows on the flanks of the vertebrae. The air spaces inside the bones may be quite extensive, marked as single or multiple-lobed cavities inside vertebral centra and neural arches and proximal ends of ribs and limb bones. In life, the spaces are lined by epithelium and they join together as parts of larger air sacs that mainly sit in the body cavity, but can invade the bones extensively, probably also serving the function of weight saving, which is particularly important in flying animals such as birds and pterosaurs, and in the massive sauropod dinosaurs.
This evidence from pneumatic foramina in the vertebrae and ribs of theropod and sauropod dinosaurs, as well as pterosaurs, shows they likely had a bird-like respiratory system (O'Connor and Claessens, 2005;O'Connor, 2006;Claessens et al., 2009;Schachner et al., 2009). PSP are seen in certain Triassic basal archosaurs (Gower, 2001;Butler et al., 2012) as well as in fossil crocodilomorphs such as the Triassic-Jurassic 'sphenosuchians', but not in modern crocodilians. Further, living crocodilians show a variety of fossae on the sides of the vertebrae that might have represented sites of PSP in their deep ancestry (O'Connor, 2006). Therefore, it seems likely that PSP and air sacs were primitive for Archosauria, and even for Archosauriformes, as a whole (Gower, 2001;O'Connor, 2006;Butler et al., 2012), and were subsequently lost in modern crocodilians as well as in ornithischian dinosaurs.
Crocodilian respiratory systems had traditionally been regarded as entirely 'ectothermic' in character, until a series of recent studies. For example, Farmer and Sanders (2010) showed that juvenile alligator lungs and air sacs are very similar to those of embryonic birds, and they noted detailed homologies in anatomy and in total volume of respiratory systems. They argued that these indicate common inheritance and that such respiratory systems probably characterised their ancestors in the Triassic. A follow-up study by Schachner et al. (2013) showed that in the Nile crocodile, respiratory flows are bird-like, with inspired air flowing cranially to caudally in the cervical ventral bronchus, and caudally to cranially in the dorso-bronchi in the lungs. Details of the anatomy of the lungs and air sacs are the same as in the alligator, and these authors also conclude that the unidirectional airflow and lungs seen in birds are replicated in modern crocodilians, and so are likely ancestral for archosaurs as a whole. Farmer (2015) presented evidence from study of eight species of modern crocodilians that the anatomical flow-through ventilation system of birds is typical also of crocodilians, and so is likely a primitive archosaurian feature.
In her review of the accumulated evidence about crocodilian lungs, Farmer (2015) wrote, "The similarity in structure and function of the bird lung with pulmonary anatomy of [a] broad range of crocodilian species indicates that a similar morphology and pattern of unidirectional flow were present in the lungs of the common ancestor of crocodilians and birds. These data suggest a paradigm shift is needed in our understanding of the evolution of this character. Although conventional wisdom is that unidirectional flow is important for the high activity and basal metabolic rates for which birds are renowned, the widespread occurrence of this pattern of flow in crocodilians indicates otherwise." Her detailed studies of the lungs of many modern crocodilians confirm the evidence from studies of the heart: crocodilians are more bird-like than expected, and some at least of their 'ectothermic characters' may reflect adaptations to living in water. The evidence confirms that their ancestors among Triassic archosaurs were likely endothermic and had sustained high metabolic rates. Lambertz et al. (2018) confirmed these suggestions by use of a histological tissue marker. These authors proposed a novel correlate of air sacs, so-called pneumosteal tissues, seen as delicate fibres in secondary trabecular and secondary endosteal bone that are in contact with air sacs in modern birds. They reported this bone type from thin sections of pneumatised vertebrae of two species of sauropod dinosaurs, and so used this to confirm that such structures were connected with the presence of avian-type air sacs.
There are fundamental differences between the lungs of birds and crocodilians (Schachner et al., 2011;Farmer, 2015). Birds have heterogeneously partitioned parabronchial lungs, that is lungs containing large numbers of tiny parabronchial tubes that enhance the surface area available for gaseous exchange between lungs and blood vessels when compared to the mammalian system and associated with the unidirectional air flow system. Further, the lungs of birds and crocodilians function differently, and this affects the nature of the dorsal vertebrae and ribs. In birds, gaseous exchange and ventilation are entirely separated; gaseous exchange occurs in the lungs, and these do not change in volume during respiration because the air is pumped in and out by bellows-like movements of the air sacs, which in turn are barely involved in gaseous exchange.
These fundamental differences between the respiratory systems of crocodilians and birds are reflected in the nature of their dorsal vertebrae and rib cages (Schachner et al., 2011). Because of their respiratory system, the lungs of birds fill their rib cages tightly and the rib cage shows a furrowed dorsal surface where the lung tissues bulge through (Fig. 10). This fixity of the rib cage is achieved by retention of two-headed ribs throughout the length of the torso with the heads braced on the transverse process (diapophysis) and centrum (parapophysis) of each vertebra. In crocodilians, most of the dorsal ribs are single-headed, and the diapophysis and parapophysis both attach to the transverse process of the vertebra, and indeed both branches of the ribs fuse in more posterior dorsal ribs (Fig. 10). The single-headed ribs can flex in and out, allowing the ribs to change shape and accommodate to the very special hepatic piston respiration system in crocodilians, where the diaphragmaticus muscle pulls the liver and digestive organs back, increasing pulmonary volume and, with movements of the intercostal ribs expanding the rib cage, drives the inhalation of air. Brocklehurst et al. (2018Brocklehurst et al. ( , 2020 suggest that the crocodilian respiratory system is likely closest to that of Triassic archosaurs, but they note that whereas the rib characters of the two respiratory systems (avian, crocodilian) can be seen in fossils, there is no osteological correlate of the hepatic piston. Their studies show that dinosaurs as a whole had fixed ribs and so likely shared dorsally immobile lungs, as in birds. The skeletons of theropods also show that many had mobile gastralia that might have allowed them to pump air in a bird-like manner, and maniraptorans had uncinate processes and other rib and vertebral characters relating to stability of lung shape and improved air pumping.
According to their informal trait evolution inferences (Fig. 10), birds share a succession of respiratory characters with dinosaurs and with other avemetatarsalians, including dorsally immobile lungs (fixed dorsal ribs) in silesaurids and dinosaurs, PSP and air sac systems in pterosaurs, sauropodomorphs and theropods (possibly acquired independently three times, or basal to all avemetatarsalians and then lost in ornithischians), mobile gastralia in all or most theropods, uncinate processes in maniraptorans, and further adaptations in birds (but some of which might have evolved deeper in the phylogeny, but which cannot be identified in the fossils). These studies provide a rationale for why dinosaurs, pterosaurs, and even their ancestral forms in the Triassic might have achieved high levels of aerobic and metabolic activity, even in the hypoxic conditions of the Mesozoic, and so contributing to their successful radiation.
Could those Triassic crocodilians have had feathers? That cannot be said yet, but there is now evidence that feathers originated in the Early Triassic.

Feathers
Dermal fluff has long been known in pterosaurs, as noted above (Section 8.1), and new discoveries from China have confirmed that all pterosaurs had whisker-like structures over their heads, necks, torso, and parts of the limbs. Examples of taxa from the Jurassic and Cretaceous of China include numerous specimens of Jeholopterus, Pterorhynchus, Gegepterus, and an undetermined genus (Czerkas and Ji, 2002;Lü, 2002;Wang et al., 2002;Kellner et al., 2010;Yang et al., 2019). These whiskers were called pycnofibres by Kellner et al. (2010), defined as dermal appendages growing from the skin of pterosaurs, and distinguished from mammalian hair and bird feathers, but otherwise homologous. In the case of pterosaurs, care is needed to discriminate pycnofibres from other fibres, especially the strengthening aktinofibrils in the wing membrane (Unwin and Bakhurina, 1994).
Even though pycnofibres have not been identified in any Triassic pterosaur, it has generally been assumed that these dermal whiskers emerged with the first pterosaurs and that they functioned primarily for insulation in animals that doubtless had high metabolic rates in order to enable active flight (Unwin and Bakhurina, 1994;Kellner et al., 2010). In one pterosaur specimen, Czerkas and Ji (2002) noted some densely aligned pinnate fibres that formed distinct tufts in a diamond-and V-shaped pattern covering the wing, and they suggested these might be protofeathers of some kind, a view rejected by Kellner et al. (2010). However, Yang et al. (2019) identified pycnofibres in two anurognathid pterosaur specimens from the Middle Jurassic of China, and there were four kinds of thesebristle-like, tufted at the end, tufted halfway along the shaft, and branching from the base (Fig. 11). These authors noted numerous characteristics of feathers in these specimensthe 'pycnofibres' have a tube-like calamus (base of the shaft), they contain melanosomes inside their structure, and three of the pycnofibre types show branching, a fundamental defining characteristic of feathers when compared to mammalian hair.
Among dinosaurs, it is well known that Archaeopteryx from the latest Jurassic (c. 150 Ma) of southern Germany was the oldest example of a tetrapod with feathers for a long time. Then, specimens of theropod dinosaurs, including Sinosauropteryx, Caudipteryx, Microraptor, Yutyrannus and others were reported in the 1990s from the Early Cretaceous (c. 125 Ma) of north-east China (Chen et al., 1998;Ji et al., 1998;Xu et al., 2003Xu et al., , 2004. Most of these dinosaurs were close to birds in the cladogram, but some such as Sinosauropteryx and Yutyrannus were much less closely related, representing compsognathids and tyrannosauroids respectively, and these shifted the putative origin of feathers downwards from Archaeopteryx to the origin of clade Coelurosauria, minimally at the beginning of the Middle Jurassic, some 174 Ma. These discoveries confirmed earlier work by Ostrom (1969Ostrom ( , 1973Ostrom ( , 1974) that had identified the origins of a suite of 'avian' characters at different points through the phylogenetic tree of theropods, some of them in the Triassic, and long before the appearance of Archaeopteryx and birds. For example, Coelophysis from the Late Triassic, some 220 Ma, had hollow bones and fused clavicles, both features once seen as diagnostically avian.
There had been hints that feathers might be even more widespread among Dinosauria with the demonstration of a strange series of thick bristles along the back of the ceratopsian Psittacosaurus (Mayr et al., 2002(Mayr et al., , 2016, and especially with reports of long, filamentous structures on the back, tail and neck of the heterodontosaurid Tianyulong from the Early Cretaceous of China  and extensive scales and feathers over the flanks and limbs of the small ornithopod Kulindadromeus (Godefroit et al., 2014). These dermal appendages include monofilaments around the head and the thorax, and more complex featherlike structures around the forelimb and hindlimb, and they all share typical characteristics of feathers, such as the fact they branch and that they contain melanosomes. These three species are ornithischian dinosaurs, a clade far removed from theropods (and birds), and these discoveries suggested to Zheng et al. (2009), Brusatte et al. (2010 and Godefroit et al. (2014) that feathers were present in the earliest dinosaurs.
The occurrence of identical branching, keratin-based structures that contain melanosomes in three clades of archosaurs, namely theropods, ornithischians and pterosaurs, could suggest a common origin of feathers in the Early Triassic, being minimally an apomorphy of Avemetatarsalia, the clade that includes Pterosauria, Dinosauria, and basal relatives (Godefroit et al., 2014;Benton et al., 2019;Yang et al., 2019). Feathers have not been reported from sauropodomorph dinosaurs or from the armoured ankylosaurs or stegosaurs among ornithischians, although it will be interesting to see whether such specimens are reported in future. Either way, there is a choice of evolutionary interpretation, either that feathers arose once and were lost in certain clades, or that feathers arose independently at least three or four times.
Feathers have three main functions -flight in birds, insulation, and display. We rule out flight as the oldest function because most of the dinosaurs with feathers clearly were not flying animals, and pterosaurs used wing membranes as flight surfaces and, while bearing simple feathers, do not show the interlocking pennate feathers that in birds form their flying surfaces. So, between insulation and display, insulation probably came first in evolution, and this is borne out by the fact that pterosaurs appear to have been rather uniformly light brown in colour, where their melanosomes have been studied (Li et al., 2014;Yang et al., 2019). On the other hand, the first identifications of colour patterns in dinosaurs showed brilliant patterns of ginger and white stripes on the tail in Sinosauropteryx (Zhang et al., 2010) and black and white stripes on the wings and a ginger head crest in Anchiornis (Li et al., 2010). Both author collectives independently decided these sharp patterns on tails, wings and crests matched display colouration in modern birds, and that these dinosaurs at least had engaged in display-type behaviour by the Middle Jurassic at least.
If feathers arose in basal avemetatarsalians in the Early Triassic, this pushes their origin back 100 million years from 150 Ma to 250 Ma and requires an entirely different macroevolutionary explanation . The climate then was generally hot to very hot, so this might seem to be the wrong time for endothermy and insulation to emerge, and that is a conundrum to be resolved. Far from being unique to birds and associated with their small size, high metabolic rates and flight, feathers are much more widespread, and their putative origin in the Early Triassic associates them with the evolution of erect posture and the beginnings of enhanced metabolic rates in archosaurs in the aftermath of the PTME.
If the first feathers were hollow, light-brown coloured monofilaments, their subsequent evolution is complex and there were many morphologies, some not seen in modern birds (Xu et al., , 2014Benton et al., 2019). It seems that pterosaurs and ornithischian dinosaurs had a variety of simple feather types such as simple monofilaments, bristles, quills, and tufted and bunched filaments, all probably for insulation; they do not show pennate feathers, those with a central rachis and roughly symmetrically branching barbs used by birds for contour and aerodynamic functions. Early theropods presumably had simple monofilament feathers, as in Sinosauropteryx, and more derived maniraptoran and paravian theropods show a greater variety of feathers, up to five or six types, including pennate contour and flight feathers (Xu et al., , 2014.
Hair and feathers are unique to synapsids and archosaurs respectively, although both may have emerged at the same time, in the Early Triassic, as convergent responses to enhanced predator-prey arms races set in train during the recovery of life from the PTME. Developmentally, it is well understood that feathers and hair are generated by archosaurs and synapsids by very similar genome regulatory sequences, and indeed these are closely related in ontogeny to other patterned structures in the skin such as scales in reptiles and fishes, and denticles in sharks . Parallel evidence for both major clades comes from bone histology and stable isotope analyses of bone.

Bone histology
In the 1970s, when Robert Bakker was arguing the case for warmblooded dinosaurs (see Section 2), Armand de Ricqlès presented cogent evidence from dinosaurian bone histology. He noted that dinosaurs generally showed abundant fibrolamellar bone, often with evidence of secondary remodelling through Haversian canals, both of which are features of the bone of living endotherms such as birds and mammals showing key modifications associated with the evolution of the avian lung-air sac system. Images from Brocklehurst et al. (2018Brocklehurst et al. ( , 2020. (For interpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.) that exhibit fast growth. Modern reptiles such as turtles, lizards and crocodilians typically do not develop these bone tissues, but rather lamellar-zonal cycles and generally without secondary Haversian remodelling, together suggesting slower growth and lower metabolic rates.
In a review of bone histology of a range of Triassic archosaurs, de Ricqlès et al. (2008) found evidence of fibrolamellar bone and secondary remodelling in nearly all examples, including derived forms such as dinosaurs and pterosaurs, but also in phytosaurs, aetosaurs, and poposaurs on the pseudosuchian line and basal archosauriforms of the Early and Middle Triassic such as erythrosuchids, proterochampsids, and euparkeriids. As an outgroup the investigators looked at a rhynchosaur. They found that, whereas the rhynchosaur showed evidence of slow-growing bone with numerous lamellar-zonal cycles, the erythrosuchids and indeed all Triassic archosaurs had fibrolamellar bone and other evidence of fast growth. Haversian systems were seen in a few specimens, including in the rhynchosaur bone sections. de Ricqlès et al. (2008) concluded that all archosauriforms showed dinosaur-like fibrolamellar bone, evidence of rapid growth and high metabolic rates, whereas the rhynchosaur, an archosauromorph but not an archosauriform, did not and so conforms to a more typically 'reptilian' model. They suggested that osteological evidence of enhanced metabolic rates dates back to the origin of archosauriforms in the latest Permian or Early Triassic.
The de Ricqlès et al. (2008) study set out to test whether the ectothermic, 'reptilian' bone histology of modern crocodilians was seen in their earliest ancestors or whether it might be secondary. They argued that, because the Triassic pseudosuchians include a diversity of forms with high-metabolic-rate fibrolamellar bone, it seems likely that crocodilians lost these characteristics at some point in their evolution. As with the evidence from their hearts and respiration (Sections 8.1,8.2), the seemingly primitive features of crocodilians today may well have arisen secondarily as a result of the massive commitment of the Jurassic thalattosuchians to life in deep waters.
These observations have been confirmed by further studies of Triassic archosauromorphs. For example, Botha-Brink and  found that fibrolamellar bone was widespread, occurring in early growth stages of basal forms such as Prolacerta and Proterosuchus, and throughout growth in Erythrosuchus. In further studies of rauisuchians, often large, flesh-eating pseudosuchians, close to the origin of crocodilomorphs, Scheyer and Desojo (2011) found evidence of fibrolamellar bone in early growth stages, indicating fast growth and high metabolic rates, as also in the Triassic crocodylomorph Terrestrisuchus. The absence of fibrolamellar bone and other evidence for slow growth in the osteoderms of modern crocodilians confirms their secondary evolution of ectothermy. Further, in a study of the rauisuchian Batrachotomus, Klein et al. (2017) confirmed the evidence for high metabolic rate in this large animal, not only in terms of widespread fibrolamellar bone, but also in its inferred fast growth rate: it achieved its relatively large size of 6 m body length within just over three years. This kind of growth rate is quite unlike that of known large ectothermic reptiles, such as crocodilians, and has much more in common with modern endothermic mammals and birds. All members of Avemetatarsalia, including pterosaurs and dinosaurs and their ancestors (Fig. 3) show fibrolamellar bone throughout, as documented by de Ricqlès et al. (2008) in the aphanosaurian Teleocrater and the basal dinosaurs Herrerasaurus, Thecodontosaurus, and Lesothosaurus. The same is true of the silesaurid Silesaurus, shown by Fostowicz-Frelik and Sulej (2010) to have fibrolamellar bone with relatively dense vascularisation, indicating fast growth in younger years, slowing towards the periphery of the bones, where lines of arrested growth (LAGs) are seen and an avascular external fundamental system (EFS) suggesting slowing and cessation of growth. Determinate growth and the EFS are associated with high metabolic rates, as indicated by the other histological evidence.
Bone histology of Triassic synapsids shows a similar story. For example, Ray et al. (2004) noted a range of bone histological patterns across therapsids, but notably slow, cyclical growth in the Late Permian gorgonopsian Scylacops, contrasting with the widespread occurrence of fibrolamellar bone in the Triassic and Early Jurassic therocephalians and cynodonts, evidence for fast, sustained growth. The widespread occurrence of fibrolamellar bone was confirmed in all Late Permian and Triassic therocephalians (Huttenlocker and Botha-Brink, 2014), with evidence for higher vascularisation in larger forms, as well as changes across the PTB favouring overall body size reduction coupled with increased vascularisation, suggesting faster growth in the survivors, and perhaps greater adaptation to post-extinction low levels of atmospheric oxygen. Derived cynodonts show very mammalian bone histology (Botha-Brink et al., 2018), with well-developed fibrolamellar bone especially at earlier stages of growth. Some of the taxa studied here were tiny, and their growth rates were fast, but still probably slower than in modern tiny mammals such as shrews. In a comparison of the primary osteon density of thin sections of synapsid bones, Faure-Brac and Cubo (2020) found a clear distinction between Early Permian 'pelycosaurs' and their ectothermic values versus Late Permian synapsids with endothermic-type bone.

Microvascularisation and red blood cell diameter
A key feature of bone structure is microvascularisation. Living bone is full of blood vessels that transfer calcium and phosphate to and from the bone tissue, and their relative size, spacing and organisation in living tetrapods can discriminate between ectotherms and endotherms (Huttenlocker and Farmer, 2017;Goslau, 2020). Birds and mammals today have smaller canal diameters and more densely packed canals than modern reptiles and amphibians (Fig. 12A, B). Canal diameter is proportional to the sizes of red blood cells (RBC), which are typically smaller in endotherms, enabling faster transmission of oxygen to the tissues, consonant with their higher metabolic rates (Goslau, 2020). There is a broad correspondence between high aerobic activity levels and endothermy, but some ectothermic fish have very small RBC diameters; the size of the RBC is correlated with aerobic capacity and not necessarily basal metabolic rate. In descriptions of the bone histology of Triassic archosaurs, most authors (e.g. de Ricqlès et al., 2008;Fostowicz-Frelik and Sulej, 2010;Scheyer and Desojo, 2011;Klein et al., 2017) note the high vascularisation of the bones, and that vessels were small, packed and irregularly organised, all indicative of fast growth. Huttenlocker and Farmer (2017) showed that microvascularisation of these fossil bones can be measured directly, and that mean RBC diameter can be estimated. Studies of fossil bone show that many synapsids had microvascularisation, and estimated RBC diameters of mammalian character in the latest Permian (Fig. 12C), reflecting the range of values seen in modern marsupials and placentals. Birds today have somewhat larger RBC than mammals, and that diversity of values is seen in Triassic archosaurs, whose red blood cells are larger than those of Triassic synapsids. However, none of these has values as low as in some modern turtles, lizards and frogs. In detail it will be interesting to determine whether basal crocodylomorphs such as Terrestrisuchus show such narrow vessels as in Poposaurus and modern crocodilians, or whether their values are more in the endothermic range.
These studies point to key aspects of the life modes of Triassic synapsids and archosauromorphs. Their small RBC sizes indicate high aerobic activity levels in many, and equivalent abilities in sustained, vigorous exercise (Huttenlocker and Farmer, 2017). Small RBC size is also seen in modern hypoxia-tolerant mammals, including burrowers, and this has been taken as confirming evidence that small therocephalians and cynodonts around the PTB were burrowers (Groenwald et al., 2001). The initial stimuli for reduction in vessel size and increase in packing within their bones may have been a mix of low levels of oxygen around the time of the PTME (see Section 11.3), combined with competitivelydriven increases in exercise capacity associated with the adoption of parasagittal gait in multiple lineages of archosauromorphs and synapsids at the same time, in the earliest Triassic.

Estimating ancient metabolic rates
Estimates of growth rates from a range of Triassic archosaurs (Legendre et al., 2013) confirmed that they all showed high, endothermic-like instantaneous bone growth rates of 6-42 μm per day, similar to growth rates in modern birds and mammals. Comparisons with crocodiles through the Mesozoic suggest they lost their endothermy in the Jurassic, perhaps associated with the new adaptations of thalattosuchians in particular to active predation underwater and their sit-and-wait strategies. Legendre et al. (2016) took the idea a step further, by using bone histology of fossil reptiles to calculate their metabolic rates as a means of exploring when endothermy arose, and whether it arose in one step, or over a series of stages. They compared resting metabolic rate (RMR) of living and fossil tetrapods, using in vivo measurements for the living forms. Values for extinct animals were estimated from four metric parameters of the fossil bones (vascular density, osteocyte density, osteocyte shape, osteocyte area), using a method that had been established by Cubo et al. (2012) and confirmed by direct comparison of calculated values for living animals with the in vivo measured RMR values. These calculations showed that endothermy of some form arose in Archosauromorpha, even before the origin of Archosauriformes, and modern-style endothermic metabolic rates were detected in theropod dinosaurs. Of course, simple comparisons of RMR values cannot be made without consideration of size because metabolic rate scales strongly allometrically with body mass; therefore, the following comparisons are across ranges of values, and future work should pay close attention to pairings of estimated body masses and estimated RMR values. Whereas modern ectothermic turtles, lizards, and crocodilians have RMR values of <0.5 mLO 2 h −1 g −0.67 , the nonarchosauriform archosauromorph Prolacerta has a value of 1.78, and other Triassic archosauriforms, including early crocodilians, fall in the range of 1-2 mLO 2 h −1 g −0.67 . Values for modern mammals range from 1.5-3.5, for dinosaurs from 2 to 6, and for modern birds from 8 to 12 mLO 2 h −1 g −0.67 . Two aquatic Triassic archosaurs had low values: the RMR for the basal archosauriform Proterosuchus is 0.78 and for the phytosaur Rutiodon is 0.40, well within the ectothermic range, and this chimes with the evidence that modern crocodilians show low metabolic rates because of their aquatic lifestyle, and because of a reversal from formerly endothermic values. The same reversal from endothermy to ectothermy might have happened also in the Triassic archosauriform clades, the Proterosuchidae and Phytosauria (Legendre et al., 2016).

Stable isotopes in bone and thermophysiology
The two stable isotopes of oxygen, oxygen-16 ( 16 O) and the rarer and heavier oxygen-18 ( 18 O), exist in nature and their ratios can reflect atmospheric temperatures. For example, palaeoclimatologists expect to find depletion of 18 O in colder climate zones because these heavier molecules condense more readily than 16 O, and so they are progressively lost polewards and at high altitude in mountains as climates become colder. The 18 O/ 16 O ratio, or ∂ 18 O, values in fossil bones can therefore reflect external palaeotemperatures, but the same relative condensation difference is affected by body temperatures. Generally, the ∂ 18 O value in a fossil bone or shell is not used to give an exact palaeothermometer reading because it can be affected by so many aspects of the external environment and by the animal's own body temperature and diet, as well as by diagenetic effects (changes caused after burial by high temperatures or pressures), so it is usually studied in a comparative manner. For example, oxygen isotope ratios in bones and teeth of synapsids or archosauromorphs (whose physiology is under study) may be compared with bones of teeth of a known ectotherm, like a fish or a temnospondyl amphibian, in the same geological deposit. By being found together, it is hoped that environmental and diagenetic changes are the same and can be ignored, and that any difference in ∂ 18 O reflects physiological differences.
In a first isotopic study of a series of Middle Permian to Middle Triassic terrestrial tetrapod examples, Rey et al. (2017) concluded that cynodonts and dicynodonts became endothermic independently at some point in the latest Permian or close to the PTB. Cynodonts, lystrosaurids and kannemeyeriids were all found to have been endothermic, and tracking back phylogenetically, these arose from independent ectothermic sources among the cynodonts on the one hand and anomodonts on the other. The apparently sudden and coincident origins of endothermy in two synapsid lineages around the time of the PTME might indicate that this kind of physiology either enabled its possessors to survive the crisis, or at least to adapt to the tough recovery time, and then to flourish into the Triassic.
A similar style of study of the oxygen isotopes of dinosaurian eggshells (Dawson et al., 2020), using the clumped isotope method that considers binding of 13 C to 18 O, revealed endothermic levels of body temperature. The method was calibrated using eggshells of modern reptiles and birds, among which the ectotherms and endotherms could be readily distinguished, and the fossil samples came from localities that had experienced widely differing environmental temperatures, from palaeoequatorial to palaeopolar regions. Dinosaur body temperatures were estimated as 27-44°C, a very wide range, but the eggshell fragments generally yielded body temperatures warmer than environmental temperatures at each site, and most of them in the range of modern endotherms (34-44°C). Overall, the study confirmed that all dinosaurs were likely endothermic, and mostly at levels equivalent to modern birds and mammals, and that endothermy was minimally the ancestral condition in Dinosauria, if not in a wider clade such as Avemetatarsalia.
These bone isotope studies are in their early days, and many more can be completed. Their strength is that they provide evidence about thermophysiology of extinct animals that is independent of anatomical studies of posture, inferred lung function, pneumatisation, bone tissue growth modes, and microvascularisation of bone.

Endothermic marine reptiles
This review is mainly concerned with life on land, but the position of the two main clades of marine reptiles, the ichthyosaurs and sauropterygians, is germane, especially now that both are seen as phylogenetically members of the clade Diapsida, perhaps diverging rapidly from lepidosauromorph ancestors in the earliest Triassic. Therefore, their origin and rapid diversification in the Early Triassic (Benton et al., 2013b;Scheyer et al., 2014) appears to parallel that of the archosauromorphs and synapsids, all being parts of the new ecosystems that recovered after the PTME.
Traditionally, the Mesozoic marine reptiles were regarded as coldblooded, just as were the dinosaurs. However, a comparative study of the oxygen isotope composition of their tooth phosphate in comparison to contemporary fishes showed that all the large marine reptiles of the Jurassic and Cretaceous (ichthyosaurs, plesiosaurs, mosasaurs) maintained a constant and high body temperature in a broad range of oceanic environments, whether tropical or cold temperate (Bernard et al., 2010).
However, this was not always the case. Triassic sauropterygians for example show typical ectothermic bone, with evidence of slow growth rates and regular LAGs, and no fibrolamellar bone or Haversian replacement. Features of fast growth and high metabolic rates have been noted from a variety of Jurassic and Cretaceous plesiosaurs (Fleischle et al., 2018(Fleischle et al., , 2019, and in their report of a latest Triassic plesiosaur, Wintrich et al. (2017) suggest that perhaps Plesiosauria from the start were endothermic, as an adaptation to cruising and efficient foraging in the open oceans. The Jurassic and Cretaceous plesiosaurs were not only endothermic, but had remarkably high RMR values, in the range of modern birds (Fleischle et al., 2018). Their Triassic relatives apparently lacked such adaptations, and were all slow-growing and ectothermic, except for the pistosaurs and plesiosaurs, members of the lineage that survived the Late Triassic extinction events, which acquired unusually large blood vessel canals in their bones, suggesting large red blood cells, and so perhaps some strong physiological adaptations to deep diving (Fleischle et al., 2019).
Ichthyosaurs, on the other hand, seem to have been endothermic from the start, as shown by bone histological studies of a wide range of forms from the Early Triassic to Late Cretaceous (e.g. de Buffrénil and Mazin, 1990;Kolb et al., 2011). They all show fibrolamellar bone with evidence of fast growth in inner parts of their bones, with more compact bone with LAGs in outer portions, especially in Triassic forms, but the latter not in the faster-growing post-Triassic ichthyosaurs. This is confirmed by oxygen isotopic studies (e.g. Bernard et al., 2010;Séon et al., 2020), which show differences in the body temperatures attained by different Jurassic and Cretaceous marine reptiles, with both plesiosaurs and ichthyosaurs achieving endothermic body temperatures of 32-40°C, whereas thalattosuchian crocodilians in the same locations showed much lower likely body temperatures in the range 27-31°C for teleosaurids and 29-37°C for metriorhynchids.
This coincidence of a switch to endothermy by Plesiosauria, and to some extent in the new clades of Ichthyosauria, at the end of the Triassic and into the Jurassic, interestingly apparently coincides with the reverse adaptation in Thalattosuchia, the crocodilians that dominated in the oceans in the Jurassic and Early Cretaceous, and perhaps switched to ectothermy to enable them to survive on low oxygen levels during deep diving. Plesiosaurs and thalattosuchians both perhaps adapted to deep diving at about the same time, in the Late Triassic and Early Jurassic, but did it by different routesectothermy and reduced oxygen use in the crocodilians and endothermy and enhanced oxygen transfer capabilities in plesiosaurs.

11.
Steps and drivers in the evolution of endothermy 11.1. Stepping up; late and early models for the origins of tetrapod endothermy Current estimates are that endothermy in birds and mammals might have been initiated at different times, ranging widely from Carboniferous to Jurassic. Lovegrove (2017) presented a hypothesis for the evolution of endothermy that uses the diverse array of anatomical, physiological, and behavioural correlates seen in modern vertebrates, and maps them temporally according to evidence from the fossil record. His phases for the evolution of endothermy are: (1) parental care and land conquering (Permian-Triassic); (2) miniaturisation, thermoregulation, and ecomorphological diversification (Late Triassic-Jurassic); and (3) locomotion and climate adaptation (Cretaceous-Cenozoic). He documented evidence for each stage and saw that the stages occurred roughly synchronously for both synapsids and archosauromorphs, but with synapsids distinctly ahead of archosauromorphs in the first steps in the Permian and Triassic.
Certainly, the evidence that Middle and Late Permian synapsids already possessed a diaphragm, differentiated teeth and an enlarged brain suggests they had evolved some form of endothermy, but possibly still regulating their body temperature by shivering thermogenesis. He commented (Lovegrove, 2017(Lovegrove, , p. 1228) that there is "no compelling fossil evidence to suggest that the Early Triassic therapsids or nontheropod bipedal dinosaurs possessed the significant insulationfur and feathers, respectivelyrequired to minimize the loss of endogenously produced heat." This view would still be supported by some palaeontologists, although it seems more likely that insulating hair in synapsids arose in the Late Permian or Early Triassic, and feathers in the Early Triassic (see Sections 7.2, 8.4). Lovegrove's (2017) second phase in the origin of endothermy was from Late Triassic to Jurassic and was triggered by miniaturisation of synapsids through the Triassic (later paralleled by miniaturisation of maniraptoran theropods on the line to birds in the Middle to Late Jurassic), brain expansion, insulating fur and feathers, and possible nocturnality, which together triggered expansions of ecomorphological adaptation in derived synapsids and early mammals, as well as among smaller dinosaurs and birds. The important role of miniaturisation in the origin of endothermy was proposed by Hopson (1973) and McNab (1978) as a means for early mammals to improve their activity levels to enter new niches, especially for activity at night.
The third phase, from Cretaceous to Cenozoic, involved the origin of powered flight in birds in the Late Jurassic and Cretaceous, and enhanced cursoriality as Cenozoic mammals adopted digitigrade postures, both evolutionary steps that were associated with yet-higher metabolic rates. Here, we will focus on Lovegrove's (2017) phases 1 and 2.
In a review of thermophysiology of synapsids, Botha-Brink et al. (2018) broadly agree with the Lovegrove scenario, summarising current palaeontological knowledge on the timing of the acquisition of mammalian characters by synapsids through the Triassic: 1. Differentiation of the vertebral column resulting in improved agility (Late Permian). 2. Bony secondary palate, allowing for more continuous ventilation (Late Permian-Early Triassic). 3. Increased tooth differentiation and improved tooth occlusion, allowing radiation into new ecological niches (Early-Middle Triassic). 4. Extended parental care, suggesting increased parental investment in young (Early Triassic; Groenewald et al., 2001). 5. Loss of pineal foramen indicating increasing thermoregulatory and reproductive control (Benoit et al., 2016a). 6. Possible evolution of maxillary vibrissae indicating improved sensory structures (Benoit et al., 2016b; early Late Triassic). 7. Ossified maxillary turbinates indicating efficient counter current exchange system for the conservation of heat and water (Crompton et al., 2017;Middle-Late Triassic).
A similarly late origin of endothermy in archosaurs is suggested by Rezende et al. (2020) in their study of the effects of miniaturisation in theropod dinosaurs as a prelude to the origin of flight. This miniaturisation has long been noted, and it began early among maniraptorans and continued through to the first birds such as Archaeopteryx at the end of the Jurassic. Puttick et al. (2014) showed that there was an acceleration in miniaturisation at the origin of Paraves, about 170 Ma, when body size reduced sharply while arm length remained roughly constant. This enabled the feathered paravians to support their weight in gliding with protowings, which eventually enabled powered flight in the first birds like Archaeopteryx. Rezende et al. (2020) noted that miniaturisation also improves the fitness of endotherms: for example, a 43.3 kg bird has the same energetic requirements as a 370 kg dinosaur, representing a scaling factor of 8.55 times. A problem with this model is that the early theropods are assumed to have been ectotherms, or at least inertial homeotherms, and yet evidence from bone histology, vascularisation, pneumaticity and other criteria (see Sections 8 and 9) suggests that dinosaurs were endothermic from the start. Nonetheless, the size advantage for an endotherm in being small was doubtless hugely important in additional acceleration of metabolic rates in paravians in general, and in birds in particular.
Whereas some of these recent papers suggest a rather late origin of endothermy, perhaps in the Jurassic, others suggest that endothermy might have been more or less primitive to amniotes. For example, the early nocturnality hypothesis of Wu and Wang (2019) is that both mammals and birds adopted endothermy convergently in the Late Carboniferous. These authors reached their conclusion by conducting ancestral character state analyses of the phylogeny of diel activity patterns in modern mammals and modern birds, and found that their ancestral condition was probably nocturnality, considering molecular and ecological evidence and reconstructed visual pigments of these ancestors. They suggested that nocturnality arose among early amniotes driven by the search for food or avoidance of predators. Nocturnality means the early synapsids and diapsids had to evolve larger eyes and specialised visual pigments, as well as enhanced hearing and olfaction, but the lower night-time temperatures perhaps also required endothermy. Nocturnality might also have required intensive parental care, so the small young were protected from freezing.
The Wu-Wang model then posits the evolution of a variety of endothermy-related characteristics in the Late Carboniferous to Early Permian, in both synapsids and diapsids, including enhanced hearing and vocal communication, as well as endothermy with insulation, shivering, respiratory turbinates, high basal metabolism, sustained activity, four-chambered heart, high blood pressure, and intensive parental care. Many of these functional and behavioural traits have not yet been identified from independent evidence in pre-Triassic synapsids or diapsids, nor have they all been tested using phylogenetic methods, and most analysts (see Section 7.7) would see the origins of nocturnality rather later, either in the Middle and Late Permian (Angielczyk and Schmitz, 2014) or Late Triassic (Lovegrove, 2019b).
The case has been made here that endothermy perhaps arose in the Early Triassic, coincident with posture shifts and origins of pelage and osteological indicators of high metabolic rates in both archosaurs and synapsids. But could these changes have been driven by low oxygen levels in the atmosphere? 11.2. Low oxygen as a driver Goslau (2020) proposed that endothermy evolved in both synapsids and archosaurs in response to low levels of atmospheric oxygen in the Triassic. This is based on evidence that the delivery of oxygen by the cardiovascular system to the body tissues is the fundamental rate limitation on aerobic metabolism (Hedrick and Hillman, 2016;Goslau, 2020). At low atmospheric oxygen levels, a prediction from physiology would be that animals should alter their lung geometry and capacities, develop a four-chambered heart, acquire low pulmonary blood pressure and high systemic blood pressure, high blood flow rates, increased capillary surface areas, and smaller red blood cells with greater surface areas for gas exchange (Goslau, 2020). Further, as noted earlier (Section 5), reduced oxygen levels might have favoured the spread of erect posture among Early Triassic tetrapods because of the fact they can breathe while moving (Carrier, 1987a). Such proposals of course depend on evidence that atmospheric oxygen levels reached unusually low levels in the Early Triassic and that tetrapods were forced to adapt.
First, it is argued that atmospheric oxygen levels fell and CO 2 levels rose in the Early Triassic, from evidence of stable isotopes, palaeosols, leaf stomata, and charcoal distribution (Payne et al., 2004;Glasspool and Scott, 2010;Retallack, 2012) as well as from modelling (Berner et al., 2007). There were short-term carbon and oxygen spikes at the PTB and repeated a further three times in the Early Triassic, indicating extreme warming and acidification, as well as sustained low levels of oxygen.
Several authors have already suggested that the low oxygen levels imposed physiological changes on plants and animals as they adapted to cope with the unusual conditions (e.g. Huey and Ward, 2005). These and other authors noted for example that some of the synapsids that survived the PTME had barrel-like chests to accommodate expanded lungs, perhaps a muscular diaphragm to force air in and out of the lungs more speedily, and a possible four-chambered heart to improve the efficiency of blood circulation. In addition, as noted earlier, Late Permian and Triassic therapsids had nasal turbinates, possibly to enhance oxygen uptake, to assist with countercurrent heat exchange or both. Further, some Early Triassic synapsids had extended secondary palates and internal nostrils, both possibly to improve oxygen uptake. The proposal that these low oxygen levels triggered the rise of endothermy by Goslau (2020) takes the idea a very large step further. According to this model, the ten or more specific physiological distinguishing characters of endotherms compared to ectotherms became embedded at the time of the PTME, or at least early in the Triassic, and coincidentally in both archosaurs and synapsids.
There are some weaknesses with this idea. First, it is worth noting that although oxygen levels plummeted through the Late Permian and Early Triassic, falling from 33% to 19% and then recovering to 22% in the Middle Triassic, according to the Berner model (Berner et al., 2007), these 'low' levels during the critical Early and Middle Triassic are actually similar to today's value of 21%. So, it would be wrong to assume that world conditions of hypoxia prevailed (Huey and Ward, 2005) without further clarity. Indeed, there are substantial debates between modellers and those who estimate ancient atmospheric compositions from empirical proxies such as stable isotopes, palaeosols, leaf stomata, and charcoal distribution, because estimates coincide in some cases, but diverge in others. Second, there is no evidence that hypoxia is a killer of life on land (or in the sea), unless it is associated with sharp temperature rises, which did indeed occur during the PTME and subsequently (Pörtner et al., 2005;. However, modern physiological studies show that with gradual changes in temperature and oxygen availability, organisms generally simply migrate away from the zone of stress, and such short-term changes do not necessarily stimulate a substantial evolutionary response. Further, in terms of hypoxia in particular, most organisms can adapt within their lifetimes to low oxygen levels (e.g. at altitude). Third, the anatomical changes noted as resulting from hypoxia include some that had already become established well before the end of the Permian (e.g. diaphragm, barrel chest, maybe even the 4-chambered heart) when oxygen levels were much higher than they are today, and indeed all these anatomical modifications could be explained simply by the origin of endothermy, but stimulated by other triggers. Fourth, several clades experience shortterm diversification events during the Early Triassic, which are generally not considered endotherms, such as procolophonid parareptiles and various temnospondyl amphibians, and they show none of these anatomical changes.
In fact, oxygen levels seem to have been lower, perhaps around 11-15%, in the Late Triassic (Berner et al., 2007;Hudgins et al., 2020), and Hudgins et al. (2020) proposed this was a key time in the enhancement of pneumaticity in dinosaurs, and that it gave theropods an adaptive advantage over pseudosuchians as top predators. These authors note how the pneumaticity index of theropods and pseudosuchians fluctuated in tune with estimated atmospheric oxygen levels, with rises in pneumaticity happening roughly as atmospheric oxygen levels fell, and then showing how pseudosuchian levels plummeted before the end of the Triassic, whereas theropod levels rose across the Triassic-Jurassic boundary. This is an interesting pairing of environmental and physiological data, but it is not clear that it tells the whole story. Indeed, theropods, and dinosaurs in general, had originated in the Early Triassic and expanded in the mid-Carnian, as noted earlier (see Section 4), and large pseudosuchian predators such as rauisuchians, ornithosuchids, and phytosaurs disappeared by the end of the Triassic. However, Hudgins et al. (2020) cannot exclude that it was the environmental stresses of the end-Triassic extinction that killed off these pseudosuchians, as well as other taxa such as aetosaurs and procolophonids, and that these disappearances perhaps gave theropods, but also dinosaurs as a whole, their chance to diversify. Further, the correlation or linkage between the fluctuating oxygen levels and fluctuating pneumaticity of Late Triassic reptiles (Hudgins et al., 2020, Fig. 6) are somewhat out of phase, and the pneumaticity values are based on rather few specimens, so the inferred moving average is not entirely reliable. In any case, it is not clear why pneumaticity would correlate with atmospheric oxygen levels, because pneumaticity does not play a role in gas exchange and therefore it is not clear why it would give theropods an advantage as top predators in low-O 2 environments.
Even though it has proved hard to make a case that hypoxia drove changes in respiratory systems or endothermy as a whole, researchers are all focussing on the Early Triassic as a time of turmoilcould the stressful conditions of the time have contributed to the parallel evolution of endothermy in both archosaurs and synapsids?
11.3. The origin of endothermy at the PTME A case has been made here, and supported by much current literature, that the switch to endothermy in both synapsids and archosaurs took place in the Early Triassic, in the turmoil of rebuilding ecosystems as life recovered from the devastation of the PTME. All the evidence suggests that feathers arose in archosaurs in the Early Triassic, coincident with the marked posture shift from sprawling to erect (Kubo and Benton, 2009). Other markers of fast growth and high metabolic rate (e.g. fibrolamellar bone, remodelling of bone, high vascularity of bone, pneumatisation, unidirectional respiratory flow) all date back to the origin of Avemetatarsalia, Archosauria, or Archosauriformes, all of which occurred in the Early Triassic or Late Permian (Huttenlocker and Farmer, 2017). Further, if as Farmer (2020) argues, parental care is a definite correlate of endothermy, then parental care has been posited, among synapsids at least, based on burrow-dwellers from the Early Triassic.
In terms of reconstructing the macroevolution of the origins of endothermy, the studies so far have brought together a suite of anatomical observations on different taxa, each of which can be located in a phylogenetic tree and given a geological age date. Such information, comprising observations on many taxa, can then be subjected to analysis by phylogenetic comparative methods (PCM). The advantages of PCM include that estimated ancestral states and traits recorded from taxa scattered across a phylogenetic tree can provide testable hypotheses of trait origin and evolution that can be tested by addition of further taxa and traits at a later time. For example, it is not necessary to find feathers or hair in Early Triassic fossils if the PCM analyses point to the Early Triassic as the time of origin of the trait (e.g. Yang et al., 2019). For a PCM study on the origins of endothermy, what is ideally required is a single trait, or a single measurement based on multiple traits, that discriminates ectotherms from endotherms. As we have seen, metabolic rate can be such a representative metric (Section 9.3).
When Legendre et al. (2016) submitted their values for actual metabolic rates in living vertebrates, together with estimated metabolic rates for extinct taxa to phylogenetic comparative analysis (Fig. 13), the acceleration in archosaur rates can be seen to have occurred in two steps, a definitive elevation of metabolic rates in the latest Permian or earliest Triassic, and a second boost towards avian-style rates in the Late Triassic. This second jump in rates was much higher in archosaurs than in synapsids, because modern metabolic rates for mammals are much lower than those for modern birds.
In a broader analysis, Legendre and Davesne (2020) estimated overall metabolic rate for a broad range of fossil taxa based on a combination of bone histological characters, as noted earlier (Section 9.3), and using a method that has been extensively ground-truthed on living animals. Their analysis shows (Fig. 14) that there were major thermophysiological switches at the origins, respectively, of Therapsida (Middle Permian) and Archosauria (Early Triassic). These authors discriminate two kinds of endothermy, the 'full-scale' endothermy shown by modern birds and mammals, or more properly non-shivering thermogenesis (NST), where heat is generated at cellular level. Many of the individual endothermic fishes and reptiles generate heat by shivering thermogenesis or other mechanisms (Lovegrove, 2017;Farmer, 2020). In evolutionary terms, this then reminds us to be careful in inferring NST from the first appearance of indicators of high metabolic rate in archosaurs and synapsids; many of these early forms could have exhibited a variety of other physiological and behavioural means to regulate their body temperature to ensure a high activity rate.
So far, a comparable PCM study has not been performed on synapsids, so we attempt this here. Without the four measurements from bone histological sections required to calculate metabolic rate (Cubo et al., 2012;Legendre et al., 2016), we take a tally of metabolic indicators from some key synapsids through the Permian to Early Jurassic interval (Table 1), largely based on data in Botha-Brink et al. (2018). These include definite indicators of endothermy such as fibrolamellar bone, maxillary nerves indicating vibrissae, nasal turbinates, and red blood cell size, but not more generic features such as differentiation of the vertebral column (and diaphragm), parasagittal gait, bony secondary palate, tooth differentiation, and parasagittal posture, which are present in all included taxa. The average value of these measurements is an 'informal degree of endothermy', highest (1.0) in the Early Jurassic mammal Morganucodon and lowest in the outgroup taxon Lystrosaurus (0.167). This can only ever be regarded as informal and nonquantitative because there is no evidence for recording just those characters I noted (Table 1), nor for their equal weighting in the final score.
I used standard PCM approaches to calculate ancestral states and transitions and plotted as a heat-tree. The calculation used a series of standard programs in R: ape (Paradis, 2011), phytools (Revell, 2012), paleotree (Bapst, 2012), and strap (Bell and Lloyd, 2015), and the 'geoscalePhylo' command to plot the phylogeny against geological time, the 'ace' command to calculate maximum likelihoods of ancestral states under different models of rates of evolution, and the 'fastAnc' and 'contMap' commands to map inferred ancestral states onto the heatmap phylogeny.
The evolutionary tree showing ancestral state reconstruction (Fig. 15) confirms that tritylodontids (Tritylodon, Oligokyphus) and tritheledontids (Pachygenelus) had slightly lower degrees of endothermy than the coeval mammal Morganucodon. Then, running backward down the tree, the two major branches of Cynodontia, the carnivorous probainognathians and largely herbivorous cynognathians have a middling degree of endothermy (green shades), and even the Early Triassic cynodonts Thrinaxodon and Galesaurus show a pale blue shade, indicating partial endothermy. Even the outgroup Lystrosaurus, while rating a low value of endothermy (dark blue) according to this metric, has been graded as an endotherm by study of the bone histology (Ray et al., 2004) and bone oxygen isotopic values (Rey et al., 2017).
Other PCM calculations, based on adaptations to nocturnality (Fig. 8;Angielczyk and Schmitz, 2014), red blood cell size (Fig. 12C;Huttenlocker and Farmer, 2017), and evolution of feathers (Yang et al., 2019) all converge on the Early Triassic as a time of major change in posture and metabolic rate. In future studies, the PCM approach is important in enabling analysts to determine the most likely sequences and timings of trait changes, but there will doubtless be many discussions over how to combine numerous indicators of endothermy, such as erect posture, postcranial skeletal pneumaticity, 4-chambered heart, parental care, and encephalisation, all of which can be determined to a greater or lesser extent in the fossils.
A startling conclusion of the PCM analyses is that they confirm the origins of many of the traits germane to endothermy in the Early Triassic. Why this time?

Triassic arms races
It has long been understood that the PTME marked a major turning point in the history of life, triggering the origins of modern ecosystems in the sea and on land. This also then seems to have been a pivotal point in the history of terrestrial vertebrates, when they switched from being ectothermic in the Permian to being, many of them, endothermic from the Early Triassic onwards. As first synapsids, then dinosaurs, and then mammals and birds took over numerical and ecological dominance in terrestrial ecosystems through the subsequent 250 million years, the origins of endothermy, the key adaptive complex that gave them the selective edge, can be tracked back to a busy time in the Early Triassic, when the Earth was still experiencing environmental turmoil and when the chance survivors of the PTME were making faltering steps to rebuild ecosystems according to a new model. Perhaps, as hinted by Kubo and Benton (2009), the coincidence of the changes suggests ecological interactions. Their discovery of a sharp shift in posture of middle-sized tetrapods from sprawlers in the Permian to parasagittal archosaurs and synapsids in the Triassic suggests a coincidence in timing between both clades and parallel evolution of postural traits. Further, postures and performance continued to evolve in all lineages through the Triassic, with increasingly erect posture (larger pace angulations in trackways; Kubo and Benton, 2009), and increased stride length, and perhaps increased leg length and speed, in archosaurs through the Triassic (Kubo and Kubo, 2013), all of which could indicate continuing arms races throughout that time. This requires further testing by considering whether increasing stride length, leg length and speed occurred also in synapsids, although the analysis could be complicated by the fact that many lineages were becoming smaller and smaller through the Late Triassic.
In different ecosystems through the Early and Middle Triassic, archosaurs and synapsids vied with each other as top predators, and the different clades of archosauromorphs and synapsids rose and fell in relative abundance within different faunas (Benton, 1983;. These studies have shown the wealth of ecological data available for well sampled terrestrial Triassic faunas, and how counts of local-scale relative abundances of different taxa give a very different picture of the relative importance of taxa and the impacts of sudden environmental changes. In particular, simple taxon counts give no impression of which were the dominant herbivore groups at particular times and places, masking the huge variations in local-scale relative abundances. Further exploration of the macroecology of Triassic tetrapods may reveal detail of how these arms races played out through time, and according to palaeogeography, climate zones and different habitats. In addition, PCM tools enable analysts to explore connections between diversity change (numbers of species through time) as well as disparity (diversity of morphologies), functional disparity (numerical metrics of feeding and locomotory function), and ecological disparity (ecological or functional roles of taxa in their ecosystems). Phylogenetic approaches can be coupled with comparisons of morphospaces through time (showing morphology, functional disparity, ecological disparity) as well as with ecological models for changing relative abundances and ecological interactions through time.

Conclusions
Whether the current proposal is correct or not, new data and new methods have allowed palaeontologists and animal physiologists to look at the question of the origin of endothermy afresh. The new information includes remarkable new fossils as well as new physiological studies on crocodilians, birds and mammals. Some very smart thinking allows physiologists and palaeontologists to combine efforts in understanding osteological markers of endothermy such as microvessels in Fig. 13. The evolution of endothermy in archosauromorphs and synapsids from the Permian to the present day. In the analysis, ancestral states of resting metabolic rates, measured in mLO 2 h −1 g −0.67 , are estimated at each branching point in the phylogeny and colour-coded to indicate the level (note the logarithmic scale). Values for ectotherms are typically <1.0, and for endotherms >1.0, with modern mammals having RMR values in the range 1.5-3.5, and modern birds, 8-12 mLO 2 h −1 g −0.67 . Based on data in Legendre et al. (2016), with thanks to Lucas Legendre for the base image. bone (as indicators of red blood cell size) and pneumatic foramina and fossae in bones as indicators of ancient air sac systems. Measurements from bones of living and fossil vertebrates provide reliable measures of metabolic rate.
Combining these new lines of evidence with phylogenetic comparative methods means that analysts do not have to rely solely on fossils to date the origin of a phenomenon. For example, if the feathers of birds are the same as the feathers of pterosaurs, then the origin of feathers Fig. 14. Evolution of endothermy among vertebrates, showing numerous independent origins among fishes and tetrapods. Two styles of warm-bloodedness are noted: full endothermy or non-shivering thermogenesis (NST), and other strategies, including shivering thermogenesis. Thermophysiology of fossil taxa is inferred from metabolic rates calculated from four characteristics of their bone histology (see text). There are two modifications from the original, with removal of the question mark from Dermochelys as large sea turtles show NST like the various fishes, and Monotremata are shown with NST (Polymeropoulos et al., 2017). Based on data in Legendre and Davesne (2020), with thanks to Donald Davesne for the base image.

Table 1
Indicators of endothermy in early synapsids. Lystrosaurus is selected as outgroup, and the other taxa are members of Cynodontia. The data columns are, from left to right: FAD, first appearance datum; LAD, last appearance datum; fibrolam, fibrolamellar bone present in early growth stages at least; fibrolam_all, fibrolamellar bone present throughout growth; nerves, modifications to maxillary nerves suggesting vibrissae (Benoit et al., 2016a); turbinates: presence of some form of nasal counter-current exchangers (Crompton et al., 2017); turb_ossif, presence of ossified nasal turbinates (Crompton et al., 2017); RBC, red blood cell size 7.4-8.3 μm (1), 6.6-7.3 μm (2); 5.0-6.5 μm (3), from Huttenlocker and Farmer (2017 can be projected parsimoniously to the latest branching point between those two clades, which happens to be in the Early Triassic. This claim can be treated as secure, given the accuracy of the phylogenetic tree and of the homology claim, but it can also stimulate the hunt for key fossils of the appropriate age, such as Triassic dinosaur or pterosaur fossils with feathers. Future work may focus on all the dozen or more markers of endothermy that can be identified in fossils, including experimental studies by physiologists on living animals, as well as the use of microscopes and 3D scanning to detect fine-scale details of histology of the bones of fossil vertebrates. It is likely that the 'origin of endothermy' in archosaurs and synapsids was not a single event in each clade, but rather several, and perhaps stepping through a dozen or more adaptations over tens of millions of years.
Key questions to be resolved include these: 1. Is there a clear-cut distinction between ectotherms and endotherms based on a single trait, such as metabolic rate, or is the distinction gradational? 2. If the distinction is gradational, what are these steps, and can they be recognised in terms of traits that are retrievable from the fossil and geological records? 3. What comes first in the transition from ectothermy to endothermyparasagittal gait, enhanced respiratory system (diaphragm in synapsids; one-way breathing system in archosaurs), enhanced cardiovascular system (four-chambered heart, high pressure), physiological thermogenesis, encephalisation, or increased parental care? 4. Was the origin of endothermy in archosaurs and synapsids triggered by particular external perturbations, such as the devastation of faunas caused by the PTME, or by unusually low or high oxygen levels or temperatures in the Triassic? 5. Did endothermy emerge in parallel in the two great clades, the synapsids and archosaurs, through the Late Permian and Triassic, or not?
6. Were there arms races through the Triassic that intensified the pace of evolution of endothermy in both archosaurs and synapsids? 7. Can we determine the key driver(s) for the origin of endothermy in synapsids and archosaurs, and is the reason the same or different in both? Can we distinguish the niche expansion (nocturnality), parental care and adaptability, and miniaturisation hypotheses?
CRediT authorship contribution statement Michael J. Benton: I did everything.

Declaration of competing interest
The author declares that he has no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.