/* five-card-tarot.html + onecard.html + yes-no-tarot.html + ai-tarot.html CSS [L] Stage 3: fan of 22 cards, pick 1|2|3|5. JS: js/five-card-select.js */

/* ==== L. STAGE 3: SELECT STAGE — fan of 22 cards, pick 1|2|3|5 (data-pick-limit on stage) ==== */
body.tarot-select-active main {
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: visible;
  position: relative;
}

.tarot-select-stage {
  --fan-scale: 0.7;
  align-items: center;
  box-sizing: border-box;
  display: none;
  flex-direction: column;
  height: 100vh;
  justify-content: flex-start;
  left: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: visible;
  padding-top: 0;
  position: absolute;
  right: 0;
  top: 0;
  transform: translateZ(0);
  width: 100%;
  z-index: 10;
}

.tarot-select-stage .select-layout-spacer {
  flex-shrink: 0;
  height: 40%;
  pointer-events: none;
  width: 100%;
}

body.tarot-select-active .site-header {
  background: transparent;
  isolation: isolate;
  position: absolute;
  top: 0;
  z-index: 1000;
}

body.tarot-select-active .mobile-header,
body.tarot-select-active .mobile-breadcrumbs {
  background: transparent;
  isolation: isolate;
  position: absolute;
  top: 0;
  z-index: 1000;
}

body.tarot-select-active .mobile-breadcrumbs {
  top: 68px;
}

.tarot-select-stage.select {
  display: flex;
}

.tarot-select-stage .select-hint {
  align-items: center;
  bottom: 48%;
  display: flex;
  flex-direction: column;
  height: auto;
  justify-content: flex-start;
  left: 0;
  padding-top: 0;
  pointer-events: none;
  position: absolute;
  right: 0;
  text-align: center;
  top: auto;
  width: 100%;
  z-index: 25;
}

.tarot-select-stage .status-panel {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 1.5vw;
  opacity: 0;
  position: relative;
  transition: opacity 0.2s;
  width: auto;
}

.tarot-select-stage.select .status-panel {
  opacity: 1;
}

.tarot-select-stage .status-panel::before,
.tarot-select-stage .status-panel::after {
  aspect-ratio: 1;
  border-radius: 50%;
  content: "";
  opacity: 0.5;
  pointer-events: none;
  position: absolute;
  top: -4vh;
  width: 40vh;
  z-index: -1;
}

.tarot-select-stage .status-panel::before {
  background: radial-gradient(circle, rgba(38, 219, 255, 0.4) 10%, transparent 70%);
  right: -1vh;
}

.tarot-select-stage .status-panel::after {
  background: radial-gradient(circle, rgba(199, 155, 254, 0.3) 10%, transparent 70%);
  left: -1vh;
}

.tarot-select-stage .hl {
  color: #fff;
  font-family: var(--font-display);
  font-size: inherit;
  font-weight: 400;
  opacity: 1;
  text-transform: none;
  transition: opacity 0.4s;
}

.tarot-select-stage .instruction {
  font-family: var(--font-display);
  font-size: 1.5vw;
  height: 1.95vw;
  letter-spacing: 0.09vw;
  line-height: 1.3;
  margin: 0;
  opacity: 1;
  padding: 0;
  white-space: nowrap;
}

.tarot-select-stage .counter-element {
  align-items: center;
  display: flex;
  flex-direction: row;
  font-family: var(--font-display);
  font-size: 2.4vw;
  gap: 1.5vw;
  letter-spacing: 0.0525vw;
}

.tarot-select-stage .counter {
  align-items: center;
  backdrop-filter: blur(0.6vw);
  background: rgba(0, 0, 0, 0.55);
  border-radius: 50%;
  box-shadow: rgba(0, 0, 0, 0.6) 0 0 32px 1px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.tarot-select-stage .count {
  border-radius: 50%;
  height: 6.9vw;
  position: relative;
  width: 6.9vw;
}

.tarot-select-stage .count::before {
  background: linear-gradient(90deg, transparent, #c79bfe, #c79bfe, transparent, #99fdfe, #99fdfe, transparent);
  border: 2px solid transparent;
  border-radius: 50%;
  content: "";
  inset: 0;
  mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.4;
  position: absolute;
  transform: rotate(20deg);
}

.tarot-select-stage .count-el {
  align-items: center;
  display: flex;
  font-size: 3.9vw;
  inset: 0;
  justify-content: center;
  line-height: 1;
  opacity: 1;
  position: absolute;
  text-align: center;
  transition: 0.8s;
  transform: scale(1);
  will-change: transform, opacity;
}

.tarot-select-stage .count-el.hiden {
  opacity: 0;
  transform: scale(1.4);
}

#scroll-control {
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  bottom: 0;
  box-shadow: rgba(255, 255, 255, 0.4) 0 0 32px;
  cursor: pointer;
  height: clamp(56px, 16vw, 72px);
  left: 50%;
  position: fixed;
  transform: translate(-50%, -20px);
  transition: 0.8s;
  width: clamp(56px, 16vw, 72px);
  z-index: 100;
  animation: scroll-blink 2s ease-in-out infinite;
}

#scroll-control::before,
#scroll-control::after {
  border-color: transparent #fff #fff transparent;
  border-style: solid;
  border-width: 2px;
  content: "";
  height: clamp(18px, 7vw, 28px);
  left: 50%;
  position: absolute;
  top: 45%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: clamp(18px, 7vw, 28px);
}

