/* Impulsion V3 : une idée par bloc, peu de texte, mobile d'abord, aucune police externe.
   Couleurs provisoires : la charte de Loire Tourisme arrive, tout passe par ces variables. */
:root {
  --encre: #22262b;
  --encre-douce: #5a606a;
  --fond: #f8f6f1;
  --carte: #fff;
  --bord: #e3ddd1;
  --accent: #1d6b57;
  --accent-clair: #e3f1ec;
  --chaud: #f4b63f;
  --chaud-clair: #fdf3dc;
  --rayon: 14px;
  --ombre: 0 1px 2px rgba(34, 38, 43, .06), 0 4px 14px rgba(34, 38, 43, .06);
  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.5 var(--police); color: var(--encre); background: var(--fond); }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.65rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin-top: 2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .75rem; }
ul { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--chaud); outline-offset: 2px; }
.evitement { position: absolute; left: -999px; }
.evitement:focus { left: .5rem; top: .5rem; background: #fff; padding: .5rem; z-index: 10; }

/* En-tête : sobre, et sa navigation passe en barre d'onglets sur téléphone */
.entete { background: var(--carte); border-bottom: 1px solid var(--bord); position: sticky; top: 0; z-index: 5; }
.entete-in { max-width: 960px; margin: 0 auto; padding: .7rem 1rem; display: flex; align-items: center; gap: 1.25rem; }
.marque { text-decoration: none; color: var(--encre); display: flex; flex-direction: column; line-height: 1.1; }
.marque-nom { font-weight: 800; font-size: 1.15rem; }
.marque-sous { font-size: .75rem; color: var(--encre-douce); }
.nav-haut { display: flex; gap: .25rem; margin-left: auto; }
.nav-haut a { text-decoration: none; color: var(--encre); font-weight: 600; padding: .5rem .8rem; border-radius: 999px; }
.nav-haut a[aria-current="page"] { background: var(--accent-clair); color: var(--accent); }
.lien-profil { font-size: .9rem; color: var(--encre-douce); }

main { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem 3rem; display: block; }
main:focus { outline: none; }

.onglets { display: none; }
@media (max-width: 720px) {
  body { font-size: 16px; padding-bottom: 72px; }
  html { scroll-padding-top: 72px; scroll-padding-bottom: 84px; }
  .nav-haut { display: none; }
  .lien-profil { margin-left: auto; }
  .onglets { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--carte); border-top: 1px solid var(--bord); z-index: 6; padding-bottom: env(safe-area-inset-bottom); }
  .onglets a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .45rem 0 .5rem; font-size: .72rem; text-decoration: none; color: var(--encre-douce); min-height: 56px; justify-content: center; }
  .onglets svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .onglets a[aria-current="page"] { color: var(--accent); font-weight: 700; }
  h1 { font-size: 1.45rem; }
}

