/* 사주트윈 모션 1단계: 별빛 배경, 오행 연출, 운세 카드 뒤집기, 만화 컷 등장.
   motion.js가 <html>에 .motion-ready 를 붙일 때만 적용된다 (JS가 없거나 '동작 줄이기'면 기존 화면 그대로). */

.motion-ready .container { position: relative; z-index: 1; }

#motionStars, #motionBurst {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#motionStars { z-index: 0; }
#motionBurst { z-index: 5; }

/* 결과 영역: 스크롤하면서 부드럽게 등장 */
.motion-ready #result .section-heading,
.motion-ready #result .saju-reading-section,
.motion-ready #result .ohang-banner,
.motion-ready #result .match-type,
.motion-ready #result .compat-section,
.motion-ready #result .share-row,
.motion-ready #result .book-card,
.motion-ready #result .celeb-card {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1);
}
.motion-ready #result .m-in {
  opacity: 1 !important;
  transform: none !important;
}

/* 오행 배너: 오행 색으로 은은하게 빛남 */
.motion-ready .ohang-banner.m-glow {
  animation: ohangGlow 3.2s ease-in-out infinite;
}
@keyframes ohangGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--m-glow, rgba(224,164,88,0)); }
  50% { box-shadow: 0 0 26px 2px var(--m-glow, rgba(224,164,88,.35)); }
}

/* 오늘의 운세 카드 뒤집기 */
.today-fortune { position: relative; }
.motion-ready .today-fortune .tf-cover {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.12), transparent 40%),
    linear-gradient(135deg, #2b2440, #1b2a44 55%, #22303f);
  border: 1px solid rgba(224,164,88,.55);
  color: var(--accent);
  z-index: 2;
  backface-visibility: hidden;
  transition: transform .8s cubic-bezier(.3,.7,.2,1), opacity .5s ease .25s;
  box-shadow: 0 0 22px rgba(224,164,88,.18);
  animation: tfPulse 2.4s ease-in-out infinite;
}
.motion-ready .today-fortune .tf-cover .tf-emoji { font-size: 2rem; }
.motion-ready .today-fortune .tf-cover .tf-text { font-size: .9rem; font-weight: 700; letter-spacing: .02em; }
.motion-ready .today-fortune .tf-cover .tf-sub { font-size: .74rem; color: var(--muted); }
@keyframes tfPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(224,164,88,.12); }
  50% { box-shadow: 0 0 28px rgba(224,164,88,.4); }
}
.motion-ready .today-fortune.tf-flipped .tf-cover {
  transform: perspective(700px) rotateY(180deg);
  opacity: 0;
  pointer-events: none;
  animation: none;
}
.motion-ready .today-fortune .today-fortune-date,
.motion-ready .today-fortune .today-fortune-headline,
.motion-ready .today-fortune .today-fortune-advice {
  transition: opacity .6s ease .35s, transform .6s ease .35s;
}
.motion-ready .today-fortune:not(.tf-flipped) .today-fortune-date,
.motion-ready .today-fortune:not(.tf-flipped) .today-fortune-headline,
.motion-ready .today-fortune:not(.tf-flipped) .today-fortune-advice {
  opacity: 0;
  transform: scale(.96);
}

/* 만화 컷: 천천히 확대되며 등장하고 글이 따라 올라옴 */
.motion-ready .comic-cut img {
  opacity: 0;
  transform: scale(1.12);
  transition: opacity .9s ease, transform 2.4s cubic-bezier(.2,.6,.2,1);
}
.motion-ready .comic-cut figcaption {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .8s ease .5s, transform .8s ease .5s;
}
.motion-ready .comic-cut.m-in img { opacity: 1; transform: scale(1); }
.motion-ready .comic-cut.m-in figcaption { opacity: 1; transform: none; }

.motion-ready .comic-next {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .8s ease, transform .8s ease;
}
.motion-ready .comic-next.m-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  #motionStars, #motionBurst { display: none; }
}

/* ───── 2단계: 오행 정령 영상 ───── */
.spirit-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2px auto 16px;
}
.spirit-frame {
  width: min(240px, 72%);
  aspect-ratio: 560 / 752;
  border-radius: 18px;
  overflow: hidden;
  background: #12141a;
  border: 1px solid var(--sp-color, var(--accent));
  box-shadow: 0 0 26px var(--sp-glow, rgba(224,164,88,.3));
}
.spirit-frame video,
.spirit-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.spirit-caption {
  margin-top: 10px;
  font-size: .78rem;
  color: var(--muted);
  letter-spacing: .02em;
}
.motion-ready .spirit-card {
  opacity: 0;
  transform: translateY(14px) scale(.97);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1);
}
