/* ============================================================
   VegasBet - Promo activated modal ("Reward Received", table 1)

   Markup: templates/_promo_modal.html. Filled by main.js showPromoModal.
   One card for both promo types; the copy, the figure, the icon and the
   worked example are what change.

   The header is the auth hero's layer stack (auth-hero.css) shrunk to a
   card: photo -> purple tint masked off the face -> glow -> a mask that
   dissolves the whole stack into the card. Same rules as there: every
   loop moves transform or opacity only, none cycles under 4s, and the
   photo's one-shot intro is the only animated `filter`.
   ============================================================ */

.promo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: promoOverlayIn 0.25s ease both;
}
.promo-modal-overlay:not([hidden]) { display: flex; }

.promo-modal-card {
  --pm-card: #1a1623;
  --pm-card-2: #141119;
  --pm-mint: #6ee7b7;
  --pm-mint-deep: #34d399;
  --pm-ink: #0e071c;

  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 440px;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--pm-card) 0%, var(--pm-card-2) 100%);
  border: 1px solid rgba(157, 93, 245, 0.24);
  box-shadow: 0 30px 90px -20px rgba(124, 58, 237, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  text-align: center;
  animation: promoModalIn 0.55s cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}

/* Slow sheen sweeping the whole card - kept from the first version. */
.promo-modal-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: promoSheen 4.5s ease-in-out 1s infinite;
  pointer-events: none;
  z-index: 4;
}

.promo-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 6;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 14, 30, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
.promo-modal-close:hover { background: rgba(20, 14, 30, 0.7); }
.promo-modal-close svg { width: 16px; height: 16px; stroke: currentColor; }

/* -- Header ----------------------------------------------------- */
.promo-modal-hero {
  /* Framing, all in header coordinates. The master is head-and-fist over
     rays, cropped to its top 1400px; at 440x270 `cover` scales by width
     and 39% lifts the window so the knuckles and the hair both clear the
     top edge, the chin lands at ~75% and the chest below it is what the
     dissolve (--pm-solid onwards) takes. The face sits left of centre;
     the mask and the breathing origin follow it. */
  --pm-face-x: 40%;
  --pm-face-y: 42%;
  --pm-pos-y: 39%;
  --pm-solid: 74%;

  position: relative;
  height: 270px;
  overflow: hidden;
  isolation: isolate;
  /* Stands in until the photo lands, and behind its dissolved edge. */
  background:
    radial-gradient(60% 90% at 50% 20%, rgba(157, 93, 245, 0.45), transparent 70%),
    linear-gradient(180deg, #2a0f55 0%, var(--pm-card) 100%);
}

/* The stack dissolves into the card from --pm-solid down, so the card's
   own gradient shows through and no scrim colour has to be matched. The
   line sits under the chin: the face is never the thing that fades. */
.promo-modal-media {
  position: absolute;
  inset: 0;
  isolation: isolate;
  -webkit-mask-image: linear-gradient(180deg, #000 var(--pm-solid), transparent 100%);
          mask-image: linear-gradient(180deg, #000 var(--pm-solid), transparent 100%);
}

.promo-modal-frame {
  position: absolute;
  inset: 0;
  display: block;
}

/* Starts invisible; the intro runs from the moment `is-loaded` is set by
   showPromoModal (the photo is lazy, so it may arrive after the card). */
.promo-modal-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% var(--pm-pos-y);
  transform-origin: var(--pm-face-x) var(--pm-face-y);
  opacity: 0;
}
.promo-modal-photo.is-loaded {
  animation:
    promoPhotoIn 1.1s cubic-bezier(0.22, 0.8, 0.28, 1) both,
    promoBreathe 16s ease-in-out 1.1s infinite alternate;
}

/* The master's rays are magenta; `color` pulls them to the site's violet
   while the mask keeps the face in its own colour. */
.promo-modal-tint {
  position: absolute;
  inset: 0;
  opacity: 0.6;
  mix-blend-mode: color;
  background: linear-gradient(155deg, var(--purple-light) 0%, var(--purple) 50%, #2a0f55 100%);
  -webkit-mask-image: radial-gradient(ellipse 38% 70% at var(--pm-face-x) var(--pm-face-y), transparent 40%, #000 100%);
          mask-image: radial-gradient(ellipse 38% 70% at var(--pm-face-x) var(--pm-face-y), transparent 40%, #000 100%);
}

.promo-modal-glow {
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
  opacity: 0.55;
  background:
    radial-gradient(70% 55% at 18% -10%, rgba(157, 93, 245, 0.34), transparent 72%),
    radial-gradient(55% 45% at 88% -6%, rgba(168, 85, 247, 0.26), transparent 74%);
  animation: promoGlowBreathe 6s ease-in-out infinite alternate;
}

/* A little dark under the close button, nothing else. */
.promo-modal-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(14, 7, 28, 0.5) 0%, transparent 32%);
}

/* -- Corner emblem ------------------------------------------------
   The promo type's icon, opposite the close button. Same disc as the old
   seam badge, minus its rings and sparks: in a corner they were noise. */
.promo-modal-emblem {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #b58cff, var(--purple) 70%);
  border: 1px solid rgba(192, 132, 252, 0.55);
  box-shadow: 0 8px 24px -6px rgba(124, 58, 237, 0.9), 0 0 0 1px rgba(14, 7, 28, 0.35);
  animation: promoBadgePop 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.4) 0.25s both;
}

.promo-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: promoFloat 4s ease-in-out 1s infinite;
}
.promo-modal-icon svg { width: 20px; height: 20px; }

/* -- Copy ---------------------------------------------------------- */
.promo-modal-content {
  position: relative;
  z-index: 2;
  padding: 18px 30px 28px;
}

.promo-modal-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--pm-mint);
  background: rgba(110, 231, 183, 0.08);
  border: 1px solid rgba(110, 231, 183, 0.22);
  animation: promoRise 0.6s ease-out 0.35s both;
}
.promo-modal-chip svg { width: 14px; height: 14px; }

