/* ===========================================================
   Background music — desktop pill + mobile mini button
   ----------------------------------------------------------
   - Desktop (>900px): floating pill in the top corner
   - Mobile  (≤900px): small round button inserted into the
     existing .floating-controls bar (alongside flags + hamburger)
   =========================================================== */

/* ---------- Desktop pill ---------- */
.music-bar {
  position: fixed;
  top: 7.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding-block: 0.4rem;
  padding-inline-start: 0.4rem;
  padding-inline-end: 0.9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,0.96) 0%, rgba(243,248,252,0.96) 100%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(91, 163, 214, 0.32);
  box-shadow:
    0 8px 20px -10px rgba(63, 127, 168, 0.32),
    0 0 0 2px rgba(255, 255, 255, 0.6);
  z-index: 1001;
  font-family: 'Heebo', sans-serif;
  color: #1F3242;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s ease,
              border-color 0.25s ease,
              opacity 0.2s ease;
}

/* Side: HE (RTL) → right edge aligned with content; EN (LTR) → left */
html[dir="rtl"] .music-bar,
html:not([dir="ltr"]) .music-bar { right: 3.5rem; }
html[dir="ltr"] .music-bar,
html[lang^="en"] .music-bar       { left: 3.5rem; right: auto; }

.music-bar:hover {
  border-color: rgba(91, 163, 214, 0.5);
  box-shadow:
    0 10px 24px -10px rgba(63, 127, 168, 0.42),
    0 0 0 2px rgba(255, 255, 255, 0.78);
}

/* Hide when mobile menu overlay is open */
body.menu-open .music-control { opacity: 0; pointer-events: none; }

/* Round play/pause button (shared by desktop pill and mobile mini) */
.music-control .mp-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #5BA3D6, #3F7FA8);
  color: #fff;
  padding: 0;
  transition: transform 0.2s ease, background 0.2s ease;
}
.music-control .mp-btn:hover {
  transform: scale(1.08);
  background: linear-gradient(135deg, #6FB5DE, #4889B0);
}
.music-control .mp-btn:focus-visible {
  outline: 2px solid #5BA3D6;
  outline-offset: 2px;
}
.music-control .mp-btn svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
  display: block;
}

/* Label */
.music-bar .mp-info {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
}
.music-bar .mp-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #2A4A5F;
  white-space: nowrap;
  line-height: 1.1;
}

/* Equalizer indicator (3 little bars) — visible only when playing */
.music-control .mp-eq {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
  flex: 0 0 auto;
}
.music-control.is-playing .mp-eq { display: inline-flex; }
.music-control .mp-eq span {
  display: inline-block;
  width: 2.5px;
  background: #5BA3D6;
  border-radius: 2px;
  animation: mp-eq 0.95s ease-in-out infinite;
}
.music-control .mp-eq span:nth-child(1) { height: 45%; animation-delay: -0.4s; }
.music-control .mp-eq span:nth-child(2) { height: 95%; animation-delay: -0.15s; }
.music-control .mp-eq span:nth-child(3) { height: 70%; animation-delay: -0.25s; }
@keyframes mp-eq {
  0%, 100% { transform: scaleY(0.4); }
  50%      { transform: scaleY(1); }
}

/* Gentle pulse around the desktop pill when playing */
@keyframes mp-pulse {
  0%, 100% { box-shadow:
    0 8px 20px -10px rgba(63, 127, 168, 0.32),
    0 0 0 2px rgba(255, 255, 255, 0.6); }
  50%      { box-shadow:
    0 8px 20px -10px rgba(63, 127, 168, 0.32),
    0 0 0 2px rgba(255, 255, 255, 0.8),
    0 0 0 8px rgba(91, 163, 214, 0.14); }
}
.music-bar.is-playing { animation: mp-pulse 3s ease-in-out infinite; }

/* ---------- Mobile: mini button lives inside .floating-controls ---------- */
@media (max-width: 900px) {
  /* Hide the desktop pill on mobile (it shouldn't render here, but be safe) */
  .music-bar { display: none !important; }

  /* Extra breathing room between the floating-controls bar and the logo */
  header.nav { padding-top: 5.5rem !important; }

  /* Mini wrapper — sits inside .floating-controls between flags and hamburger */
  .music-mini {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-inline-start: 0.35rem;
    padding-inline-start: 0.35rem;
    border-inline-start: 1px solid rgba(91, 163, 214, 0.28);
  }

  /* Slightly smaller round button to match the hamburger/flag scale */
  .music-mini .mp-btn {
    width: 26px;
    height: 26px;
  }
  .music-mini .mp-btn svg {
    width: 12px;
    height: 12px;
  }
  /* Tiny EQ bars next to the button when playing */
  .music-mini .mp-eq { height: 9px; }
  .music-mini .mp-eq span { width: 2px; }
}
