Stacking context
A set of rules governing how elements are ordered in depth when they overlap on a webpage.
Z-index doesn't simply control screen order — it creates hierarchies. A stacking context is a level in this hierarchy. Each context has its own z-index ordering, and merging between contexts follows specific rules. Adding position, opacity, or will-change can create new stacking relationships that sometimes surprise developers. Understanding this is essential for avoiding z-index hell and debugging layering problems.