/* ==========================================================================
   508 Ministry | Site-Wide Smart Autoplay Mode Split:
     - Main Site & Dashboard: Muted Video Motion Default + Explicit-Unmute Gold
     - /social/: Full Social Autoplay + Single-Active-Speaker Gold Frame
   Self-hosted typography (Figtree / Cormorant), zero third-party font CDNs.
   ========================================================================== */

@keyframes m508GoldHaloPulse {
  0%, 100% {
    box-shadow:
      0 0 0 3px rgba(245, 194, 73, 0.34),
      0 12px 32px rgba(212, 168, 56, 0.24);
  }
  50% {
    box-shadow:
      0 0 0 5px rgba(245, 194, 73, 0.48),
      0 16px 38px rgba(212, 168, 56, 0.34);
  }
}

@keyframes m508ArrowBobDown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(3px); }
}

@keyframes m508ArrowBobUp {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-3px); }
}

@keyframes m508EqBarA {
  0%, 100% { height: 5px; }
  45% { height: 15px; }
  75% { height: 9px; }
}

@keyframes m508EqBarB {
  0%, 100% { height: 13px; }
  35% { height: 6px; }
  70% { height: 16px; }
}

@keyframes m508EqBarC {
  0%, 100% { height: 8px; }
  40% { height: 15px; }
  80% { height: 5px; }
}

/* Highlighted Brushed-Gold Container around the Active Audio/Video Player */
.m508-audio-active-card {
  outline: 2.5px solid #E5B942 !important;
  outline-offset: 2px !important;
  border-color: #E5B942 !important;
  box-shadow:
    0 0 0 3px rgba(245, 194, 73, 0.34),
    0 12px 32px rgba(212, 168, 56, 0.24) !important;
  animation: m508GoldHaloPulse 2.8s ease-in-out infinite;
  transition: outline-color 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}

.m508-audio-active-card.m508-audio-is-muted {
  outline-color: rgba(229, 185, 66, 0.72) !important;
  animation: none;
  box-shadow:
    0 0 0 2px rgba(245, 194, 73, 0.22),
    0 8px 22px rgba(16, 27, 56, 0.14) !important;
}

/* Floating Gold Pointer Pill & Audio Controls */
.m508-now-playing-badge {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2147482000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0E1B38 0%, #1B2F5C 100%);
  border: 1.5px solid #F2C95A;
  color: #FFFDF7;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  box-shadow:
    0 10px 28px rgba(10, 20, 44, 0.38),
    0 0 0 2.5px rgba(245, 194, 73, 0.34);
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(-9999px, -9999px, 0);
  transition: opacity 0.18s ease, visibility 0.18s ease, background 0.2s ease;
  max-width: calc(100vw - 16px);
  box-sizing: border-box;
}

