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

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

.gal {
  width: 280px;
  max-width: 100%;
}

.gal__radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gal__frame {
  position: relative;
  height: clamp(100px, 50vh, 176px);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(23, 20, 26, 0.06);
}

.gal__scene {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform: translateX(110%);
  opacity: 0;
  transition: transform 300ms ease-out, opacity 300ms ease-out;
}

.gal__scene--1 {
  background: linear-gradient(150deg, #2f6df6, rgba(47, 109, 246, 0.35));
}

.gal__scene--2 {
  background: linear-gradient(150deg, #ff4d1f, rgba(255, 77, 31, 0.35));
}

.gal__scene--3 {
  background: linear-gradient(150deg, #17141a, rgba(23, 20, 26, 0.5));
}

.gal__tag {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 247, 230, 0.9);
  font-weight: 800;
  font-size: clamp(12px, 3.4vw, 14px);
  font-family: inherit;
  color: #17141a;
}

.gal__scene--1 {
  transform: translateX(0);
  opacity: 1;
}

#gal-1:checked ~ .gal__frame .gal__scene--1 {
  transform: translateX(0);
  opacity: 1;
}

#gal-1:checked ~ .gal__frame .gal__scene--2,
#gal-1:checked ~ .gal__frame .gal__scene--3 {
  transform: translateX(-110%);
  opacity: 0;
}

#gal-2:checked ~ .gal__frame .gal__scene--2 {
  transform: translateX(0);
  opacity: 1;
}

#gal-2:checked ~ .gal__frame .gal__scene--1,
#gal-2:checked ~ .gal__frame .gal__scene--3 {
  transform: translateX(-110%);
  opacity: 0;
}

#gal-3:checked ~ .gal__frame .gal__scene--3 {
  transform: translateX(0);
  opacity: 1;
}

#gal-3:checked ~ .gal__frame .gal__scene--1,
#gal-3:checked ~ .gal__frame .gal__scene--2 {
  transform: translateX(-110%);
  opacity: 0;
}

.gal__thumbs {
  position: relative;
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  padding-bottom: 8px;
}

.gal__thumb {
  box-sizing: border-box;
  width: 88px;
  padding: 8px 0;
  border: 2px solid rgba(23, 20, 26, 0.16);
  border-radius: 999px;
  background: #ffffff;
  font-weight: 700;
  font-size: 12px;
  font-family: inherit;
  color: rgba(23, 20, 26, 0.7);
  text-align: center;
  cursor: pointer;
  transition: color 220ms ease-out, border-color 220ms ease-out;
}

#gal-1:checked ~ .gal__thumbs .gal__thumb--1,
#gal-2:checked ~ .gal__thumbs .gal__thumb--2,
#gal-3:checked ~ .gal__thumbs .gal__thumb--3 {
  color: #17141a;
  border-color: #17141a;
}

.gal__indicator {
  position: absolute;
  bottom: 0;
  left: calc(50% - 140px);
  width: 88px;
  height: 4px;
  border-radius: 999px;
  background: #17141a;
  transform: translateX(0);
  transition: transform 300ms ease-out;
}

#gal-2:checked ~ .gal__thumbs .gal__indicator {
  transform: translateX(96px);
}

#gal-3:checked ~ .gal__thumbs .gal__indicator {
  transform: translateX(192px);
}

.gal.is-demo .gal__scene--1 {
  animation: s1-loop 2s ease-out infinite;
}

.gal.is-demo .gal__scene--2 {
  animation: s2-loop 2s ease-out infinite;
}

.gal.is-demo .gal__scene--3 {
  animation: s3-loop 2s ease-out infinite;
}

.gal.is-demo .gal__indicator {
  animation: ind-loop 2s ease-out infinite;
}

.gal.is-demo .gal__thumb--1 {
  animation: th1 2s ease-out infinite;
}

.gal.is-demo .gal__thumb--2 {
  animation: th2 2s ease-out infinite;
}

.gal.is-demo .gal__thumb--3 {
  animation: th3 2s ease-out infinite;
}

@keyframes s1-loop {
  0%, 23% {
    transform: translateX(0);
    opacity: 1;
  }
  33%, 88% {
    transform: translateX(-110%);
    opacity: 0;
  }
  98%, 100% {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes s2-loop {
  0%, 23% {
    transform: translateX(110%);
    opacity: 0;
  }
  33%, 56% {
    transform: translateX(0);
    opacity: 1;
  }
  66%, 100% {
    transform: translateX(-110%);
    opacity: 0;
  }
}
@keyframes s3-loop {
  0%, 56% {
    transform: translateX(110%);
    opacity: 0;
  }
  66%, 88% {
    transform: translateX(0);
    opacity: 1;
  }
  98%, 100% {
    transform: translateX(110%);
    opacity: 0;
  }
}
@keyframes ind-loop {
  0%, 23% {
    transform: translateX(0);
  }
  33%, 56% {
    transform: translateX(calc(100% + 8px));
  }
  66%, 88% {
    transform: translateX(calc(200% + 16px));
  }
  98%, 100% {
    transform: translateX(0);
  }
}
@keyframes th1 {
  0%, 23% {
    border-color: #17141a;
    color: #17141a;
  }
  33%, 88% {
    border-color: rgba(23, 20, 26, 0.16);
    color: rgba(23, 20, 26, 0.7);
  }
  98%, 100% {
    border-color: #17141a;
    color: #17141a;
  }
}
@keyframes th2 {
  0%, 23% {
    border-color: rgba(23, 20, 26, 0.16);
    color: rgba(23, 20, 26, 0.7);
  }
  33%, 56% {
    border-color: #17141a;
    color: #17141a;
  }
  66%, 100% {
    border-color: rgba(23, 20, 26, 0.16);
    color: rgba(23, 20, 26, 0.7);
  }
}
@keyframes th3 {
  0%, 56% {
    border-color: rgba(23, 20, 26, 0.16);
    color: rgba(23, 20, 26, 0.7);
  }
  66%, 88% {
    border-color: #17141a;
    color: #17141a;
  }
  98%, 100% {
    border-color: rgba(23, 20, 26, 0.16);
    color: rgba(23, 20, 26, 0.7);
  }
}
@media (max-width: 360px) {
  .gal__frame {
    height: 100px;
  }
  .gal__thumb {
    width: 72px;
    padding: 4px 0;
    font-size: 10px;
  }
  .gal__indicator {
    width: 72px;
    left: calc(50% - 116px);
  }
  #gal-2:checked ~ .gal__thumbs .gal__indicator {
    transform: translateX(80px);
  }
  #gal-3:checked ~ .gal__thumbs .gal__indicator {
    transform: translateX(160px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .gal__scene, .gal__thumb, .gal__indicator {
    transition: none;
  }
  .gal.is-demo .gal__scene,
  .gal.is-demo .gal__indicator,
  .gal.is-demo .gal__thumb {
    animation: none;
  }
}
