/*
 * Punchbox — (c) 2026 Alexis Clement. Tous droits reserves.
 * Logiciel proprietaire. Toute reproduction ou diffusion interdite sans
 * autorisation ecrite.
 */

/* ==========================================================================
   TÉLESCRIPTEUR DE DOUBLAGE (mission pb-telescripteur)
   Zone dédiée EN BAS du poste de dictée : lit le texte à voix haute pendant
   l'enregistrement. Défilement continu sous une ligne de lecture repérée.

   Charte : aucune couleur hors jetons existants. Le télescripteur réutilise
   --enfonce / --texte / --laiton / --bordure. Le MODE FORT CONTRASTE (.tsc--
   contraste) est une surface de lecture d'accessibilité (noir/blanc neutres,
   non colorés) — exigée par la mission (contraste ≥ 7:1, lecture soutenue).
   ========================================================================== */

.telescripteur {
  margin: 24px auto 0;
  max-width: var(--largeur, 1120px);
  padding: 0 4px;
}

/* --- En-tête / disclosure titré ------------------------------------------- */
.tsc-titre-wrap {
  margin: 0;
  font-size: 1rem;
}
.tsc-bascule {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--bordure-forte);
  border-radius: var(--rayon-s);
  background: var(--surface);
  color: var(--texte);
  font: inherit;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: start;
  cursor: pointer;
}
.tsc-bascule:hover { border-color: var(--laiton); }
.tsc-bascule .tsc-chevron {
  flex: none;
  transition: transform .18s ease;
  color: var(--laiton);
}
.tsc-bascule[aria-expanded="true"] .tsc-chevron { transform: rotate(90deg); }
.tsc-bascule .tsc-titre-txt {
  color: var(--accent-titre);
  text-transform: uppercase;
}
.tsc-sous {
  margin: 6px 2px 0;
  color: var(--discret);
  font-size: .9rem;
}

/* --- Corps ---------------------------------------------------------------- */
.tsc-corps {
  margin-top: 12px;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-s);
  background: var(--carte);
  padding: 14px;
}

