/* 508 Life Vault Companion App: Floating Interactive Jesus-on-the-Cross Medallion & Gospel Sermon Card
   Self-hosted Cormorant + Figtree only. Light Coastal Blue & Warm Ivory palette. Zero em dashes. */

.cm508-dock {
  position: fixed;
  right: 22px;
  bottom: 96px;
  z-index: 99960;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cm508-stage {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  padding: 6px;
}

/* Soft luminous golden-coastal halo behind the floating medallion */
.cm508-halo {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 215, 125, 0.52) 0%, rgba(125, 194, 247, 0.28) 54%, rgba(125, 194, 247, 0) 76%);
  filter: blur(5px);
  pointer-events: none;
  animation: cm508HaloPulse 4.4s ease-in-out infinite;
}

@keyframes cm508HaloPulse {
  0%, 100% { transform: scale(0.95); opacity: 0.72; }
  50% { transform: scale(1.09); opacity: 1; }
}

@keyframes cm508FloatBob {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(1.1deg); }
}

.cm508-drift {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

.cm508-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  outline: none;
  animation: cm508FloatBob 4.2s ease-in-out infinite;
  transition: filter 0.22s ease;
}

.cm508-trigger:hover,
.cm508-trigger:focus-visible,
.cm508-dock.is-open .cm508-trigger {
  filter: brightness(1.06);
}

.cm508-trigger:focus-visible {
  box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 6px #38BDF8;
}

.cm508-trigger img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 12px 22px rgba(12, 26, 46, 0.36)) drop-shadow(0 0 14px rgba(212, 168, 75, 0.45));
}

/* Subtle floating caption pill beneath medallion */
.cm508-badge-tip {
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 2px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #F0F8FF 0%, #D9EEFF 100%);
  border: 1px solid #7DC2F7;
  color: #0C1A2E;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 6px 14px rgba(12, 26, 46, 0.2);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.cm508-dock.is-open .cm508-badge-tip {
  opacity: 0;
  transform: translateX(-50%) translateY(4px);
}

/* Clean Dismiss X Close Button */
.cm508-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 4;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid #7DC2F7;
  background: rgba(255, 253, 247, 0.96);
  color: #0C1A2E;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(12, 26, 46, 0.26);
  opacity: 0.72;
  transition: opacity 0.18s ease, transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.cm508-stage:hover .cm508-close,
.cm508-stage:focus-within .cm508-close,
.cm508-dock.is-open .cm508-close {
  opacity: 1;
}

.cm508-close:hover {
  background: #0C1A2E;
  color: #FFF4CC;
  border-color: #D4A84B;
  transform: scale(1.08);
}

/* Gospel of the Cross Devotional Sermon Popover Card */
.cm508-card {
  position: absolute;
  right: 88px;
  bottom: -6px;
  width: 422px;
  max-width: calc(100vw - 32px);
  max-height: min(84vh, 680px);
  overflow-y: auto;
  padding: 15px 17px 15px;
  border-radius: 20px;
  background: linear-gradient(155deg, #FFFDF8 0%, #F4FAFF 56%, #E5F4FF 100%);
  border: 1.5px solid #7DC2F7;
  box-shadow:
    0 24px 56px rgba(12, 26, 46, 0.28),
    0 0 0 1px rgba(212, 168, 75, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  color: #0C1A2E;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(12px, 10px, 0) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
              visibility 0.24s ease;
}

/* Invisible hover bridge between medallion and card so moving cursor never drops hover */
.cm508-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: -24px;
  width: 26px;
  height: 100%;
}

.cm508-dock.is-open .cm508-card {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0) scale(1);
}

.cm508-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cm508-card-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px 4px 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, #EAF6FF 0%, #D5ECFE 100%);
  border: 1px solid #7DC2F7;
  color: #0A5660;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cm508-card-eyebrow img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: block;
}

.cm508-card-x {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(125, 194, 247, 0.78);
  background: rgba(255, 255, 255, 0.9);
  color: #0C1A2E;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.cm508-card-x:hover {
  background: #0C1A2E;
  color: #FFF4CC;
  border-color: #D4A84B;
}

.cm508-verse-box {
  margin: 0 0 10px;
  padding: 10px 13px;
  border-radius: 13px;
  background: linear-gradient(135deg, #EAF6FF 0%, #D8EEFF 100%);
  border: 1px solid #7DC2F7;
  border-left: 4px solid #D4A84B;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.cm508-verse-quote {
  margin: 0 0 4px;
  font-family: 'Cormorant', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  font-style: italic;
  line-height: 1.26;
  color: #0C1A2E;
}

.cm508-verse-ref {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0B5D9E;
}

.cm508-sermon-title {
  margin: 0 0 6px;
  font-family: 'Cormorant', Georgia, serif;
  font-size: 20.5px;
  font-weight: 800;
  line-height: 1.15;
  color: #0C1A2E;
}

.cm508-sermon-body {
  margin: 0 0 10px;
  font-size: 12.6px;
  line-height: 1.46;
  color: #1E3554;
}

.cm508-sermon-body p {
  margin: 0 0 7px;
}

.cm508-sermon-body p:last-child {
  margin-bottom: 0;
}

.cm508-sermon-body strong {
  color: #0C1A2E;
}

.cm508-refs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 10px;
}

.cm508-ref-pill {
  font-size: 11px;
  font-weight: 700;
  color: #0C1A2E;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(212, 168, 75, 0.58);
  border-radius: 999px;
  padding: 3px 9px;
}

.cm508-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1.5px solid #C99234;
  background: linear-gradient(135deg, #FCE7A6 0%, #E7B956 54%, #D4A84B 100%);
  color: #0C1A2E;
  font-size: 13.5px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(181, 130, 32, 0.28);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.cm508-cta-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

/* Tiny unobtrusive restore pill when user closes the medallion */
.cm508-restore {
  position: fixed;
  right: 16px;
  bottom: 92px;
  z-index: 99959;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid #7DC2F7;
  background: linear-gradient(135deg, #F0F8FF 0%, #D9EEFF 100%);
  color: #0C1A2E;
  font-family: 'Figtree', sans-serif;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(12, 26, 46, 0.22);
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.cm508-restore:hover {
  transform: translateY(-2px);
  border-color: #D4A84B;
}

.cm508-restore[hidden],
.cm508-dock[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .cm508-dock {
    right: 12px;
    bottom: 120px;
  }
  .cm508-trigger {
    width: 60px;
    height: 60px;
  }
  .cm508-card {
    right: 0;
    bottom: 74px;
    width: calc(100vw - 24px);
    max-height: 64vh;
    padding: 14px 15px;
  }
  .cm508-card::after {
    display: none;
  }
  .cm508-close {
    opacity: 1;
  }
  .cm508-restore {
    right: 12px;
    bottom: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cm508-trigger,
  .cm508-halo {
    animation: none !important;
  }
  .cm508-card {
    transition: opacity 0.15s ease;
  }
}
