I don't understand the structure of this sentence. How come "did" was placed in the middle of the sentence? and what does "did" mean here?
"Only when (something happens), did..." is a common sentence structure that is used when an action verb only occurs on account of another verb happening. It is a conditional expression between two verbs that means that it wasn't until one thing happens that the other could happened. "Did" in this case is used to introduce an action verb and mean that something happens. Ex: Only when I got home did I realize I left my phone at work. Ex: Only when she received the acceptance letter did she finally feel relaxed.