/* =============================================================================
   Audioguide Pompeii — mise en page
   Complète css/typographie.css, qui est livré et n'est PAS modifié ici :
   familles, tokens de couleur, .numero-poste, .champ-code, lisibilité renforcée
   et préférences système y sont déjà définis.

   Reprise visuelle du 23 septembre 2026 — voir ADR-V1 à ADR-V6.
   Répartition des surfaces, identique sur tous les écrans :
     crème   : on y lit    (transcription, lignes de liste, actions)
     sable   : on y identifie le poste (numéro, titre, durée, saisie)
     bandeau : on y agit   (barre haute, lecteur)
   Les surfaces se touchent : aucune marge verticale entre deux fonds.

   Aucun px hors filets de 1 px. Cibles tactiles >= 2,75rem.
   ========================================================================== */

/* --- 0. Tokens complémentaires --------------------------------------------
   Ajoutés ici, jamais dans typographie.css. Aucun token existant n'est
   redéfini. Ratios mesurés en sRGB, formule WCAG 2.x.
   ------------------------------------------------------------------------ */

:root {
  /* Accent d'interface : bleu nuit. La charte imprimée reste terracotta —
     voir ADR-A12. --terracotta et --terracotta-txt subsistent dans
     typographie.css mais ne sont plus appelés. */
  --accent:          #1B3A5C;  /* 10,31 crème · 9,51 bandeau · 8,14 sable */
  --accent-txt:      #1B3A5C;  /* crème dessus : 10,31 */

  /* Le terracotta ne subsiste que pour l'erreur. Aucun autre usage. */
  --erreur:          #9E360A;  /* 6,23 sur crème · 4,93 sur sable */

  --bandeau:         #EDE8DC;  /* surface des commandes. encre 8,88 · accent 9,51 */
  --gris-selecteur:  #767676;  /* 4,54 sur blanc · 3,72 sur bandeau */
}

/* --- 1. Réinitialisation minimale ----------------------------------------- */

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

/* Toute règle `display` sur un élément porteur de [hidden] écraserait le
   display:none du navigateur : les écrans s'empileraient tous. On fige la
   priorité une fois pour toutes, avant la moindre règle de mise en page. */
[hidden] { display: none !important; }

/* Le fond est porté par html ET par body. En s'appuyant sur la seule
   propagation body -> canvas, Chrome en thème sombre peint la zone que le fond
   propagé ne couvre pas avec sa couleur de canvas sombre. Voir ADR-A11. */
html {
  -webkit-text-size-adjust: 100%;
  background: var(--creme);
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1, h2, p, ul, form, figure { margin: 0; }
ul { list-style: none; padding: 0; }
img { max-width: 100%; }

/* --- 2. Utilitaires ------------------------------------------------------- */

.hors-ecran {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Un seul style de focus dans tout le projet, toujours visible.
   Sur le bouton plein, le décalage laisse une bande de fond qui le détache. */
:focus-visible {
  outline: 0.1875rem solid var(--accent);
  outline-offset: 0.125rem;
}
/* Les titres reçoivent le focus par programme : pas de liseré parasite. */
h1:focus:not(:focus-visible),
main:focus:not(:focus-visible) { outline: none; }

.evitement {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--encre);
  color: var(--creme);
  transition: top 0.15s ease;
}
.evitement:focus { top: 0.5rem; }

/* --- 3. Barre haute — surface bandeau ------------------------------------- */

.barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;                 /* jamais de troncature à grande police */
  gap: 0.5rem;
  min-height: 3.5rem;
  padding: 0 0.5rem;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bandeau);
  color: var(--encre);             /* 8,88 */
}

