/* adventure-effects.css — Animations: transitions, dice, damage */

/* Scene fade-in */
.adv-scene-enter {
  animation: adv-fadeSlideIn 0.5s ease both;
}

@keyframes adv-fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Choice stagger entrance */
.adv-choice {
  opacity: 0;
  animation: adv-choiceEnter 0.3s ease forwards;
}

.adv-choice:nth-child(1) { animation-delay: 0.1s; }
.adv-choice:nth-child(2) { animation-delay: 0.2s; }
.adv-choice:nth-child(3) { animation-delay: 0.3s; }
.adv-choice:nth-child(4) { animation-delay: 0.4s; }

@keyframes adv-choiceEnter {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Dice roll animation */
.adv-dice--rolling .adv-dice__value {
  animation: adv-diceRoll 0.6s ease-out;
}

@keyframes adv-diceRoll {
  0% { transform: scale(0.5) rotate(-180deg); opacity: 0; }
  50% { transform: scale(1.3) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Damage shake */
.adv-shake {
  animation: adv-damageShake 0.4s ease;
}

@keyframes adv-damageShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* HP flash on damage */
.adv-hp-flash {
  animation: adv-hpFlash 0.5s ease;
}

@keyframes adv-hpFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Heal glow */
.adv-heal-glow {
  animation: adv-healGlow 0.6s ease;
}

@keyframes adv-healGlow {
  0% { box-shadow: 0 0 0 rgba(52, 211, 153, 0); }
  50% { box-shadow: 0 0 16px rgba(52, 211, 153, 0.5); }
  100% { box-shadow: 0 0 0 rgba(52, 211, 153, 0); }
}

/* Item gain pulse */
.adv-item-gain {
  animation: adv-itemGain 0.4s ease;
}

@keyframes adv-itemGain {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

/* Typewriter cursor */
.adv-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--sf-accent, #7C3AED);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: adv-blink 0.8s step-end infinite;
}

@keyframes adv-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Toast animation */
.adv-toast {
  animation: adv-toastIn 0.3s ease;
}

.adv-toast--exit {
  animation: adv-toastOut 0.3s ease forwards;
}

@keyframes adv-toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes adv-toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* Fade-in (pause overlay, general) */
@keyframes adv-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Scene exit (fade up before new turn) */
.adv-scene-exit {
  animation: adv-fadeSlideOut 0.3s ease forwards;
}

@keyframes adv-fadeSlideOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

/* Genre accent color override — overrides --sf-accent per genre */
.adv-app[data-genre="fantasy"] { --sf-accent: #7C3AED; --sf-accent-rgb: 124, 58, 237; --sf-accent-soft: #A78BFA; }
.adv-app[data-genre="horror"] { --sf-accent: #EF4444; --sf-accent-rgb: 239, 68, 68; --sf-accent-soft: #FCA5A5; }
.adv-app[data-genre="scifi"] { --sf-accent: #06B6D4; --sf-accent-rgb: 6, 182, 212; --sf-accent-soft: #67E8F9; }
.adv-app[data-genre="detective"] { --sf-accent: #FBBF24; --sf-accent-rgb: 251, 191, 36; --sf-accent-soft: #FDE68A; }
.adv-app[data-genre="postapoc"] { --sf-accent: #84CC16; --sf-accent-rgb: 132, 204, 22; --sf-accent-soft: #BEF264; }
.adv-app[data-genre="pirate"] { --sf-accent: #F97316; --sf-accent-rgb: 249, 115, 22; --sf-accent-soft: #FDBA74; }
.adv-app[data-genre="superhero"] { --sf-accent: #3B82F6; --sf-accent-rgb: 59, 130, 246; --sf-accent-soft: #93C5FD; }

/* Apply accent to key elements */
.adv-choice__key {
  background: rgba(var(--sf-accent-rgb), 0.15);
  color: var(--sf-accent-soft);
}

.adv-scene__progress-fill {
  background: linear-gradient(90deg, var(--sf-accent), var(--sf-cta, #F43F5E));
}

/* ── Scene Image Loading Effects ── */

/* Enhanced image reveal: fade + subtle zoom */
.adv-scene__image {
  transform: scale(1.03);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.adv-scene__image--loaded {
  transform: scale(1);
}

/* Loading text cycle */
.adv-loading-text {
  display: block;
  min-height: 1.4em;
  font-style: italic;
  font-size: 0.85rem;
  color: rgba(var(--sf-text-rgb, 226, 232, 240), 0.45);
  transition: opacity 0.4s ease;
}

.adv-loading-text--fade {
  opacity: 0;
}

/* Scene loading uses CSS shimmer + genre gradient (see adventure-play.css) */
