/* ============================================================
   RETRO STICKY BAR — global, closeable
   Desktop: bottom-LEFT (passport pill keeps bottom-right)
   Mobile: full-width bottom strip
   ============================================================ */

.rm-sticky-bar {
  position: fixed;
  z-index: var(--rm-z-sticky-bar, 130);

  /* Desktop default — bottom left, max 380px wide. */
  left: 18px;
  bottom: 18px;
  width: min(380px, calc(100vw - 36px));

  /* Hidden until JS reveals; explicit fallback so [hidden] always wins
     over the display rule below in older browsers. */
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.28s ease, transform 0.28s ease;

  /* Pixel-art arcade dialog box feel */
  background: linear-gradient(180deg, #1a1d2e 0%, #0f1120 100%);
  color: #fff;
  border: 3px solid #0d0f1a;
  border-radius: 10px;
  box-shadow:
    0 0 0 2px #f47e1e inset,
    6px 6px 0 0 rgba(13, 15, 26, 0.55);

  /* Subtle red top accent line */
  background-image:
    linear-gradient(180deg, #ff0040 0, #ff0040 4px, transparent 4px),
    linear-gradient(180deg, #1a1d2e 0%, #0f1120 100%);
  background-size: 100% 100%, 100% 100%;
  background-repeat: no-repeat;
}

.rm-sticky-bar[hidden] {
  display: none !important;
}

.rm-sticky-bar.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.rm-sticky-bar.is-dismissing {
  opacity: 0;
  transform: translateY(20px) scale(0.98);
}

.rm-sticky-bar__inner {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  grid-template-areas:
    "media body  close"
    "media body  body-spacer"
    "cta   cta   cta";
  align-items: center;
  gap: 12px;
  padding: 14px 14px 12px;
  position: relative;
}

/* Media slot — image or emoji */
.rm-sticky-bar__media {
  grid-area: media;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  background: #0d0f1a;
  border: 2px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rm-sticky-bar__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rm-sticky-bar__media--icon {
  font-size: 1.85rem;
  background: linear-gradient(135deg, #2a2f48 0%, #1a1d2e 100%);
}

/* Body */
.rm-sticky-bar__body {
  grid-area: body;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.rm-sticky-bar__eyebrow {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: #f47e1e;
  text-transform: uppercase;
  line-height: 1;
}

.rm-sticky-bar__title {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.25;
  color: #fff;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rm-sticky-bar__desc {
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.72);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* CTA */
.rm-sticky-bar__cta {
  grid-area: cta;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  margin-top: 4px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
}

.rm-sticky-bar__cta-arrow {
  transition: transform 0.18s ease;
}

.rm-sticky-bar__cta:hover .rm-sticky-bar__cta-arrow,
.rm-sticky-bar__cta:focus-visible .rm-sticky-bar__cta-arrow {
  transform: translateX(3px);
}

/* Close button — pixelated X in the corner */
.rm-sticky-bar__close {
  grid-area: close;
  align-self: start;
  width: 26px;
  height: 26px;
  padding: 0;
  margin: -4px -4px 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.rm-sticky-bar__close:hover,
.rm-sticky-bar__close:focus-visible {
  background: rgba(255, 0, 64, 0.18);
  color: #fff;
  border-color: rgba(255, 0, 64, 0.55);
  outline: none;
}

/* ------------------------------------------------------------
   Mobile / small screens — full-width strip on the bottom edge
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  .rm-sticky-bar {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-radius: 14px 14px 0 0;
    border-top: 3px solid #0d0f1a;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow:
      0 0 0 2px #f47e1e inset,
      0 -8px 18px rgba(0, 0, 0, 0.35);
    /* Account for iOS safe area */
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .rm-sticky-bar__inner {
    grid-template-columns: 52px 1fr auto;
    grid-template-areas:
      "media body  close"
      "cta   cta   cta";
    gap: 10px;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0));
  }

  .rm-sticky-bar__media {
    width: 52px;
    height: 52px;
  }

  .rm-sticky-bar__title {
    font-size: 0.88rem;
    -webkit-line-clamp: 1;
  }

  .rm-sticky-bar__desc {
    -webkit-line-clamp: 1;
  }

  .rm-sticky-bar__cta {
    padding: 12px 14px;
    font-size: 0.85rem;
  }
}

/* ------------------------------------------------------------
   Reduced motion — kill the slide animation
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .rm-sticky-bar,
  .rm-sticky-bar__cta-arrow {
    transition: none !important;
    transform: none !important;
  }
}

/* ------------------------------------------------------------
   When passport pill or other bottom-right elements coexist on
   mobile, make sure the sticky bar pushes them up via padding
   on body. Handled by JS adding a class. The rule below applies
   only when the bar is visible.
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  body.rm-sticky-bar-visible .rm-passport__pill {
    bottom: calc(18px + 110px + env(safe-area-inset-bottom, 0));
  }
}