.barre-nav    { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; min-height: 2.75rem; }
.barre-outils { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

/* Sur l'écran de langue, les deux outils sont déjà dans le contenu : les
   répéter dans la barre donnerait deux commandes concurrentes. */
body[data-ecran='langue'] .barre-outils,
body[data-ecran='chargement'] .barre-outils { display: none; }

.btn-barre {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  font: inherit;
  font-weight: 500;
  color: var(--encre);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.chevron { width: 1.125rem; height: 1.125rem; flex: 0 0 auto; }

/* Libellés visibles courts, noms accessibles complets en aria-label. */
.btn-outil {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--encre);             /* 10,86 sur blanc */
  background: var(--blanc);
  border: 1px solid var(--gris-selecteur);
  border-radius: 0.25rem;
  cursor: pointer;
  white-space: nowrap;
}

.bascule-lisibilite[aria-pressed='true'] {
  color: var(--creme);
  background: var(--accent);       /* 10,31 */
  border-color: var(--accent);
}

/* --- 4. Squelette des écrans ---------------------------------------------- */

#principal { flex: 1; display: flex; flex-direction: column; }

.ecran { display: block; }
.ecran-colonne { display: flex; flex-direction: column; flex: 1; }
.colonne-restante { display: flex; flex-direction: column; flex: 1; }

/* Marge latérale commune. 1rem en dessous de 22.5em (voir § 12). */
.bloc-marque,
.bloc-texte,
.bloc-saisie,
.bloc-choix,
.bloc-identite,
.bloc-lecteur,
.bloc-transcription,
.bloc-actions { padding-left: 1.25rem; padding-right: 1.25rem; }

.bloc-marque      { padding-top: 2.5rem; padding-bottom: 1.5rem; }
.bloc-texte       { padding-top: 1.75rem; padding-bottom: 1.25rem; }
.bloc-choix       { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.bloc-saisie      { padding-top: 1.5rem; padding-bottom: 1.5rem; background: var(--sable); }
.bloc-actions     { margin-top: auto; padding-top: 1.5rem; padding-bottom: 2rem; }
.bloc-actions > * + * { margin-top: 0.75rem; }

/* --- 5. Marque ------------------------------------------------------------ */

.marque {
  font-family: var(--police-titre);
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-txt);        /* 10,31 sur crème */
}
.marque-sous { font-size: 0.9375rem; margin-top: 0.25rem; }

/* --- 6. Titres ------------------------------------------------------------ */

h1, h2 { font-family: var(--police-titre); font-weight: 500; }

.titre-consigne { font-size: 1.375rem; line-height: 1.25; }

#titre-liste { font-size: 2.25rem; line-height: 1.1; }

#titre-poste {
  font-size: 2.125rem;
  line-height: 1.1;
  text-wrap: balance;
  hyphens: auto;
}
/* Variante B — sans image, le titre porte seul l'écran. */
#ecran-poste[data-variante='sans-image'] #titre-poste { font-size: 2.375rem; line-height: 1.08; }

.titre-section { font-family: var(--police-titre); font-weight: 500; font-size: 1.5rem; line-height: 1.2; }

/* --- 7. Boutons ------------------------------------------------------------
   Un seul bouton plein par écran : Écouter (accueil), Lecture/Pause (poste),
   Réessayer (panne), le choix de langue (entrée). Aucun dans la liste.
   ------------------------------------------------------------------------ */

.btn-plein {
  display: block;
  width: 100%;
  min-height: 3.5rem;
  padding: 0.75rem 1.25rem;
  font: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--creme);             /* 10,31 sur bleu nuit */
  background: var(--accent);
  border: 0;
  border-radius: 0;                /* angles droits */
  cursor: pointer;
}
.btn-plein[aria-disabled='true'] { opacity: 0.75; }

.btn-contour {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 1.25rem;
  font: inherit;
  font-weight: 600;
  color: var(--encre);
  background: transparent;
  border: 0.125rem solid var(--encre);   /* 9,63 sur crème */
  border-radius: 0;
  cursor: pointer;
}

a { color: var(--accent-txt); text-underline-offset: 0.2em; }

.secours { text-align: center; }
.secours a {
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  font-weight: 500;
}

/* --- 8. Sélecteur de langue ------------------------------------------------
   Divulgation simple : aria-expanded + aria-controls. Pas de role="listbox",
   pas de drapeau — « FR FR » sous Windows, lu n'importe comment.
   ------------------------------------------------------------------------ */

.langue { position: relative; }

.menu-langue {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 5;
  width: 17rem;
  max-width: calc(100vw - 2rem);
  padding: 0.5rem;
  color: var(--encre);
  background: var(--creme);
  border: 0.125rem solid var(--encre);
}

