/* hora-player — the station's stream panel, one source for every place it appears:
   the website's stream page (wordpress/theme, shortcode in hora-sendungen) and the
   webplayer on stream.hochschulradio-aachen.de (roles/streaming). Behaviour in
   hora-player.js. Colours fall back to the CD values outside WordPress.

   States on .hora-stream:  (idle)  .is-connecting (the button breathes)
                            .is-playing  .is-error

   Markup:
   <section class="hora-stream" data-now-url="…">
     <div class="hora-stream__head">
       <span class="hora-stream__station">Hochschulradio Aachen</span>
       <span class="hora-stream__freq">99,1 FM</span>
       <span class="hora-stream__live"><span class="hora-stream__dot"></span>LIVE</span>   (optional)
     </div>
     <div class="hora-stream__row">
       <button class="hora-stream__play" type="button" aria-label="Stream abspielen"></button>
       <div class="hora-stream__meta">
         <span class="hora-stream__label">Läuft gerade</span>
         <span class="hora-stream__now" data-fallback="Livestream">Livestream</span>
       </div>
     </div>
     <div class="hora-stream__controls">                                                  (optional)
       <div class="hora-stream__quality" role="radiogroup" aria-label="Qualität">
         <button type="button" role="radio" data-src="/radio.mp3" data-type="audio/mpeg">Standard</button> …
       </div>
       <label class="hora-stream__vol"><span class="hora-visually-hidden">Lautstärke</span><input type="range" min="0" max="1" step="0.01"></label>
     </div>
     <p class="hora-stream__error" hidden>…</p>
     <audio class="hora-stream__audio" preload="none" src="(default stream)"></audio>
   </section>

   Never tabular figures or ligatures with Liasion Grotesque: its tnum glyphs and
   the ff ligature are empty in Bold, & is missing. */

.hora-stream{
  --hs-green:var(--wp--preset--color--accent-1,#22B573);
  --hs-green-dark:var(--wp--preset--color--accent-2,#1A8F5A);
  --hs-ink:var(--wp--preset--color--contrast,#222222);
  --hs-wave:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="240" height="40" viewBox="0 0 240 40"><path d="M0 20q30-16 60 0t60 0 60 0 60 0" fill="none" stroke="%2322B573" stroke-width="2.5"/></svg>');
  position:relative;overflow:hidden;isolation:isolate;
  background:var(--hs-ink);color:#fff;border-radius:18px;
  padding:clamp(1.5rem,4vw,2.25rem);
  font-variant-ligatures:none;font-feature-settings:"liga" 0,"clig" 0;
}
.hora-stream::before,.hora-stream::after{
  content:"";position:absolute;left:0;right:-240px;height:40px;z-index:0;
  background-image:var(--hs-wave);background-repeat:repeat-x;pointer-events:none;
}
.hora-stream::before{top:18%;opacity:.26;animation:hora-drift 14s linear infinite}
.hora-stream::after{bottom:12%;opacity:.14;animation:hora-drift 22s linear infinite reverse}
.hora-stream.is-playing::before{opacity:.4}
.hora-stream > *{position:relative;z-index:1}
@keyframes hora-drift{from{transform:translateX(0)}to{transform:translateX(-240px)}}

.hora-stream__head{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;margin-bottom:1.25rem}
.hora-stream__station{font-weight:700;font-size:clamp(1.1rem,.9rem+.7vw,1.45rem)}
.hora-stream__freq{
  font-size:.7rem;font-weight:700;letter-spacing:.09em;color:var(--hs-green);
  border:1px solid var(--hs-green);border-radius:99px;padding:.15rem .6rem;
}
.hora-stream__live{margin-left:auto;display:flex;align-items:center;gap:.4rem;font-size:.75rem;font-weight:700;letter-spacing:.06em}
.hora-stream__dot{width:.5rem;height:.5rem;border-radius:50%;background:#777}
.hora-stream.is-playing .hora-stream__dot{background:var(--hs-green);animation:hora-pulse 2.4s infinite}

.hora-stream__row{display:flex;align-items:center;gap:1rem}
.hora-stream__play{
  flex:0 0 auto;width:3.6rem;height:3.6rem;border-radius:50%;border:0;cursor:pointer;
  background:var(--hs-green);display:grid;place-items:center;
  transition:background .18s ease,transform .18s ease;
}
.hora-stream__play:hover{background:var(--hs-green-dark);transform:scale(1.05)}
.hora-stream__play:focus-visible{outline:2px solid #fff;outline-offset:3px}
.hora-stream__play::before{
  content:"";border-style:solid;border-width:.62rem 0 .62rem 1rem;
  border-color:transparent transparent transparent #fff;margin-left:.22rem;
}
.hora-stream__play.is-playing::before{
  border:0;width:.9rem;height:1.05rem;margin:0;
  background:linear-gradient(90deg,#fff 0 34%,transparent 34% 66%,#fff 66% 100%);
}
/* connecting: the button breathes until the first audio arrives */
.hora-stream.is-connecting .hora-stream__play{animation:hora-breathe 1.2s ease-in-out infinite}

.hora-stream__meta{display:flex;flex-direction:column;min-width:0}
.hora-stream__label{font-size:.66rem;font-weight:700;letter-spacing:.11em;text-transform:uppercase;color:var(--hs-green)}
.hora-stream__now{font-size:clamp(1.02rem,.95rem+.4vw,1.2rem);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.hora-stream__controls{display:flex;align-items:center;gap:1rem;flex-wrap:wrap;margin-top:1.5rem}
.hora-stream__quality{display:flex;gap:.35rem;flex-wrap:wrap}
.hora-stream__quality button{
  font:inherit;font-size:.8rem;font-weight:700;cursor:pointer;
  color:rgba(255,255,255,.8);background:transparent;
  border:1px solid rgba(255,255,255,.28);border-radius:6px;padding:.35rem .7rem;
}
.hora-stream__quality button:hover{border-color:#fff;color:#fff}
.hora-stream__quality button[aria-checked="true"]{background:var(--hs-green);border-color:var(--hs-green);color:#fff}
.hora-stream__quality button:focus-visible{outline:2px solid #fff;outline-offset:2px}
.hora-stream__vol{margin-left:auto;display:flex;align-items:center}
.hora-stream__vol input{width:8rem;accent-color:var(--hs-green)}
.hora-stream__error{margin:1.1rem 0 0;font-size:.9rem;color:#ffb4a8}
.hora-visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

@media (max-width:30rem){
  .hora-stream__vol{margin-left:0;width:100%}
  .hora-stream__vol input{width:100%}
}

/* shared animations — the website's sticky bar uses hora-breathe and hora-pulse too */
@keyframes hora-breathe{50%{transform:scale(.92);opacity:.75}}
@keyframes hora-pulse{0%{box-shadow:0 0 0 0 rgba(34,181,115,.6)}70%{box-shadow:0 0 0 .55rem rgba(34,181,115,0)}100%{box-shadow:0 0 0 0 rgba(34,181,115,0)}}
@media (prefers-reduced-motion:reduce){
  .hora-stream::before,.hora-stream::after,
  .hora-stream.is-playing .hora-stream__dot,
  .hora-stream.is-connecting .hora-stream__play{animation:none}
}
