/* effects.css
   Keyframes and classes for the experience pass: particles, flash, knot wipe,
   rune set-piece, shake, spotlight, parallax drift, and stamp pop. Everything
   animates only transform and opacity. The .reduce-motion body class (set by
   effects.js) disables movement so set-pieces become instant. */

#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }

/* particles */
.fx-particle-sprite {
  position: fixed;
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  pointer-events: none;
  will-change: transform, opacity;
  animation: fx-particle 0.9s ease-out forwards;
}
@keyframes fx-particle {
  0% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot, 90deg)) scale(0.3); opacity: 0; }
}
.fx-spark-static {
  position: fixed; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  background: radial-gradient(circle, var(--gold-bright, #ffe08a), rgba(245,166,35,0));
  pointer-events: none; opacity: 0.9;
}

/* full-screen flash */
.fx-flash {
  position: fixed; inset: 0; z-index: 210; pointer-events: none;
  opacity: 0.85; transition: opacity 0.22s ease-out;
}

/* knot wipe */
.fx-knot-overlay {
  position: fixed; inset: 0; z-index: 215; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 8, 15, 0); transition: background 0.3s ease;
}
.fx-knot-overlay.run { background: rgba(6, 8, 15, 0.92); }
.fx-knot { width: 80px; height: 80px; opacity: 0; will-change: transform, opacity; }
.fx-knot-overlay.run .fx-knot { animation: fx-knot 0.62s ease-in-out forwards; }
@keyframes fx-knot {
  0% { transform: scale(0.2) rotate(0deg); opacity: 0; }
  40% { transform: scale(8) rotate(140deg); opacity: 1; }
  100% { transform: scale(22) rotate(320deg); opacity: 0; }
}

/* rune-glow cross fade */
.fx-rune-glow {
  position: fixed; inset: 0; z-index: 210; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 60%, rgba(255,224,138,0.55), rgba(201,168,76,0) 60%);
  transition: opacity 0.18s ease-in;
}
.fx-rune-glow.run { opacity: 1; transition: opacity 0.36s ease-out; }

/* shake */
.fx-shake { animation: fx-shake 0.4s ease-in-out; }
@keyframes fx-shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-7px) rotate(-1.5deg); }
  40% { transform: translateX(6px) rotate(1.5deg); }
  60% { transform: translateX(-4px) rotate(-1deg); }
  80% { transform: translateX(3px) rotate(0.6deg); }
}