.menu-langue .choix-langue {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  font: inherit;
  text-align: left;
  color: var(--encre);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.menu-langue .choix-langue[aria-current='true'] { font-weight: 700; background: var(--sable); }

.choix-langue-entree { margin-top: 1.5rem; }
.choix-langue-entree li + li { margin-top: 0.75rem; }

.choix-menu { margin-top: 1.5rem; }
.choix-menu > * + * { margin-top: 0.75rem; }

.separateur { color: var(--accent); padding: 0 0.4rem; }

.mention-stockage { font-size: 0.875rem; line-height: 1.5; }
.mention-stockage + .mention-stockage { margin-top: 0.5rem; }
.menu-langue .mention-stockage { margin-top: 0.75rem; padding: 0 0.75rem; }
.option-lisibilite + .mention-stockage { margin-top: 1.25rem; }

/* --- 9. Saisie du code ----------------------------------------------------- */

.champ-code {
  display: block;
  width: 100%;
  margin-top: 0.875rem;
  font-size: 2.5rem;               /* surcharge la valeur de typographie.css */
  letter-spacing: 0.08em;
  min-height: 4.5rem;
  padding: 0 1rem;
  color: var(--encre);
  background: var(--creme);
  border: 0.125rem solid var(--encre);   /* 9,63 — identifie le champ */
  border-radius: 0;
}
/* L'état d'erreur est porté par trois moyens : le mot « Erreur : », le filet
   plus épais et la couleur. Jamais la couleur seule. */
.champ-code[aria-invalid='true'] { border-width: 0.1875rem; border-color: var(--erreur); }

.aide { font-size: 0.9375rem; margin-top: 0.5rem; }

/* Hauteur réservée : le bloc ne saute pas quand le message apparaît. */
.zone-message { min-height: 3rem; margin-top: 0.75rem; }

.apercu:not(:empty),
.erreur:not(:empty) {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 1rem;
  line-height: 1.4;
}
.apercu:not(:empty) { font-weight: 500; }
.erreur:not(:empty) { font-weight: 600; color: var(--erreur); }

.apercu:not(:empty)::before { content: '\2713'; flex: 0 0 auto; }
.erreur:not(:empty)::before { content: '\26A0'; flex: 0 0 auto; }

/* --- 10. Page d'un poste --------------------------------------------------- */

/* Image du poste, pleine largeur au-dessus du bandeau sable.
   width + aspect-ratio réservent la boîte avant chargement : aucun saut.
   loading="eager" dans le HTML : au-dessus de la ligne de flottaison.
   Quand l'image est null ou échoue, hidden la retire — aucun cadre vide. */
.image-poste {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--sable);
}

.bloc-identite {
  background: var(--sable);
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
}
.bloc-identite > * + * { margin-top: 0.5rem; }

/* Sans image, le bloc devient l'en-tête typographique du poste. */
#ecran-poste[data-variante='sans-image'] .bloc-identite {
  padding-top: 2rem;
  padding-bottom: 1.75rem;
}
#ecran-poste[data-variante='sans-image'] .bloc-identite > * + * { margin-top: 0.75rem; }

/* Chiffres en Inter, jamais en Oswald : condensée, 1 et 7 se confondent à
   distance en salle sombre. */
.numero-geant {
  font-family: var(--police-corps);
  font-weight: 400;
  font-size: 6rem;
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--encre);             /* 7,61 sur sable */
}

.meta-poste {
  font-size: 0.9375rem;
  line-height: 1.4;
  font-variant-numeric: lining-nums tabular-nums;
}
#position-poste { font-weight: 600; }

.legende { font-size: 0.875rem; font-style: italic; line-height: 1.45; }
.legende:not([hidden]) {
  border-top: 1px solid var(--encre);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
}

.note-attente {
  font-weight: 600;
  line-height: 1.4;
}

/* --- 11. Lecteur — surface bandeau ---------------------------------------- */

.bloc-lecteur {
  background: var(--bandeau);
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
}
.bloc-lecteur > * + * { margin-top: 0.5rem; }

/* L'anneau de focus est porté par le CONTENEUR : un outline sur l'input
   lui-même resterait correct ici, mais le conteneur donne une cible visuelle
   à la hauteur de la zone tactile. Voir ADR-V4. */
.piste-progression {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
}
.piste-progression:focus-within {
  outline: 0.1875rem solid var(--accent);
  outline-offset: 0.125rem;
}

#progression {
  --progression: 0%;
  display: block;
  width: 100%;
  height: 2.75rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
#progression:focus-visible { outline: none; }   /* l'anneau est sur le conteneur */
#progression:disabled { cursor: default; opacity: 0.55; }

#progression::-webkit-slider-runnable-track {
  height: 0.375rem;
  background: linear-gradient(to right,
    var(--accent) var(--progression), var(--creme) var(--progression));
  border: 1px solid var(--encre);
}
#progression::-moz-range-track {
  height: 0.375rem;
  background: linear-gradient(to right,
    var(--accent) var(--progression), var(--creme) var(--progression));
  border: 1px solid var(--encre);
}

