/* Direction « Calque » : papier crème, encre, bleu de calque, accent terre cuite. Couleurs uniquement dans :root. */
:root {
  --papier: #F4F1EA;
  --encre: #1B1B19;
  --calque: #2B4C7E;
  --terre: #C4553A;
  --trame: #E7E2D6;
  --filet: #CFC8B8;
  --titre: "Instrument Serif", Georgia, "Times New Roman", serif;
  --texte: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gouttiere: 16px;
  --cible: 44px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--papier);
  background-image:
    repeating-linear-gradient(0deg, var(--trame) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, var(--trame) 0 1px, transparent 1px 24px);
  color: var(--encre);
  font: 400 16px/1.6 var(--texte);
  overflow-x: hidden;
  overflow-wrap: anywhere;
}

main, header, footer, .assistant {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding-left: var(--gouttiere);
  padding-right: var(--gouttiere);
}

h1, h2 {
  font-family: var(--titre);
  font-weight: 400;
  line-height: 1.15;
  color: var(--encre);
  margin: 0 0 .6em;
}
h1 { font-size: clamp(2rem, 6vw, 3.2rem); margin-top: 1.2em; }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); margin-top: 1.8em; }

p { margin: 0 0 1em; }

a {
  color: var(--calque);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }

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

.saut {
  position: absolute;
  left: var(--gouttiere);
  top: -100px;
  background: var(--encre);
  color: var(--papier);
  padding: 10px 14px;
  min-height: var(--cible);
  z-index: 10;
}
.saut:focus { top: 8px; }

.haut {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--filet);
}

.marque {
  font-family: var(--titre);
  font-size: 1.35rem;
  color: var(--encre);
  text-decoration: none;
  min-height: var(--cible);
  display: inline-flex;
  align-items: center;
}

.haut nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.haut nav a, .langue {
  display: inline-flex;
  align-items: center;
  min-height: var(--cible);
  color: var(--encre);
}

.langue { font-family: var(--mono); font-size: .9rem; }

.accroche, section { margin-top: 1.5rem; }

.intro { font-size: 1.05rem; max-width: 64ch; }

.etapes {
  padding-left: 1.4em;
  margin: 0 0 1.5em;
  max-width: 64ch;
}
.etapes li { margin-bottom: .5em; }

.prix {
  width: 100%;
  border-collapse: collapse;
  background: var(--papier);
  margin-bottom: .6em;
}
.prix th, .prix td {
  text-align: left;
  vertical-align: top;
  padding: 10px 8px;
  border-bottom: 1px solid var(--filet);
}
.prix thead th { font-weight: 600; font-size: .9rem; }
.prix td {
  font-family: var(--mono);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.prix th[scope="row"] { font-weight: 400; }
.prix td[colspan] { white-space: normal; font-family: var(--texte); }

.note { font-size: .9rem; color: var(--encre); }

.travaux {
  padding-left: 1.2em;
  columns: 1;
  margin: 0 0 1em;
}
.travaux li { margin-bottom: .45em; }

.formulaire {
  display: grid;
  gap: 8px;
  max-width: 560px;
  margin-top: 1em;
}
.formulaire label { font-weight: 600; font-size: .95rem; }
.formulaire input, .formulaire textarea, .formulaire select {
  width: 100%;
  min-height: var(--cible);
  padding: 10px 12px;
  font: inherit;
  color: var(--encre);
  background: var(--papier);
  border: 1px solid var(--encre);
  border-radius: 0;
}
.formulaire textarea { min-height: 9em; resize: vertical; }
.formulaire input[type="file"] { padding: 8px; }
.formulaire input[type="checkbox"] { width: 24px; min-height: 24px; height: 24px; padding: 0; margin: 0; flex: none; }
.case {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--cible);
  font-weight: 400;
}
#chantier input[type="checkbox"] { width: 24px; height: 24px; margin: 0 10px 0 0; vertical-align: middle; }
#chantier > label { display: inline-block; min-height: var(--cible); }

button {
  justify-self: start;
  min-height: var(--cible);
  padding: 10px 20px;
  font: 600 1rem/1 var(--texte);
  color: var(--papier);
  background: var(--calque);
  border: 1px solid var(--calque);
  border-radius: 0;
  cursor: pointer;
}
button:hover { background: var(--encre); border-color: var(--encre); }
button:disabled { opacity: .6; cursor: progress; }
button[hidden] { display: none; }

