/* Tarot Page Styles — enhanced card art, animations, and layout */

/* Base tarot page */
.tarot-page {
  --slime: hsl(275 60% 55%);
  --slime-dark: hsl(275 55% 45%);
  --slime-glow: hsl(275 60% 55% / 0.4);
}

.tarot-page .hero {
  padding: 2rem 1rem;
}

.tarot-page .page-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  text-shadow: 0 0 10px var(--slime-glow);
}

/* Tarot spread containers */
.tarot-spread {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.5rem 0;
  min-height: 300px;
  align-items: flex-end;
}

.tarot-spread.three-card-spread {
  gap: 1.5rem;
}

.tarot-spread.year-spread {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 1.5rem auto;
}

/* Tarot card */
.tarot-card {
  position: relative;
  width: 180px;
  height: 280px;
  perspective: 1000px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tarot-card:focus-visible {
  outline: 3px solid var(--slime);
  outline-offset: 4px;
  border-radius: 12px;
}

.tarot-card.year-card {
  width: 140px;
  height: 218px;
}

.tarot-face,
.tarot-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px 16px;
  display: flex;
  flex-direction: column;
}

.tarot-face {
  z-index: 2;
  transform: rotateY(0deg);
}

.tarot-back {
  transform: rotateY(180deg);
  z-index: 1;
}

.tarot-card.flippable .tarot-face {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.tarot-card.flippable .tarot-back {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.tarot-card.flipped .tarot-back {
  transform: rotateY(0deg);
  z-index: 3;
}

/* Card interior */
.tarot-card svg {
  width: 100%;
  height: 100%;
  border-radius: 12px 16px;
}

.tarot-fortune {
  margin-top: auto;
  padding: 0.75rem;
  background: rgba(22, 21, 42, 0.95);
  border-radius: 0 0 12px 16px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: hsl(0 0% 90%);
  text-align: center;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Reversed card indicator */
.tarot-card.reversed .tarot-face {
  opacity: 1;
}

/* Celtic cross cards */
.celtic-spread {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  max-width: 800px;
  margin: 1.5rem auto;
}

.celtic-spread > * {
  width: 100%;
}

.celtic-card {
  position: relative;
  aspect-ratio: 180 / 280;
  perspective: 1000px;
  cursor: pointer;
}

.celtic-card .celtic-position {
  position: absolute;
  top: -24px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--slime);
  text-shadow: 0 0 8px var(--slime-glow);
  white-space: nowrap;
  z-index: 10;
}

.celtic-card .tarot-face,
.celtic-card .tarot-back {
  width: 100%;
  height: 100%;
}

.celtic-card svg {
  width: 100%;
  height: 100%;
}

/* Specific Celtic Cross positions */
.celtic-spread .celtic-card:nth-child(1) { /* Present - center */
  grid-column: 2;
  grid-row: 2;
  transform: scale(1.1);
  z-index: 5;
}
.celtic-spread .celtic-card:nth-child(2) { /* Challenge - cross on present */
  grid-column: 2;
  grid-row: 2;
  transform: scale(0.9) rotate(90deg);
  z-index: 4;
}
.celtic-spread .celtic-card:nth-child(3) { /* Past - left */
  grid-column: 1;
  grid-row: 2;
}
.celtic-spread .celtic-card:nth-child(4) { /* Future - right */
  grid-column: 3;
  grid-row: 2;
}
.celtic-spread .celtic-card:nth-child(5) { /* Above - top */
  grid-column: 2;
  grid-row: 1;
}
.celtic-spread .celtic-card:nth-child(6) { /* Below - bottom */
  grid-column: 2;
  grid-row: 3;
}
.celtic-spread .celtic-card:nth-child(7) { /* Advice - left column */
  grid-column: 4;
  grid-row: 1;
}
.celtic-spread .celtic-card:nth-child(8) { /* External - left column */
  grid-column: 4;
  grid-row: 2;
}
.celtic-spread .celtic-card:nth-child(9) { /* Hopes - left column */
  grid-column: 4;
  grid-row: 3;
}
.celtic-spread .celtic-card:nth-child(10) { /* Outcome - bottom of left column */
  grid-column: 4;
  grid-row: 4;
}

/* Horseshoe spread - arc layout */
.horseshoe-spread {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.5rem 0;
  min-height: 300px;
}

.horseshoe-spread .celtic-card {
  width: 120px;
  height: 187px;
}

.horseshoe-spread .celtic-card .celtic-position {
  top: -20px;
  font-size: 0.65rem;
}

/* Tarot controls */
.tarot-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 1rem 0;
}

.tarot-controls label {
  font-weight: 600;
  color: var(--ink);
}

.tarot-controls input,
.tarot-controls select {
  padding: 0.5rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  font: inherit;
  color: var(--ink);
  min-width: 200px;
}

.tarot-controls input:focus,
.tarot-controls select:focus {
  outline: 2px solid var(--slime);
  outline-offset: 2px;
}

.celtic-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 1rem 0;
}

.horoscope-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 1rem 0;
}

.horoscope-controls select {
  min-width: 180px;
}

/* Tarot actions */
.tarot-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.tarot-actions button {
  padding: 0.5rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.tarot-actions button:hover {
  background: var(--slime);
  border-color: var(--slime);
  color: var(--card);
}

.tarot-actions .btn-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  color: var(--ink);
  text-decoration: underline;
  font: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.tarot-actions .btn-link:hover {
  color: var(--slime);
}

/* Tarot deck list */
.tarot-deck-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.tarot-deck-item {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}

.tarot-deck-item:hover {
  border-color: var(--slime);
  transform: translateY(-2px);
}

.tarot-deck-item__emoji {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  display: block;
}

.tarot-deck-item__name {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--ink);
}

