/* Scratch-off reward card — styles for the vanilla Scratcher component
 * (js/scratcher.js). Adapted from the scratcher-package overlay CSS; the
 * coupon/OfferPage styles and the Google Fonts @import were dropped (the page
 * self-hosts Lilita One / Manrope and CSP forbids third-party font CDNs).
 * Uses the project's brand tokens from styles.css. */

/* ------------------------------------------------------------------ */
/* Card + reveal layer (beneath the scratch surface).                  */
/* ------------------------------------------------------------------ */
.scratcher-card {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-hard);
  background: linear-gradient(160deg, var(--pp-blue), var(--pp-blue-dk));
  /* The whole card (border, background, contents) starts invisible and fades
   * in as one unit once it has painted at its final size — see scratcher.js.
   * Sizing happens while invisible, so there is no slide and no sizing flash. */
  opacity: 0;
  transition: opacity 0.35s ease;
}

.scratcher-card.is-ready {
  opacity: 1;
}

/* Stage wraps the reveal + scratch overlay. No entrance animation of its own —
 * the parent card fades the whole unit in together. */
.scratcher-stage {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.scratcher-reveal {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: radial-gradient(circle at 50% 38%, #ffffff 0%, #eaf4ff 60%, #d7ecff 100%);
}

.scratcher-reveal-face {
  width: 64%;
  max-width: 190px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  border: 5px solid var(--paper);
  box-shadow: var(--shadow-soft);
}

.scratcher-reveal-label {
  font-family: var(--font-head);
  font-size: 1.9rem;
  line-height: 1;
  color: var(--pp-blue);
  text-align: center;
  letter-spacing: 0.5px;
  text-shadow: 2px 2px 0 var(--pp-blue-dk);
}

/* ------------------------------------------------------------------ */
/* Scratch overlay (canvas surface the player rubs away).              */
/* ------------------------------------------------------------------ */
.av8s-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* No radius here — the parent .scratcher-card has overflow:hidden + a 3px
     border, so it clips children to its INNER radius (16 - 3 = 13px). Declaring
     16px on the overlay/canvas made the corner curves disagree with that clip
     and left a sliver. Let the card own all corner rounding. */
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.av8s-overlay--hidden {
  opacity: 0;
}

/* Canvas dimensions are set from paint() (with !important) — this rule
 * intentionally does NOT set width/height to avoid any aspect mismatch. */
.av8s-scratch-canvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
}

.av8s-particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.av8s-shimmer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.av8s-shimmer-sweep {
  position: absolute;
  inset: 0;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    135deg,
    transparent 0%,
    transparent 30%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 70%,
    transparent 100%
  );
  animation: av8s-shimmer 1.5s ease-in-out forwards;
}

@keyframes av8s-shimmer {
  0% {
    transform: translateX(-100%) translateY(-100%);
    opacity: 1;
  }
  80% {
    transform: translateX(80%) translateY(80%);
    opacity: 1;
  }
  100% {
    transform: translateX(100%) translateY(100%);
    opacity: 0;
  }
}

.av8s-reveal-btn {
  position: absolute;
  bottom: 24px;
  z-index: 10;
  padding: 8px 24px;
  border: none;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease, background 0.3s ease;
}

.av8s-reveal-btn:hover {
  background: rgba(255, 255, 255, 0.34);
}

.av8s-reveal-btn--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .av8s-shimmer-sweep {
    animation: none;
    display: none;
  }
  .av8s-overlay,
  .av8s-reveal-btn {
    transition: none;
  }
  .scratcher-card {
    transition: none;
  }
}
