/* ================================================================
   VOICE.CSS — Study's voice mode (conceptual/tutor/voice_mode.js): one
   full-screen orb and two round buttons (Seth, 2026-10-06: "no text, it
   just has the voice thing on the screen"), plus, since 2026-10-09, the
   open question's text under the orb (.vm-q) so it can be re-read. Phone
   first.

   The orb's size and glow follow `--lvl` (0–1, the voice level the script
   writes each frame); `data-state` on .vm sets its look:
     speaking  the tutor talks: the XP gradient, moving with the voice
     listening your turn: bright, moving with your voice
     thinking  transcribing / grading / fetching: a slow breath
     paused | done | error | nomic: dimmed, with a play or mic-off glyph
   Token-only colours, as the rest of styles/conceptual. Also the Study-by-
   phone dialog (phone_link.js), at the end.
   ================================================================ */

body.vm-open { overflow: hidden; }

.vm {
  --lvl: 0;
  align-items: center;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 28px;
  inset: 0;
  justify-content: center;
  overscroll-behavior: contain;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  position: fixed;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  z-index: 10000;
}

.vm-orb {
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 34% 28%, rgb(var(--tint-rgb) / 0.55), transparent 52%),
    linear-gradient(145deg, var(--xp-from), var(--xp-to));
  border: 0;
  border-radius: 50%;
  box-shadow: 0 0 calc(24px + 70px * var(--lvl)) rgb(var(--xp-glow-rgb) / calc(0.22 + 0.5 * var(--lvl)));
  cursor: pointer;
  display: grid;
  margin-top: -8vh;
  padding: 0;
  place-items: center;
  position: relative;
  transform: scale(calc(0.9 + 0.3 * var(--lvl)));
  transition: filter 0.3s ease, box-shadow 0.08s linear;
  width: min(58vw, 34vh, 280px);
}

.vm-orb:focus-visible { outline: 3px solid var(--xp-to); outline-offset: 10px; }

.vm[data-state="listening"] .vm-orb {
  background:
    radial-gradient(circle at 40% 32%, var(--white), rgb(var(--xp-glow-rgb) / 0.55) 70%),
    var(--xp-to);
}

.vm[data-state="thinking"] .vm-orb,
.vm[data-state="starting"] .vm-orb {
  animation: vm-breathe 1.8s ease-in-out infinite;
  filter: saturate(0.55) brightness(0.85);
}

.vm[data-state="paused"] .vm-orb,
.vm[data-state="done"] .vm-orb,
.vm[data-state="nomic"] .vm-orb {
  filter: grayscale(0.85) brightness(0.6);
}

.vm[data-state="error"] .vm-orb {
  box-shadow: 0 0 40px rgb(var(--danger-rgb) / 0.55);
  filter: grayscale(0.6) brightness(0.7);
}

@keyframes vm-breathe {
  0%, 100% { transform: scale(0.86); }
  50% { transform: scale(0.95); }
}

.vm-icon { display: none; height: 34%; width: 34%; }
.vm-icon svg { fill: var(--white); height: 100%; stroke: var(--white); width: 100%; }
.vm-icon-mic svg { fill: none; }
.vm:is([data-state="paused"], [data-state="done"], [data-state="error"]) .vm-icon-play,
.vm[data-state="nomic"] .vm-icon-mic { display: block; }

.vm-bar {
  bottom: calc(32px + env(safe-area-inset-bottom));
  display: flex;
  gap: 40px;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
}

.vm-btn {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  display: flex;
  height: 60px;
  justify-content: center;
  padding: 0;
  width: 60px;
}

.vm-btn svg { fill: currentColor; height: 24px; stroke: currentColor; width: 24px; }
.vm-close { background: rgb(var(--danger-rgb) / 0.16); border-color: rgb(var(--danger-rgb) / 0.4); }
.vm-btn:focus-visible { outline: 2px solid var(--xp-to); outline-offset: 3px; }

/* The open question (voice_mode.js showQuestion): readable, selectable, and
   scrolls on its own so a long one never reaches the buttons below. */
.vm-q {
  color: var(--text);
  font-family: var(--ui-font);
  font-size: 17px;
  line-height: 1.5;
  margin: 0;
  max-height: 32vh;
  max-width: min(640px, calc(100vw - 40px));
  overflow-y: auto;
  text-align: center;
  user-select: text;
}

/* Read by screen readers only: the state, since nothing on screen says it. */
.vm-sr {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: 0;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* A round button at the end of Study's dock row: Study by phone (the voice
   mic moved to the Learner Home's Voice switch, 2026-10-09). */
.ct-voice {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  margin-left: auto;
  min-width: 0;
  padding: 0;
  width: 42px;
}
.ct-voice svg { fill: none; height: 20px; stroke: currentColor; width: 20px; }
.ct-voice + .ct-phone { margin-left: 0; }

/* STUDY BY PHONE (conceptual/tutor/phone_link.js): the line's number, the
   linked phones, and a one-time code to type on a phone's first call. */
.pl-dialog {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  color: var(--text);
  box-sizing: border-box;
  max-width: min(460px, calc(100vw - 32px));
  padding: 22px 24px;
}
.pl-dialog::backdrop { background: var(--scrim-modal); }
.pl-dialog h3 { font-size: 18px; margin: 0 0 12px; }
.pl-dialog p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 12px; }
.pl-number { color: var(--text); font-weight: 600; white-space: nowrap; }
.pl-codebox { border: 1px solid var(--border); border-radius: 10px; margin: 0 0 12px; padding: 12px 14px; }
.pl-dialog .pl-code {
  color: var(--text);
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
}
.pl-dialog .pl-error { color: var(--danger); }
.pl-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  .vm-orb { transform: none; transition: none; }
  .vm[data-state="thinking"] .vm-orb, .vm[data-state="starting"] .vm-orb { animation: none; }
}
