/* z-index.css: Styles for the CSS z-index demo page */
body {
  background: linear-gradient(120deg, #f0f4f8 0%, #e0e7ef 100%);
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  padding: 0;
  color: #222;
}
.container {
  max-width: 900px;
  margin: 40px auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 32px 0 rgba(52, 152, 219, 0.10);
  padding: 32px 24px 24px 24px;
}
h1 {
  text-align: center;
  color: #8e44ad;
  margin-bottom: 16px;
}
.theory-section, .code-section, .demo-section {
  margin-bottom: 32px;
  padding: 18px 20px;
  border-radius: 12px;
  background: #f8fafc;
  box-shadow: 0 2px 8px 0 rgba(52, 152, 219, 0.04);
}
.code-section {
  background: #23272e;
  color: #f8f8f2;
}
.code-block {
  background: #181a20;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin-top: 10px;
}
.code-block code {
  color: #ffd200;
  font-family: 'Fira Mono', 'Consolas', monospace;
  font-size: 1rem;
}
.demo-section {
  background: #f7f9fb;
}
.z-demo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  margin-top: 18px;
}
.z-demo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px 0 rgba(52, 152, 219, 0.08);
  padding: 12px 10px 10px 10px;
  min-width: 260px;
  min-height: 200px;
  transition: box-shadow 0.3s, transform 0.2s;
  margin-bottom: 8px;
  position: relative;
}
.z-demo-card:hover, .z-demo-card:focus-within {
  box-shadow: 0 8px 32px 0 #8e44ad44;
  transform: translateY(-4px) scale(1.04);
}
.z-demo-label {
  font-weight: 600;
  color: #8e44ad;
  margin-bottom: 8px;
  font-size: 1.08rem;
}
.z-stack-demo {
  position: relative;
  width: 180px;
  height: 120px;
  margin: 0 auto 0.7rem auto;
}
.z-box {
  position: absolute;
  width: 110px;
  height: 60px;
  left: 35px;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.92;
  transition: box-shadow 0.2s, opacity 0.2s, outline 0.2s;
  cursor: pointer;
  outline: 2px solid transparent;
  font-size: 1.08rem;
  z-index: auto;
}
.z1 { top: 0; background: #3498db; }
.z2 { top: 25px; background: #e67e22; }
.z3 { top: 50px; background: #8e44ad; }
.z-box:hover {
  box-shadow: 0 0 0 4px #fff, 0 0 0 8px #8e44ad33;
  opacity: 1;
  outline: 2px solid #ffd200;
}
.default-stack .z-box:hover,
.zindex-stack .z-box:hover,
.parent-context .z-box:hover,
.parent-context .z-child:hover {
  z-index: 99;
}
/* z-index stacking demo: override z-index for demo */
.zindex-stack .z1 { z-index: 1; }
.zindex-stack .z2 { z-index: 3; }
.zindex-stack .z3 { z-index: 2; }
/* parent stacking context demo */
.parent-context {
  width: 220px;
  height: 120px;
}
.z-parent {
  position: relative;
  width: 120px;
  height: 80px;
  background: #d6eaf8;
  border-radius: 8px;
  left: 10px;
  top: 20px;
  z-index: 10;
  box-shadow: 0 2px 8px #3498db22;
}
.z-parent-label {
  position: absolute;
  left: 8px; top: 4px;
  font-size: 0.92rem;
  color: #636e72;
  background: #fff;
  padding: 0 6px;
  z-index: 2;
  border-radius: 4px;
}
.z-child {
  position: absolute;
  top: 30px;
  left: 30px;
  width: 70px;
  height: 36px;
  background: #ffd200;
  color: #222;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.98rem;
  font-weight: 600;
  box-shadow: 0 2px 8px #e67e2244;
  z-index: 2;
}
.z-outside {
  position: absolute;
  top: 10px;
  left: 120px;
  width: 80px;
  height: 60px;
  background: #e74c3c;
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.98rem;
  font-weight: 600;
  box-shadow: 0 2px 8px #e74c3c44;
  z-index: 5;
}
.z-demo-desc {
  color: #888;
  font-size: 0.98rem;
  margin-top: 8px;
  text-align: center;
}
.back-btn {
  display: inline-block;
  margin-top: 24px;
  padding: 10px 22px;
  background: linear-gradient(90deg, #8e44ad 60%, #3498db 100%);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 2px 8px 0 rgba(52, 152, 219, 0.12);
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}
.back-btn:hover, .back-btn:focus {
  background: linear-gradient(90deg, #3498db 0%, #8e44ad 100%);
  box-shadow: 0 4px 16px 0 #8e44ad44;
  transform: translateY(-2px) scale(1.03);
}
@media (max-width: 700px) {
  .container {
    padding: 10px 2vw;
  }
  .z-demo-row {
    flex-direction: column;
    gap: 16px;
  }
  .z-demo-card {
    min-width: 0;
    width: 100%;
  }
}
:focus {
  outline: 2px solid #8e44ad;
  outline-offset: 2px;
}
