/* Revealz — Memory Match game styles.
   Scoped entirely under .rvz-game-memory-match so it can be dropped into any
   theme's post-reveal DOM without colliding with the host page's own classes.
   Colors/fonts are read from CSS custom properties set inline by game.js from
   the active skin config — never hardcoded here except neutral chrome. */

.rvz-game-memory-match {
  --rvz-mm-primary: #2A2A66;
  --rvz-mm-accent: #E8B84B;
  --rvz-mm-bg: #FFF8EF;
  --rvz-mm-surface: #FFFFFF;
  --rvz-mm-ink: #2B2340;
  --rvz-mm-heading-font: 'Lora', Georgia, serif;
  --rvz-mm-body-font: system-ui, -apple-system, 'Segoe UI', sans-serif;

  box-sizing: border-box;
  max-width: 480px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  background: var(--rvz-mm-bg);
  color: var(--rvz-mm-ink);
  font-family: var(--rvz-mm-body-font);
  border-radius: 16px;
  text-align: center;
}

.rvz-game-memory-match *,
.rvz-game-memory-match *::before,
.rvz-game-memory-match *::after {
  box-sizing: inherit;
}

.rvz-game-memory-match__heading {
  font-family: var(--rvz-mm-heading-font);
  font-size: 1.4rem;
  margin: 0 0 0.25rem;
  /* --rvz-mm-ink, not --rvz-mm-primary: ink is the variable every skin author
     picks specifically to read against --rvz-mm-bg. primary is meant to pair
     with accent (as the card-back combo does), not to sit directly on the page
     background — a dark-mode skin's primary can be nearly invisible there. */
  color: var(--rvz-mm-ink);
}

.rvz-game-memory-match__subtext {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  opacity: 0.75;
}

.rvz-game-memory-match__status {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

.rvz-game-memory-match__grid {
  display: grid;
  gap: 0.5rem;
  perspective: 800px;
}

.rvz-game-memory-match__card {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  aspect-ratio: 3 / 4;
  cursor: pointer;
  outline-offset: 3px;
}

.rvz-game-memory-match__card:focus-visible {
  outline: 3px solid var(--rvz-mm-accent);
}

.rvz-game-memory-match__card-inner {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-style: preserve-3d;
}

.rvz-game-memory-match__card.is-flipped .rvz-game-memory-match__card-inner,
.rvz-game-memory-match__card.is-matched .rvz-game-memory-match__card-inner {
  transform: rotateY(180deg);
}

.rvz-game-memory-match__card-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  backface-visibility: hidden;
  font-size: 1.6rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.rvz-game-memory-match__card-face--back {
  background: var(--rvz-mm-primary);
  color: var(--rvz-mm-accent);
}

.rvz-game-memory-match__card-face--front {
  background: var(--rvz-mm-surface);
  color: var(--rvz-mm-ink);
  transform: rotateY(180deg);
  overflow: hidden; /* clips the photo <img> to the card's own border-radius */
}

.rvz-game-memory-match__card-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rvz-game-memory-match__card.is-matched .rvz-game-memory-match__card-face--front {
  box-shadow: 0 0 0 2px var(--rvz-mm-accent), 0 2px 6px rgba(0, 0, 0, 0.12);
}

.rvz-game-memory-match__card.is-matched {
  animation: rvz-mm-pop 0.4s ease;
}

.rvz-game-memory-match__win {
  margin-top: 1.25rem;
  font-family: var(--rvz-mm-heading-font);
  font-size: 1.15rem;
  color: var(--rvz-mm-ink);
}

.rvz-game-memory-match__win[hidden] {
  display: none;
}

.rvz-game-memory-match__sparkle {
  display: inline-block;
  animation: rvz-mm-sparkle 1.6s ease-in-out infinite;
}

.rvz-game-memory-match__feedback {
  margin-top: 1rem;
  font-size: 0.85rem;
}

.rvz-game-memory-match__feedback[hidden] {
  display: none;
}

.rvz-game-memory-match__feedback-prompt {
  display: block;
  margin-bottom: 0.35rem;
  opacity: 0.8;
}

.rvz-game-memory-match__feedback-stars {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
}

.rvz-game-memory-match__feedback-star {
  appearance: none;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--rvz-mm-ink);
  opacity: 0.35;
  padding: 0.15rem;
}

.rvz-game-memory-match__feedback-star:hover,
.rvz-game-memory-match__feedback-star:focus-visible {
  opacity: 1;
  color: var(--rvz-mm-accent);
}

@keyframes rvz-mm-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes rvz-mm-sparkle {
  0%, 100% { opacity: 1; transform: translateY(0) rotate(0deg); }
  50% { opacity: 0.6; transform: translateY(-2px) rotate(8deg); }
}

/* Respect the platform-wide "no motion sickness" rule: swap the 3D flip for a
   plain opacity cross-fade and drop the pop/sparkle keyframes entirely. */
@media (prefers-reduced-motion: reduce) {
  .rvz-game-memory-match__card-inner {
    transition: none;
  }
  .rvz-game-memory-match__card.is-flipped .rvz-game-memory-match__card-inner,
  .rvz-game-memory-match__card.is-matched .rvz-game-memory-match__card-inner {
    transform: none;
  }
  .rvz-game-memory-match__card-face--front {
    transform: none;
    opacity: 0;
  }
  .rvz-game-memory-match__card.is-flipped .rvz-game-memory-match__card-face--front,
  .rvz-game-memory-match__card.is-matched .rvz-game-memory-match__card-face--front {
    opacity: 1;
  }
  .rvz-game-memory-match__card.is-flipped .rvz-game-memory-match__card-face--back,
  .rvz-game-memory-match__card.is-matched .rvz-game-memory-match__card-face--back {
    opacity: 0;
  }
  .rvz-game-memory-match__card.is-matched,
  .rvz-game-memory-match__sparkle {
    animation: none;
  }
}
