:root {
  --sky-top: #8dd8ff;
  --sky-mid: #c5ecff;
  --sky-bottom: #eef9ff;
  --cream: #fff2cf;
  --cream-soft: rgba(255, 242, 207, 0.85);
  --shadow: 0 26px 50px rgba(67, 111, 153, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Inter", "Pretendard", "Apple SD Gothic Neo", sans-serif;
  background: linear-gradient(180deg, rgba(141, 216, 255, 0.38), rgba(238, 249, 255, 0.2));
  color: var(--cream);
}

.sky::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(141, 216, 255, 0.32), rgba(238, 249, 255, 0.24)),
    url("./배경.jpg") center center / cover no-repeat fixed;
  filter: blur(10px) saturate(0.95);
  transform: scale(1.05);
  z-index: 0;
}

.sky {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.scene {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 72px 20px 56px;
}

.stage {
  width: min(100%, 1280px);
  display: grid;
  justify-items: center;
  gap: 22px;
}

.balloon-row {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  flex-wrap: nowrap;
  perspective: 1800px;
  perspective-origin: 50% 40%;
}

.balloon {
  position: relative;
  flex: 0 0 auto;
  width: clamp(138px, 16.5vw, 228px);
  aspect-ratio: 1 / 1.15;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
  animation: float 5.8s ease-in-out infinite;
  will-change: transform;
  --follow-x: 0px;
  --follow-y: 0px;
  --base-rotate: 0deg;
  --base-translate-y: 0px;
  --base-translate-x: 0px;
}

.balloon:nth-child(1) {
  animation-delay: 0s;
  --base-rotate: -10deg;
  --base-translate-y: 8px;
}

.balloon:nth-child(2) {
  animation-delay: 0.35s;
  --base-rotate: 1deg;
  --base-translate-y: 2px;
  margin-left: clamp(-102px, -7.2vw, -74px);
}

.balloon:nth-child(3) {
  animation-delay: 0.7s;
  --base-rotate: -1deg;
  --base-translate-y: 10px;
  margin-left: clamp(-86px, -6vw, -56px);
}

.balloon:nth-child(4) {
  animation-delay: 1.05s;
  --base-rotate: 8deg;
  --base-translate-y: 4px;
  margin-left: clamp(-85px, -5.9vw, -53px);
}

.balloon:nth-child(2) img {
  transform: translateZ(22px) scale(0.82);
}

.balloon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 26px 20px rgba(72, 108, 150, 0.16));
  transform: translateZ(22px);
  user-select: none;
  pointer-events: none;
}

.balloon-label {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%) translateZ(30px);
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  font-weight: 800;
  color: var(--cream);
  text-shadow: 0 2px 10px rgba(82, 101, 120, 0.22);
  pointer-events: none;
}

.caption {
  width: 100%;
  height: 100%;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  color: #111;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.mode-area {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(58, 96, 127, 0.12);
}

.toggle-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  background: transparent;
  color: #111;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.toggle-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.toggle-btn.active {
  background: #ffffff;
  color: #111;
}

.toggle-btn:active {
  transform: scale(0.97);
}

.info-box {
  width: min(100%, 560px);
  height: 104px;
  display: grid;
  place-items: center;
  padding: 18px 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 30px rgba(58, 96, 127, 0.08);
}

.caption-line-1 {
  font-size: clamp(16px, 2vw, 27px);
  line-height: 1.08;
}

.caption-line-2 {
  font-size: clamp(14px, 1.8vw, 21px);
  line-height: 1.08;
}

@keyframes float {
  0%,
  100% {
    transform:
      translate3d(
        calc(var(--follow-x) + var(--base-translate-x)),
        calc(var(--follow-y) + var(--base-translate-y)),
        0
      )
      rotate(var(--base-rotate));
  }
  50% {
    transform:
      translate3d(
        calc(var(--follow-x) + var(--base-translate-x)),
        calc(var(--follow-y) + var(--base-translate-y) - 12px),
        0
      )
      rotate(var(--base-rotate));
  }
}

@media (max-width: 980px) {
  .scene {
    padding-top: 84px;
  }
}

@media (max-width: 720px) {
  .sky::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 20vh;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.2));
    pointer-events: none;
  }

  .balloon-row {
    justify-content: flex-start;
    overflow-x: auto;
    padding: 0 8px 6px;
    scroll-snap-type: x mandatory;
  }

  .balloon:nth-child(2),
  .balloon:nth-child(3),
  .balloon:nth-child(4) {
    margin-left: -62px;
  }

  .balloon {
    width: clamp(122px, 32vw, 178px);
    scroll-snap-align: center;
  }

  .balloon:nth-child(2) img {
    transform: translateZ(22px) scale(0.92);
  }

  .caption-line-1 {
    font-size: clamp(14px, 4.5vw, 19px);
  }

  .caption-line-2 {
    font-size: clamp(12px, 4vw, 17px);
  }

  .toggle-btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  .info-box {
    height: 94px;
    padding: 16px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .balloon {
    animation: none;
  }
}