/* --- Barre de commandes --------------------------------------------------- */
.tsc-commandes {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 18px;
  margin-bottom: 14px;
}
.tsc-groupe {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tsc-transport { flex-wrap: wrap; }

/* Boutons de transport : réutilisent les boutons existants (charte). Ici on
   ne fait que la disposition ; le style vient de .bouton-plein/.bouton-secondaire. */
.tsc-transport .bouton-plein,
.tsc-transport .bouton-secondaire {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tsc-transport .tsc-btn-ico { flex: none; }

/* Réglages (glissières) : légende texte à gauche, valeur chiffrée à droite —
   la valeur est TOUJOURS annoncée en clair (accessibilité), jamais seulement
   par la position du curseur. */
.tsc-reglage {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
}
.tsc-reglage-tete {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.tsc-reglage-titre {
  color: var(--secondaire);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.tsc-valeur {
  color: var(--texte);
  font-family: var(--mono);
  font-size: .85rem;
  font-weight: 700;
}
.tsc-reglage input[type="range"] {
  width: 100%;
  accent-color: var(--laiton);
}

/* Choix de la source (transcription / traduction) */
.tsc-source {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.tsc-source legend {
  padding: 0;
  color: var(--secondaire);
  font-size: .82rem;
  font-weight: 600;
}
.tsc-source .tsc-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--texte);
  font-size: .92rem;
}
.tsc-source input[type="radio"] { accent-color: var(--vert); width: 16px; height: 16px; }

/* --- Écran de lecture ----------------------------------------------------- */
.tsc-ecran {
  position: relative;
  overflow: hidden;
  height: clamp(240px, 46vh, 620px);
  border: 1px solid var(--bordure-forte);
  border-radius: var(--rayon-s);
  background: var(--enfonce);          /* clair 14.3:1 / sombre 16.3:1 avec --texte */
  color: var(--texte);
  /* On empêche la sélection accidentelle pendant qu'on lit à voix haute. */
  user-select: none;
}

/* Ligne de lecture : bande repère fixe où l'œil se pose. À ~38 % du haut. */
.tsc-bande {
  position: absolute;
  left: 0;
  right: 0;
  top: 38%;
  height: calc(1em + 12px);
  transform: translateY(-6px);
  pointer-events: none;
  z-index: 2;
  background: color-mix(in srgb, var(--laiton) 16%, transparent);
  border-top: 2px solid var(--laiton);
  border-bottom: 2px solid var(--laiton);
}
/* Petit chevron sur le bord gauche de la bande, pour désigner la ligne. */
.tsc-bande::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 0; height: 0;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid var(--laiton);
}

/* Bloc défilant : c'est LUI qu'on translate. */
.tsc-defilant {
  position: relative;
  z-index: 1;
  will-change: transform;
}

/* Bloc de texte : GRANDE taille, largeur de lecture PLAFONNÉE même si la zone
   est plus large (une ligne trop large fatigue). La mesure suit la police
   (unité ch) : 2 à 4 mots par ligne aux grandes tailles. */
.tsc-texte {
  max-width: min(100%, 30ch);
  margin: 0 auto;
  padding: 0 20px;
  font-family: var(--sans);
  font-size: 64px;                     /* piloté en JS (glissière 24–160) */
  line-height: 1.35;
  font-weight: 600;
  text-align: start;
  white-space: pre-wrap;               /* respecte les retours du texte source */
  overflow-wrap: break-word;
  color: inherit;
}

/* Message quand il n'y a pas de texte à lire. */
.tsc-vide {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--discret);
  font-size: 1.05rem;
}

/* --- Aide clavier / mode --------------------------------------------------- */
.tsc-aide {
  margin: 12px 2px 0;
  color: var(--discret);
  font-size: .85rem;
  line-height: 1.6;
}
.tsc-aide kbd {
  font-family: var(--mono);
  font-size: .82em;
  background: color-mix(in srgb, var(--texte) 8%, transparent);
  border: 1px solid var(--bordure-forte);
  border-radius: 2px;
  padding: 1px 6px;
}
.tsc-mode-note {
  margin: 8px 2px 0;
  color: var(--accent-titre);
  font-size: .9rem;
  font-weight: 600;
}
.tsc-etat {
  margin: 8px 2px 0;
  min-height: 1.2em;
  color: var(--secondaire);
  font-size: .9rem;
}

/* --- Mode MOUVEMENT RÉDUIT (avance manuelle) ------------------------------ */
/* Par défaut, les commandes d'avance manuelle sont masquées ; le défilement
   continu (lecture/pause/vitesse) est visible. En mode réduit, on inverse :
   avance ligne par ligne, pas de moteur continu. */
.tsc-manuel-seul { display: none; }
.tsc--manuel .tsc-continu-seul { display: none; }
.tsc--manuel .tsc-manuel-seul { display: inline-flex; }
.tsc--manuel .tsc-mode-note { display: block; }

/* --- Mode FORT CONTRASTE (accessibilité, ≥ 7:1 garanti) ------------------- */
/* Surface de lecture neutre noir/blanc : 19.8:1. Indépendant du thème pour
   assurer la lisibilité soutenue à un mètre, même si le thème courant est
   clair. Ne touche à AUCUN autre élément de la page. */
.tsc--contraste .tsc-ecran {
  background: #0a0a0a;
  color: #ffffff;
  border-color: #ffffff;
}
.tsc--contraste .tsc-bande {
  background: color-mix(in srgb, #ffffff 14%, transparent);
  border-top-color: #ffffff;
  border-bottom-color: #ffffff;
}
.tsc--contraste .tsc-bande::before { border-left-color: #ffffff; }
.tsc--contraste .tsc-vide { color: #cfcfcf; }

/* --- Focus visible sur toutes les commandes (accessibilité) --------------- */
.telescripteur button:focus-visible,
.telescripteur input:focus-visible,
.telescripteur [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Réduction d'animation : pas de transition de chevron ------------------ */
@media (prefers-reduced-motion: reduce) {
  .tsc-bascule .tsc-chevron { transition: none; }
  .tsc-defilant { will-change: auto; }
}

/* --- Étroit : commandes en colonne ---------------------------------------- */
@media (max-width: 640px) {
  .tsc-commandes { gap: 12px; }
  .tsc-reglage { min-width: 100%; }
  .tsc-texte { font-size: 48px; }
}
