/**
 * Floating corner radio FAB — site-wide mini player
 */
.radio-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 997;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
  font-family: var(--font-body);
}

.radio-fab__toggle {
  position: relative;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--green-dark) 0%, var(--green) 55%, var(--green-hover) 100%);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 14px rgba(20, 83, 45, 0.35),
    0 10px 28px rgba(15, 23, 42, 0.18);
  transition: transform var(--ease), box-shadow var(--ease);
}

.radio-fab__toggle i {
  font-size: 1.45rem;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.radio-fab__toggle:hover,
.radio-fab__toggle:focus-visible {
  transform: scale(1.06);
  box-shadow:
    0 6px 18px rgba(20, 83, 45, 0.4),
    0 14px 32px rgba(15, 23, 42, 0.22);
  outline: none;
}

.radio-fab__toggle:focus-visible {
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 6px var(--green);
}

.radio-fab__pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(34, 197, 94, 0.65);
  animation: radio-fab-pulse 2s ease-out infinite;
  pointer-events: none;
}

.radio-fab.is-playing .radio-fab__pulse {
  border-color: #d4af37;
}

@keyframes radio-fab-pulse {
  0% { transform: scale(1); opacity: 0.85; }
  100% { transform: scale(1.55); opacity: 0; }
}

.radio-fab__badge {
  position: absolute;
  top: 50%;
  left: auto;
  right: calc(100% + 4px);
  bottom: auto;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.08;
  white-space: nowrap;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  /* Extra right padding leaves room for the arrow head */
  padding: 0.58rem 1.55rem 0.58rem 0.7rem;
  min-width: 4.8rem;
  border-radius: 0;
  background: #d4af37;
  color: #1e293b;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  z-index: 2;
  pointer-events: none;
  /* Classic arrow: shaft + pointed head toward the radio button */
  clip-path: polygon(
    0% 8%,
    68% 8%,
    68% 0%,
    100% 50%,
    68% 100%,
    68% 92%,
    0% 92%
  );
}

.radio-fab__badge span {
  display: block;
}

.radio-fab__badge::after {
  display: none;
}

.radio-fab__panel {
  width: min(300px, calc(100vw - 2rem));
  background: linear-gradient(165deg, #0f172a 0%, #14532d 100%);
  color: #fff;
  border-radius: 16px;
  padding: 0.85rem;
  box-shadow:
    0 8px 24px rgba(15, 23, 42, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  transform-origin: bottom right;
  animation: radio-fab-in 0.22s ease;
}

.radio-fab__panel[hidden] {
  display: none !important;
}

@keyframes radio-fab-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.radio-fab__panel-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.radio-fab__logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.radio-fab__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.radio-fab__meta strong {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  line-height: 1.2;
}

.radio-fab__meta span {
  font-size: 0.75rem;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio-fab__close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.radio-fab__close:hover,
.radio-fab__close:focus-visible {
  background: rgba(255, 255, 255, 0.2);
}

.radio-fab__panel-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.radio-fab__play {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--green-dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.radio-fab__play i {
  font-size: 1.35rem;
  line-height: 1;
}

.radio-fab__play .icon-pause {
  display: none;
}

.radio-fab.is-playing .radio-fab__play .icon-play {
  display: none;
}

.radio-fab.is-playing .radio-fab__play .icon-pause {
  display: block;
}

.radio-fab__open-site {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 42px;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background var(--ease);
}

.radio-fab__open-site:hover,
.radio-fab__open-site:focus-visible {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.radio-fab audio {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

/* Keep back-to-top above the FAB stack */
body:has(.radio-fab) .back-to-top {
  bottom: 86px;
}

@media (max-width: 480px) {
  .radio-fab {
    right: 14px;
    bottom: 14px;
  }

  body:has(.radio-fab) .back-to-top {
    bottom: 80px;
    right: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .radio-fab__pulse,
  .radio-fab__panel {
    animation: none;
  }
}
