/*
 * Calhou.me! share placements (UI v2): the "Passa o Calhou.me" card (result page /r/,
 * after the result, and management page) and the public character page /p/:id. Loaded only by those pages, after app.css and motion.css.
 */

/* ---------- Result page: "Passa o Calhou.me" card after (outside) the result ---------- */

.pass-card.result-pass {
  width: calc(100% - 8px);
  max-width: 28rem;
  margin: 8px auto 32px;
  text-align: left;
}

/* Only once the result is on screen (the already-opened page has no .reveal). */
.result-page:has(.reveal:not([open])) + .result-pass,
.result-page:has(.reveal.playing) + .result-pass {
  display: none;
}

.pass-card .invite-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  font-weight: 800;
  color: var(--accent);
}

@media (prefers-reduced-motion: no-preference) {
  .result-page:has(.reveal[open]:not(.playing)) + .result-pass {
    animation: calhou-pop var(--dur-slow) var(--ease-out) both;
    animation-delay: 700ms;
  }

  .invite-link:hover .icon {
    animation: share-nudge 600ms steps(2, jump-none) infinite;
  }
}

@keyframes share-nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

/* ---------- Public character page /p/:id ---------- */

.char-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 236px;
  margin: -28px -20px 8px;
  overflow: hidden;
  background: linear-gradient(to bottom, #0b1026 0 30%, #141c44 30% 60%, #1f2a58 60% 100%);
}

.char-stage .char-sprite {
  position: relative;
  z-index: 2;
  margin-bottom: 26px;
}

.char-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40px;
  z-index: 1;
  background: linear-gradient(to bottom, #ffffff 0 6px, #dfe8f5 6px 14px, #c9d6ea 14px 100%);
  box-shadow: 0 -4px 0 0 #9fb2d4;
}

/* Cheap CSS pixel snow: two layers of dots drifting down. */
.char-snow {
  position: absolute;
  inset: 0 0 40px;
  z-index: 0;
  background-image:
    radial-gradient(#ffffff 1.5px, transparent 2px),
    radial-gradient(rgba(255, 255, 255, 0.6) 1px, transparent 1.5px),
    radial-gradient(rgba(255, 255, 255, 0.4) 1px, transparent 1.5px);
  background-size: 97px 61px, 53px 79px, 31px 43px;
  background-position: 0 0, 23px 11px, 7px 29px;
}

.char-actions .share-wa {
  width: 100%;
  max-width: 22rem;
}

@media (min-width: 40rem) {
  .char-stage {
    margin: -40px -36px 8px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .char-snow {
    animation: char-snow 9s linear infinite;
  }

  .char-stage .char-sprite:active {
    transform: translateY(-12px);
  }
}

@keyframes char-snow {
  from { background-position: 0 0, 23px 11px, 7px 29px; }
  to { background-position: 97px 244px, -30px 248px, 38px 287px; }
}

/* ---------- Management: Passa o Calhou ---------- */

.pass-card {
  position: relative;
  margin: 16px 4px 24px;
  padding: 18px 16px 16px;
  border: 0;
  border-radius: 0;
  background: var(--deep);
  box-shadow:
    4px 0 0 0 var(--pink-dark),
    -4px 0 0 0 var(--pink-dark),
    0 4px 0 0 var(--pink-dark),
    0 -4px 0 0 var(--pink-dark),
    4px 8px 0 0 rgba(0, 0, 0, 0.35);
}

.pass-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--pixel-font);
  font-weight: 400;
  font-size: 0.8125rem;
  line-height: 1.6;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--pink);
}

.pass-heart {
  display: inline-flex;
  padding: 4px;
  background: #3a1428;
  box-shadow: inset 0 -3px 0 0 #24091a;
  line-height: 0;
}

.pass-card .share-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.pass-card .share-btns .btn-sm {
  min-height: 48px;
}

@media (prefers-reduced-motion: no-preference) {
  .pass-heart .icon {
    animation: calhou-bob 1.6s steps(4, end) infinite;
  }
}
