/* 3D Animated Tarot Card Plugin Styles */

.tarot-card-wrapper {
  position: relative;
  width: 188px;
  height: 320px;
  margin: 50px auto;
  perspective: 2000px;
  z-index: 1;
  animation: tarotFloat 10.4s ease-in-out infinite;
  will-change: transform;
}

/* Light Effects - Enhanced for better visual impact */
.welcome__lights-container {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 800px;
  height: 800px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
  will-change: transform, opacity;
}

.lights {
  position: relative;
  width: 100%;
  height: 100%;
}

.lights-a {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 400px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at center,
      rgba(147, 51, 234, 0.8) 0%,
      rgba(168, 85, 247, 0.6) 15%,
      rgba(192, 132, 252, 0.4) 30%,
      rgba(216, 180, 254, 0.2) 50%,
      rgba(233, 213, 255, 0.1) 70%,
      transparent 100%);
  border-radius: 50%;
  filter: blur(80px);
  animation: lightPulse 4s ease-in-out infinite, lightRotate 20s linear infinite;
  opacity: 0.9;
  mix-blend-mode: screen;
}

.lights-b {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  height: 600px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(ellipse at center,
      rgba(96, 165, 250, 0.6) 0%,
      rgba(125, 211, 252, 0.4) 20%,
      rgba(165, 243, 252, 0.3) 40%,
      rgba(224, 242, 254, 0.15) 60%,
      transparent 80%);
  border-radius: 50%;
  filter: blur(100px);
  animation: lightGlow 6s ease-in-out infinite alternate, lightRotate 30s linear infinite reverse;
  opacity: 0.7;
  mix-blend-mode: screen;
}

/* Light animations - More dramatic effects */
@keyframes lightPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.9;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 1;
  }
}

@keyframes lightGlow {
  0% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.6;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.8;
  }
}

@keyframes lightRotate {
  from {
    filter: blur(80px) hue-rotate(0deg);
  }
  to {
    filter: blur(80px) hue-rotate(360deg);
  }
}

/* Tarot Card Styles */
.tarot-card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: cardRotate 8s linear infinite;
  cursor: pointer;
  border-radius: 15px;
  transition: transform 0.3s ease;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.tarot-card:hover {
  transform: scale(1.02) translateZ(20px);
}

.tarot-card-rotating {
  animation: cardRotate 8s linear infinite, cardFloat 4s ease-in-out infinite;
}

.tarot-card-rotating:hover {
  animation-play-state: paused;
  transform: scale(1.05) translateZ(30px);
}

/* Card faces */
.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 15px;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(147, 51, 234, 0.3),
    inset 0 0 20px rgba(255, 255, 255, 0.05);
  will-change: transform;
}

.card-front {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border: 1px solid rgba(147, 51, 234, 0.3);
}

.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #4a148c 0%, #6a1b9a 50%, #8e24aa 100%);
  border: 1px solid rgba(168, 85, 247, 0.4);
}

/* Card content containers */
.card-content-front,
.card-content-back {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Video and image styles */
.card-content-front video,
.card-content-front img,
.card-content-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 15px;
}

/* Fallback content for missing media */
.card-content-front .fallback-content,
.card-content-back .fallback-content {
  color: #ffffff;
  text-align: center;
  font-family: Georgia, serif;
  padding: 20px;
}

.card-content-front .fallback-content h3,
.card-content-back .fallback-content h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  opacity: 0.9;
}

.card-content-front .fallback-content p,
.card-content-back .fallback-content p {
  margin: 0;
  font-size: 12px;
  opacity: 0.7;
}

/* Animations */
@keyframes cardRotate {
  0% {
    transform: rotateY(0deg) rotateX(0deg);
  }
  25% {
    transform: rotateY(90deg) rotateX(5deg);
  }
  50% {
    transform: rotateY(180deg) rotateX(0deg);
  }
  75% {
    transform: rotateY(270deg) rotateX(-5deg);
  }
  100% {
    transform: rotateY(360deg) rotateX(0deg);
  }
}

@keyframes cardFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-15px);
  }
}

@keyframes mysticalFloat {
  0%, 100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-10px) scale(1.02);
  }
}

@keyframes tarotFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg) scale(1);
  }
  16% {
    transform: translateY(-15px) rotate(1deg) scale(1.01);
  }
  33% {
    transform: translateY(-25px) rotate(2deg) scale(1.02);
  }
  50% {
    transform: translateY(-30px) rotate(0deg) scale(1.01);
  }
  66% {
    transform: translateY(-20px) rotate(-2deg) scale(1.01);
  }
  83% {
    transform: translateY(-10px) rotate(-1deg) scale(1.01);
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .tarot-card-wrapper {
    width: 141px;
    height: 240px;
    margin: 30px auto;
    perspective: 1500px;
  }

  .welcome__lights-container {
    width: 500px;
    height: 500px;
  }

  .lights-a {
    width: 300px;
    height: 300px;
    filter: blur(60px);
    animation: lightPulse 4s ease-in-out infinite;
  }

  .lights-b {
    width: 400px;
    height: 400px;
    filter: blur(80px);
    animation: lightGlow 6s ease-in-out infinite alternate;
  }

  /* Simplify animations on mobile for better performance */
  .tarot-card-rotating {
    animation: cardRotate 8s linear infinite;
  }

  @keyframes tarotFloat {
    0%, 100% {
      transform: translateY(0px);
    }
    50% {
      transform: translateY(-15px);
    }
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .tarot-card {
    border: 2px solid #ffffff;
  }
  
  .lights-a,
  .lights-b {
    opacity: 0.9;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .tarot-card-wrapper {
    animation: none;
  }

  .tarot-card-rotating {
    animation: cardRotate 20s linear infinite;
  }

  .lights-a,
  .lights-b {
    animation: none;
    opacity: 0.5;
  }

  .tarot-card:hover {
    transform: scale(1.02);
  }
}

/* Performance optimizations for low-end devices */
@media (max-width: 480px) {
  .tarot-card-wrapper {
    width: 120px;
    height: 204px;
  }

  .welcome__lights-container {
    width: 400px;
    height: 400px;
  }

  .lights-a {
    width: 250px;
    height: 250px;
    filter: blur(50px);
  }

  .lights-b {
    width: 320px;
    height: 320px;
    filter: blur(70px);
  }
}