/* ==========================================================================
   Promolive – Réservation au moulin
   Charte colorée validée (cahier des charges, section 12)
   ========================================================================== */

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("../fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---------- Couleurs : mode clair ---------- */
:root {
  color-scheme: light dark;
  --fond: #F6F8F0;
  --surface: #FFFFFF;
  --texte: #1E2A18;
  --texte-2: #55634E;
  --ligne: #DCE3D0;
  --olive: #3F6B28;          /* titres, boutons */
  --sur-olive: #FFFFFF;      /* texte posé sur le vert olive */
  --feuille: #68B038;        /* sélection */
  --sur-feuille: #1E2A18;
  --libre: #E3F1D4;          /* créneau libre */
  --pris: #E3E6DC;           /* créneau pris */
  --ocre: #B0700F;           /* attention */
  --rouge: #B3261E;          /* complet, erreurs */
  --fond-erreur: #FBEDEC;
  --fond-attention: #FBF1E2;
  --focus: #1E2A18;

  --police-titre: "Source Serif 4", Georgia, "Times New Roman", serif;
  --police-texte: "Atkinson Hyperlegible", Verdana, Arial, sans-serif;
  --rayon: 12px;
}

/* ---------- Couleurs : mode nuit (automatique) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #141B11;
    --surface: #1D2719;
    --texte: #EAF0E2;
    --texte-2: #A4B29A;
    --ligne: #33422C;
    --olive: #8FCB62;
    --sur-olive: #141B11;
    --feuille: #68B038;
    --sur-feuille: #141B11;
    --libre: #26381D;
    --pris: #2A3325;
    --ocre: #E2A23C;
    --rouge: #F08A80;
    --fond-erreur: #3A1F1C;
    --fond-attention: #382A12;
    --focus: #EAF0E2;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police-texte);
  font-size: 1.25rem;            /* 20 px, jamais moins de 18 px */
  line-height: 1.5;
}
h1, h2, h3 { font-family: var(--police-titre); color: var(--olive); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--olive); text-underline-offset: 3px; text-decoration-thickness: 2px; }
strong { font-weight: 700; }

:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.cache { display: none !important; }
.lecteur-ecran {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.page { max-width: 680px; margin: 0 auto; padding: 0 16px 48px; }

/* ---------- En-tête ---------- */
.entete { text-align: center; padding: 24px 0 8px; }
.entete img { display: block; width: 110px; height: auto; margin: 0 auto 8px; }
.entete p { color: var(--texte-2); margin: 0 auto; max-width: 32em; }

/* ---------- Cartes des étapes ---------- */
.etape {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  padding: 20px 16px 24px;
  margin-top: 20px;
}
.etape h2 { display: flex; align-items: center; gap: 12px; }
.etape h2:focus { outline: none; }
.numero {
  flex: none;
  display: inline-grid; place-items: center;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--olive); color: var(--sur-olive);
  font-family: var(--police-texte); font-size: 1.15rem; font-weight: 700;
}
.aide { color: var(--texte-2); font-size: 1.125rem; }

/* ---------- Boutons des jours ---------- */
.grille-jours {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.jour {
  min-height: 72px; padding: 10px 8px;
  border: 2px solid var(--olive); border-radius: var(--rayon);
  background: var(--libre); color: var(--texte);
  font: inherit; font-size: 1.125rem; line-height: 1.3;
  cursor: pointer; text-align: center;
}
.jour .nom-jour { display: block; font-weight: 700; }
.jour .etat { display: block; font-size: 1rem; font-weight: 700; margin-top: 2px; }
.jour[aria-pressed="true"] {
  background: var(--feuille); color: var(--sur-feuille); border-color: var(--feuille);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--feuille);
}
.jour:disabled {
  background: var(--pris); border-color: var(--ligne); color: var(--texte-2); cursor: not-allowed;
}
.jour.complet .etat { color: var(--rouge); }

/* ---------- Grille des créneaux ---------- */
.legende {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  list-style: none; padding: 0; margin: 0 0 16px;
  font-size: 1.125rem; color: var(--texte-2);
}
.legende li { display: flex; align-items: center; gap: 8px; }
.pastille { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--olive); }
.pastille.libre { background: var(--libre); }
.pastille.pris { background: var(--pris); border-color: var(--ligne); }
.pastille.choisi { background: var(--feuille); border-color: var(--feuille); }

