html, body {
  margin: 0;
  overflow: hidden;
}

.stage {
  box-sizing: border-box;
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: #ff4d1f;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding: clamp(8px, 4vw, 24px);
}

.stack {
  position: relative;
  width: min(260px, 78vw);
  height: 92px;
  outline: none;
}

.stack__item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 16px;
  border-radius: 16px;
  background: #fff7e6;
  color: #17141a;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
  font-family: inherit;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
  transform: translateY(calc(var(--i) * -6px)) scale(calc(1 - var(--i) * 0.05));
  opacity: calc(1 - var(--i) * 0.22);
}

.stack:hover .stack__item,
.stack:focus-within .stack__item {
  transform: translateY(calc(var(--i) * -22px)) scale(1);
  opacity: 1;
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stack.is-demo .stack__item {
  animation: spread 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

@keyframes spread {
  0%, 100% {
    transform: translateY(calc(var(--i) * -6px)) scale(calc(1 - var(--i) * 0.05));
    opacity: calc(1 - var(--i) * 0.22);
  }
  35%, 65% {
    transform: translateY(calc(var(--i) * -22px)) scale(1);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stack.is-demo .stack__item {
    animation: none;
    transform: translateY(calc(var(--i) * -22px)) scale(1);
    opacity: 1;
  }
}
