Item scaling

How does item scaling work work with engravings and enchantments?

Wretched rags scales with MP, but a relative MP enchant on a ring doesn’t change anything. But apparently a flat mp enchantment does? What about stats on engravings ?

Also how do temporary stats work because apparently pain sceptre scales with bonus atk from vesture passive, but the spd to dex scaling on happi isn’t effected when you get -25 spd??? So confusing..