/* ============================================================
   TAROT READING — Styles
   ============================================================ */

/* ---- Page Wrapper ---- */
.tarot-wrapper {
  background: var(--cream);
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.5rem 5rem;
  width: 100%;
}

#tarot-app {
  width: 100%;
  max-width: 960px;
}

.tarot-loading {
  text-align: center;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  opacity: 0.45;
  margin-top: 4rem;
}

/* ---- Step Container ---- */
.tarot-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
}

/* ---- Step Header ---- */
.tarot-step-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  max-width: 640px;
}

.tarot-step-label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.88rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dark);
  opacity: 0.7;
}

.tarot-step-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: var(--dark);
}

/* Subtitle text — matches mayan calculator muted para */
.tarot-step-sub {
  font-family: 'Josefin Sans', sans-serif;
  font-size: clamp(1.05rem, 1.8vw, 1.2rem);
  font-weight: 300;
  letter-spacing: 0.05em;
  opacity: 0.75;
  max-width: 480px;
}

/* ---- Controls ---- */
.tarot-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* ---- Buttons ---- */
.tarot-btn {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 400;
  background: var(--dark);
  color: var(--cream);
  border: none;
  padding: 0.85rem 2.4rem;
  cursor: pointer;
  transition: opacity 0.2s;
}
.tarot-btn:hover:not(:disabled) { opacity: 0.75; }
.tarot-btn:disabled { opacity: 0.28; cursor: default; }

.tarot-btn-ghost {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 400;
  background: none;
  color: var(--dark);
  border: 1.5px solid var(--dark);
  padding: 0.7rem 1.8rem;
  cursor: pointer;
  transition: opacity 0.2s, background 0.2s;
}
.tarot-btn-ghost:hover:not(:disabled) { background: rgba(39,37,34,0.06); }
.tarot-btn-ghost:disabled { opacity: 0.25; cursor: default; }

.tarot-btn--ghost-dark {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 400;
  background: none;
  color: var(--dark);
  border: 1.5px solid rgba(39,37,34,0.35);
  padding: 0.7rem 2rem;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-top: 1rem;
}
.tarot-btn--ghost-dark:hover { opacity: 0.55; }

/* ---- Progress Line ---- */
.tarot-progress-line {
  font-family: 'Josefin Sans', sans-serif;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  letter-spacing: 0.1em;
  color: var(--dark);
  opacity: 0.75;
}

/* ============================================================
   STEP 1 — DECK (overlapping spread)
   ============================================================ */

.tarot-deck {
  position: relative;
  margin: 0 auto;
  overflow: visible;
}

.deck-card {
  position: absolute;
  width: 119px;
  height: 227px;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  top: 0;
}
.deck-card:hover {
  transform: translateY(-18px) scale(1.04);
  box-shadow: 0 18px 36px rgba(39,37,34,0.28);
  z-index: 200 !important;
}

.deck-card-inner {
  width: 100%;
  height: 100%;
}
.deck-card-inner svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- Flying ghost (card in flight from deck to tray) ---- */
.card-ghost svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- Tap highlight (card selected, lifts before flying) ---- */
@keyframes cardTap {
  0%   { transform: translateY(0)     scale(1);    box-shadow: 0 4px 12px rgba(39,37,34,0.15); }
  50%  { transform: translateY(-20px) scale(1.12); box-shadow: 0 20px 40px rgba(39,37,34,0.3), 0 0 18px rgba(196,160,90,0.55); }
  100% { transform: translateY(-20px) scale(1.12); box-shadow: 0 20px 36px rgba(39,37,34,0.25); }
}

.deck-card.tapped {
  animation: cardTap 0.3s cubic-bezier(0.2, 0, 0.1, 1) forwards;
  z-index: 500 !important;
  pointer-events: none;
}


/* ---- Shuffle wave animation ---- */
@keyframes cardFlick {
  0%   { transform: translateY(0)     rotate(0deg);    }
  30%  { transform: translateY(-22px) rotate(-1.8deg); }
  60%  { transform: translateY(-8px)  rotate(0.9deg);  }
  100% { transform: translateY(0)     rotate(0deg);    }
}

.tarot-deck.shuffling .deck-card {
  animation: cardFlick 0.5s ease both;
  animation-delay: calc(var(--ci, 0) * 18ms);
  pointer-events: none;
}

/* ---- Tray (picked cards row below deck) ---- */
.tarot-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  min-height: 40px;
  width: 100%;
}

.tray-card {
  flex-shrink: 0;
}

/* ============================================================
   FLIP CARD — 20% larger than deck card (143 × 272)
   ============================================================ */

