/* =========================================================
   TODAY TAROT
   CINEMA ANIMATION
   中央 → 四方へ散開 → 収束 → 1枚ずつ公開
========================================================= */


/* ==============================
   全画面
============================== */

.tarot-cinema-overlay {
  position: fixed;
  inset: 0;

  width: 100vw;
  height: 100dvh;

  overflow: hidden;

  background:
    radial-gradient(
      circle at 50% 45%,
      #241936 0%,
      #120d28 48%,
      #05040f 100%
    );

  z-index: 2147483647 !important;

  opacity: 1;
  visibility: visible;
}


/* ==============================
   舞台
============================== */

.tarot-cinema-stage {
  position: relative;

  width: 100%;
  height: 100%;

  overflow: hidden;

  perspective: 1400px;
  transform-style: preserve-3d;
}


/* ==============================
   背景
============================== */

.tarot-cinema-background {
  position: absolute;
  inset: 0;

  pointer-events: none;

  background:
    radial-gradient(
      circle at 50% 48%,
      rgba(166, 121, 214, .15),
      transparent 35%
    );
}


/* ==============================
   星
============================== */

.tarot-cinema-stars {
  position: absolute;
  inset: 0;

  overflow: hidden;
  pointer-events: none;
}


.tarot-cinema-star {
  position: absolute;

  left: var(--x);
  top: var(--y);

  width: var(--size);
  height: var(--size);

  border-radius: 50%;

  background:
    rgba(255, 239, 190, .95);

  box-shadow:
    0 0 6px
    rgba(255, 226, 138, .7);

  opacity: .25;

  animation:
    tarotCinemaTwinkle
    3.5s
    ease-in-out
    infinite;

  animation-delay:
    var(--delay);
}


@keyframes tarotCinemaTwinkle {

  0%,
  100% {
    opacity: .15;
    transform: scale(.75);
  }

  50% {
    opacity: .9;
    transform: scale(1.35);
  }
}


/* ==============================
   タイトル
============================== */

.tarot-cinema-heading {
  position: absolute;

  top: 7%;
  left: 50%;

  width: calc(100% - 40px);
  max-width: 680px;

  transform: translateX(-50%);

  text-align: center;

  z-index: 40;
}


.tarot-cinema-heading span {
  display: block;

  margin-bottom: 8px;

  color:
    rgba(230, 208, 150, .72);

  font-size: 10px;
  font-weight: 600;

  letter-spacing: .28em;
}


.tarot-cinema-heading strong {
  display: block;

  color: #fff7dc;

  font-family:
    "Yu Mincho",
    "YuMincho",
    "Hiragino Mincho ProN",
    serif;

  font-size: 22px;
  font-weight: 500;

  line-height: 1.6;
  letter-spacing: .08em;

  text-shadow:
    0 2px 12px rgba(0,0,0,.8),
    0 0 20px rgba(255,222,137,.14);
}


/* =========================================================
   カード空間
========================================================= */

.tarot-cinema-space {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  perspective: 1300px;
  transform-style: preserve-3d;

  z-index: 10;
}


/* =========================================================
   周囲のカード
   初期位置 = 中央
========================================================= */

.tarot-cinema-floating-card {
  position: absolute;

  left: 50%;
  top: 50%;

  width: 72px;
  height: 116px;

  opacity: 0;

  transform:
    translate(-50%, -50%)
    translate3d(0, 0, 0)
    rotate(0deg)
    scale(.25);

  transform-style: preserve-3d;

  transition:
    opacity .35s ease,
    transform 1.25s
    cubic-bezier(.18,.8,.22,1);

  will-change:
    transform,
    opacity;
}


.tarot-cinema-floating-inner {
  width: 100%;
  height: 100%;

  border-radius: 8px;

  border:
    1px solid
    rgba(222,197,126,.55);

  background-image:
    url("/wp-content/themes/hello-elementor/images/tarot/99.png");

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  box-shadow:
    0 10px 28px rgba(0,0,0,.42),
    0 0 12px rgba(226,198,119,.13);
}



/* =========================================================
   中央 → 四方へ散開
========================================================= */

.tarot-cinema-stage.is-scattered
.tarot-cinema-floating-card {
  opacity: .92;

  transform:
    translate(-50%, -50%)
    translate3d(
      var(--x),
      var(--y),
      var(--z)
    )
    rotate(var(--r))
    scale(var(--scale));
}
.tarot-cinema-stage.is-scattered
.tarot-cinema-floating-inner {
  animation:
    tarotCinemaFloating 3.2s
    ease-in-out
    infinite;

  animation-delay:
    var(--delay);
}


