/* ------------------------------------------------------------------
   Jetons de style
   ------------------------------------------------------------------ */
:root {
  --encre:        #10233A;
  --encre-douce:  #5C7189;
  --papier:       #E7ECF0;
  --surface:      #FFFFFF;
  --trait:        #C4CFD9;
  --surligneur:   #FFD84D;
  --alerte:       #B4402F;

  --police-titre:   "Bricolage Grotesque", system-ui, sans-serif;
  --police-lecture: "Newsreader", Georgia, serif;
  --police-donnee:  "IBM Plex Mono", ui-monospace, monospace;

  --rayon: 4px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: clamp(1.5rem, 5vw, 4rem) clamp(1rem, 5vw, 2rem) 4rem;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--police-lecture);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.contenu { max-width: 880px; margin: 0 auto; }

/* ------------------------------------------------------------------
   En-tête
   ------------------------------------------------------------------ */
.surtitre {
  font-family: var(--police-donnee);
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--encre-douce);
  margin: 0 0 .9rem;
}

h1 {
  font-family: var(--police-titre);
  font-weight: 800;
  font-size: clamp(2.1rem, 7vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -.03em;
  margin: 0 0 .6rem;
}

.chapeau {
  margin: 0 0 2.2rem;
  max-width: 48ch;
  color: var(--encre-douce);
  font-size: 1.05rem;
}

/* ------------------------------------------------------------------
   Feuille de saisie et prompteur
   ------------------------------------------------------------------ */
.feuille {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: clamp(1rem, 3vw, 1.6rem);
}

textarea {
  display: block;
  width: 100%;
  min-height: 240px;
  border: 0;
  padding: 0;
  resize: vertical;
  background: transparent;
  color: var(--encre);
  font-family: var(--police-lecture);
  font-size: 1.15rem;
  line-height: 1.65;
}
textarea:focus { outline: none; }
textarea::placeholder { color: #9AAABA; }

.prompteur {
  min-height: 240px;
  max-height: 48vh;
  overflow-y: auto;
  font-size: 1.28rem;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  scroll-behavior: smooth;
}

/* Chaque phrase est cliquable : on saute directement à sa lecture. */
.fragment {
  cursor: pointer;
  border-radius: 2px;
  transition: background-color .15s ease;
}
.fragment:hover { background: rgba(16, 35, 58, .06); }

/* Signature : la phrase en cours passe au marqueur jaune. */
.fragment.est-lu {
  background: linear-gradient(
    180deg,
    transparent 8%, var(--surligneur) 8%,
    var(--surligneur) 92%, transparent 92%
  );
}

.fragment.est-en-attente { opacity: .45; }

/* Barre de progression, collée au bas de la feuille. */
.progression {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0;
  background: var(--encre);
  border-bottom-left-radius: var(--rayon);
  transition: width .2s linear;
}

.pied-feuille {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: .9rem;
  padding-top: .8rem;
  border-top: 1px solid var(--trait);
  font-family: var(--police-donnee);
  font-size: .75rem;
  color: var(--encre-douce);
}

/* ------------------------------------------------------------------
   Réglages
   ------------------------------------------------------------------ */
.reglages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem 1.6rem;
  margin: 1.8rem 0;
}

.reglage { display: flex; flex-direction: column; gap: .45rem; }

.reglage > label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--police-donnee);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--encre-douce);
}

.valeur { color: var(--encre); font-weight: 500; letter-spacing: 0; }

select {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--surface);
  color: var(--encre);
  font-family: var(--police-titre);
  font-size: .95rem;
}

input[type="range"] {
  width: 100%;
  height: 1.6rem;
  margin: 0;
  accent-color: var(--encre);
  background: transparent;
}

/* ------------------------------------------------------------------
   Transport
   ------------------------------------------------------------------ */
.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
}

button {
  font-family: var(--police-titre);
  font-weight: 500;
  font-size: .95rem;
  padding: .7rem 1.2rem;
  border: 1px solid var(--encre);
  border-radius: var(--rayon);
  background: var(--surface);
  color: var(--encre);
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
button:hover:not(:disabled) { background: var(--encre); color: var(--surface); }
button:disabled { opacity: .35; cursor: not-allowed; }

.bouton-principal {
  background: var(--encre);
  color: var(--surface);
  padding-inline: 1.6rem;
  min-width: 8.5rem;
}
.bouton-principal:hover:not(:disabled) { background: #000; }

:focus-visible { outline: 3px solid var(--surligneur); outline-offset: 2px; }

.etat {
  flex: 1 1 12rem;
  text-align: right;
  font-family: var(--police-donnee);
  font-size: .78rem;
  color: var(--encre-douce);
}
.etat[data-type="erreur"] { color: var(--alerte); }

.note {
  margin-top: 2.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--trait);
  font-size: .88rem;
  color: var(--encre-douce);
  max-width: 60ch;
}

.est-masque { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .prompteur { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
