📚 Stacking Order Rules

  1. Background and borders of the root element
  2. Non-positioned descendants (in document order)
  3. Floats and their contents
  4. Non-positioned inline descendants
  5. Positioned elements (relative/absolute/fixed/sticky) with z-index: auto or z-index: 0
  6. Positioned elements with positive z-index, in ascending order