South Africa knew they would win the series against Australia just after they lost the opening match in Durban.
It sounds strange, doesn't it? That a team who had been beaten by 118 runs, after being bowled out for 162 in their first innings, knew they would come back and win a trophy. But they knew because their recovery had already begun, even in defeat
Though it always seemed unlikely South Africa would successfully chase 417 at Kingsmead, there was a time in that innings when it felt like they could. It was when Aiden Markram and Quinton de Kock - two of the younger members of the line-up - were batting together, and not just because their stand grew to 147 runs.
Both Markram and de Kock came under relentless verbal pressure from an Australian side who still believed in playing the game "hard but fair." Markram was taunted from the moment AB de Villiers was run out in the 12th over and for most of the six hours he spent at the crease after that.
Chief among the Australian jibes was to remind Markram that he had only scored big runs against less-strong teams - a reference to his two centuries in three Tests against Bangladesh and Zimbabwe, and a reminder that 94 against India was not good enough.
De Kock faced far worse. For more than two hours, he was teased about his weight and his appearance. With no runs of substance to his name since July 2016 at Trent Bridge, he said nothing in reply. He usually says nothing anyway. But as the players left the field for tea, David Warner had one more go. He called de Kock a "f****** sook," an Australian slang word for crybaby, and de Kock could take no more. His retort about Warner's wife, Candice, set in motion a chain of events which would go on to define the series.
Of course, none of this was known until the final morning of the Test, when leaked CCTV footage showed Warner needing to be physically restrained from attacking de Kock on the stairwell leading to the changeroom. From that moment, Warner took it on himself to defend his family and the Australian team formed a protective circle around him. They said de Kock crossed the line, and they didn't have to say anymore when South Africans fans, and two CSA officials, crossed the line too. When a fan at Newlands had an altercation with Warner on the staircase after he was dismissed, the Australia vice-captain appeared to be able to take no more. His part in the series ended with the ball-tampering saga, an act ordered by a stressed man with a scrambled mind.
It could so easily have been the South Africans who felt that way. De Kock was under extreme scrutiny because he made a personal derogatory remark, though several of the same nature were made to him. At an ICC code of conduct hearing, South Africa contested the sanction de Kock would get for a Level 1 offence and came out saying they believed he had not done anything wrong. De Kock received a sanction - 25% of his match fee and one demerit point - and has been quiet since, but the noise did not lessen.
"We could have been scared, or nervous, but even though we lost that day, on day five in Durban, the guys were really upbeat, we knew we were going to beat these guys."Rabada talks about the dressing-room mood after Durban loss
Instead, it became more defiant, with the South Africans rallying in response to what happened at Kingsmead by going from what captain Faf du Plessis said was "motivation" at the start of the series, to "motivated slash angry" after their Durban defeat. One of the angriest of the lot, Kagiso Rabada, revealed that shift in intention ranked as his favourite moment of the summer.
"As a team, after we lost in Durban, it would have been easy for us to disintegrate and not be connected. How we stayed in the fight was my favourite moment, because that's why we're sitting here victorious in this series," Rabada said. "We could have been scared, or nervous, but even though we lost that day, on day five in Durban, the guys were really upbeat, we knew we were going to beat these guys."
Rabada feelings spilled on to the field, when he had a shoulder brush with Steven Smith and gave David Warner a send-off in Port Elizabeth - acts which almost saw him banned for the rest of the series. But he explained there was a reason behind his rage. Smith's dismissal, with Australia at 161 for 3 in the first innings of the second Test, was where Rabada felt South Africa started to surge ahead.
Asked which one of his 23 wickets he savoured most, Rabada said: "The Steve Smith one - because we were a bit behind after lunch. We needed that spark, that's when momentum started for us."
It probably really started with Markram's century in Durban - an innings that prompted former South African captain Ali Bacher, the last man to lead a South African side to a series win over Australia at home, to offer his opinion on the significance of the century. "A new star is born," Bacher said at the time. By the time the series ended, Markram had a second century to his name and led the run-charts in this series, which ultimately contributed significantly to how South African won.
Yes, they took 80 wickets, an incredible feat, but they also scored many more runs: 700 more runs than Australia. They crossed 300 five times and made more than 350 three times. Australia totalled over 300 only once.
Given South Africa's recent history - they filled their boots on flat pitches against Bangladesh but weren't able to score a century on spicy pitches against India - they will be particularly pleased with the five hundreds in this series and the way they handled Australia's much-vaunted attack. De Villiers' century in Port Elizabeth was an effort du Plessis said "singlehandedly" won a Test match, and his form since his comeback has been spectacular. De Villiers has scored seven fifties and a hundred since returning from a sabbatical and confirmed he is enjoying his cricket more than ever.
After Starc's nine-for in Durban, he only took three more wickets in two Tests, something coach Ottis Gibson said took a stern chat and a concerted effort from all involved. "It was probably a couple of meetings after the Durban Test that was the turning point. We didn't play Starc well, he was the main threat there and we spoke about neutralising some of the main threat," Gibson said. "Batsmen worked on getting bit further onto off stump and at going at the ball directly. The ball still reverse swung, but we played him a lot better."
South Africa were also pleased with their handling of Nathan Lyon, who finished with the same number of wickets as Vernon Philander but didn't have a particular stand-out performance.
Crucially, though, South Africa were able to stay focused as the intensity heightened.
When Rabada was banned, they fought the sanction yet prepared as though they would play without him. Two back-ups were called up and the retiring Morne Morkel was in reserve. When Rabada's appeal was successful, they did not gloat. They said they were happy to have him back and would make sure he behaved. When their fans were called a disgrace by coach Darren Lehmann, they reaffirmed their affection for the Newlands crowd but, in an understated way, asked supporters to show respect. When Australia started to unravel and Steven Smith broke down, they expressed sympathy. They did not talk about kicking a team when it was down, but then did exactly that.
Credit for those things must go to all involved, from the coaching staff to the individual players, but increasingly one man has emerged as the glue that has kept South Africa together: du Plessis. Since he took over as captain in 2016, du Plessis has won six out of seven series, he has taken the team from No. 7 to being close to challenging for No.1, and he has led with both strategic and interpersonal excellence.
"Faf is a great leader because he has got time for everyone. He is someone who has got real emotional intelligence," Rabada said. "He understands every player and can have a conversation with everyone. When you understand people, that's when you know what's gets them going. He is a very fair guy and very honest, not biasedly honest, logically honest. These results are not a coincidence."
Not in the least. Du Plessis has broken new ground by becoming the first man to captain a South African side to a home series win over Australia since readmission.
Du Plessis did not even know that South Africa had beaten Australia in a series at home before - largely because South Africa's pre-unity period is not openly celebrated - but he did know he could do something special this summer. Throughout the last six months, du Plessis seemed to just know, and he was right.
Firdose Moonda is ESPNcricinfo's South Africa correspondent