/*
 * 4e6ka.ru — Business Tarot page.
 * Builds on Silicon / Bootstrap and home.css (reveal, sparkles, .hand, .caption-mono).
 */

:root {
  --gold: #d4af37;
  --tarot-night: #12152e;
  --tcard-w: 112px;              /* card width in the deck */
}

/* ---------- Card: back (CSS + Doge medallion) and front (cat) ---------- */
.tcard {
  --w: var(--tcard-w);
  position: relative;
  display: block;
  width: var(--w);
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 0;
  border-radius: calc(var(--w) * .08);
  background: none;
  perspective: 1200px;
  transition: transform .3s cubic-bezier(.3, 1.6, .5, 1), opacity .4s, filter .4s;
}
.tcard-inner {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.3, 1.3, .5, 1);
}
.tcard.is-flipped .tcard-inner { transform: rotateY(180deg); }
.tcard-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.tcard-front { transform: rotateY(180deg); background: var(--tarot-night); }
.tcard-front img { display: block; width: 100%; height: 100%; object-fit: cover; }

.tcard-back {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--w) * .1) 0;
  background: radial-gradient(circle at 50% 50%, #283272 0, var(--tarot-night) 70%);
  box-shadow:
    inset 0 0 0 calc(var(--w) * .035) var(--tarot-night),
    inset 0 0 0 calc(var(--w) * .045) var(--gold),
    inset 0 0 0 calc(var(--w) * .07) var(--tarot-night),
    inset 0 0 0 calc(var(--w) * .075) rgba(212, 175, 55, .55),
    0 .5rem 1.5rem rgba(0, 0, 0, .35);
}
.tcard-back::before {                      /* Doge medallion */
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: url(../tarot/doge.jpg) center / cover;
  box-shadow: 0 0 0 calc(var(--w) * .015) var(--gold), 0 0 calc(var(--w) * .12) rgba(212, 175, 55, .35);
  transform: translate(-50%, -50%);
}
.tcard-orn {
  color: var(--gold);
  font-size: calc(var(--w) * .1);
  line-height: 1;
  letter-spacing: .25em;
  white-space: nowrap;
  user-select: none;
}

/* ---------- Hero: three floating backs ---------- */
.tarot-hero-fan { position: relative; height: 22rem; }
.tarot-hero-fan .tcard { --w: 11rem; position: absolute; top: 2rem; animation: tarot-float 5s ease-in-out infinite; }
.tarot-hero-fan .tcard:nth-child(1) { left: 6%;  z-index: 1; animation-delay: -1.5s; }
.tarot-hero-fan .tcard:nth-child(2) { left: 30%; z-index: 3; top: 0; animation-delay: -3s; }
.tarot-hero-fan .tcard:nth-child(3) { left: 54%; z-index: 2; }
@keyframes tarot-float { 50% { translate: 0 -.75rem; } }

/* ---------- Steps ---------- */
.tarot-step {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: .75rem;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-weight: 700;
}
.tarot-today { max-width: 48rem; }

/* ---------- Deck: one row of overlapping cards (JS sets --step) ---------- */
.tarot-deck {
  position: relative;
  max-width: 1100px;
  height: calc(var(--tcard-w) * 1.5 + 2.5rem);
  margin-inline: auto;
}
.tarot-deck .tcard {
  position: absolute;
  top: 1.5rem;
  left: calc(var(--i) * var(--step, 64px));
  cursor: pointer;
}
.tarot-deck .tcard:not(.is-locked):hover,
.tarot-deck .tcard:not(.is-locked):focus-visible { transform: translateY(-1.25rem); }
.tarot-deck .tcard:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.tarot-deck .tcard.is-locked { cursor: default; filter: brightness(.75) saturate(.7); }
.tarot-deck .tcard.is-taken { visibility: hidden; }
.tarot-deck.is-done .tcard { opacity: .2; pointer-events: none; }

/* Phones: a swipeable strip instead of a fanned row */
@media (max-width: 767.98px) {
  :root { --tcard-w: 92px; }
  .tarot-deck {
    display: flex;
    gap: .5rem;
    height: auto;
    margin-inline: -1rem;
    padding: 1.5rem 1rem 1rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }
  .tarot-deck .tcard { position: relative; top: auto; left: auto; flex: 0 0 var(--tcard-w); scroll-snap-align: center; }
}

/* ---------- Slot for the chosen card (grows after the reveal) ---------- */
.tarot-slot {
  --slot-w: min(17rem, 72vw);
  position: relative;
  display: grid;
  place-items: center;
  width: var(--slot-w);
  aspect-ratio: 2 / 3;
  margin-inline: auto;
  border: 2px dashed rgba(212, 175, 55, .45);
  border-radius: 1.25rem;
  transition: width .6s cubic-bezier(.3, 1.2, .5, 1), border-color .3s, box-shadow .6s;
}
.tarot-slot-label { padding: 1rem; color: rgba(255, 255, 255, .45); font-size: .875rem; text-align: center; }
.tarot-slot .tcard { --w: var(--slot-w); position: absolute; inset: 0; width: 100%; }
.tarot-slot.has-card { border-color: transparent; }
.tarot-slot.is-chosen { box-shadow: 0 0 3rem rgba(212, 175, 55, .35); animation: tarot-glow 2.4s ease-in-out infinite; }
.tarot-slot.is-revealed { --slot-w: min(26rem, 88vw); }
.tarot-slot.is-revealed .tcard { cursor: zoom-in; }
@media (min-width: 768px) {
  .tarot-slot.is-revealed { position: sticky; top: 6rem; }      /* stays in view while reading */
}
@keyframes tarot-glow { 50% { box-shadow: 0 0 4.5rem rgba(212, 175, 55, .55); } }

.tarot-slot .tarot-zoom-btn { position: absolute; right: .75rem; bottom: .75rem; z-index: 2; }   /* beats .page-wrapper .btn */

/* Full-screen card */
.tarot-zoom {
  position: fixed;
  inset: 0;
  z-index: 1090;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(10, 12, 30, .92);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity .25s;
}
.tarot-zoom.is-open { opacity: 1; }
.tarot-zoom img {
  display: block;
  max-width: min(92vw, 40rem);
  max-height: 82vh;
  margin-inline: auto;
  border-radius: 1.25rem;
  box-shadow: 0 0 4rem rgba(212, 175, 55, .35);
  transform: scale(.94);
  transition: transform .35s cubic-bezier(.3, 1.3, .5, 1);
}
.tarot-zoom.is-open img { transform: none; }
.tarot-zoom-close { position: absolute; top: 1rem; right: 1rem; }

/* ---------- Result: sections fade in one after another (--d on each child) ---------- */
.tarot-result.is-shown > * { animation: fade-up .6s cubic-bezier(.22, .61, .36, 1) both; animation-delay: calc(var(--d, 0) * 90ms + .3s); }
.tarot-result .badge-keyword { background: rgba(212, 175, 55, .15); color: var(--gold); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .tarot-hero-fan .tcard,
  .tarot-slot.is-chosen,
  .tarot-result.is-shown > * { animation: none; }
  .tcard-inner { transition: none; }
}