.tc-flip {
  width: 143px;
  height: 272px;
  perspective: 900px;
  cursor: default;
}

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

.tc-flip.flipped .tc-inner {
  transform: rotateY(180deg);
}

.tc-back,
.tc-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 6px;
  overflow: hidden;
}

.tc-back svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tc-front {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
}

.tc-front img {
  width: 100%;
  height: calc(100% - 28px);
  object-fit: cover;
  display: block;
}

.tc-name {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
  padding: 3px 4px;
  color: #272522;
  background: #fff;
  width: 100%;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Tray card entry pop */
@keyframes trayEnter {
  from { transform: scale(0.82); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.tc-flip.tray-enter {
  animation: trayEnter 0.32s cubic-bezier(0.2, 0, 0, 1) forwards;
}

/* ============================================================
   STEP 2–4 — PICK GRID
   ============================================================ */

.tarot-pick-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px 16px;
  width: 100%;
}

.pick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.16s ease;
  user-select: none;
}
.pick-card:hover { transform: translateY(-8px); }

.pick-card img {
  width: 119px;
  height: 206px;
  object-fit: cover;
  border-radius: 6px;
  border: 2.5px solid transparent;
  box-shadow: 0 4px 14px rgba(39,37,34,0.12);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  display: block;
}

.pick-card.selected img {
  border-color: var(--dark);
  box-shadow: 0 0 0 4px rgba(39,37,34,0.15), 0 6px 20px rgba(39,37,34,0.18);
  transform: translateY(-6px);
}

.pick-name {
  font-family: 'Josefin Sans', sans-serif;
  font-size: clamp(0.72rem, 1.2vw, 0.82rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: var(--dark);
  opacity: 0.75;
  max-width: 119px;
  line-height: 1.3;
}
.pick-card.selected .pick-name { opacity: 1; font-weight: 400; }

/* ============================================================
   STEP 5 — READING RESULTS
   ============================================================ */

.tarot-reading-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--dark);
  text-align: center;
}

.reading-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2.5rem 0;
  border-top: 1px solid rgba(39,37,34,0.12);
}

.reading-group-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--dark);
  text-align: center;
}

/* Group intro — matches mayan calculator .desc-para--muted */
.reading-group-intro {
  font-family: 'Josefin Sans', sans-serif;
  font-size: clamp(1.05rem, 1.6vw, 1.15rem);
  font-weight: 300;
  letter-spacing: 0.04em;
  opacity: 0.65;
  color: var(--dark);
  text-align: center;
  max-width: 560px;
}

.reading-cards-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2.5rem;
  width: 100%;
}

.reading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 260px;
  text-align: center;
}

.reading-card-img {
  width: 140px;
  height: 230px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(39,37,34,0.16);
  display: block;
}

/* Card name — slightly larger than before */
.reading-card-name {
  font-family: 'Cinzel', serif;
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--dark);
}

/* Main interpretation text — exact match to mayan calculator .desc-para */
.reading-card-text {
  font-family: 'Josefin Sans', sans-serif;
  font-size: clamp(1.28rem, 2vw, 1.45rem);
  font-weight: 300;
  line-height: 1.75;
  color: var(--dark);
  opacity: 1;
  text-align: left;
}

/* ---- Missing Card ---- */
.reading-missing {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2.5rem 0;
  border-top: 1px solid rgba(39,37,34,0.12);
}

.reading-missing-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  max-width: 480px;
}

.reading-missing-divider {
  flex: 1;
  height: 1px;
  background: rgba(39,37,34,0.2);
}

.reading-missing-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.reading-missing-body {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  max-width: 700px;
  width: 100%;
}

.reading-missing-img {
  width: 130px;
  height: 213px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(39,37,34,0.16);
}

.reading-missing-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
  .tarot-wrapper { padding: 2rem 0.75rem 4rem; }

  /* Deck cards — JS drives the spread size; CSS sets element dimensions */
  .deck-card { width: 76px; height: 145px; }

  /* Tray flip cards — also 20% larger than deck mobile */
  .tc-flip { width: 106px; height: 203px; }
  .tc-name { font-size: 0.5rem; height: 22px; }
  .tc-front img { height: calc(100% - 22px); }

  .pick-card img { width: 88px; height: 152px; }
  .tarot-pick-grid { gap: 14px 10px; }
  .pick-name { max-width: 88px; }

  .reading-card-img { width: 110px; height: 181px; }
  .reading-cards-row { gap: 1.75rem; }
  .reading-card { max-width: 100%; }
  .reading-card-text { text-align: center; }

  .reading-missing-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .reading-missing-content { align-items: center; }

  .reading-group { padding: 1.75rem 0; }
}
