/* =====================================================================
   모션 토큰 + 공용 키프레임 — 웹 키오스크 (motion.js / attract.js 와 세트)
   타이밍·이징의 단일 소스. 프로젝트 tokens.css 와 별개로 이 파일만 이식한다.
   AS3 TweenMax 감성 매핑 — 검증값 (매드트로닉/합천):
     Strong.easeOut → --ease-strong · Back.easeOut → --ease-back
   ===================================================================== */

:root {
  /* ── 스케일 (boot.js fitStage 가 갱신) ── */
  --app-scale: 1;

  /* ── 듀레이션 ── */
  --dur-fast:  240ms;   /* 인터랙션 피드백 · exit 페이드 */
  --dur-med:   420ms;   /* 일반 전환 · 오버레이 페이드 */
  --dur-slow:  640ms;   /* 화면 셸 진입 (시트 슬라이드업 등) */
  --dur-obj:   1100ms;  /* 오브젝트 진입 스태거 */

  /* ── 이징 (AS3 TweenMax 매핑) ── */
  --ease-strong: cubic-bezier(0.16, 1, 0.3, 1);     /* Strong.easeOut */
  --ease-back:   cubic-bezier(0.34, 1.4, 0.5, 1);   /* Back.easeOut (약한 오버슈트) */
  --ease-obj:    cubic-bezier(0.34, 1.22, 0.42, 1); /* 오브젝트 진입 — 살짝 안착하는 백 */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft:   cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-inout:  cubic-bezier(0.65, 0, 0.35, 1);
}

/* =====================================================================
   1층 — 화면 셸 진입 (화면당 1회)
   ===================================================================== */

/* 하단 시트가 아래에서 올라오며 등장 (.sheet 등 셸 컨테이너에 부여) */
.sheet-up { animation: sheetUp var(--dur-slow) var(--ease-out) both; }
@keyframes sheetUp {
  from { transform: translateY(64px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* 메인 메뉴 카드 진입 (nth-child 로 수동 스태거 — 카드 수가 고정일 때) */
.card-in { animation: cardIn var(--dur-slow) var(--ease-out) both; }
.card-in:nth-child(1) { animation-delay: .05s; }
.card-in:nth-child(2) { animation-delay: .13s; }
.card-in:nth-child(3) { animation-delay: .21s; }
.card-in:nth-child(4) { animation-delay: .29s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }

/* =====================================================================
   2층 — 오브젝트 스태거 진입 (motion.js animateIn 이 부여)
   대상 요소에 data-anim 속성 필수 — 히어로/배너에도 붙일 것 (하드컷 방지)
   ===================================================================== */
.anim-in {
  opacity: 0;
  animation: objIn var(--dur-obj) var(--ease-obj) both;
  animation-delay: var(--delay, 0s);
  will-change: transform, opacity;
}
@keyframes objIn {
  0%   { opacity: 0; transform: translateY(36px); }
  55%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0); }
}

/* 화면 이탈 — motion.js fadeOutThen 이 부여 (#app 루트 섹션에) */
.is-leaving {
  opacity: 0 !important;
  transform: translateY(-14px);
  transition: opacity var(--dur-fast) var(--ease-soft), transform var(--dur-fast) var(--ease-soft);
  pointer-events: none;
}

/* =====================================================================
   3층 — 유도 루프 (대기 유도용 infinite — transform/opacity 만 사용)
   ===================================================================== */

/* 터치 유도 링 (어트랙트 .attract__tap 등) */
.tap-ring { position: relative; }
.tap-ring::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid currentColor;
  animation: tapRing 2.4s var(--ease-out) infinite;
}
@keyframes tapRing {
  0%   { transform: scale(.6); opacity: .9; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* 문구 펄스 */
.pulse { animation: promptPulse 2.4s var(--ease-inout) infinite; }
@keyframes promptPulse { 0%,100% { opacity: .7; } 50% { opacity: 1; } }

/* 핸드 탭 (터치 가이드 아이콘) */
.hand-tap { animation: handTap 1.8s var(--ease-inout) infinite; }
@keyframes handTap { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px) rotate(-6deg); } }

/* =====================================================================
   어트랙트 오버레이 진입 (attract.js 마크업과 세트)
   #attract 자체는 opacity transition 으로 페이드 (is-on 토글)
   ===================================================================== */
#attract { opacity: 0; transition: opacity var(--dur-med) var(--ease-soft); }
#attract.is-on { opacity: 1; }

.attract__title { animation: atTitleIn 1s var(--ease-obj) both; }
.attract__frame { animation: atFrameIn 1.1s var(--ease-obj) both; }
.attract__word {
  display: inline-block;
  animation: atWordIn .7s var(--ease-obj) both;
  animation-delay: calc(var(--i, 0) * 0.07s + 0.3s);  /* 어절 스태거 */
}
@keyframes atTitleIn { from { opacity: 0; transform: translateY(-38px); } to { opacity: 1; transform: translateY(0); } }
@keyframes atFrameIn { from { opacity: 0; transform: scale(.955); } to { opacity: 1; transform: scale(1); } }
@keyframes atWordIn  { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }