/* =========================================================================
   Welcome-offer modal (PromoModal.astro + promo-modal.js). One card, two
   halves: the product graphic on a bright blue-to-pink burst (the /giveaways
   vocabulary) and the offer copy with the promo code and the App Store CTA.
   Desktop = centred card. Under 720px = bottom sheet with the graphic as a
   short banner above the copy. z 200: above the header capsule (30) and the
   mobile menu sheet (100). Light and dark via the site tokens.
   ========================================================================= */

.pm {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.pm[hidden] { display: none; }
.pm-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 14, 26, 0.42);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
  opacity: 0; transition: opacity 260ms ease;
}
html[data-theme="dark"] .pm-backdrop { background: rgba(4, 6, 12, 0.62); }
.pm.in .pm-backdrop { opacity: 1; }

.pm-card {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  width: min(100%, 900px);
  max-height: calc(100dvh - 48px);
  overflow: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line-hi); border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--soft-shadow-lg), 0 2px 0 rgba(255, 255, 255, 0.35) inset;
  outline: none;
  opacity: 0; transform: translateY(18px) scale(0.985);
  transition: opacity 320ms cubic-bezier(0.2, 0.82, 0.2, 1), transform 320ms cubic-bezier(0.2, 0.82, 0.2, 1);
}
html[data-theme="dark"] .pm-card { box-shadow: 0 50px 110px -30px rgba(0, 0, 0, 0.7); }
.pm.in .pm-card { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- close -- */
.pm-x {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line-hi); border-radius: 999px;
  background: var(--glass); color: var(--text);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  cursor: pointer; transition: transform 160ms ease, border-color 160ms ease;
}
.pm-x svg { width: 18px; height: 18px; }
.pm-x:hover { transform: scale(1.06); border-color: var(--sky); }
.pm-x:focus-visible, .pm-copy-btn:focus-visible, .pm-store:focus-visible, .pm-later:focus-visible {
  outline: 2px solid var(--acc-sky); outline-offset: 2px;
}