/* The figure: "+100" "%" or "+$1000" ".00", main and tail styled apart.
   Mint gradient through the text, the way the brief draws it. */
.promo-modal-amount {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #b7f7dc 0%, var(--pm-mint) 45%, var(--pm-mint-deep) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 28px rgba(52, 211, 153, 0.28));
  animation: promoRise 0.6s ease-out 0.45s both;
}
.promo-modal-amount[hidden] { display: none; }
.promo-modal-amount-main { font-size: 72px; }
.promo-modal-amount-sub  { font-size: 34px; margin-left: 2px; }

.promo-modal-title {
  margin: 10px 0 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f4f2f8;
  line-height: 1.25;
  animation: promoRise 0.6s ease-out 0.5s both;
}

.promo-modal-body {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  color: #a69fb6;
  animation: promoRise 0.6s ease-out 0.55s both;
}

/* Worked example: what the percent means in dollars. */
.promo-modal-example {
  margin: 18px 0 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: promoRise 0.6s ease-out 0.6s both;
}
.promo-modal-example[hidden] { display: none; }

.promo-modal-example-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.promo-modal-example-col span {
  font-size: 12.5px;
  font-weight: 600;
  color: #a69fb6;
}
.promo-modal-example-col b {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f4f2f8;
  font-variant-numeric: tabular-nums;
}
.promo-modal-example-col--to b { color: var(--pm-mint); }
.promo-modal-example-arrow { width: 22px; height: 22px; color: var(--purple-light); }

.promo-modal-cta {
  position: relative;
  z-index: 2;
  overflow: hidden;
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 17px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(90deg, #a66bff, var(--purple));
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 16px 40px -14px rgba(124, 58, 237, 1), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: promoRise 0.6s ease-out 0.7s both;
}
/* One pass over the button as it lands, then still. */
.promo-modal-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: promoCtaShine 1.2s ease 1.1s 1 forwards;
  pointer-events: none;
}
.promo-modal-cta:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 20px 48px -14px rgba(124, 58, 237, 1), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.promo-modal-close:focus-visible,
.promo-modal-cta:focus-visible { outline: 2px solid #c4a8ff; outline-offset: 3px; }

/* -- Keyframes ------------------------------------------------------ */
@keyframes promoOverlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes promoModalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes promoPhotoIn {
  from { opacity: 0; transform: scale(1.08); filter: blur(6px); }
  to   { opacity: 1; transform: scale(1);    filter: blur(0); }
}
@keyframes promoBreathe {
  from { transform: scale(1); }
  to   { transform: scale(1.04); }
}
@keyframes promoGlowBreathe {
  from { opacity: 0.55; }
  to   { opacity: 0.9; }
}
@keyframes promoBadgePop {
  0%   { opacity: 0; transform: scale(0) rotate(-30deg); }
  55%  { opacity: 1; transform: scale(1.14) rotate(6deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes promoFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes promoSheen {
  0%   { transform: translateX(-140%) skewX(-18deg); }
  100% { transform: translateX(240%) skewX(-18deg); }
}
@keyframes promoCtaShine { to { transform: translateX(120%); } }
@keyframes promoRise { 0% { opacity: 0; transform: translateY(12px); } 100% { opacity: 1; transform: translateY(0); } }

/* -- Small screens --------------------------------------------------- */
@media (max-width: 400px) {
  .promo-modal-hero { height: 240px; --pm-solid: 70%; --pm-face-y: 40%; }
  .promo-modal-content { padding: 16px 20px 22px; }
  .promo-modal-amount-main { font-size: 58px; }
  .promo-modal-amount-sub  { font-size: 28px; }
  .promo-modal-title { font-size: 19px; }
  .promo-modal-body  { font-size: 14px; }
  .promo-modal-example { padding: 12px 12px; }
  .promo-modal-example-col b { font-size: 19px; }
  .promo-modal-cta { font-size: 15px; padding: 15px; }
}

/* -- Reduced motion --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .promo-modal-overlay,
  .promo-modal-card,
  .promo-modal-card::after,
  .promo-modal-photo.is-loaded,
  .promo-modal-glow,
  .promo-modal-emblem,
  .promo-modal-icon,
  .promo-modal-chip,
  .promo-modal-amount,
  .promo-modal-title,
  .promo-modal-body,
  .promo-modal-example,
  .promo-modal-cta,
  .promo-modal-cta::before { animation: none !important; }

  .promo-modal-photo.is-loaded { opacity: 1; }
  .promo-modal-cta::before { display: none; }
}
