/* Voiceover (public/voiceover.js). The founder's reference (a Text to Speech
   screen) puts the controls in one column of stacked boxes and the results
   beside it; that layout is kept, drawn with the Atelier tokens (DESIGN.md §0):
   a neutral shell, the waveform is the work, the Make button is the one blue. */

.vo-shell { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: var(--s6); align-items: start; }

/* ---------------------------------------------------------------- controls */
.vo-form { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.vo-editor {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 10px;
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.vo-editor:focus-within { border-color: var(--accent-line); box-shadow: var(--focus); }
.vo-box-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.vo-box-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.vo-box-hint { text-wrap: pretty; margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); max-width: 46ch; }
.vo-optional { font-size: 11.5px; color: var(--muted); padding: 2px 8px; border-radius: var(--r-xs); background: var(--panel-2); border: 1px solid var(--border); }
.vo-script, .vo-details {
  width: 100%; border: 0; padding: 6px 0 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; line-height: 1.65; resize: none; outline: none; box-shadow: none;
  field-sizing: content; max-height: 50vh;
}
/* the box around it shows focus, not the field itself */
.vo-script:focus, .vo-details:focus, .vo-script:focus-visible, .vo-details:focus-visible { border: 0; outline: none; box-shadow: none; }
.vo-script { min-height: 120px; }
/* a long script scrolls: a thin quiet bar with room before the text (it sits on the left for Arabic) */
.vo-script, .vo-details { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; padding-inline-end: 10px; }
.vo-details { min-height: 64px; font-size: 14px; line-height: 1.55; }
.vo-script::placeholder, .vo-details::placeholder { color: var(--muted); opacity: .8; }
.vo-meta { display: flex; justify-content: space-between; gap: var(--s2); font-size: 12px; color: var(--muted); }
.vo-editor.is-small .vo-meta { justify-content: flex-end; }
.vo-count, .vo-dur.is-time, .vo-time, .vo-card-len { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.vo-pair { display: grid; grid-template-columns: 1fr; gap: var(--s3); }
.vo-field { display: flex; flex-direction: column; gap: 6px; }
.vo-seg { flex-wrap: wrap; }

/* voices: a short roster, the chosen one outlined (ElevenLabs' voice-row, two up) */
.vo-voice-group { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s2); }
.vo-voice-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.vo-voice-head .set-label { margin: 0; }
.vo-voices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.vo-voice {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px 8px 8px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--panel); color: var(--text);
  font: inherit; cursor: pointer; transition: border-color .15s ease;
}
.vo-voice:hover { border-color: var(--border-2); }
.vo-voice:active { transform: translateY(1px); }
.vo-voice.is-sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.vo-voice:focus-visible { outline: none; box-shadow: var(--focus); }
.vo-voice-mark {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-2);
  font-size: 14px; font-weight: 600;
}
.vo-voice.is-sel .vo-voice-mark { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.vo-voice-mark.is-sm { width: 30px; height: 30px; border-radius: var(--r-sm); font-size: 13px; }
.vo-voice-text { display: flex; flex-direction: column; min-width: 0; }
.vo-voice-name { font-size: 14px; font-weight: 600; }
/* « hear it »: a small round play beside the name, outside the pick button */
.vo-voice-cell { position: relative; min-width: 0; display: flex; }
.vo-voice-cell > .vo-voice { flex: 1; min-width: 0; }
.vo-voice.has-hear { padding-right: 48px; }
.vo-hear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--border-2); background: var(--panel); color: var(--text);
  transition: background-color .15s ease, border-color .15s ease;
}
.vo-hear .ico { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.vo-hear:hover { border-color: var(--muted); }
.vo-hear.is-playing { background: var(--text); border-color: var(--text); color: var(--panel); }
.vo-hear:focus-visible { outline: none; box-shadow: var(--focus); }
.vo-prev-note { margin: 0; font-size: 12.5px; }
.vo-voice-trait { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.vo-foot { display: flex; flex-direction: column; gap: 8px; padding: var(--s2) 0 var(--s3); }
.vo-make { width: 100%; min-height: 46px; font-size: 15px; justify-content: center; }
.vo-nocredit { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.vo-nocredit .set-status { margin: 0; }
.vo-make:active:not(:disabled) { transform: translateY(1px); }
/* disabled: a quiet neutral, not a faded blue (dark navy on dim indigo was unreadable) */
.vo-make:disabled { opacity: 1; background: var(--panel-2); border-color: var(--border-2); color: var(--muted); }

/* ---------------------------------------------------------------- results */
.vo-list { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.vo-list > .set-legend { margin: 0 0 var(--s1); }
.vo-empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--s4); padding: 56px var(--s5);
  border: 1px dashed var(--border-2); border-radius: var(--r-lg); text-align: center;
}
.vo-empty .vo-wave { width: min(360px, 100%); }

.vo-list { gap: var(--s2); }
/* one compact row per voiceover (the founder: « tu mets en petit »): play, who, length,
   download, delete. The one in the player opens to its waveform. */
.vo-card {
  display: flex; flex-direction: column; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.vo-card.is-current { border-color: var(--border-2); box-shadow: var(--shadow); }
.vo-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; }
.vo-card.is-running .vo-row { grid-template-columns: auto minmax(0, 1fr); }
.vo-card-who { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; align-items: baseline; min-width: 0; }
.vo-card-name { font-size: 14px; font-weight: 600; white-space: nowrap; }
.vo-card-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vo-card-len { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.vo-card.is-failed .vo-card-len { color: var(--danger); font-family: inherit; }
.vo-card-script {
  grid-column: 1 / -1; margin: 2px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vo-card.is-failed .set-status { margin: 0; }
.vo-icon-btn {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); border: 0; cursor: pointer;
  background: transparent; color: var(--muted); transition: background-color .15s ease, color .15s ease;
}
.vo-icon-btn .ico { width: 16px; height: 16px; }
.vo-icon-btn:hover { background: var(--panel-2); color: var(--text); }
.vo-icon-btn:active { transform: translateY(1px); }
.vo-hear:active { transform: translateY(-50%) scale(.94); }
.vo-icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.vo-open { display: none; flex-direction: column; align-items: flex-start; gap: 6px; }
.vo-card.is-current .vo-open { display: flex; }
.vo-open .vo-wave { width: 100%; height: 36px; }
.vo-aspreview { margin-left: -8px; }
.vo-more { align-self: center; }

.vo-play {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--text); color: var(--panel); transition: transform var(--dur-press) var(--ease-out);
}
.vo-play .ico { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.vo-play:active { transform: scale(.96); }
.vo-play:focus-visible { outline: none; box-shadow: var(--focus); }
.vo-time { font-size: 12.5px; color: var(--muted); min-width: 4ch; text-align: right; }

/* the waveform: real loudness of the MP3, played bars in ink */
.vo-wave {
  display: flex; align-items: center; justify-content: space-between; gap: 2px; height: 44px;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
}
.vo-wave.is-ready { cursor: pointer; border-radius: var(--r-xs); }
.vo-wave.is-ready:focus-visible { outline: none; box-shadow: var(--focus); }
.vo-bar {
  flex: 1 1 0; max-width: 4px; min-width: 2px; height: calc(var(--h, .3) * 100%); border-radius: 2px;
  background: var(--border-2); transition: background-color .12s linear, height var(--dur-3) var(--spring);
}
.vo-bar.is-played { background: var(--text); }
.vo-wave.is-ready:hover .vo-bar:not(.is-played) { background: var(--muted); }
.vo-wave.is-empty .vo-bar { background: var(--border); }

/* making: the bars breathe in a wave, left to right (Kokonut's ai-voice rhythm) */
.vo-wave.is-making .vo-bar { background: var(--accent-line); transform-origin: center; animation: vo-breathe 1.4s cubic-bezier(.23, 1, .32, 1) infinite; }
@keyframes vo-breathe { 0%, 100% { transform: scaleY(.35); } 45% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .vo-wave.is-making .vo-bar { animation: none; } }
.vo-making { margin: -4px 0 0; }

@media (max-width: 980px) {
  .vo-shell { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .vo-voices { grid-template-columns: 1fr; }
}

/* no lone word on the last line of the small notes (redesign audit, 17/10) */
.vo-foot .set-note, .vo-prev-note, .vo-empty .set-note { text-wrap: pretty; }
