/**
 * css/saeha.css
 * ------------------------------------------------------------------
 * [주인공 마스코트] 어디서든 유연하게 표시 가능한 새하(Saeha) 캐릭터 레이어
 */

/* 1. 전역 고정 레이어 (Fixed Floating Layer) */
.saeha-layer {
  position: fixed;
  z-index: 1050; /* 하단 네비게이션(1000)보다 위 */
  pointer-events: auto;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 새하 캐릭터 이미지 본체 (225x500 원본 비율 유지) */
.saeha-img {
  width: 225px;
  height: 500px;
  background-image: url('../assets/images/ui/chibi_excited_walk.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
  cursor: pointer;
  transition: transform 0.25s ease, filter 0.25s ease;
}

/* 호버 시 발광 효과 */
.saeha-img:hover {
  transform: translateY(-4px) scale(1.05);
  filter: drop-shadow(0 12px 22px rgba(255, 143, 171, 0.6));
}

/* 통통 튀며 신나게 걷는 애니메이션 */
.saeha-bounce {
  animation: saehaWalkBounce 1.4s infinite ease-in-out alternate;
}

@keyframes saehaWalkBounce {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
  100% { transform: translateY(0) rotate(-2deg); }
}

/* 클릭 점프 리액션 */
.saeha-jump {
  animation: saehaJumpEffect 0.55s ease forwards;
}

@keyframes saehaJumpEffect {
  0% { transform: scale(1) translateY(0); }
  35% { transform: scale(1.15) translateY(-30px); }
  65% { transform: scale(0.95) translateY(4px); }
  100% { transform: scale(1) translateY(0); }
}

/* 좌우 반전 (왼쪽 바라보기) */
.saeha-flip {
  transform: scaleX(-1);
}
.saeha-img.saeha-flip:hover {
  transform: scaleX(-1) translateY(-4px) scale(1.05);
}

/* 새하 말풍선 대사창 */
.saeha-bubble {
  position: relative;
  background: rgba(15, 23, 42, 0.92);
  color: #F8FAFC;
  border: 2px solid var(--primary);
  border-radius: 16px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  max-width: 220px;
  text-align: center;
  margin-bottom: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  white-space: pre-wrap;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(10px) scale(0.85);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.saeha-bubble.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.saeha-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px 6px 0 6px;
  border-style: solid;
  border-color: var(--primary) transparent transparent transparent;
}

/* 2. 배경화면 내부 안전 영역(Safe Area)에 맞춘 위치 프리셋 */

/* 정문 매표소: 티켓 자판기 좌측 앞길 (배경화면 통로 내부 고정) */
.saeha-pos-gate {
  bottom: clamp(65px, calc(50% - 370px), 130px);
  right: clamp(10px, calc(50% - 550px), calc(50% - 400px));
}

/* 지도 화면: 파크 안내 지도 오른쪽 통로 위 (배경화면 내부 고정) */
.saeha-pos-map {
  bottom: clamp(75px, calc(50% - 400px), 110px);
  right: clamp(15px, calc(50% - 460px), 25%);
}

/* 어트랙션 우하단 위치 (배경화면 우측 통로 내부 고정) */
.saeha-pos-bottom-right {
  bottom: clamp(75px, calc(50% - 420px), 110px);
  right: clamp(15px, calc(50% - 480px), 22%);
}

/* 어트랙션 좌하단 위치 (배경화면 좌측 통로 내부 고정) */
.saeha-pos-bottom-left {
  bottom: clamp(75px, calc(50% - 420px), 110px);
  left: clamp(15px, calc(50% - 480px), 22%);
}

/* 3. 크기 조절 옵션 */
.saeha-sm .saeha-img { width: 75px; height: 150px; }
.saeha-md .saeha-img { width: 100px; height: 200px; }
.saeha-lg .saeha-img { width: 130px; height: 260px; }
.saeha-original .saeha-img { width: 150px; height: 300px; }

/* 4. 섹션 내부 일반 요소로 삽입 시 (인라인 마스코트용) */
.saeha-inline {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

/* 숨김 상태 */
.saeha-hidden {
  display: none !important;
}

/* 모바일 화면 최적화 */
@media (max-width: 640px) {
  .saeha-img {
    width: 75px;
    height: 150px;
  }
  .saeha-pos-gate {
    bottom: 75px;
    left: 10px;
  }
  .saeha-pos-map,
  .saeha-pos-bottom-right {
    bottom: 75px;
    right: 10px;
  }
  .saeha-pos-bottom-left {
    bottom: 75px;
    left: 10px;
  }
}