/* Blocs */
.chapo { color: var(--encre-douce); font-size: 1.02rem; }
.gratuit { display: inline-block; background: var(--accent-clair); color: var(--accent); font-weight: 600; font-size: .9rem; padding: .3rem .7rem; border-radius: 999px; }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 1rem 1.1rem; box-shadow: var(--ombre); }
.pile { display: grid; gap: .75rem; }
.retour { display: inline-block; margin-bottom: .75rem; font-size: .92rem; text-decoration: none; }
.meta { color: var(--encre-douce); font-size: .88rem; margin: 0; }
.nouveau { display: inline-block; background: var(--chaud-clair); color: #7a5300; font-size: .74rem; font-weight: 700; padding: .1rem .45rem; border-radius: 6px; vertical-align: middle; margin-left: .3rem; }

.bouton { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 46px; padding: .6rem 1.1rem; border-radius: 999px; border: 2px solid var(--accent); background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer; }
.bouton-clair { background: var(--carte); color: var(--accent); }
.boutons { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }

/* Recherche en langage courant */
.recherche { display: flex; gap: .5rem; margin: 1.2rem 0; }
.recherche input { flex: 1; min-width: 0; min-height: 50px; padding: .6rem 1rem; border: 2px solid var(--bord); border-radius: 999px; background: var(--carte); }
.recherche input:focus { border-color: var(--accent); outline: none; }
.recherche button { flex: none; }

/* Trois portes d'entrée */
.portes { display: grid; gap: .75rem; margin-top: 1.2rem; }
.porte { display: flex; align-items: center; gap: 1rem; text-decoration: none; color: var(--encre); padding: 1.1rem; }
.porte-icone { font-size: 1.9rem; line-height: 1; width: 3rem; height: 3rem; display: grid; place-items: center; background: var(--fond); border-radius: 12px; flex: none; }
.porte strong { display: block; font-size: 1.12rem; }
.porte span.meta { display: block; }
@media (min-width: 721px) { .portes { grid-template-columns: repeat(3, 1fr); } .porte { flex-direction: column; align-items: flex-start; } }

/* Filtres par thématique de l'ÉcoBoussole */
.puces { display: flex; flex-wrap: wrap; gap: .45rem; margin: .8rem 0; }
.puce { display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; padding: .35rem .8rem; border: 1px solid var(--bord); border-radius: 999px; background: var(--carte); text-decoration: none; color: var(--encre); font-size: .92rem; cursor: pointer; }
.puce[aria-pressed="true"], .puce[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.puce .compte { font-size: .78rem; opacity: .75; }
.puce-bientot { color: var(--encre-douce); background: transparent; border-style: dashed; cursor: default; }
details.bientot summary { cursor: pointer; color: var(--encre-douce); font-size: .92rem; min-height: 40px; display: flex; align-items: center; }

/* Listes de challenges */
.ligne-challenge { display: flex; gap: .8rem; align-items: center; text-decoration: none; color: var(--encre); }
.ligne-challenge .emoji { font-size: 1.5rem; flex: none; width: 2.2rem; text-align: center; }
.ligne-challenge strong { display: block; }
.fleche { margin-left: auto; color: var(--encre-douce); font-size: 1.3rem; }

/* Page d'un challenge */
.essentiel { background: var(--chaud-clair); border-color: #f1dfb3; }
.essentiel ol { margin: .2rem 0 0; padding-left: 1.2rem; }
.essentiel li { margin: .25rem 0; }
.action h3 { margin-bottom: .55rem; }
.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.chiffre { background: var(--fond); border-radius: 10px; padding: .45rem .6rem; }
.chiffre b { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--encre-douce); font-weight: 700; }
.chiffre span { font-size: .9rem; }
.cobenefice { margin: .55rem 0 0; font-size: .88rem; color: var(--encre-douce); }
.cobenefice::before { content: "＋ "; color: var(--accent); font-weight: 700; }
@media (max-width: 520px) { .chiffres { grid-template-columns: 1fr; } .chiffre { display: flex; gap: .6rem; align-items: baseline; } .chiffre b { width: 4.2rem; flex: none; } }
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.tuile { display: flex; flex-direction: column; gap: .2rem; padding: .85rem; text-decoration: none; color: var(--encre); }
.tuile .emoji { font-size: 1.4rem; }
.rex-video { display: flex; align-items: center; gap: .6rem; background: var(--encre); color: #fff; border-radius: 10px; padding: .7rem .9rem; margin: .6rem 0; border: 0; width: 100%; cursor: pointer; text-align: left; }
.rex-video .lecture { width: 2rem; height: 2rem; border-radius: 50%; background: #fff; color: var(--encre); display: grid; place-items: center; font-size: .8rem; flex: none; }
.rex-faits { display: grid; gap: .25rem; margin: .3rem 0 0; list-style: none; font-size: .92rem; }
.rex-faits b { color: var(--encre-douce); font-weight: 600; }
.encadre { border-left: 4px solid var(--accent); }
.liens-pro { list-style: none; display: grid; gap: .4rem; }
.liens-pro a { font-weight: 600; }
.discret { color: var(--encre-douce); font-size: .9rem; }

/* Pas à pas, à la manière d'une application de formation */
.progression { height: 10px; background: var(--bord); border-radius: 999px; overflow: hidden; margin: .5rem 0; }
.progression span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.chemin { list-style: none; position: relative; margin: 1.2rem 0; padding: 0; }
.chemin::before { content: ""; position: absolute; left: 27px; top: 28px; bottom: 28px; border-left: 3px dashed var(--bord); }
.chemin li { position: relative; display: flex; align-items: center; gap: 1rem; margin: 0 0 1rem; }
.noeud { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; flex: none; background: var(--carte); border: 3px solid var(--bord); color: var(--encre-douce); text-decoration: none; position: relative; z-index: 1; }
.noeud-fait { background: #2f9e6f; border-color: #2f9e6f; color: #fff; }
.noeud-suivant { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 6px var(--accent-clair); }
.chemin .titre-etape { text-decoration: none; color: var(--encre); }
.chemin .titre-etape strong { display: block; }
.badge { display: flex; gap: .8rem; align-items: center; }
.badge-rond { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; background: var(--chaud-clair); flex: none; filter: grayscale(1); opacity: .55; }
.badge-gagne .badge-rond { filter: none; opacity: 1; box-shadow: 0 0 0 4px var(--chaud); }
.etape-points { padding-left: 1.2rem; }
.etape-points li { margin: .4rem 0; }
.quiz fieldset { border: 0; padding: 0; margin: 0; }
.quiz legend { font-weight: 700; margin-bottom: .5rem; }
.choix { display: flex; align-items: center; gap: .6rem; min-height: 46px; padding: .5rem .8rem; border: 1px solid var(--bord); border-radius: 10px; margin: .4rem 0; cursor: pointer; background: var(--carte); }
.choix-bon { border-color: #2f9e6f; background: #e6f5ee; }
.choix-faux { border-color: #c98a00; background: var(--chaud-clair); }
.grille { width: 100%; border-collapse: collapse; font-size: .92rem; margin-top: .5rem; }
.grille th, .grille td { text-align: left; padding: .4rem .3rem; border-bottom: 1px solid var(--bord); }

/* Formulaires */
.champ { display: grid; gap: .3rem; margin: 0 0 1rem; }
.champ label, .champ legend { font-weight: 600; }
.champ input, .champ textarea, .champ select { min-height: 46px; padding: .55rem .8rem; border: 1px solid var(--bord); border-radius: 10px; background: var(--carte); width: 100%; }
fieldset.champ { border: 0; padding: 0; margin: 0 0 1.2rem; }
.options { display: flex; flex-wrap: wrap; gap: .45rem; }
.option { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .4rem .8rem; border: 1px solid var(--bord); border-radius: 999px; background: var(--carte); cursor: pointer; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-clair); color: var(--accent); font-weight: 600; }
.option input { accent-color: var(--accent); }
.filtres { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem; }
.filtres .champ { margin: 0; }
.merci { background: var(--accent-clair); border-color: #bfe0d4; }

/* Pied */
.pied { border-top: 1px solid var(--bord); background: var(--carte); }
.pied-in { max-width: 760px; margin: 0 auto; padding: 1.2rem 1rem 1.5rem; }
.pied-titre { font-weight: 700; margin-bottom: .4rem; }
.pied-liens { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin-bottom: .8rem; }
.pied-note { font-size: .82rem; color: var(--encre-douce); margin: 0; }

/* Fiche et mémo à imprimer */
.imprimable { background: #fff; border: 1px solid var(--bord); border-radius: var(--rayon); padding: 1.5rem; }
.imprimable h1 { font-size: 1.5rem; }
.imprimable ol { padding-left: 1.3rem; }
.imprimable li { margin: .5rem 0; }
.memo-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: .5rem 0 1rem; }
.memo-table th, .memo-table td { border: 1px solid var(--bord); padding: .45rem; text-align: left; vertical-align: top; }
.memo-table th { background: var(--fond); }
@media (max-width: 560px) {
  .memo-table thead { display: none; }
  .memo-table tr { display: block; border: 1px solid var(--bord); border-radius: 10px; margin-bottom: .6rem; padding: .3rem; }
  .memo-table td { display: block; border: 0; padding: .2rem .4rem; }
  .memo-table td:nth-child(2)::before { content: "Coût : "; font-weight: 700; }
  .memo-table td:nth-child(3)::before { content: "Gain : "; font-weight: 700; }
  .memo-table td:nth-child(4)::before { content: "Retour : "; font-weight: 700; }
}
.signature { font-size: .8rem; color: var(--encre-douce); margin-top: 1.2rem; }
@media print {
  .entete, .pied, .onglets, .ne-pas-imprimer, .evitement { display: none !important; }
  body { background: #fff; padding: 0; font-size: 12pt; }
  main { max-width: none; padding: 0; }
  .imprimable { border: 0; padding: 0; }
  a { color: inherit; text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