.grille-creneaux {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
}
.creneau {
  min-height: 60px; padding: 6px 4px;
  border: 2px solid var(--olive); border-radius: 10px;
  background: var(--libre); color: var(--texte);
  font: inherit; font-size: 1.25rem; font-weight: 700; line-height: 1.15;
  cursor: pointer;
}
.creneau .mention { display: block; font-size: .95rem; font-weight: 400; }
.creneau[aria-pressed="true"] {
  background: var(--feuille); color: var(--sur-feuille); border-color: var(--feuille);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--feuille);
}
/* Repère écrit en plus de la couleur, pour ceux qui distinguent mal les verts */
.creneau[aria-pressed="true"]::after,
.jour[aria-pressed="true"]::after {
  content: "✓ choisi"; display: block; font-size: .95rem; font-weight: 700;
}
.creneau:disabled {
  background: var(--pris); border-color: var(--ligne); color: var(--texte-2);
  cursor: not-allowed; font-weight: 400;
}

/* ---------- Formulaire ---------- */
.champ { margin-bottom: 20px; }
.champ label { display: block; font-weight: 700; margin-bottom: 6px; }
.champ .facultatif { font-weight: 400; color: var(--texte-2); }
.champ input:not([type="radio"]):not([type="checkbox"]) {
  display: block; width: 100%;
  min-height: 56px; padding: 10px 14px;
  border: 2px solid var(--texte-2); border-radius: 10px;
  background: var(--surface); color: var(--texte);
  font: inherit; font-size: 1.25rem;
}
.champ input:focus-visible { outline: 4px solid var(--feuille); outline-offset: 0; border-color: var(--olive); }
.champ input[aria-invalid="true"] { border-color: var(--rouge); }
.champ .aide { margin: 6px 0 0; }
.champ .erreur-champ { margin: 6px 0 0; color: var(--rouge); font-weight: 700; font-size: 1.125rem; }
.champ-kg { display: flex; align-items: center; gap: 10px; }
.champ-kg input { max-width: 10rem; }
.champ-kg span { font-weight: 700; }

/* Tranches de poids : grandes cases faciles à toucher */
.tranches { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.tranches legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.tranches > .aide { margin: 0 0 10px; }
.grille-tranches { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.tranches .tranche {
  display: flex; margin: 0; white-space: nowrap; align-items: center; gap: 10px;
  min-height: 56px; padding: 8px 12px;
  border: 2px solid var(--olive); border-radius: 10px;
  background: var(--libre); color: var(--texte);
  font-weight: 700; cursor: pointer;
}
.tranches .tranche input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--olive); }
.tranche:has(input:checked) { background: var(--feuille); border-color: var(--feuille); color: var(--sur-feuille); }
.tranche:has(input:focus-visible) { outline: 4px solid var(--focus); outline-offset: 3px; }
.tranches[aria-invalid="true"] .tranche { border-color: var(--rouge); }
.sous-champ { margin: 16px 0 0; }

/* Bidons à acheter : deux champs côte à côte quand la place le permet */
.champs-bidons { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.champs-bidons input { max-width: 10rem; }
#total-bidons:not(:empty) { font-weight: 700; color: var(--texte); }

/* Questions oui / non */
.question { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.question legend { font-weight: 700; padding: 0; margin-bottom: 10px; }
.choix-ligne { display: flex; flex-wrap: wrap; gap: 10px; }
.question .choix {
  display: flex; align-items: center; gap: 10px; margin: 0;
  flex: 1 1 7rem; min-height: 56px; padding: 8px 14px;
  border: 2px solid var(--olive); border-radius: 10px;
  background: var(--libre); color: var(--texte);
  font-weight: 700; cursor: pointer; white-space: nowrap;
}
.question .choix input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--olive); }
.question .choix:has(input:checked) { background: var(--feuille); border-color: var(--feuille); color: var(--sur-feuille); }
.question .choix:has(input:focus-visible) { outline: 4px solid var(--focus); outline-offset: 3px; }
.question[aria-invalid="true"] .choix { border-color: var(--rouge); }
.champ .case-a-cocher {
  display: flex; align-items: center; gap: 10px; margin: 12px 0 0;
  min-height: 48px; font-weight: 400; cursor: pointer;
}
.case-a-cocher input { width: 26px; height: 26px; margin: 0; accent-color: var(--olive); flex: none; }
.champ input:not([type="radio"]):not([type="checkbox"]):disabled { background: var(--pris); color: var(--texte-2); }

