/* Atelier URL / QR codes — feuille unique, polices système, aucune ressource externe. */

:root {
  --fond: #f6f7f9;
  --surface: #ffffff;
  --texte: #1a1f2b;
  --texte-doux: #4a5263;
  --bordure: #d5d9e0;
  --accent: #1d4ed8;
  --accent-texte: #ffffff;
  --accent-doux: #e6edfc;
  --sd: #7c3aed;        /* sous-domaines */
  --sd-fond: #f1eafd;
  --dom: #0f766e;       /* domaine enregistrable */
  --dom-fond: #e3f4f1;
  --suf: #a16207;       /* suffixe */
  --focus: #f59e0b;
  --rayon: 8px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 100%;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #11151c;
    --surface: #1a2029;
    --texte: #e8ebf0;
    --texte-doux: #a9b1bf;
    --bordure: #333c4a;
    --accent: #6b9cff;
    --accent-texte: #0b1220;
    --accent-doux: #1e2a42;
    --sd: #c4a5ff;
    --sd-fond: #2b2140;
    --dom: #5fd4c4;
    --dom-fond: #15302d;
    --suf: #f0c060;
    color-scheme: dark;
  }
}

/* Mode projection : plus grand, contraste forcé en clair. */
:root.projection {
  font-size: 137.5%;
  --fond: #ffffff;
  --surface: #ffffff;
  --texte: #000000;
  --texte-doux: #2b2f38;
  --bordure: #8a93a3;
  color-scheme: light;
}

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

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  padding-inline: max(16px, env(safe-area-inset-left, 0px));
}

.entete, .onglets, main, .pied {
  max-width: 64rem;
  margin-inline: auto;
}

h1 { font-size: 1.6rem; margin: 0; line-height: 1.2; }
h3 { font-size: 1.05rem; margin: 0 0 0.6rem; }

.entete {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.25rem 1rem;
}
.sous-titre { margin: 0.25rem 0 0; color: var(--texte-doux); }

/* Onglets */
.onglets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 2px solid var(--bordure);
}
.onglets [role="tab"] {
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  background: none;
  color: var(--texte-doux);
  cursor: pointer;
}
.onglets [role="tab"][aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

main { padding-block: 1.25rem 2rem; }
main:focus { outline: none; }

/* Formulaire */
.formulaire {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 1rem;
}
.formulaire > label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
.rangee {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.rangee-exemples { margin-top: 0.75rem; color: var(--texte-doux); }

input[type="text"], select {
  font: inherit;
  color: var(--texte);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 0.55rem 0.7rem;
}
input[type="text"] {
  flex: 1 1 18rem;
  min-width: 0;
  font-family: var(--mono);
}

.bouton {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--rayon);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-texte);
  cursor: pointer;
}
.bouton-secondaire {
  background: var(--surface);
  color: var(--accent);
}
.bouton[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-texte);
}

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

/* Résultats */
.resultat { margin-top: 1rem; display: grid; gap: 1rem; }
.resultat:empty { display: none; }

.bloc, .message {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 1rem;
  margin: 0;
}
.message p { margin: 0 0 0.6rem; }
.message p:last-child { margin-bottom: 0; }

.bandeau {
  margin: 0;
  padding: 0.6rem 1rem;
  border-radius: var(--rayon);
  background: var(--accent-doux);
  border-left: 4px solid var(--accent);
}

code {
  font-family: var(--mono);
  font-size: 0.95em;
}
.url { overflow-wrap: anywhere; word-break: break-all; }

.champs { margin: 0; display: grid; gap: 0.5rem; }
.ligne {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) 1fr;
  gap: 0.25rem 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--bordure);
}
.ligne:last-child { border-bottom: 0; padding-bottom: 0; }
.ligne dt { font-weight: 600; color: var(--texte-doux); }
.ligne dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 36rem) {
  .ligne { grid-template-columns: 1fr; }
}

/* Lecture visuelle de l'hôte */
.schema-hote {
  font-family: var(--mono);
  font-size: 1.25rem;
  margin: 0 0 0.6rem;
  overflow-wrap: anywhere;
  word-break: break-all;
  line-height: 1.8;
}
.schema-hote .part-sd { background: var(--sd-fond); color: var(--sd); padding: 0.1em 0.25em; border-radius: 4px; }
.schema-hote .part-dom { background: var(--dom-fond); color: var(--dom); padding: 0.1em 0.25em; border-radius: 4px; font-weight: 700; }
.schema-hote .part-suf { text-decoration: underline 2px var(--suf); text-underline-offset: 0.2em; }

