/*
 * Socle commun à toutes les pages : matière, couleurs, typographie, logo.
 *
 * L'outil sert dans une salle sombre : fond graphite, peu de lumière. Les couleurs portent un sens et rien d'autre :
 * le rouge dit "à l'écran", le vert "relié", l'ambre "à regarder", et la couleur d'accent ce qui est choisi ou
 * l'action principale. Ce que le public voit (stage.css) a ses propres réglages.
 */
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('../fonts/atkinson-hyperlegible-next.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Mono';
  src: url('../fonts/atkinson-hyperlegible-mono.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* matière */
  --fond: #14161a;
  --surface: #1c1f25;
  --surface-2: #272b33;
  --filet: #373c47;
  --trait-fort: #5d6573;   /* contour des commandes qu'on doit voir d'abord */
  --texte: #eef0f4;
  --sourdine: #9ba3b0;   /* texte secondaire */
  --noir: #000;
  --blanc: #fff;

  /* sens */
  --accent: #8f9bff;        /* ce qui est choisi, l'action principale */
  --accent-encre: #0e1020;  /* texte posé sur l'accent */
  --direct: #ff453a;        /* réservé à "à l'écran" */
  --ok: #32d26a;            /* relié, tout va bien */
  --alerte: #ffb224;        /* à regarder */
  --erreur-fond: #3b1414;
  --erreur-encre: #ffb9b3;

  /* Une seule famille, choisie pour se lire d'un coup d'œil dans le noir : le zéro et le O, le 1 et le l s'y
     distinguent, ce qui compte pour un code dicté à voix haute. La variante à chasse fixe sert aux codes. */
  --police: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --chasse-fixe: 'Atkinson Hyperlegible Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: dark;
}

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

html, body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* Titres */
.display {
  font-family: var(--police);
  font-weight: 750;
  letter-spacing: -0.012em;
  line-height: 1.1;
}

/* Le logo : le nom du produit, en un mot. */
.logo {
  display: inline-block;
  margin: 0;
  color: var(--texte);
  font-family: var(--police);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- pages simples : connexion, administration, saisie d'un code ---------- */

.champ {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--filet);
  border-radius: 0.5rem;
  background: var(--surface);
  font-size: 1rem;
}
.champ:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.champ.code { font-family: var(--chasse-fixe); letter-spacing: 0.08em; }
.etiquette { display: block; margin: 0 0 0.3rem; color: var(--sourdine); font-size: 0.9rem; }

.btn-main {
  padding: 0.72rem 1.2rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--accent-encre);
  font-weight: 750;
  font-size: 1rem;
  white-space: nowrap;
}
.btn-main:hover { filter: brightness(1.08); }
.btn-main:active { transform: translateY(1px); }
.btn-main:disabled { opacity: 0.5; cursor: default; }

.btn-second {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--filet);
  border-radius: 0.5rem;
  background: none;
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
}
.btn-second:hover { background: var(--surface-2); }

.message-erreur { margin: 0; padding: 0.65rem 0.85rem; border-radius: 0.5rem; background: var(--erreur-fond); color: var(--erreur-encre); }
.message-erreur a { color: var(--blanc); }

/* ---------- langue de l'interface ---------- */

/* Bascule FR / EN, commune à toutes les pages */
.lang { display: inline-flex; flex: none; border: 1px solid var(--filet); border-radius: 0.5rem; overflow: hidden; }
.lang button { padding: 0.42rem 0.62rem; border: 0; background: none; color: inherit; font: inherit; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.03em; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--texte); color: var(--fond); cursor: default; }
/* Dans le coin haut droit d'une page simple (caméra avant le départ, accueil) */
.lang-corner { position: absolute; top: calc(env(safe-area-inset-top) + 1.1rem); right: 1.25rem; }
.lang-corner:empty, [data-lang-toggle]:empty { display: none; }
/* En anglais, le corps de page attend d'être traduit avant de s'afficher (voir lang-boot.js) */
html.i18n-wait body { visibility: hidden; }
