/* ============================================================
   Concept: z-index
   Stacking order for positioned elements. Higher = on top.
   ============================================================ */

/* ---------- Base reset & typography ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  line-height: 1.6;
  color: #1f2937;
  background: #f8fafc;
  padding: 2rem;
}
.page-header {
  max-width: 760px;
  margin: 0 auto 2rem;
}
.page-header h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  color: #0f172a;
}
.page-header .lead {
  color: #475569;
}
.demo {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.box {
  padding: 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.stack {
  position: relative;
  height: 180px;
}
.layer {
  position: absolute;
  width: 120px;
  height: 120px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.l1 {
  background: #ef4444;
  top: 0;
  left: 0;
  z-index: 1;
}
.l2 {
  background: #10b981;
  top: 20px;
  left: 40px;
  z-index: 2;
}
.l3 {
  background: #3b82f6;
  top: 40px;
  left: 80px;
  z-index: 3;
}