/* Fixed bottom-left promo — full card on desktop, round icon on phone. */

.site-rail {
  position: fixed;
  left: max(0.85rem, env(safe-area-inset-left, 0px));
  bottom: max(5.5rem, calc(env(safe-area-inset-bottom, 0px) + 4.75rem));
  z-index: 40;
  animation: site-rail-in 0.35s ease both;
}

@keyframes site-rail-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile: only the round image */
.site-rail__fab {
  display: flex;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(204, 28, 57, 0.55);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.45),
    0 0 0 3px rgba(24, 24, 27, 0.85);
  background: var(--surface-2);
  text-decoration: none;
}

.site-rail__fab .site-rail__logo {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}

.site-rail__panel {
  display: none;
}

.site-rail__logo {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  display: block;
}

.site-rail__logo--fallback {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--rose);
  background:
    radial-gradient(circle at 30% 30%, rgba(204, 28, 57, 0.35), transparent 60%),
    var(--surface-2);
}

/* Desktop: full card */
@media (min-width: 860px) {
  .site-rail {
    left: max(1.25rem, env(safe-area-inset-left, 0px));
    bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
    width: min(20.5rem, calc(100vw - 2.5rem));
    padding: 0.95rem 1rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(204, 28, 57, 0.35);
    background:
      linear-gradient(165deg, rgba(44, 44, 48, 0.97) 0%, rgba(24, 24, 27, 0.98) 100%);
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.04) inset,
      0 12px 36px rgba(0, 0, 0, 0.45),
      0 0 28px rgba(204, 28, 57, 0.12);
  }

  .site-rail__fab {
    display: none;
  }

  .site-rail__panel {
    display: block;
    position: relative;
  }

  .site-rail__close {
    position: absolute;
    top: -0.35rem;
    right: -0.25rem;
    width: 1.7rem;
    height: 1.7rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
  }

  .site-rail__close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
  }

  .site-rail__top {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-right: 1.2rem;
  }

  .site-rail__copy {
    min-width: 0;
    flex: 1;
  }

  .site-rail__eyebrow {
    margin: 0 0 0.15rem;
    font-family: var(--font-eyebrow);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rose);
  }

  .site-rail__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
  }

  .site-rail__text {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .site-rail__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.85rem;
    width: 100%;
    min-height: 2.45rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: 0;
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #e02445 0%, #cc1c39 45%, #a51935 100%);
    box-shadow: 0 6px 18px rgba(204, 28, 57, 0.35);
    transition: transform 0.15s ease, filter 0.15s ease;
  }

  .site-rail__cta:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    color: #fff;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-rail {
    animation: none;
  }
}
