/* ============================================================
   CSS 10.07 — z-index: who is on top?
   ============================================================
   z-index = the "layer number". Bigger number = closer to you.
   ⚠ z-index only works on POSITIONED elements (relative, absolute, fixed, sticky)
     — and on flex / grid items (later lessons).
   ============================================================ */

.stack {
  position: relative;               /* the frame for the 3 cards */
  height: 150px;
}

.layer {
  position: absolute;               /* positioned → z-index can work */
}

.l1 { top: 0;    left: 0; }
.l2 { top: 20px; left: 80px; }
.l3 { top: 40px; left: 160px; }

.front {
  z-index: 3;                       /* bigger number → on top of the others */
}
/* Try it: give .l2 a z-index of 5 → in BOTH rows, card 2 jumps to the front. */


/* ------------------------------------------------------------
   Only to make the cards visible — not part of this lesson
   ------------------------------------------------------------ */
.stack {
  margin-bottom: 16px;
}

.layer {
  width: 180px;
  height: 110px;
  padding: 10px;
  border-radius: 10px;
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.l1 { background-color: #2D62EF; }
.l2 { background-color: #1F9D55; }
.l3 { background-color: #E54B4F; }


/* ============================================================
   Lesson 10 — Summary: the 5 position values
   ============================================================
   Value      Measured from                 Keeps its space?   Used for
   ---------  ----------------------------  -----------------  ---------------------------
   static     — (normal flow, the default)  yes                everything
   relative   its own normal place          yes                small nudges; PARENT of absolute
   absolute   nearest positioned parent     NO                 badges, × buttons, captions
   fixed      the browser window            NO                 back-to-top, chat button
   sticky     normal, then sticks at top    yes                headers, table headings

   Move it with:  top · right · bottom · left      Layer it with:  z-index

   z-index    bigger = on top (positioned elements only)
   Centre an absolute box:  top: 50%; left: 50%; transform: translate(-50%, -50%);

   Practice tasks:
     1. Put a "−20%" discount badge on the bottom-left of a fee card.
     2. Make a fixed "Apply now" button at the bottom-LEFT of the window.
     3. Make a table header (<th>) sticky in a scrolling table.
   ============================================================ */
