Hello, Joseph, and welcome to the Grammar Exchange.
It is my understanding that participial clauses can modify any noun in a sentence, but with some constructions this can give rise to ambiguities.
They can, but when set off by a comma they should always refer to a noun in subject position.
My question is whether participial phrases can modify nouns mentioned as part of a larger complex noun phrase. So, for example:
The river ran through the wood and under the bridge that James had whiled away entire afternoons on, thinking about nothing in particular.
Is the above example acceptable? Can writers construct sentences like this as long as they are unambiguous? The participial clause beginning with "thinking" clearly should apply to James, as rivers and bridges are incapable of thinking, but is its placement in the sentence incorrect? The noun James is, I think, acting as part of the post-modifier of the complex noun phrase in which "the bridge" is the head noun. Can participial clauses modify such nouns, or should I generally avoid constructions like this and rewrite them to avoid confusion?
I don't think there is any problem with "thinking about nothing in particular" referring to the animate subject within the relative clause, i.e. "James."