/* ========== TAROT CARD 3D FLIP ANIMATIONS ========== */

.card-spread {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  perspective: 1200px;
}

/* Individual tarot card container */
.tarot-card {
  width: 140px;
  height: 240px;
  perspective: 1000px;
  cursor: pointer;
  position: relative;
}

.tarot-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.tarot-card.flipped .tarot-card-inner {
  transform: rotateY(180deg);
}

.tarot-card.reversed.flipped .tarot-card-inner {
  transform: rotateY(180deg) rotate(180deg);
}

.tarot-card-front,
.tarot-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--gold-dim);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.tarot-card-front {
  transform: rotateY(180deg);
}

.tarot-card-front img,
.tarot-card-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Card back ornate pattern */
.tarot-card-back {
  background: url('/assets/card-back.png') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tarot-card-back img {
  border-radius: 8px;
}

/* Hover states */
.tarot-card:not(.flipped):hover {
  transform: translateY(-8px);
}

.tarot-card:not(.flipped):hover .tarot-card-inner {
  box-shadow: 0 8px 32px rgba(201, 162, 39, 0.3);
}

/* Glow effect on reveal */
.tarot-card.flipped::after {
  content: '';
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border-radius: 12px;
  background: radial-gradient(ellipse at center, var(--gold-glow), transparent 70%);
  animation: revealGlow 1.5s ease-out forwards;
  pointer-events: none;
  z-index: -1;
}

@keyframes revealGlow {
  0% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.2); }
}

/* Staggered entrance animation */
.tarot-card.entering {
  animation: cardFloat 0.6s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
  opacity: 0;
}

@keyframes cardFloat {
  0% { opacity: 0; transform: translateY(40px) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Shuffle animation */
.tarot-card.shuffling {
  animation: cardShuffle 0.4s ease-in-out;
}

@keyframes cardShuffle {
  0% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-20px) rotate(-5deg); }
  50% { transform: translateX(20px) rotate(5deg); }
  75% { transform: translateX(-10px) rotate(-2deg); }
  100% { transform: translateX(0) rotate(0); }
}

/* Position label */
.card-position-label {
  text-align: center;
  margin-top: 12px;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  max-width: 140px;
  word-wrap: break-word;
}

/* Card name after flip */
.card-name-label {
  text-align: center;
  margin-top: 4px;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--gold);
  letter-spacing: 1px;
  max-width: 140px;
}

.card-reversed-label {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  color: var(--rose);
  text-align: center;
}

/* ========== SPREAD LAYOUTS ========== */

/* Single card */
.spread-1 { justify-content: center; }
.spread-1 .tarot-card { width: 180px; height: 310px; }

/* 3-card spread */
.spread-3 { justify-content: center; }
.spread-3 .tarot-card { width: 160px; height: 275px; }

/* Celtic Cross (10 cards) - special layout */
.spread-celtic {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, auto);
  gap: 12px;
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .tarot-card { width: 100px; height: 172px; }
  .spread-1 .tarot-card { width: 150px; height: 258px; }
  .spread-3 .tarot-card { width: 120px; height: 206px; }
  .card-spread { gap: 10px; }
  .card-position-label { font-size: 0.6rem; max-width: 100px; }
}

@media (max-width: 480px) {
  .tarot-card { width: 80px; height: 138px; }
  .spread-1 .tarot-card { width: 130px; height: 224px; }
  .spread-3 .tarot-card { width: 100px; height: 172px; }
}
