/* ===== アニメーション初期化 ===== */
.anim-init {
  opacity: 0;
}


/* ===== 汎用背景グラデーションアニメーション ===== */
.bg-anim-gradient {
  position: relative;
  overflow: hidden;
  z-index: 0;
}

.bg-anim-gradient::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg,
    #ff0080,
    #ff8c00,
    #ff9933,
    #ee7800,
    #f15a22,
    #faa755
  );
  background-size: 400% 400%;
  animation: bgGradientMove 14s ease infinite;
  z-index: -1;
  opacity: 0.8;
}

@keyframes bgGradientMove {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}


/* ===== テキストアニメーション共通スタイル ===== */
.text-anim-wrapper {
  display: inline-block;
}

.text-anim-wrapper .char-anim {
  display: inline-block;
  opacity: 0;
  transform-origin: center center;
}

/* white-textクラスの文字は白色を保持 */
.text-anim-wrapper span:not(.char-anim) .char-anim {
  color: inherit;
}

/* black-textクラスの文字は黒色を保持 */
.text-anim-wrapper .black-text .char-anim {
  color: var(--text-dark) !important;
}

/* ===== テキストアニメーション: bounce-roll ===== */
.text-bounce-roll .char-anim {
  animation: charBounceRoll 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
  animation-delay: calc(var(--char-index) * 0.05s);
}

@keyframes charBounceRoll {
  0% {
    opacity: 0;
    transform: translateY(50px) rotate(-180deg) scale(0.3);
  }
  60% {
    opacity: 1;
    transform: translateY(-10px) rotate(10deg) scale(1.1);
  }
  80% {
    transform: translateY(5px) rotate(-5deg) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

/* ===== テキストアニメーション: fade-in ===== */
.text-fade-in .char-anim {
  animation: charFadeIn 0.6s ease-out forwards;
  animation-delay: calc(var(--char-index) * 0.03s);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.text-fade-in .char-anim.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes charFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== テキストアニメーション: slide-in ===== */
.text-slide-in .char-anim {
  animation: charSlideIn 0.5s ease-out forwards;
  animation-delay: calc(var(--char-index) * 0.02s);
}

@keyframes charSlideIn {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== テキストアニメーション: wave ===== */
.text-wave .char-anim {
  animation: charWave 1s ease-in-out forwards;
  animation-delay: calc(var(--char-index) * 0.05s);
}

@keyframes charWave {
  0%, 100% {
    opacity: 1;
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* ===== 通常のアニメーション（非テキスト） ===== */
.anim-fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.anim-slide-in-left {
  animation: slideInLeft 0.8s ease-out forwards;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.anim-slide-in-right {
  animation: slideInRight 0.8s ease-out forwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.anim-scale-in {
  animation: scaleIn 0.8s ease-out forwards;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===== 複合アニメーション: bounce-roll-special ===== */
.anim-bounce-roll-special {
  animation: bounceRollCombo 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes bounceRollCombo {
  0% {
    opacity: 0;
    transform: translateY(50px) translateX(-100px) rotate(-360deg) scale(0.8);
  }
  40% {
    transform: translateY(-20px) translateX(-50px) rotate(-180deg) scale(1.1);
  }
  70% {
    transform: translateY(10px) translateX(-20px) rotate(-90deg) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) translateX(0) rotate(0deg) scale(1);
  }
}

/* ===== ローディング演出 ===== */
.logo-assembly {
  animation: assembleAndBounce 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes assembleAndBounce {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.1) rotate(10deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* ページ全体のフェードイン */
.page-fade-in {
  animation: pageFadeIn 0.8s ease-out;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== カーソルグロー ===== */
.cursor-glow {
  position: fixed;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(238, 120, 0, 0.6), transparent);
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: screen;
  transition: transform 0.1s ease;
}

/* ===== リップルエフェクト ===== */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: rippleEffect 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleEffect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ===== レスポンシブ: アニメーション簡略化 ===== */
@media (max-width: 768px) {
  .text-bounce-roll .char-anim {
    animation-duration: 0.6s;
  }
  
  .char-anim {
    animation-delay: calc(var(--char-index) * 0.03s) !important;
  }
}

/* ==== スクロールでフェードインさせる共通クラス ==== */
.fade-in-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

/* 画面内に入ったら表示 */
.fade-in-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.poster-gallery .poster-item:hover {
  transform: scale(1.05) translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* ===== アニメーション無効化（アクセシビリティ） ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .char-anim {
    opacity: 1 !important;
    transform: none !important;
  }
}