#progression::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: -0.625rem;
  border-radius: 50%;
  background: var(--accent);
  border: 0.1875rem solid var(--creme);
}
#progression::-moz-range-thumb {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  border: 0.1875rem solid var(--creme);
}

.lecteur-temps {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  font-size: 0.9375rem;
  font-variant-numeric: lining-nums tabular-nums;
}

.lecteur-commandes { display: flex; justify-content: center; padding-top: 0.25rem; }

/* Le bouton plein de l'écran. */
.btn-rond {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.75rem;
  height: 4.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--creme);             /* 10,31 sur bleu nuit */
  background: var(--accent);
  cursor: pointer;
}
.btn-rond:disabled { opacity: 0.55; cursor: default; }
.icone-transport { width: 1.75rem; height: 1.75rem; }

.lecteur-etat:not(:empty) { font-weight: 600; line-height: 1.4; }
.lecteur-etat.est-erreur { color: var(--erreur); }

/* --- 12. Transcription ----------------------------------------------------- */

.bloc-transcription { padding-top: 1.5rem; padding-bottom: 2rem; }

.titre-section-porteur { margin: 0; }
#transcription-bascule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0;
  font: inherit;
  color: var(--encre);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.faux-lien {
  flex: 0 0 auto;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--accent-txt);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.transcription { margin-top: 1rem; }
.transcription p {
  font-size: 1.0625rem;
  line-height: 1.6;
  text-wrap: pretty;
}
.transcription p + p { margin-top: 1rem; }
#transcription-resume { margin-top: 0.75rem; }
#note-transcription { margin-top: 1rem; }

/* --- 13. Liste des postes -------------------------------------------------- */

.liste-postes { border-top: 1px solid var(--sable); }

.poste-liste { border-bottom: 1px solid var(--sable); }

.poste-liste > a,
.poste-liste > .ligne-inerte {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  min-height: 4rem;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  color: var(--encre);
}
.poste-liste > a:hover .titre-liste { text-decoration: underline; }

.numero-liste {
  font-family: var(--police-corps);
  font-weight: 600;
  font-size: 1.125rem;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--accent-txt);        /* 10,31 sur crème */
}

.colonne-titre { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.titre-liste { font-size: 1.0625rem; font-weight: 500; line-height: 1.3; }

.meta-liste {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.625rem;
  font-size: 0.875rem;
  font-variant-numeric: lining-nums tabular-nums;
}

.ligne-inerte { opacity: 0.75; }

/* --- 14. Absence de JavaScript --------------------------------------------- */

.sans-js { max-width: 34rem; margin: 0 auto; padding: 1.5rem 1.25rem; }
.sans-js h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.sans-js h2 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; }

.pied { padding: 1rem 1.25rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); }

/* --- 15. Contraste renforcé ------------------------------------------------
   typographie.css câble déjà prefers-contrast sur --encre et --terracotta-txt.
   L'interface n'appelant plus --terracotta-txt, on rebranche le renfort sur
   --erreur, à la valeur #8A2E08 déjà choisie dans le fichier livré.
   --accent n'est pas renforcé : 10,31 sur crème, rien à gagner.
   ------------------------------------------------------------------------ */

@media (prefers-contrast: more) {
  :root { --erreur: #8A2E08; }     /* 7,52 sur crème · 6,94 sur bandeau */
}

/* --- 16. Petits écrans ou grande police ------------------------------------
   Point de rupture en em : il se déclenche aussi quand le visiteur agrandit
   sa police système. À 16 px, 22.5em vaut 360 px ; à 20 px, 450 px.
   ------------------------------------------------------------------------ */

@media (max-width: 22.5em) {
  .bloc-marque, .bloc-texte, .bloc-saisie, .bloc-choix,
  .bloc-identite, .bloc-lecteur, .bloc-transcription, .bloc-actions {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .poste-liste > a, .poste-liste > .ligne-inerte { padding-left: 1rem; padding-right: 1rem; }
  .numero-geant { font-size: 4.5rem; }
  #titre-poste { font-size: 1.875rem; }
  #ecran-poste[data-variante='sans-image'] #titre-poste { font-size: 2rem; }
  #titre-liste { font-size: 1.875rem; }
}