@keyframes tarotCinemaFloating {

  0%,
  100% {
    transform:
      translateY(0)
      rotate(0deg);
  }

  50% {
    transform:
      translateY(-12px)
      rotate(1.5deg);
  }

}
/* =========================================================
   四方 → 中央へ戻りながら縮小
========================================================= */

.tarot-cinema-stage.scene-gather
.tarot-cinema-floating-card {
  opacity: 1;

  transform:
  translate(-50%, -50%)
  translate3d(0, 0, 0)
  rotate(0deg)
  scale(.55);
}


/* =========================================================
   選ばれたカード領域
========================================================= */

.tarot-cinema-selected {
  position: absolute;

  left: 50%;
  top: 50%;

  width: 620px;
  height: 360px;

  transform:
    translate(-50%, -45%);

  transform-style: preserve-3d;

  z-index: 30;
}


/* =========================================================
   選択カード 初期状態
========================================================= */

.tarot-cinema-result-card {
  position: absolute;

  left: 50%;
  top: 50%;

  width: 126px;
  height: 202px;

  opacity: 0;

  transform:
    translate(-50%, -50%)
    rotate(0deg)
    scale(.30);

  transform-origin:
    50% 50%;

  transform-style:
    preserve-3d;

  transition:
    opacity .35s ease,
    transform .65s
    cubic-bezier(.16,1,.3,1);

  z-index: 5;
}
/* =========================================================
   未公開カードは完全に描画しない
   次のカードがフリップ中の下から見えるのを防止
========================================================= */

.tarot-cinema-result-card:not(.is-focus):not(.is-complete) {
  visibility: hidden;
}


/* 公開開始したカードだけ表示 */
.tarot-cinema-result-card.is-focus,
.tarot-cinema-result-card.is-complete {
  visibility: visible;
}


/* =========================================================
   今公開しているカード
   中央へ飛び出す
========================================================= */

.tarot-cinema-stage.cards-ready
.tarot-cinema-result-card.is-focus {
  opacity: 1;

  transform:
    translate(-50%, -58%)
    rotate(0deg)
    scale(1.22);

  z-index: 50 !important;
}


/* =========================================================
   Glow
========================================================= */

.tarot-cinema-card-glow {
  position: absolute;

  inset: -12px;

  border-radius: 18px;

  background:
    radial-gradient(
      circle,
      rgba(242,211,126,.34),
      rgba(242,211,126,0)
    );

  filter: blur(18px);

  opacity: 0;

  pointer-events: none;

  transition:
    opacity .4s ease;
}


.tarot-cinema-result-card.is-focus
.tarot-cinema-card-glow,
.tarot-cinema-result-card.is-revealed
.tarot-cinema-card-glow {
  opacity: 1;
}

/* =========================================================
   カード反転：表裏を独立して回転
   親要素は回転させず、左右半分の描画欠けを抑える
========================================================= */

.tarot-cinema-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: none;
  transform-style: flat;
  -webkit-transform-style: flat;
}

.tarot-cinema-card-back,
.tarot-cinema-card-front {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(228,201,125,.68);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform-origin: center center;
  transition: transform .65s cubic-bezier(.16,1,.3,1);
  box-shadow:
    0 18px 42px rgba(0,0,0,.48),
    0 0 16px rgba(229,199,119,.15);
}