.msg {
  min-height: 1.6em;
  margin: 1em 0;
  font-weight: 600;
}
.msg.erreur {
  border-left: 4px solid var(--terre);
  padding-left: 10px;
}
.msg.ok {
  border-left: 4px solid var(--calque);
  padding-left: 10px;
}

.liste { padding-left: 1.2em; }
.liste li { margin-bottom: .6em; min-height: var(--cible); display: flex; flex-wrap: wrap; align-items: center; }

.fiche {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px 0;
  margin: 0 0 1.2em;
  border-top: 1px solid var(--filet);
}
.fiche dt {
  font-size: .85rem;
  color: var(--encre);
  padding-top: 12px;
}
.fiche dd {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--filet);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.fiche dd ul { font-family: var(--texte); padding-left: 1.2em; margin: 0; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 1.2em 0;
}

/* Assistant : sous le contenu de chaque page, jamais par-dessus. La réponse porte le filet bleu de calque. */
.assistant {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--filet);
}
.assistant h2 { margin-top: 0; }
.assistant-intro { max-width: 64ch; }
.assistant-fil {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  max-width: 64ch;
}
.assistant-fil li { margin: 0 0 1rem; }
.assistant-auteur {
  margin: 0 0 .2em;
  font: 600 .85rem/1.4 var(--mono);
}
.assistant-texte { margin: 0; white-space: pre-wrap; }
.assistant-reponse {
  border-left: 2px solid var(--calque);
  padding-left: 12px;
}
.assistant .note { max-width: 64ch; }

.pied {
  margin-top: 3rem;
  padding-top: 1.2rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--filet);
  font-size: .9rem;
}

@media (min-width: 640px) {
  .fiche {
    grid-template-columns: minmax(10em, 14em) minmax(0, 1fr);
  }
  .fiche dt { padding-right: 16px; }
  .fiche dd { padding-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Page du lien de connexion : un bouton par langue, pleine largeur sur téléphone. */
.page-lien form { margin: 1rem 0; }
.page-lien button { width: 100%; max-width: 22rem; }

/* Dossier de permis : une question par bloc, filet de calque à gauche comme les messages. */
.formulaire fieldset {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0 0 12px;
  padding: 12px 0 12px 14px;
  border: 0;
  border-left: 2px solid var(--filet);
}
.formulaire legend { padding: 0; font: 400 1.35rem/1.2 var(--titre); }
.formulaire input[type="radio"] { width: 24px; min-height: 24px; height: 24px; padding: 0; margin: 0; flex: none; }
.formulaire .parcelle { border-left-color: var(--calque); }
.formulaire .parcelle legend { font: 600 .95rem/1.2 var(--texte); }
.aide { margin: 0; font-size: .9rem; }
.sous-bloc { display: grid; gap: 8px; }
.sous-bloc[hidden] { display: none; }
button.secondaire { color: var(--calque); background: transparent; }
button.secondaire:hover { color: var(--papier); background: var(--encre); }
.etat-dossier { font-weight: 600; border-left: 4px solid var(--calque); padding-left: 10px; }
.etat-dossier:empty { display: none; }

/* Pages de contenu (service, guide, FAQ par région) */
.fil { font-size: .9rem; margin-top: 1rem; overflow-wrap: anywhere; }
.fil a { display: inline-flex; align-items: center; min-height: var(--cible); }
.contenu { max-width: 70ch; }
.contenu h2 { margin-top: 2rem; }
.contenu ul { padding-left: 1.2em; }
.contenu li { margin-bottom: .45em; }
.chapeau { font-size: 1.1rem; }
.action { margin: 1.5rem 0; }
.bouton {
  display: inline-flex; align-items: center; min-height: var(--cible); padding: 10px 20px;
  font: 600 1rem/1.2 var(--texte); color: var(--papier); background: var(--calque);
  border: 1px solid var(--calque); text-decoration: none;
}
.bouton:hover { background: var(--encre); border-color: var(--encre); }
.contenu details { border-top: 1px solid var(--filet); padding: .6rem 0; }
.contenu summary { cursor: pointer; font-weight: 600; min-height: var(--cible); display: flex; align-items: center; }
.contenu details p { margin: .5rem 0 0; }
.liens li { min-height: var(--cible); display: flex; align-items: center; }
.pied-regions { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-bottom: .75rem; }
.pied-regions a { min-height: var(--cible); display: inline-flex; align-items: center; }
