/**
 * Radio Fitness в шапке сайта.
 *
 * Стиль повторяет карточки калькуляторов (protrener-diet.css /
 * protrener-booking.css): тёмный градиент, янтарные акценты, pill-кнопки,
 * переменные темы (--text, --muted).
 *
 * Панель position:fixed — всегда прибита к верху экрана. Её высота
 * задаётся только CSS-переменной --pr-radio-h (JS её не трогает), поэтому
 * контент и sticky-навигация темы не наезжают на плеер и ничего не
 * «разъезжается» при скролле и смене страницы.
 */
:root { --pr-radio-h: 46px; }

html { scroll-padding-top: calc(var(--pr-radio-h) + 76px); }

body.has-pr-radio { padding-top: var(--pr-radio-h); }

/* Навигация темы прилипает ровно под панелью радио. */
body.has-pr-radio .site-header { top: var(--pr-radio-h); }

.pr-radio {
  --radio-amber: #f6b547;
  --radio-line: rgba(245, 158, 11, .25);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  height: var(--pr-radio-h);
  background: linear-gradient(145deg, rgba(22, 29, 39, .97), rgba(12, 16, 22, .96));
  border-bottom: 1px solid var(--radio-line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  animation: pr-radio-enter .4s ease both;
}

/* В одну строку: высота не «прыгает» при переносе элементов. */
.pr-radio-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .5rem .8rem;
  height: 100%;
  padding: 0;
}

/* --- кнопка play/pause: круглая янтарная, как pill-акцент калькулятора --- */
.pr-radio-toggle {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(246, 181, 71, .55);
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(246, 181, 71, .22), rgba(246, 181, 71, .08));
  color: #fde68a;
  font: inherit;
  font-size: .72rem;
  line-height: 1;
  cursor: pointer;
  transition: transform .18s ease, background .2s ease, border-color .2s ease;
}
.pr-radio-toggle:hover {
  transform: translateY(-2px);
  border-color: var(--radio-amber);
  background: linear-gradient(180deg, rgba(246, 181, 71, .32), rgba(246, 181, 71, .12));
}
.pr-radio-toggle[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--radio-amber), #d68f1a);
  color: #15120c;
  border-color: var(--radio-amber);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, .28);
}
.pr-radio-toggle:focus-visible,
.pr-radio-volume input:focus-visible {
  outline: 2px solid var(--radio-amber);
  outline-offset: 3px;
}
.pr-radio-icon { display: inline-block; transform: translateY(-1px); }

/* --- подпись станции: kicker как .diet-kicker --- */
.pr-radio-info { display: grid; gap: .05rem; min-width: 0; }
.pr-radio-kicker {
  color: var(--radio-amber);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}
.pr-radio-name {
  color: var(--text, #edf2f7);
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- громкость --- */
.pr-radio-volume { display: flex; align-items: center; gap: .4rem; min-width: 90px; flex: 0 1 130px; margin-left: auto; }
.pr-radio-volume input[type="range"] { width: 100%; accent-color: var(--radio-amber); cursor: pointer; }

/* --- эквалайзер: живая индикация воспроизведения --- */
.pr-radio-bars { display: flex; align-items: flex-end; gap: 2px; height: 14px; flex: 0 0 auto; }
.pr-radio-bars i {
  display: block;
  width: 3px; height: 30%;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--radio-amber), rgba(246, 181, 71, .35));
  transition: height .2s ease;
}
.pr-radio.is-playing .pr-radio-bars i { animation: pr-radio-bar .9s ease-in-out infinite; }
.pr-radio.is-playing .pr-radio-bars i:nth-child(2) { animation-delay: .15s; }
.pr-radio.is-playing .pr-radio-bars i:nth-child(3) { animation-delay: .3s; }
.pr-radio.is-playing .pr-radio-bars i:nth-child(4) { animation-delay: .45s; }

.pr-radio-error { color: #fecaca; font-size: .74rem; }

/* доступные подписи для скринридеров */
.pr-radio-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

@keyframes pr-radio-bar { 0%, 100% { height: 25%; } 50% { height: 100%; } }
/* Только прозрачность: transform на fixed-панели ломает привязку к верху. */
@keyframes pr-radio-enter { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 782px) {
  .pr-radio-volume { flex-basis: 92px; min-width: 70px; }
}
@media (max-width: 560px) {
  :root { --pr-radio-h: 42px; }
  .pr-radio-info { display: none; }
  .pr-radio-inner { gap: .4rem .55rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pr-radio { animation: none; }
  .pr-radio.is-playing .pr-radio-bars i { animation: none; height: 70%; }
}