.m508-now-playing-badge.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Sunlit Gold Callout State on /social/ when Browser Awaits First Tap for Live Sound */
.m508-now-playing-badge.is-tap-sound {
  background: linear-gradient(135deg, #F6CE5B 0%, #DFA628 100%);
  border-color: #FFF4CC;
  color: #101B38;
  cursor: pointer;
  box-shadow:
    0 10px 30px rgba(212, 168, 56, 0.44),
    0 0 0 3px rgba(255, 244, 204, 0.65);
}

.m508-now-playing-badge.is-tap-sound .m508-np-eq span {
  background: #101B38;
}

.m508-now-playing-badge.is-tap-sound .m508-np-btn {
  background: rgba(16, 27, 56, 0.14);
  border-color: rgba(16, 27, 56, 0.28);
  color: #101B38;
}

.m508-now-playing-badge.is-tap-sound .m508-np-btn:hover {
  background: rgba(16, 27, 56, 0.24);
}

.m508-now-playing-badge.is-tap-sound .m508-np-arrow {
  border-top-color: #E3AC2E;
}

.m508-now-playing-badge.is-tap-sound.is-arrow-top .m508-np-arrow {
  border-bottom-color: #F4C852;
  border-top-color: transparent;
}

/* Understated Muted Preview Chip (Non-Social Pages: Video Motion Only, Zero Auto Sound) */
.m508-now-playing-badge.is-muted-preview {
  padding: 5px 11px;
  gap: 6px;
  background: rgba(14, 27, 56, 0.86);
  border: 1px solid rgba(242, 201, 90, 0.45);
  color: #F6F8FC;
  font-size: 11.5px;
  box-shadow: 0 6px 18px rgba(10, 20, 44, 0.24);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.m508-now-playing-badge.is-muted-preview:hover {
  background: rgba(14, 27, 56, 0.96);
  border-color: #F2C95A;
}

.m508-now-playing-badge.is-muted-preview .m508-np-eq,
.m508-now-playing-badge.is-muted-preview .m508-np-multi,
.m508-now-playing-badge.is-muted-preview [data-m508-act="pause"],
.m508-now-playing-badge.is-muted-preview .m508-np-arrow {
  display: none !important;
}

.m508-now-playing-badge.is-muted-preview .m508-np-btn {
  height: 24px;
  padding: 0 8px;
  background: rgba(242, 201, 90, 0.16);
  border-color: rgba(242, 201, 90, 0.5);
  color: #FCE395;
  font-size: 11px;
}

/* Animated 3-Bar Gold Equalizer */
.m508-np-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 16px;
  width: 14px;
  flex-shrink: 0;
}

.m508-np-eq span {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, #FFE48A 0%, #E0AD34 100%);
  height: 6px;
}

.m508-now-playing-badge.is-playing:not(.is-muted):not(.is-muted-preview) .m508-np-eq span:nth-child(1) {
  animation: m508EqBarA 0.85s ease-in-out infinite;
}

.m508-now-playing-badge.is-playing:not(.is-muted):not(.is-muted-preview) .m508-np-eq span:nth-child(2) {
  animation: m508EqBarB 0.72s ease-in-out infinite;
}

.m508-now-playing-badge.is-playing:not(.is-muted):not(.is-muted-preview) .m508-np-eq span:nth-child(3) {
  animation: m508EqBarC 0.94s ease-in-out infinite;
}

.m508-now-playing-badge.is-muted .m508-np-eq span {
  height: 4px !important;
  opacity: 0.55;
}

/* Status Label + Multi-Player Count Chip */
.m508-np-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  min-width: 0;
}

.m508-np-label {
  white-space: nowrap;
}

.m508-np-multi {
  display: none;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(242, 201, 90, 0.2);
  border: 1px solid rgba(242, 201, 90, 0.46);
  color: #FCE08B;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.m508-now-playing-badge.is-multi:not(.is-muted-preview) .m508-np-multi {
  display: inline-flex;
}

.m508-now-playing-badge.is-tap-sound .m508-np-multi {
  background: rgba(16, 27, 56, 0.12);
  border-color: rgba(16, 27, 56, 0.24);
  color: #101B38;
}

/* 1-Click Mute / Unmute and Pause Controls */
.m508-np-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 2px;
  flex-shrink: 0;
}

.m508-np-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 27px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(242, 201, 90, 0.52);
  background: rgba(255, 255, 255, 0.1);
  color: #FFFDF7;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.m508-np-btn:hover {
  background: rgba(242, 201, 90, 0.26);
  border-color: #FCE08B;
}

.m508-np-btn:active {
  transform: scale(0.96);
}

.m508-np-btn:focus-visible {
  outline: 2px solid #FFE48A;
  outline-offset: 2px;
}

.m508-np-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* Gold Pointer Arrow Aimed Directly at the Active Container */
.m508-np-arrow {
  position: absolute;
  left: var(--m508-arrow-x, 50%);
  bottom: -10px;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 10px solid #F2C95A;
  transform: translateX(-50%);
  filter: drop-shadow(0 3px 4px rgba(10, 20, 44, 0.32));
  pointer-events: none;
  animation: m508ArrowBobDown 1.7s ease-in-out infinite;
}

.m508-now-playing-badge.is-arrow-top .m508-np-arrow {
  bottom: auto;
  top: -10px;
  border-top: 0;
  border-bottom: 10px solid #F2C95A;
  animation: m508ArrowBobUp 1.7s ease-in-out infinite;
}

@media (max-width: 640px) {
  .m508-now-playing-badge {
    padding: 6px 8px 6px 10px;
    gap: 6px;
    font-size: 11.5px;
  }

  .m508-np-multi {
    display: none !important;
  }

  .m508-np-btn {
    height: 30px;
    padding: 0 8px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .m508-audio-active-card,
  .m508-np-arrow,
  .m508-np-eq span {
    animation: none !important;
  }
}