#scroll-control::after {
  top: 58%;
}

@keyframes scroll-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.tarot-select-stage.scrolled #scroll-control {
  opacity: 0;
  pointer-events: none;
}

.tarot-select-stage .cards-container {
  flex: 0 1 auto;
  height: 62%;
  margin-top: 0;
  overflow: visible;
  position: relative;
  touch-action: none;
  transform: scale(var(--fan-scale));
  transform-origin: center bottom;
  width: 100vw;
}

.tarot-select-stage .cards-container-inner {
  align-items: center;
  bottom: 0;
  display: flex;
  height: calc(300vh - 49.896vw);
  justify-content: center;
  left: calc(-150vh + 74.948vw);
  position: absolute;
  transform-origin: center center;
  transition: transform 2s cubic-bezier(0.3, 0, 0.14, 1);
  width: calc(300vh - 49.896vw);
}

.tarot-select-stage.fan-hidden .cards-container-inner {
  transform: rotate(-130deg);
}

.tarot-select-stage.fan-visible .cards-container-inner {
  transform: rotate(0deg);
}

.tarot-select-stage.fan-ready .cards-container-inner {
  transition: none;
}

.tarot-select-stage.select .card-axis {
  transition-timing-function: ease-out;
}

.tarot-select-stage .card-axis {
  align-items: flex-end;
  box-sizing: content-box;
  display: flex;
  flex-shrink: 0;
  height: 100%;
  justify-content: center;
  left: auto;
  margin-left: auto;
  margin-right: auto;
  margin-top: auto;
  pointer-events: none;
  position: absolute;
  right: auto;
  transform: rotate(calc(1deg * var(--arc-span) / 2 - 1deg * (var(--index) - 1) * var(--arc-span) / 2 / (var(--total) - 1)));
  transition: transform calc(2.1s * (1.5 + (var(--total) / 2 - var(--index)) * 0.0375)) cubic-bezier(0.3, 0, 0.14, 1);
  width: 10%;
  will-change: transform;
}

.tarot-select-stage .card-axis.shown {
  transform: rotate(calc(1deg * var(--arc-span) / 2 - 1deg * (var(--index) - 1) * var(--arc-span) / (var(--total) - 1)));
  z-index: var(--index);
}

.tarot-select-stage .card-wrapper {
  align-items: center;
  display: flex;
  height: 50vh;
  justify-content: center;
  margin-bottom: 3vh;
  min-width: 100%;
  perspective: 138.6vw;
  pointer-events: none;
  transform: translateY(0) rotate(calc(1deg * (var(--total) / 2 - var(--index))));
  transition: transform 2s ease-in-out;
  will-change: transform;
}

.tarot-select-stage .card-el {
  aspect-ratio: 196 / 304;
  border-radius: clamp(12px, 3.7vw, 16px);
  cursor: default;
  filter: drop-shadow(rgba(0, 0, 0, 0.4) 0px 0px 16px);
  pointer-events: none;
  position: relative;
  transform: translateZ(0);
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), filter 0.45s ease;
  user-select: none;
  width: 100%;
}

.tarot-select-stage.fan-ready .card-el {
  cursor: pointer;
  pointer-events: all;
}

.tarot-select-stage.fan-ready .card-el:hover {
  filter:
    drop-shadow(0 8px 18px rgba(94, 160, 255, 0.3))
    drop-shadow(rgba(0, 0, 0, 0.4) 0 0 16px);
  transform: translateY(7%);
}

.tarot-select-stage.fan-ready .card-el:hover .card-back::after,
.tarot-select-stage.fan-ready .card-el:hover .card-front::after {
  background: linear-gradient(
    180deg,
    rgba(48, 62, 118, 0.4) 0%,
    rgba(68, 82, 158, 0.36) 38%,
    rgba(98, 145, 225, 0.44) 72%,
    rgba(124, 182, 252, 0.56) 100%
  );
  border-radius: inherit;
  content: "";
  inset: 0;
  mix-blend-mode: soft-light;
  position: absolute;
  z-index: 2;
}

.tarot-select-stage.fan-ready .card-el.selected {
  filter:
    drop-shadow(0 10px 22px rgba(110, 184, 255, 0.36))
    drop-shadow(rgba(0, 0, 0, 0.4) 0 0 16px);
  transform: translateY(12%);
}