/* ---------------------------------------------------------------- stage -- */
.pm-stage {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; place-items: center;
  min-height: 100%; padding: 28px 12px 0;
  border-right: 1px solid var(--line-hi);
}
.pm-burst {
  position: absolute; inset: -12%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(62% 58% at 24% 20%, rgba(92, 193, 246, 0.50), transparent 70%),
    radial-gradient(58% 58% at 82% 30%, rgba(243, 26, 145, 0.40), transparent 72%),
    radial-gradient(70% 70% at 55% 100%, rgba(123, 98, 232, 0.34), transparent 70%);
  filter: blur(10px);
}
html[data-theme="dark"] .pm-burst {
  background:
    radial-gradient(62% 58% at 24% 20%, rgba(92, 193, 246, 0.32), transparent 70%),
    radial-gradient(58% 58% at 82% 30%, rgba(243, 26, 145, 0.28), transparent 72%),
    radial-gradient(70% 70% at 55% 100%, rgba(123, 98, 232, 0.26), transparent 70%);
}
.pm-img {
  position: relative; z-index: 1; display: block;
  width: min(100%, 300px); height: auto; margin-bottom: -6%;
  -webkit-mask-image: radial-gradient(64% 60% at 50% 45%, #000 44%, transparent 82%);
  mask-image: radial-gradient(64% 60% at 50% 45%, #000 44%, transparent 82%);
}
.pm-prizetag {
  position: absolute; z-index: 2; left: 18px; bottom: 18px;
  display: flex; flex-direction: column; gap: 2px;
  padding: 11px 15px; border-radius: 16px;
  border: 1px solid var(--line-hi); background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: var(--soft-shadow);
}
.pm-prizetag-k { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); }
.pm-prizetag-v { font-size: 0.98rem; font-weight: 680; letter-spacing: -0.015em; color: var(--text); }

/* ----------------------------------------------------------------- copy -- */
.pm-copy { padding: clamp(28px, 4vw, 44px) clamp(24px, 4vw, 44px) clamp(24px, 3vw, 34px); }
.pm-badge {
  display: inline-block; margin: 0 0 16px; padding: 7px 13px; border-radius: 999px;
  background: linear-gradient(100deg, var(--sky), var(--royal) 52%, var(--magenta));
  color: #fff; font-size: 0.68rem; font-weight: 750; letter-spacing: 0.14em; text-transform: uppercase;
  box-shadow: 0 10px 22px rgba(73, 121, 239, 0.28);
}
.pm-title {
  margin: 0; color: var(--text); font-family: var(--sans);
  font-size: clamp(34px, 4.2vw, 50px); font-weight: 650;
  letter-spacing: -0.05em; line-height: 0.98; text-wrap: balance;
}
.pm-title .grad {
  background: linear-gradient(104deg, var(--sky) 0%, var(--royal) 46%, var(--magenta) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  padding-block: 0.12em; margin-block: -0.12em;
}
.pm-lede {
  max-width: 44ch; margin: 16px 0 0; color: var(--dim);
  font-size: clamp(15px, 1.15vw, 17px); line-height: 1.52; letter-spacing: -0.01em;
}

/* the code chip */
.pm-code {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "k btn" "v btn";
  align-items: center; column-gap: 14px;
  margin-top: 22px; padding: 12px 12px 12px 18px;
  border: 1.5px dashed var(--acc-royal); border-radius: 18px;
  background: color-mix(in srgb, var(--acc-royal) 7%, var(--panel));
}
.pm-code-k { grid-area: k; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); }
.pm-code-v {
  grid-area: v; font-size: clamp(26px, 2.6vw, 32px); font-weight: 700; line-height: 1.05;
  letter-spacing: 0.08em; color: var(--text);
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
.pm-copy-btn {
  grid-area: btn; min-height: 42px; padding: 0 18px;
  border: 1px solid var(--line-hi); border-radius: 999px;
  background: var(--panel); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 650; letter-spacing: -0.01em;
  box-shadow: var(--soft-shadow); cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}
.pm-copy-btn:hover { transform: translateY(-2px); border-color: var(--sky); }
.pm-copy-btn.is-copied { background: var(--acc-sky); border-color: var(--acc-sky); color: #fff; }

/* actions */
.pm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 20px; }
.pm-store {
  display: inline-flex; align-items: center; gap: 11px;
  min-height: 56px; padding: 8px 24px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(108deg, var(--sky), var(--royal) 54%, var(--magenta));
  background-origin: border-box;
  box-shadow: 0 16px 36px rgba(73, 121, 239, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #fff; text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.pm-store:hover { transform: translateY(-3px); box-shadow: 0 22px 46px rgba(73, 121, 239, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.pm-store svg { width: 24px; height: 24px; flex: 0 0 auto; }
.pm-store span { display: flex; flex-direction: column; align-items: flex-start; font-size: 16px; font-weight: 680; line-height: 1.14; }
.pm-store small { margin-bottom: 1px; font-size: 10px; font-weight: 550; letter-spacing: 0.02em; }
.pm-later {
  appearance: none; padding: 8px 4px; border: 0; background: none;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--dim);
  text-decoration: underline; text-decoration-color: var(--line-hi); text-underline-offset: 4px;
  cursor: pointer; transition: color 160ms ease;
}
.pm-later:hover { color: var(--text); text-decoration-color: currentColor; }

.pm-fine { margin: 18px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--soft); }
.pm-fine a { color: var(--dim); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-hi); text-underline-offset: 3px; }
.pm-fine a:hover { color: var(--text); }

/* ---------------------------------------------------------- bottom sheet -- */
@media (max-width: 720px) {
  .pm { place-items: end center; padding: 0; }
  .pm-card {
    grid-template-columns: 1fr;
    width: 100%; max-height: calc(100dvh - 40px);
    border-radius: 28px 28px 0 0; border-bottom: 0;
    transform: translateY(40px);
  }
  /* Short banner: the phone sits right of centre, lifted so its "Connecting
     with a Safety Agent" card is the part that shows; the prize tag takes the
     empty bottom-left corner and stays clear of the phone. */
  .pm-stage {
    min-height: 0; height: 216px; padding: 0;
    border-right: 0; border-bottom: 1px solid var(--line-hi);
    align-items: start; justify-items: end;
  }
  .pm-img {
    width: min(58%, 220px); margin: 0 6% 0 0;
    transform: translateY(-18%);
    -webkit-mask-image: radial-gradient(64% 60% at 50% 42%, #000 40%, transparent 80%);
    mask-image: radial-gradient(64% 60% at 50% 42%, #000 40%, transparent 80%);
  }
  .pm-prizetag { left: 14px; bottom: 14px; max-width: 52%; padding: 9px 12px; }
  .pm-prizetag-v { font-size: 0.92rem; }
  .pm-copy { padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px)); }
  .pm-title { font-size: clamp(30px, 8.6vw, 38px); }
  .pm-lede { font-size: 15px; }
  .pm-code { margin-top: 18px; }
  .pm-actions { gap: 10px; }
  .pm-store { width: 100%; justify-content: center; }
  .pm-later { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .pm-backdrop, .pm-card, .pm-x, .pm-copy-btn, .pm-store { transition: none; }
  .pm-card { transform: none; }
}