.legende {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  color: var(--texte-doux);
  font-size: 0.9rem;
}
.legende li { display: flex; align-items: center; gap: 0.4rem; }
.puce { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: 3px; }
.puce.part-sd { background: var(--sd); }
.puce.part-dom { background: var(--dom); }
.puce.part-suf { background: var(--suf); }

/* Paramètres */
.defilement { overflow-x: auto; }
.parametres { border-collapse: collapse; width: 100%; }
.parametres th, .parametres td {
  text-align: left;
  vertical-align: top;
  padding: 0.3rem 0.6rem 0.3rem 0;
  border-bottom: 1px solid var(--bordure);
}
.parametres th { font-weight: 600; color: var(--texte-doux); }

/* Observations : neutres, sans code couleur de verdict. */
.observations { margin: 0 0 0.75rem; padding-left: 1.25rem; display: grid; gap: 0.5rem; }
.avertissement {
  margin: 0;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--bordure);
  color: var(--texte-doux);
  font-size: 0.92rem;
}

.discret { color: var(--texte-doux); font-size: 0.92rem; }

.pied {
  padding-block: 1rem 2rem;
  color: var(--texte-doux);
  font-size: 0.88rem;
  border-top: 1px solid var(--bordure);
}
.pied p { margin: 0.25rem 0; }

.visuellement-masque {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.lien-evitement {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: var(--surface);
  padding: 0.5rem 1rem;
  border-radius: var(--rayon);
}
.lien-evitement:focus { left: 1rem; z-index: 10; }

@media (prefers-reduced-motion: no-preference) {
  .bouton, .onglets [role="tab"] { transition: background-color 120ms, color 120ms, border-color 120ms; }
}



/* Lecteur de QR */
.zone-depot {
  background: var(--surface);
  border: 2px dashed var(--bordure);
  border-radius: var(--rayon);
  padding: 1rem;
}
.zone-depot.survol { border-color: var(--accent); background: var(--accent-doux); }
.zone-titre { margin: 0 0 0.75rem; font-weight: 600; }
.zone-depot .discret { margin: 0.75rem 0 0; }
input[type="file"] { font: inherit; max-width: 100%; }
.apercu-conteneur { overflow-x: auto; }
.apercu-qr { display: block; max-width: 100%; height: auto; border: 1px solid var(--bordure); border-radius: 4px; background: #fff; }
.bloc-apercu .discret { margin: 0.5rem 0 0; }
.contenu-brut {
  font-family: var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
  margin: 0 0 0.6rem;
  padding: 0.75rem;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 6px;
  max-height: 20rem;
  overflow-y: auto;
}
.bloc p { margin: 0 0 0.6rem; }
.bloc p:last-child { margin-bottom: 0; }

/* En-tête : actions */
.entete-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.statut { color: var(--texte-doux); font-size: 0.9rem; min-height: 1.2em; }

/* Exercices */
.liste-exercices { display: grid; gap: 1rem; }
.exercice h3 { font-size: 1.15rem; }
.contenu-exercice {
  margin: 0 0 0.75rem;
  padding: 0.75rem;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 6px;
  overflow-x: auto;
}
.contenu-exercice code { font-size: 1.05rem; }
.image-exercice { display: block; width: 12rem; max-width: 100%; height: auto; background: #fff; image-rendering: pixelated; }
.question { margin: 0 0 0.4rem; }
.reponse-libre {
  display: block;
  width: 100%;
  font: inherit;
  color: var(--texte);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 0.5rem 0.7rem;
  margin: 0.25rem 0 0.75rem;
  resize: vertical;
}
.actions-exercice { margin: 0 0 0.75rem; }
.corrige { border-top: 1px solid var(--bordure); padding-top: 0.6rem; }
.corrige summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  padding: 0.25rem 0;
  width: fit-content;
}
.corrige[open] summary { margin-bottom: 0.6rem; }

/* Mode projection : cibles plus grandes, contenu plus large */
:root.projection .entete, :root.projection .onglets, :root.projection main, :root.projection .pied { max-width: 80rem; }
:root.projection .schema-hote { font-size: 1.5rem; }
:root.projection .image-exercice { width: 16rem; }
:root.projection .onglets [role="tab"] { padding: 0.75rem 1.2rem; }

/* Petits écrans */
@media (max-width: 36rem) {
  h1 { font-size: 1.35rem; }
  .onglets [role="tab"] { padding: 0.55rem 0.6rem; font-size: 0.95rem; }
  .rangee > .bouton { flex: 1 1 auto; }
  .formulaire, .bloc, .message, .zone-depot { padding: 0.8rem; }
}
