/* ————— the microphone on a text field, and the note beneath it —————
   Lifted from interview.html so every page shows the same control.
   Pairs with voice-input.js, which creates the markup. */

/* The wrapper holds only the field and the button, so the button can be
   pinned to the bottom of the box. The note sits OUTSIDE it — inside, it
   made the wrapper taller and pushed the button out of the field. */
.voice-host { position: relative; display: block; line-height: 0; }
.voice-host > textarea,
.voice-host > input[type="text"] { display: block; }

/* room for the button, so long text never runs underneath it */
.voice-host > textarea { padding-right: 44px; }
.voice-host > input[type="text"] { padding-right: 44px; }

.voice-host > .mic {
  position: absolute; bottom: 7px; right: 9px;
  appearance: none; width: 28px; height: 28px;
  border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #8A929C; background: transparent;
  cursor: pointer; padding: 0;
  transition: color .2s ease, background .2s ease;
}
/* a single-line field is short, so centre the button in it instead */
.voice-host > input[type="text"] + .mic { bottom: 50%; transform: translateY(50%); }

.voice-host > .mic svg { display: block; }
.voice-host > .mic:hover { color: #6E2C41; background: rgba(110, 44, 65, 0.08); }
.voice-host > .mic:focus-visible { outline: 2px solid #2E2E33; outline-offset: 1px; }

/* An empty field pulses three times to say the microphone is there, then
   goes quiet. A field that already has an answer never pulses — the founder
   has clearly found it, or does not need it. */
@keyframes mic-ready {
  0%, 100% { box-shadow: 0 0 0 0 rgba(92, 122, 153, .35); }
  60%      { box-shadow: 0 0 0 7px rgba(92, 122, 153, 0); }
}
.voice-host > .mic.is-ready { color: #5C7A99; animation: mic-ready 2.2s ease-out 3; }

/* Listening. The ring follows the actual input level (--level, set from the
   microphone), so speaking visibly moves it and silence does not. Until the
   first reading arrives it falls back to a steady pulse, which also covers
   browsers that give no level. */
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(177, 74, 90, .35); }
  60%      { box-shadow: 0 0 0 8px rgba(177, 74, 90, 0); }
}
.voice-host > .mic.is-recording {
  background: #B14A5A; color: #FFFFFF;
  animation: mic-pulse 1.4s ease-out infinite;
}
.voice-host > .mic.is-recording[style*="--level"] {
  animation: none;
  box-shadow: 0 0 0 var(--level, 4px) rgba(177, 74, 90, .28);
  transition: box-shadow .08s linear;
}

.voice-note {
  font-size: 13px; line-height: 1.6; color: #8A929C;
  margin: 8px 0 0;
}
.voice-note.is-recording { color: #B14A5A; }

@media (prefers-reduced-motion: reduce) {
  .voice-host > .mic.is-recording,
  .voice-host > .mic.is-ready { animation: none; }
}
