/* Voice input: while listening (js/llm/voice/modes.js) the mics wear the logo's running hover shine, its
   size driven by --voice-level (voiceLevel.js, ~60 Hz, 0..1). Filter/opacity/inset only: no box changes. */
@keyframes voiceGlowPulse {
    0%, 100% { filter: drop-shadow(0 0 1px color-mix(in srgb, var(--accent) 25%, transparent)); }
    50%      { filter: drop-shadow(0 0 7px color-mix(in srgb, var(--accent) 80%, transparent)); }
}
#voice-chat-btn.active .ic,
.chat-abtn.chat-voice-listening .ic, .ctx-assist-abtn.chat-voice-listening .ic {
    animation: voiceGlowPulse 1.2s ease-in-out infinite;
}
/* The sound waves are the mic's STATE alone; a hover pulses the body instead. */
.ic-mic .ic-wave-l, .ic-mic .ic-wave-r { opacity: 0; transition: opacity 0.2s ease; }
#voice-chat-btn.active .ic-mic .ic-wave-l, #voice-chat-btn.active .ic-mic .ic-wave-r,
.chat-voice-listening .ic-mic .ic-wave-l, .chat-voice-listening .ic-mic .ic-wave-r { opacity: 1; }
/* .voice-waves-in / -out for one flight (motion.js replayWaves); --ic-ms / --ic-delay stagger the arcs. */
/* !important: the hover trigger's :is()/:not() chain outranks any plain class. */
.voice-waves-in .ic-mic .ic-wave-l { animation-name: icmWaveInL !important; }
.voice-waves-in .ic-mic .ic-wave-r { animation-name: icmWaveInR !important; }
/* Twins of icmWaveOutL/R under their own names: CSS restarts an animation only when its name changes. */
@keyframes icmWaveInL { 0% { transform: translateX(2px) scale(0.2); }  100% { transform: none; } }
@keyframes icmWaveInR { 0% { transform: translateX(-2px) scale(0.2); } 100% { transform: none; } }
.voice-waves-out .ic-mic .ic-wave-l { animation-name: icmWaveAwayL !important; --ic-ms: 0.3s; --ic-ease: cubic-bezier(0.4, 0, 1, 1); }
.voice-waves-out .ic-mic .ic-wave-r { animation-name: icmWaveAwayR !important; --ic-ms: 0.3s; --ic-ease: cubic-bezier(0.4, 0, 1, 1); }
@keyframes icmWaveAwayL { 0% { transform: none; opacity: 1; } 100% { transform: translateX(-10px) scale(1.3); opacity: 0; } }
@keyframes icmWaveAwayR { 0% { transform: none; opacity: 1; } 100% { transform: translateX(10px) scale(1.3); opacity: 0; } }
/* A quarter larger than its 16px box, by transform, so the button never grows. */
#voice-chat-btn .ic { transform: scale(1.25); }
/* No hover lift: it is :not(.active), so a hovered mic would drop a pixel as it turns on. */
#voice-chat-btn:hover, #voice-chat-btn:active { transform: none; }
/* No UA focus ring: the mic keeps focus after the click and the ring drew over the shine. */
#voice-chat-btn:focus, #voice-chat-btn:focus-visible,
.chat-abtn.chat-voice-on:focus, .chat-abtn.chat-voice-on:focus-visible,
.ctx-assist-abtn.chat-voice-on:focus, .ctx-assist-abtn.chat-voice-on:focus-visible { outline: none; }
/* The halo is an accent box-shadow on ::after breathing on the 1.2s beat; opacity only, so the
   level-sized shadow never fights the keyframes. This spelling outranks layout/shimmer.css's hover sweep. */
#voice-chat-btn.active::after,
.btn-icon.chat-abtn.chat-voice-on.chat-voice-listening::after,
.btn-icon.ctx-assist-abtn.chat-voice-on.chat-voice-listening::after {
    content: "";
    inset: 0;
    border-radius: inherit;
    background: none;
    transform: none;
    z-index: -1;
    box-shadow: 0 0 calc(7px + 14px * var(--voice-level, 0)) calc(1px + 3px * var(--voice-level, 0)) var(--accent);
    animation: micHaloPulse 1.2s ease-in-out infinite;
    transition: box-shadow 0.06s linear;
}
@keyframes micHaloPulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
#voice-chat-btn.active,
.chat-abtn.chat-voice-listening, .ctx-assist-abtn.chat-voice-listening {
    box-shadow: none;
    transition: background 0.2s, color 0.2s;
}
/* The ray ring is drawn on the voice-dust canvas (ui/dust/voiceDust.js), where the tile is punched out;
   the halo needs the tile unclipped and its own stacking context so z-index:-1 sits under the glyph. */
#voice-chat-btn, .chat-abtn.chat-voice-on, .ctx-assist-abtn.chat-voice-on { position: relative; }
#voice-chat-btn.active, .chat-abtn.chat-voice-listening, .ctx-assist-abtn.chat-voice-listening {
    overflow: visible;
    isolation: isolate;
}
@media (prefers-reduced-motion: reduce) {
    /* The halo is the level readout, so it stays; voiceDust.js honours motionReduced. */
    #voice-chat-btn.active .ic,
    .chat-abtn.chat-voice-listening .ic, .ctx-assist-abtn.chat-voice-listening .ic { animation: none; }
    #voice-chat-btn.active::after,
    .btn-icon.chat-abtn.chat-voice-on.chat-voice-listening::after,
    .btn-icon.ctx-assist-abtn.chat-voice-on.chat-voice-listening::after { animation: none; opacity: 0.8; }
}
