/* =========================
   QSJ Tarot Layout Wrapper
========================= */
.qsj-tarot {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding: clamp(2rem, 3vw, 4rem) 0 clamp(2.5rem, 4vw, 5rem);
  text-align: center;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* =========================
   TAROT LAYOUT WRAPPER
========================= */
.tarot-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  overflow: visible;
  padding: clamp(6px, 1vw, 12px);
}

/* =========================
   TAROT LAYOUT
========================= */
.tarot-layout {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: clamp(16px, 3vw, 40px);
  align-items: center;
  justify-content: center;
  justify-items: center;
  display: inline-grid;
  width: auto;
  margin: 0 auto;
  padding: 0;
  position: relative;
  left: auto;
  right: auto;
  transform: none;
  justify-self: center;
  overflow: visible;
}

@media (max-width: 900px) {
  .tarot-layout {
    grid-template-columns: repeat(2, auto);
    gap: clamp(24px, 4vw, 32px);
  }
}

@media (max-width: 600px) {
  .tarot-layout {
    grid-template-columns: 1fr;
    gap: clamp(24px, 4vw, 36px);
    width: 100%;
    justify-content: center;
    justify-items: center;
    overflow: visible;
  }
}

/* =========================
   ACTIVE CARD HIGHLIGHT
========================= */
.tarot-card.is-active {
  position: relative;
}

.tarot-card.is-active::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: calc(var(--card-radius) + 10px);
  pointer-events: none;
  background:
    radial-gradient(
      60% 80% at 50% 50%,
      rgba(255,255,255,0.25),
      rgba(255,255,255,0.05) 60%,
      rgba(255,255,255,0) 100%
    );
  filter: blur(8px);
  animation: halo-breathe 3.5s ease-in-out infinite;
}

@keyframes halo-breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* =========================
   DETAIL PANEL
========================= */
.tarot-detail {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.tarot-detail.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.tarot-detail {
  width: min(720px, 92vw);
  text-align: center;
  margin: 0 auto;
}


.tarot-detail-title {
  font-size: 1.1em;
  margin: 0 0 0.5em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tarot-detail-text {
  font-size: 0.9em;
  line-height: 1.5;
  opacity: 0.85;
}

/* =========================
   TAROT CARD
========================= */
.tarot-card {
  --card-width: min(26vw, 280px);
  --frame-pad: 6%;
  --card-radius: 12px;
  --inner-radius: calc(var(--card-radius) * 0.45);

  width: var(--card-width);
  aspect-ratio: 70 / 120;

  cursor: pointer;
  transform: rotateZ(-0.6deg);
  transition: transform 0.3s ease;

  --fs-base: clamp(0.55rem, 1.1vw, 0.85rem);
  font-size: var(--fs-base);
}

.tarot-card:hover {
  transform: rotateZ(-0.6deg) translateY(-2px);
}

.tarot-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(.22,.61,.36,1);
}

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

.tarot-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.tarot-face.front {
  background: #f0f0f0;
  z-index: 2;
}

.tarot-face.back {
  background: #ededed;
  transform: rotateY(180deg);
}

.tarot-frame {
  width: 100%;
  height: 100%;
  padding: var(--frame-pad);
  display: grid;
  gap: var(--frame-pad);
}

.tarot-face.back .tarot-frame {
  grid-template-rows: 8% 1fr 10%;
}

.tarot-illustration,
.tarot-illustration-zone {
  background: #d8d8d8;
  border-radius: var(--inner-radius);
}

.qsj-tarot .tarot-illustration {
  position: relative;
  overflow: hidden;
  color: var(--icon-fill, var(--ink-strong));
}

.qsj-tarot .tarot-illustration-pattern {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  grid-auto-rows: minmax(48px, 1fr);
  place-items: center;
  gap: clamp(10px, 1.2vw, 16px);
  pointer-events: none;
  opacity: 0.06;
}

.qsj-tarot .tarot-illustration-pattern svg {
  width: clamp(20px, 2vw, 32px);
  height: auto;
  color: inherit;
  display: block;
}
.qsj-tarot .tarot-illustration-pattern-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.qsj-tarot .tarot-illustration {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  color: var(--icon-fill, var(--ink-strong));
  background-color: var(--header-bg-top, #d2bea0);
}

.tarot-number-zone,
.tarot-title-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  user-select: none;
  font-family: var(--font-heading);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
