/*
 * Bond Live Open — sender-side inset viewer (Phase 8e / Add-On 3).
 *
 * Renders a small floating window in the corner of the sender's screen
 * while the recipient is cleaving the wax in real time. On desktop the
 * inset lives bottom-right (~280x180 + caption); on mobile it morphs
 * into a full-width strip at the top of the viewport so the procedural
 * cleavage paint isn't crammed into a postage-stamp.
 *
 * Locked to the rest of the Bond visual language:
 *   - Cream-on-walnut palette (#f4e8c8 / #2a1f17) per E v2.
 *   - Subtle backdrop blur — no acid-bright glow.
 *   - Respects prefers-reduced-motion (turns off the entrance + cleave
 *     pulse).
 *   - No autoplay sound. Visual mirror only.
 */

.bond-live-open-inset {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9700;
  font-family: 'EB Garamond', 'Cormorant Garamond', Georgia, serif;
  color: #f4e8c8;
  pointer-events: none;
}

.bond-live-open-inset .bond-live-open-inset-frame {
  position: relative;
  width: 280px;
  background: linear-gradient(180deg, rgba(20, 15, 10, 0.92), rgba(10, 7, 5, 0.96));
  border: 1px solid rgba(180, 140, 80, 0.32);
  border-radius: 14px;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 240, 200, 0.06);
  overflow: hidden;
  pointer-events: auto;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: bondLiveOpenSlideIn 320ms ease-out;
}

.bond-live-open-inset .bond-live-open-inset-canvas {
  display: block;
  width: 100%;
  height: 180px;
  background: #1a140c;
}

.bond-live-open-inset .bond-live-open-inset-caption {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px 4px;
  border-top: 1px solid rgba(180, 140, 80, 0.18);
}

.bond-live-open-inset .bond-live-open-inset-eyebrow {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #c84d3a;
  padding: 2px 6px;
  border: 1px solid rgba(200, 77, 58, 0.5);
  border-radius: 4px;
  text-transform: uppercase;
  position: relative;
}

.bond-live-open-inset .bond-live-open-inset-eyebrow::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff5a3c;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 4px rgba(255, 90, 60, 0.6);
  animation: bondLiveOpenPulse 1.2s ease-in-out infinite;
}

.bond-live-open-inset .bond-live-open-inset-label {
  font-size: 14px;
  font-style: italic;
  color: rgba(244, 232, 200, 0.88);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.bond-live-open-inset .bond-live-open-inset-status {
  padding: 0 14px 12px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(244, 232, 200, 0.55);
}

.bond-live-open-inset .bond-live-open-inset-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: rgba(20, 15, 10, 0.6);
  color: rgba(244, 232, 200, 0.78);
  font-size: 20px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 120ms ease, color 120ms ease;
}

.bond-live-open-inset .bond-live-open-inset-close:hover,
.bond-live-open-inset .bond-live-open-inset-close:focus {
  background: rgba(40, 30, 20, 0.9);
  color: #f4e8c8;
  outline: none;
}

@keyframes bondLiveOpenSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bondLiveOpenPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.7); }
}

/* Mobile — narrow viewport. The bottom-right inset would crowd the
 * thumb-zone, so we morph it into a full-width strip across the top
 * of the viewport. The canvas reflows to a wider 16:9-ish strip; the
 * caption stacks below.
 */
@media (max-width: 540px) {
  .bond-live-open-inset {
    inset: env(safe-area-inset-top, 0) 0 auto 0;
    right: 0;
    bottom: auto;
    padding: 8px 12px;
  }
  .bond-live-open-inset .bond-live-open-inset-frame {
    width: 100%;
    max-width: none;
    border-radius: 10px;
  }
  .bond-live-open-inset .bond-live-open-inset-canvas {
    height: 140px;
  }
}

/* Reduced-motion preference: disable the slide-in animation and pulse
 * dot so motion-sensitive users get a stable inset instead of a
 * recurring twitch. Cleavage paint itself is content (informational
 * mirror of the recipient's screen) — we don't suppress that.
 */
@media (prefers-reduced-motion: reduce) {
  .bond-live-open-inset .bond-live-open-inset-frame {
    animation: none;
  }
  .bond-live-open-inset .bond-live-open-inset-eyebrow::before {
    animation: none;
  }
}