.tarot-cinema-card-back {
  background-color: #090713;
  background-image: url("/wp-content/themes/hello-elementor/images/tarot/99.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: rotateY(0deg);
}

.tarot-cinema-card-front {
  background: #090713;
  transform: rotateY(-180deg);
}

.tarot-cinema-result-card.is-revealed .tarot-cinema-card-back {
  transform: rotateY(180deg);
}

.tarot-cinema-result-card.is-revealed .tarot-cinema-card-front {
  transform: rotateY(0deg);
}

/* =========================================================
   カード画像
   めくった直後は均一にぼかす
========================================================= */

.tarot-cinema-card-image {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;

  opacity: 1;

  filter:
    blur(7px)
    brightness(.78);

  /*
   * blurの端が見えないよう、
   * 画像だけ少し拡大。
   * 3D transformとは分離する。
   */
  width: calc(100% + 16px);
  height: calc(100% + 16px);

  margin:
    -8px
    0
    0
    -8px;

  transition:
    filter .55s ease;

  will-change: filter;
}


/* =========================================================
   鮮明になる
========================================================= */

.tarot-cinema-result-card.is-clear
.tarot-cinema-card-image {
  filter:
    blur(0)
    brightness(1);
}


/* =========================================================
   逆位置
========================================================= */

.tarot-cinema-card-image.is-reversed {
  transform: rotate(180deg);
}
/* =========================================================
   公開完了後の最終配置
========================================================= */


/* 1枚目 → 左斜め */

.tarot-cinema-stage.cards-ready
.tarot-cinema-result-card.card-1.is-complete {
  opacity: 1;

  transform:
    translate(-165%, -45%)
    rotate(-11deg)
    scale(1);

  z-index: 6;
}


/* 2枚目 → 中央 */

.tarot-cinema-stage.cards-ready
.tarot-cinema-result-card.card-2.is-complete {
  opacity: 1;

  transform:
    translate(-50%, -55%)
    rotate(0deg)
    scale(1);

  z-index: 7;
}


/* 3枚目 → 右斜め */

.tarot-cinema-stage.cards-ready
.tarot-cinema-result-card.card-3.is-complete {
  opacity: 1;

  transform:
    translate(65%, -45%)
    rotate(11deg)
    scale(1);

  z-index: 6;
}


/* =========================================================
   1枚引き
========================================================= */

.tarot-cinema-result-card.single-card {
  width: 142px;
  height: 226px;
}


.tarot-cinema-stage.cards-ready
.tarot-cinema-result-card.single-card.is-focus {
  opacity: 1;

  transform:
    translate(-50%, -58%)
    rotate(0deg)
    scale(1.22);
}


.tarot-cinema-stage.cards-ready
.tarot-cinema-result-card.single-card.is-complete {
  opacity: 1;

  transform:
    translate(-50%, -50%)
    rotate(0deg)
    scale(1);
}


/* =========================================================
   ステータス
========================================================= */

.tarot-cinema-status {
  position: absolute;

  left: 50%;
  bottom: 7%;

  width:
    calc(100% - 40px);

  transform:
    translateX(-50%);

  color:
    rgba(244,222,161,.88);

  font-family:
    "Yu Mincho",
    "YuMincho",
    "Hiragino Mincho ProN",
    serif;

  font-size: 14px;

  line-height: 1.7;
  letter-spacing: .08em;

  text-align: center;

  text-shadow:
    0 0 14px
    rgba(240,210,125,.25);

  z-index: 40;
}


/* =========================================================
   Smartphone
========================================================= */

@media (max-width: 768px) {

  .tarot-cinema-heading {
    top: 6%;
  }


  .tarot-cinema-heading strong {
    font-size: 18px;
  }


  .tarot-cinema-floating-card {
    width: 52px;
    height: 84px;
  }


  .tarot-cinema-selected {
    width: 100%;
    height: 320px;

    transform:
      translate(-50%, -43%);
  }


  .tarot-cinema-result-card {
    width: 90px;
    height: 145px;
  }


  /*
   * 中央へ飛び出す
   */

  .tarot-cinema-stage.cards-ready
  .tarot-cinema-result-card.is-focus {
    transform:
      translate(-50%, -60%)
      rotate(0deg)
      scale(1.22);
  }


  /*
   * 左
   */

  .tarot-cinema-stage.cards-ready
  .tarot-cinema-result-card.card-1.is-complete {
    transform:
      translate(-145%, -42%)
      rotate(-10deg)
      scale(1);
  }


  /*
   * 中央
   */

  .tarot-cinema-stage.cards-ready
  .tarot-cinema-result-card.card-2.is-complete {
    transform:
      translate(-50%, -54%)
      rotate(0deg)
      scale(1);
  }


  /*
   * 右
   */

  .tarot-cinema-stage.cards-ready
  .tarot-cinema-result-card.card-3.is-complete {
    transform:
      translate(45%, -42%)
      rotate(10deg)
      scale(1);
  }


  /*
   * 1枚引き
   */

  .tarot-cinema-result-card.single-card {
    width: 116px;
    height: 186px;
  }


  .tarot-cinema-stage.cards-ready
  .tarot-cinema-result-card.single-card.is-focus {
    transform:
      translate(-50%, -58%)
      scale(1.18);
  }


  .tarot-cinema-stage.cards-ready
  .tarot-cinema-result-card.single-card.is-complete {
    transform:
      translate(-50%, -50%)
      scale(1);
  }


  .tarot-cinema-status {
    bottom: 5%;

    font-size: 12px;
  }

}