/* rune discovery set-piece */
.fx-rune-overlay {
  position: fixed; inset: 0; z-index: 220; opacity: 0; transition: opacity 0.25s ease;
  display: flex; align-items: center; justify-content: center;
}
.fx-rune-overlay.show { opacity: 1; }
.fx-rune-vignette { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, rgba(6,8,15,0.55), rgba(6,8,15,0.92)); }
.fx-rune-big {
  position: relative; width: 160px; height: 160px; z-index: 2;
  filter: drop-shadow(0 0 24px rgba(255,224,138,0.85));
  animation: fx-rune-spin 2.2s ease-in-out infinite;
  transition: transform 0.9s cubic-bezier(0.5, 0, 0.2, 1), opacity 0.6s ease;
}
.fx-rune-glyph { position: relative; z-index: 2; font-family: var(--font-rune, serif); color: var(--gold-bright, #ffe08a); font-size: 90px; }
@keyframes fx-rune-spin { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.06); } }
.fx-rune-overlay.fly .fx-rune-big {
  transform: translateY(-42vh) scale(0.35);
  opacity: 0.2;
  animation: none;
}
.fx-rune-staff {
  position: absolute; top: 7vh; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 3;
  padding: 8px 12px; border-radius: 12px;
  background: rgba(10,14,46,0.7); border: 1px solid var(--gold, #c9a84c);
}
.fx-staff-pip { width: 16px; height: 16px; border-radius: 50%; background: rgba(255,255,255,0.15); border: 1px solid var(--gold, #c9a84c); }
.fx-staff-pip.lit { background: radial-gradient(circle, var(--gold-bright, #ffe08a), var(--amber, #f5a623)); }
.fx-staff-pip.just-lit { animation: fx-pip-pop 0.5s ease; }
@keyframes fx-pip-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* spotlight (tutorial) */
.fx-spotlight-overlay { position: fixed; inset: 0; z-index: 230; }
.fx-spotlight-ring {
  position: fixed; border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(6, 8, 15, 0.78), 0 0 24px 6px rgba(255, 224, 138, 0.7) inset;
  outline: 3px solid var(--gold-bright, #ffe08a);
  pointer-events: none;
  animation: fx-spot-pulse 1.6s ease-in-out infinite;
}
@keyframes fx-spot-pulse { 0%, 100% { outline-color: rgba(255,224,138,0.6); } 50% { outline-color: rgba(255,224,138,1); } }
.fx-spotlight-pointer {
  position: fixed; transform: translate(-50%, -100%); z-index: 231;
  color: var(--gold-bright, #ffe08a); font-size: 30px; pointer-events: none;
  animation: fx-pointer-bob 1s ease-in-out infinite;
}
@keyframes fx-pointer-bob { 0%, 100% { transform: translate(-50%, -100%); } 50% { transform: translate(-50%, -130%); } }

/* parallax drift (Feature 5) */
.parallax-stack { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.parallax-layer {
  position: absolute; inset: -5% -10% -5% -10%;
  background-position: center bottom; background-repeat: no-repeat; background-size: cover;
  will-change: transform; opacity: 0.5;
}
.parallax-layer.drift-slow { animation: fx-drift 26s ease-in-out infinite alternate; }
.parallax-layer.drift-mid { animation: fx-drift 18s ease-in-out infinite alternate; }
.parallax-layer.drift-fast { animation: fx-drift 12s ease-in-out infinite alternate; }
@keyframes fx-drift { from { transform: translate3d(-12px, 0, 0) scale(1.05); } to { transform: translate3d(12px, -6px, 0) scale(1.08); } }
.portrait-float { animation: fx-float 5s ease-in-out infinite; }
@keyframes fx-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* stamp pop (Feature 7) */
.stamp-pop { animation: fx-stamp 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes fx-stamp { 0% { transform: scale(0.2) rotate(-12deg); opacity: 0; } 60% { transform: scale(1.25) rotate(4deg); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.check-draw { stroke-dasharray: 24; stroke-dashoffset: 24; animation: fx-check 0.4s ease forwards 0.1s; }
@keyframes fx-check { to { stroke-dashoffset: 0; } }
.sparkle-shower { position: fixed; inset: 0; pointer-events: none; z-index: 205; }

/* tutorial sandbox (Feature 1) */
.tutorial-overlay {
  position: fixed; inset: 0; z-index: 190;
  background: radial-gradient(circle at 50% 30%, rgba(22,32,78,0.55), rgba(6,8,15,0.92));
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 18px; padding-bottom: calc(18px + env(safe-area-inset-bottom));
}
.tutorial-caption {
  width: min(620px, 94vw);
  background: linear-gradient(180deg, rgba(243,230,196,0.97), rgba(226,207,156,0.97));
  color: #2c2208; border: 2px solid var(--gold, #c9a84c); border-radius: 14px;
  padding: 14px 16px; box-shadow: var(--shadow, 0 10px 30px rgba(0,0,0,0.45));
}
.tutorial-caption.tappable { cursor: pointer; }
.tut-speaker { font-family: var(--font-head, serif); font-weight: 700; color: var(--rune-red, #8b1a1a); margin-bottom: 4px; }
.tut-text { font-size: 17px; line-height: 1.45; }
.tut-advance { text-align: right; font-size: 12px; color: #7a6326; margin-top: 6px; letter-spacing: 1px; }
.tutorial-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; width: 100%; }
.tut-practice { min-width: 200px; }
.tut-row { display: flex; align-items: center; gap: 12px; background: var(--panel, rgba(255,255,255,0.06)); border: 1px solid rgba(201,168,76,0.4); border-left: 6px solid var(--forest, #2d7a2d); border-radius: 14px; padding: 14px 16px; color: var(--cream, #fdf6e3); font-size: 16px; }
.tut-check { font-size: 22px; color: var(--forest, #2d7a2d); }
.tutorial-skip { align-self: flex-end; }

/* reduced motion: kill the new movement, keep visibility */
.reduce-motion .parallax-layer { animation: none !important; transform: none !important; }
.reduce-motion .portrait-float { animation: none !important; }
.reduce-motion .fx-rune-big { animation: none !important; }
.reduce-motion .fx-spotlight-ring { animation: none !important; }
.reduce-motion .fx-spotlight-pointer { animation: none !important; }
.reduce-motion .fx-knot { animation: none !important; }
.reduce-motion .stamp-pop { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .parallax-layer, .portrait-float, .fx-rune-big, .fx-spotlight-ring, .fx-spotlight-pointer { animation: none !important; }
}
