/* ==========================================================================
   audio.css — .wf-audio ambient-music toggle (OPTIONAL feature, audio.js)
   A small play/pause control that lives in the header actions cluster, styled
   to match the nav buttons. Hidden by default (audio.js reveals it only when a
   track is configured via window.SITE_CONFIG.audioSrc).
   Includes an OPTIONAL decorative "equaliser" visualiser: aria-hidden, and
   reduced-motion-safe (no animation when the user prefers reduced motion).
   ========================================================================== */

.wf-audio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;                          /* gap between visualiser bars */
  width: 44px;                       /* >=44px tap target (BRIEF §7/§8) */
  height: 44px;
  padding: 0;
  color: var(--c-terracotta-dk);
  background-color: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
/* `.wf-audio{display:inline-flex}` is an author rule, so it otherwise beats
   the UA [hidden]{display:none} default (same specificity, author wins the
   cascade) and the button stays visible — a real bug: a non-functional
   "ghost" toggle rendering in the nav on every page where audioSrc isn't
   configured, also eating nav-bar width on mobile. This re-asserts hidden
   with higher specificity so the HTML `hidden` attribute (audio.js only
   removes it once SITE_CONFIG.audioSrc is set) actually hides it again. */
.wf-audio[hidden] { display: none; }

.wf-audio:hover {
  color: var(--c-terracotta);
  background-color: var(--c-parchment-deep);
}

/* Focus ring per BRIEF §8 (base.css provides :focus-visible outline). */
.wf-audio:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

/* --- Decorative visualiser ------------------------------------------------
   Three little bars, aria-hidden (purely decorative). They sit at a calm rest
   height when paused. When playing AND motion is allowed, audio.js sets
   [data-playing] on the button and the bars animate. */
.wf-audio__bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}

.wf-audio__bars span {
  display: block;
  width: 3px;
  height: 5px;                       /* calm rest height (paused) */
  border-radius: 2px;
  background-color: currentColor;
  transform-origin: bottom center;
}

/* Animate only when playing AND the user has not asked for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .wf-audio[data-playing] .wf-audio__bars span {
    animation: wf-audio-eq 0.9s ease-in-out infinite;
  }
  /* Stagger the three bars so they look lively, not robotic. */
  .wf-audio[data-playing] .wf-audio__bars span:nth-child(1) { animation-delay: 0s; }
  .wf-audio[data-playing] .wf-audio__bars span:nth-child(2) { animation-delay: 0.18s; }
  .wf-audio[data-playing] .wf-audio__bars span:nth-child(3) { animation-delay: 0.36s; }
}

@keyframes wf-audio-eq {
  0%, 100% { height: 5px; }
  50%      { height: 15px; }
}

/* When paused, give a subtle "filled middle" rest pose so the icon reads as a
   little equaliser even without motion. */
.wf-audio:not([data-playing]) .wf-audio__bars span:nth-child(2) { height: 9px; }
