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);
}

.bookmark {
  display: inline-flex;
  align-items: center;
  gap: clamp(8px, 2.6vw, 12px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bookmark__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.bookmark__icon {
  position: relative;
  width: 24px;
  height: 30px;
  flex: none;
}
.bookmark__ribbon {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
  background: rgba(255, 247, 230, 0.3);
}
.bookmark__ribbon::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
  background: #fff7e6;
  opacity: 0;
  transform: scaleY(0.35);
  transform-origin: top;
  transition: opacity 300ms cubic-bezier(0.2, 0.8, 0.2, 1), transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bookmark__fold {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  clip-path: polygon(100% 0, 0 0, 100% 100%);
  background: rgba(23, 20, 26, 0.35);
  transform: scale(0) rotate(-90deg);
  transform-origin: 100% 0;
  opacity: 0;
  transition: opacity 300ms cubic-bezier(0.2, 0.8, 0.2, 1), transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bookmark__fx {
  position: absolute;
  top: 0;
  left: 100%;
  pointer-events: none;
}
.bookmark__chip {
  position: absolute;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  background: #fff7e6;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}
.bookmark__label {
  font-weight: 600;
  font-size: clamp(15px, 4.2vw, 18px);
  line-height: 1;
  font-family: inherit;
  color: #17141a;
}
.bookmark__input:checked ~ .bookmark__icon .bookmark__ribbon::after {
  opacity: 1;
  transform: scaleY(1);
}
.bookmark__input:checked ~ .bookmark__icon .bookmark__fold {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}
.bookmark.is-demo .bookmark__icon .bookmark__ribbon::after {
  animation: ribbon-fill-loop 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}
.bookmark.is-demo .bookmark__icon .bookmark__fold {
  animation: fold-in-loop 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

@keyframes ribbon-fill-loop {
  0%, 20% {
    opacity: 0;
    transform: scaleY(0.35);
  }
  40%, 80% {
    opacity: 1;
    transform: scaleY(1);
  }
  100% {
    opacity: 0;
    transform: scaleY(0.35);
  }
}
@keyframes fold-in-loop {
  0%, 20% {
    opacity: 0;
    transform: scale(0) rotate(-90deg);
  }
  40%, 80% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: scale(0) rotate(-90deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .bookmark__ribbon::after, .bookmark__fold {
    transition: opacity 1ms;
  }
  .bookmark.is-demo .bookmark__icon .bookmark__ribbon::after,
  .bookmark.is-demo .bookmark__icon .bookmark__fold {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
  .bookmark__chip {
    display: none;
  }
}
