:root {
  --bg: #090909;
  --paper: #f2eee6;
  --ink: #111;
  --muted: rgba(242, 238, 230, 0.62);
  --line: rgba(242, 238, 230, 0.24);
  --accent: #ff2f92;
  --card-w: min(25vw, 250px);
  --card-ratio: 1.62;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 15%, rgba(255,255,255,.045), transparent 30rem),
    var(--bg);
  color: var(--paper);
  font-family: Helvetica, Arial, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image:
    repeating-radial-gradient(circle at 0 0, transparent 0, rgba(255,255,255,.025) 1px, transparent 2px);
  background-size: 9px 9px;
}

button { font: inherit; }

.tarot-page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 8vh 0 10vh;
}

.intro {
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}

.sigil {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  opacity: .9;
}

.eyebrow {
  margin: 0 0 1rem;
  font-size: .72rem;
  letter-spacing: .24em;
  opacity: .6;
}

h1 {
  margin: 0;
  font-family: "Times New Roman", Times, serif;
  font-weight: 400;
  font-size: clamp(2.4rem, 7vw, 6.4rem);
  line-height: .98;
  letter-spacing: -.035em;
}

.intro-copy {
  max-width: 520px;
  margin: 1.6rem auto 0;
  color: var(--muted);
  line-height: 1.6;
}

.ritual {
  display: grid;
  justify-items: center;
  padding-top: 4.5rem;
}

.deck-stage {
  width: 210px;
  height: 320px;
  display: grid;
  place-items: center;
  perspective: 1000px;
}

.deck {
  position: relative;
  width: 150px;
  height: 243px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform-style: preserve-3d;
}

.deck-card {
  position: absolute;
  inset: 0;
  border: 1px solid var(--paper);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, transparent 0 29px, rgba(242,238,230,.75) 30px 31px, transparent 32px),
    linear-gradient(45deg, transparent 48%, rgba(242,238,230,.18) 49% 51%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(242,238,230,.18) 49% 51%, transparent 52%),
    #111;
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
  transition: transform .5s ease;
}

.deck-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(242,238,230,.5);
  border-radius: 4px;
}

.deck-card-1 { z-index: 3; }
.deck-card-2 { z-index: 2; transform: translate(5px, 5px) rotate(1.5deg); }
.deck-card-3 { z-index: 1; transform: translate(10px, 10px) rotate(3deg); }

.card-back-symbol {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Times New Roman", Times, serif;
  font-size: 3rem;
  z-index: 2;
}

.deck:hover .deck-card-1 { transform: translateY(-5px) rotate(-1deg); }

.deck-stage.shuffling .deck-card-1 { animation: shuffleOne .85s ease-in-out 2; }
.deck-stage.shuffling .deck-card-2 { animation: shuffleTwo .85s ease-in-out 2; }
.deck-stage.shuffling .deck-card-3 { animation: shuffleThree .85s ease-in-out 2; }

@keyframes shuffleOne {
  0%,100% { transform: translate(0,0) rotate(0); }
  40% { transform: translate(-72px,-8px) rotate(-9deg); }
  70% { transform: translate(34px,5px) rotate(5deg); }
}
@keyframes shuffleTwo {
  0%,100% { transform: translate(5px,5px) rotate(1.5deg); }
  35% { transform: translate(72px,-3px) rotate(11deg); }
  70% { transform: translate(-25px,8px) rotate(-4deg); }
}
@keyframes shuffleThree {
  0%,100% { transform: translate(10px,10px) rotate(3deg); }
  40% { transform: translate(-45px,12px) rotate(-7deg); }
  72% { transform: translate(60px,8px) rotate(8deg); }
}

.instruction {
  min-height: 1.5em;
  margin: .8rem 0 1.5rem;
  color: var(--muted);
  font-size: .9rem;
}

.controls {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  justify-content: center;
}

.ritual-button {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  border-radius: 999px;
  padding: .9rem 1.25rem;
  cursor: pointer;
  letter-spacing: .04em;
  transition: .2s ease;
}

.ritual-button:hover:not(:disabled) {
  border-color: var(--paper);
  transform: translateY(-1px);
}

.ritual-button:disabled {
  opacity: .3;
  cursor: default;
}

.ritual-button-primary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}

.reading-section {
  margin-top: 7rem;
  text-align: center;
}

.reading {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 4vw, 48px);
  align-items: start;
}

.reading-card-wrap {
  min-width: 0;
}

.position {
  margin: 0 0 1rem;
  font-size: .68rem;
  letter-spacing: .22em;
  color: var(--muted);
}

.flip-card {
  width: 100%;
  aspect-ratio: 1 / var(--card-ratio);
  perspective: 1200px;
  cursor: pointer;
}

.flip-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .85s cubic-bezier(.2,.8,.2,1);
}

.flip-card.revealed .flip-inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 10px;
  overflow: hidden;
}

.face-back {
  border: 1px solid var(--paper);
  background:
    radial-gradient(circle at center, transparent 0 38px, rgba(242,238,230,.75) 39px 40px, transparent 41px),
    linear-gradient(45deg, transparent 48%, rgba(242,238,230,.18) 49% 51%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(242,238,230,.18) 49% 51%, transparent 52%),
    #111;
}

.face-back::after {
  content: "☽";
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(242,238,230,.5);
  border-radius: 5px;
  font-family: "Times New Roman", Times, serif;
  font-size: clamp(2.5rem, 6vw, 5rem);
}

.face-front {
  transform: rotateY(180deg);
  background: var(--paper);
  color: var(--ink);
  border: 1px solid rgba(0,0,0,.35);
  padding: clamp(14px, 2vw, 24px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  text-align: left;
}

.face-front.reversed .card-glyph {
  transform: rotate(180deg);
}

.card-number {
  font-size: .62rem;
  letter-spacing: .12em;
  opacity: .5;
}

.card-glyph {
  display: grid;
  place-items: center;
  font-family: "Times New Roman", Times, serif;
  font-size: clamp(3rem, 8vw, 7rem);
  transition: transform .5s ease;
}

.card-face-name {
  margin: 0;
  font-family: "Times New Roman", Times, serif;
  font-size: clamp(1.15rem, 2.5vw, 2rem);
  font-weight: 400;
  line-height: 1;
}

.card-details {
  opacity: 0;
  transform: translateY(8px);
  transition: .5s ease .35s;
  padding-top: 1.1rem;
  text-align: left;
}

.flip-card.revealed + .card-details {
  opacity: 1;
  transform: translateY(0);
}

.orientation {
  margin: 0 0 .45rem;
  font-size: .62rem;
  letter-spacing: .18em;
  color: var(--accent);
  text-transform: uppercase;
}

.card-title {
  margin: 0;
  font-family: "Times New Roman", Times, serif;
  font-weight: 400;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
}

.keywords {
  margin: .7rem 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.5;
}

.meaning {
  margin: 0;
  font-family: "Times New Roman", Times, serif;
  font-size: clamp(1rem, 1.6vw, 1.22rem);
  line-height: 1.45;
}

.return-button { margin-top: 3.5rem; }

.note {
  margin: 1.5rem auto 0;
  color: rgba(242,238,230,.4);
  font-size: .72rem;
}

@media (max-width: 760px) {
  .tarot-page { width: min(100% - 24px, 560px); padding-top: 6vh; }
  .reading { grid-template-columns: 1fr; gap: 4rem; }
  .reading-card-wrap { width: min(82vw, 360px); margin: 0 auto; }
  .reading-section { margin-top: 5rem; }
  .deck-stage { transform: scale(.9); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