.tarot-deck-item__meanings {
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.5;
}

.tarot-deck-item__meaning {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: rgba(139, 90, 212, 0.08);
  border-radius: 6px;
}

.tarot-deck-item__meaning.upright {
  border-left: 3px solid var(--slime);
}

.tarot-deck-item__meaning.reversed {
  border-left: 3px solid hsl(0 60% 50%);
}

.tarot-deck-item__meaning.minor {
  border-left: 3px solid var(--slime-dark);
  background: rgba(139, 90, 212, 0.12);
}

/* Horoscope result */
.horoscope-result {
  margin-top: 1rem;
}

.horoscope-card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.horoscope-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.horoscope-tone {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0.5rem 0;
}

.horoscope-tone.auspicious {
  color: hsl(120 60% 45%);
}

.horoscope-tone.ominous {
  color: hsl(0 60% 55%);
}

.horoscope-advice {
  font-style: italic;
  color: var(--slime);
  margin: 1rem 0;
}

.horoscope-lucky {
  font-weight: 600;
  margin-top: 1rem;
}

/* Tarot History */
.tarot-history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.tarot-history-item {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tarot-history-item:hover {
  border-color: var(--slime);
  box-shadow: 0 4px 12px var(--slime-glow);
}

.tarot-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tarot-history-type {
  font-weight: 700;
  color: var(--slime);
}

.tarot-history-date {
  font-size: 0.85rem;
  opacity: 0.7;
}

.tarot-history-question {
  font-style: italic;
  margin: 0.5rem 0;
  opacity: 0.8;
  font-size: 0.9rem;
}

.tarot-history-cards {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}

.tarot-history-card {
  font-size: 1.5rem;
  cursor: help;
}

.tarot-history-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.history-tag-pill {
  background: rgba(139, 90, 212, 0.15);
  border: 1px solid var(--slime);
  border-radius: 20px;
  padding: 0.2rem 0.75rem;
  font-size: 0.75rem;
  color: var(--slime);
}

.tarot-history-notes {
  font-style: italic;
  border-top: 1px dashed var(--ink);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.add-notes-btn {
  transition: all 0.2s;
}

.add-notes-btn:hover {
  background: var(--ink) !important;
  color: var(--card) !important;
}

/* History stats */
.tarot-history-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.tarot-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  background: rgba(139, 90, 212, 0.08);
  border-radius: 8px;
  border: 1px solid var(--slime-dark);
  min-width: 80px;
}

.tarot-stat--featured {
  border-color: var(--slime);
  background: rgba(139, 90, 212, 0.15);
}

.tarot-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slime);
}

.tarot-stat-label {
  font-size: 0.75rem;
  opacity: 0.7;
  text-align: center;
}

.tag-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.tag-pill {
  background: rgba(139, 90, 212, 0.1);
  border: 1px solid var(--slime-dark);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  color: var(--slime);
}

/* Entrance animations */
@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cardShuffleOut {
  to {
    opacity: 0;
    transform: translate(var(--tx, 100px), var(--ty, -50px)) rotate(var(--tr, 180deg)) scale(0.5);
  }
}

.tarot-card[style*="opacity: 0"],
.celtic-card[style*="opacity: 0"] {
  animation: cardEntrance 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .tarot-card,
  .celtic-card,
  .tarot-face,
  .tarot-back {
    animation: none !important;
    transition: none !important;
  }
}

/* Responsive */
@media (max-width: 600px) {
  .tarot-spread {
    gap: 0.5rem;
  }

  .tarot-card {
    width: 140px;
    height: 218px;
  }

  .celtic-spread {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .celtic-card {
    width: 100%;
    aspect-ratio: 180 / 280;
  }

  .celtic-spread .celtic-card:nth-child(1) {
    grid-column: span 2;
    grid-row: 1;
    transform: scale(1);
  }
  .celtic-spread .celtic-card:nth-child(2) {
    grid-column: span 2;
    grid-row: 1;
    transform: scale(0.9) rotate(90deg);
  }
  .celtic-spread .celtic-card:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
  }
  .celtic-spread .celtic-card:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
  }
  .celtic-spread .celtic-card:nth-child(5) {
    grid-column: 1;
    grid-row: 3;
  }
  .celtic-spread .celtic-card:nth-child(6) {
    grid-column: 2;
    grid-row: 3;
  }
  .celtic-spread .celtic-card:nth-child(7) {
    grid-column: 1;
    grid-row: 4;
  }
  .celtic-spread .celtic-card:nth-child(8) {
    grid-column: 2;
    grid-row: 4;
  }
  .celtic-spread .celtic-card:nth-child(9) {
    grid-column: 1;
    grid-row: 5;
  }
  .celtic-spread .celtic-card:nth-child(10) {
    grid-column: 2;
    grid-row: 5;
  }

  .horseshoe-spread .celtic-card {
    width: 100px;
    height: 156px;
  }

  .tarot-deck-list {
    grid-template-columns: 1fr;
  }

  .tarot-controls,
  .celtic-controls,
  .horoscope-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .tarot-controls input,
  .tarot-controls select {
    min-width: 100%;
  }
}

/* Card detail page */
.card-detail {
  max-width: 240px;
  margin: 2rem auto;
}

.card-detail svg {
  width: 200px;
  height: 311px;
}