.tarot-select-stage.fan-ready .card-el.selected .card-back::after,
.tarot-select-stage.fan-ready .card-el.selected .card-front::after {
  background: linear-gradient(
    180deg,
    rgba(42, 54, 108, 0.44) 0%,
    rgba(68, 82, 158, 0.4) 34%,
    rgba(102, 152, 232, 0.5) 68%,
    rgba(132, 192, 255, 0.62) 100%
  );
  border-radius: inherit;
  content: "";
  inset: 0;
  mix-blend-mode: soft-light;
  position: absolute;
  z-index: 2;
}

.tarot-select-stage.fan-ready .card-el.selected {
  cursor: default;
  pointer-events: none;
}

.tarot-select-stage .card-back::after,
.tarot-select-stage .card-front::after {
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity 0.35s ease, background 0.35s ease;
  z-index: 1;
}

.tarot-select-stage.fan-ready .card-el:hover .card-back::after,
.tarot-select-stage.fan-ready .card-el:hover .card-front::after,
.tarot-select-stage.fan-ready .card-el.selected .card-back::after,
.tarot-select-stage.fan-ready .card-el.selected .card-front::after {
  opacity: 1;
}

.tarot-select-stage .card-inner {
  height: 100%;
  perspective: 1000px;
  position: relative;
  transform-style: preserve-3d;
  width: 100%;
}

.tarot-select-stage .card-back,
.tarot-select-stage .card-front {
  backface-visibility: hidden;
  background: #19233a;
  border-radius: inherit;
  height: 100%;
  isolation: isolate;
  overflow: hidden;
  position: absolute;
  width: 100%;
}

.tarot-select-stage .card-back::before,
.tarot-select-stage .card-front::before {
  background: linear-gradient(-45deg, rgba(255,255,255,0.5), rgba(255,255,255,0), rgba(255,255,255,0.25), rgba(255,255,255,0), rgba(255,255,255,0.3));
  border: 1px solid transparent;
  border-radius: inherit;
  content: "";
  inset: 0;
  mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  pointer-events: none;
  position: absolute;
  z-index: 3;
}

.tarot-select-stage .card-back picture,
.tarot-select-stage .card-front picture {
  display: flex;
  height: 100%;
  position: relative;
  transform: translateZ(0);
  width: 100%;
  z-index: 1;
}

.tarot-select-stage .card-back img,
.tarot-select-stage .card-front img {
  display: block;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  width: 100%;
}

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

body.tarot-select-active .content {
  margin-top: 100vh;
  position: relative;
  z-index: 1;
}

@media (max-width: 767px) {
  .tarot-select-stage .select-hint {
    bottom: 33%;
    padding-top: 5vh;
  }

  .tarot-select-stage .status-panel {
    gap: 4.62vw;
  }

  .tarot-select-stage .instruction {
    font-size: 4.62vw;
    height: 6.006vw;
    letter-spacing: 0.2772vw;
  }

  .tarot-select-stage .counter-element {
    font-size: 7.392vw;
    gap: 4.62vw;
    letter-spacing: 0.1617vw;
  }

  .tarot-select-stage .count {
    height: 21.252vw;
    width: 21.252vw;
  }

  .tarot-select-stage .count-el {
    font-size: 12.012vw;
  }

  .tarot-select-stage .counter {
    backdrop-filter: blur(1.848vw);
  }

  .tarot-select-stage .cards-container {
    flex: none;
    margin-top: -25%;
    position: relative;
    width: 100vw;
  }

  .tarot-select-stage .card-wrapper {
    height: 38vh;
    margin-bottom: 2vh;
  }
}

@media (min-width: 768px) {
  .tarot-select-stage {
    height: 100vh;
  }

  .tarot-select-stage .cards-container {
    flex: none;
    margin-top: 0;
    position: relative;
    width: 100vw;
  }

  .tarot-select-stage .card-wrapper {
    height: 50vh;
    perspective: 45vw;
  }
}

@media (min-width: 1440px) {
  .tarot-select-stage {
    height: calc(100vh - 72px);
  }

  .tarot-select-stage .select-hint {
    bottom: 46%;
  }

  .tarot-select-stage .cards-container {
    margin-top: -2%;
  }

  .tarot-select-stage .status-panel {
    gap: 20px;
  }

  .tarot-select-stage .instruction {
    font-size: 20px;
    height: 26px;
    letter-spacing: 1.2px;
  }

  .tarot-select-stage .counter-element {
    font-size: 32px;
    gap: 20px;
    letter-spacing: 0.7px;
  }

  .tarot-select-stage .count {
    height: 92px;
    width: 92px;
  }

  .tarot-select-stage .count-el {
    font-size: 52px;
  }

  .tarot-select-stage .counter {
    backdrop-filter: blur(8px);
  }

  .tarot-select-stage .card-wrapper {
    perspective: 600px;
  }

  .tarot-select-stage .cards-container-inner {
    height: calc(300vh - 216px);
    left: calc(-150vh + 108px + 50vw);
    width: calc(300vh - 216px);
  }
}
