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

.stage {
  padding: clamp(8px, 2.4vw, 16px);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 228px;
  max-width: 100%;
}

.tile {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 8px;
  overflow: hidden;
  outline: none;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}

.tile__media {
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, #2f6df6 0%, #17141a 100%);
}

.tile__media--b {
  background: linear-gradient(200deg, #fff7e6 0%, #17141a 100%);
}

.tile__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 8px;
  background: linear-gradient(0deg, rgba(23, 20, 26, 0.88), rgba(23, 20, 26, 0));
  transform: translateY(64%);
  opacity: 0;
  transition: transform 300ms ease-out, opacity 300ms ease-out;
}

.tile__title {
  margin: 0;
  font-weight: 700;
  font-size: clamp(10px, 3vw, 11px);
  line-height: 1.3;
  font-family: inherit;
  color: #ffffff;
}

.tile__desc {
  margin: 0;
  font-weight: 500;
  font-size: clamp(9px, 2.6vw, 10px);
  line-height: 1.3;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.85);
}

.tile:hover .tile__caption, .tile:focus-visible .tile__caption, .tile:active .tile__caption {
  transform: translateY(0);
  opacity: 1;
}

.gallery.is-demo .tile__caption {
  animation: caption-loop 2s ease-out infinite;
}

.gallery.is-demo .tile:nth-child(2) .tile__caption {
  animation-delay: -1s;
}

@keyframes caption-loop {
  0%, 10% {
    transform: translateY(64%);
    opacity: 0;
  }
  40%, 60% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(64%);
    opacity: 0;
  }
}
@media (hover: none) {
  .tile:active .tile__caption {
    transform: translateY(0);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tile__caption {
    transition: none;
    transform: translateY(0);
    opacity: 1;
  }
  .gallery.is-demo .tile__caption {
    animation: none;
  }
}