/* Champ piège pour les robots : invisible pour les humains */
.piege { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.recapitulatif {
  border-left: 6px solid var(--feuille);
  background: var(--libre);
  border-radius: 8px;
  padding: 12px 16px; margin: 8px 0 20px;
  font-size: 1.25rem;
}

.bouton {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 60px; padding: 12px 20px;
  border: 2px solid var(--olive); border-radius: var(--rayon);
  background: var(--olive); color: var(--sur-olive);
  font: inherit; font-size: 1.3rem; font-weight: 700;
  cursor: pointer; text-decoration: none; text-align: center;
}
.bouton:disabled { opacity: .65; cursor: wait; }
.bouton.secondaire { background: transparent; color: var(--olive); }
.bouton.danger { background: var(--rouge); border-color: var(--rouge); color: var(--surface); }

.rgpd {
  margin-top: 20px; padding: 14px 16px;
  border: 1px solid var(--ligne); border-radius: 10px;
  font-size: 1.125rem; color: var(--texte-2);
}
.rgpd p:last-child { margin-bottom: 0; }

/* ---------- Messages ---------- */
.message {
  border-radius: 10px; padding: 14px 16px; margin: 16px 0;
  font-weight: 700;
}
.message.erreur { background: var(--fond-erreur); border-left: 6px solid var(--rouge); color: var(--texte); }
.message.attention { background: var(--fond-attention); border-left: 6px solid var(--ocre); color: var(--texte); font-weight: 400; }
.message a, .confirmation p { overflow-wrap: break-word; }

.chargement { color: var(--texte-2); }

/* ---------- Confirmation ---------- */
.confirmation { text-align: left; }
.confirmation .coche, .confirmation h2 { text-align: center; }
.confirmation h2 { justify-content: center; }
.confirmation .coche {
  display: grid; place-items: center;
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--feuille); color: var(--sur-feuille);
  font-size: 2.6rem; font-weight: 700; margin: 0 auto 8px;
}
.fiche {
  text-align: left; margin: 16px 0 20px; padding: 0;
  list-style: none;
  border: 1px solid var(--ligne); border-radius: 10px;
}
.fiche li { padding: 12px 16px; border-bottom: 1px solid var(--ligne); }
.fiche li:last-child { border-bottom: 0; }
.fiche .libelle { display: block; color: var(--texte-2); font-size: 1.05rem; }
.fiche .valeur { font-weight: 700; font-size: 1.3rem; }
.pile-boutons { display: grid; gap: 12px; margin-top: 20px; }

/* ---------- Infos pratiques et pied de page ---------- */
.infos dl { margin: 0; }
.infos dt { font-weight: 700; }
.infos dd { margin: 0 0 12px; }
.a-completer { color: var(--ocre); font-weight: 700; }
.consignes { margin: 4px 0 0; padding-left: 1.4em; }
.consignes li { margin-bottom: 6px; }

.pied {
  margin-top: 32px; padding-top: 16px;
  border-top: 1px solid var(--ligne);
  text-align: center; color: var(--texte-2); font-size: 1.125rem;
}

/* ---------- Écrans plus larges ---------- */
@media (min-width: 600px) {
  .etape { padding: 28px 28px 32px; }
  .pile-boutons { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---------- Guide de bon usage (avant de réserver) ---------- */
.guide .gros { font-size: 1.25rem; font-weight: 700; }
.actions-guide { display: grid; gap: 12px; margin: 16px 0; }
.guide .case-a-cocher { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 2px solid var(--ligne); border-radius: var(--rayon); }
.guide .case-a-cocher:has(input:checked) { border-color: var(--feuille); background: var(--libre); }
.guide .case-a-cocher:has(input:disabled) { opacity: .7; }
.guide .case-a-cocher:has(input:focus-visible) { outline: 4px solid var(--focus); outline-offset: 3px; }
@media (min-width: 640px) { .actions-guide { grid-template-columns: 1fr 1fr; } }
