/* Version mobile / application installée : barre d'onglets en bas, gros boutons, une action par carte */
/* Couleurs propres à ce fichier : certaines pages n'ont pas signal.css et theme.css donne --accent en RGB brut */
:root { --am-bg: #F5F8FC; --am-surface: #FFFFFF; --am-trait: #D8E1EC; --am-texte: #0B1F3A; --am-texte-2: #46566E; --am-accent: #1E63C9;
  --am-f-titre: 'Archivo', system-ui, -apple-system, sans-serif; --am-f-texte: 'Atkinson Hyperlegible', system-ui, -apple-system, sans-serif; }
html.dark { --am-bg: #060E1B; --am-surface: #0D1C33; --am-trait: #1D3150; --am-texte: #EAF1FA; --am-texte-2: #A3B3C9; --am-accent: #7CC0F5; }
.app-onglets { position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--am-surface); border-top: 1px solid var(--am-trait); }
.app-onglets a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; justify-content: center;
  color: var(--am-texte-2); text-decoration: none; font: 700 .72rem/1.1 var(--am-f-texte); border-radius: 12px;
  -webkit-tap-highlight-color: transparent; }
.app-onglets a svg { width: 24px; height: 24px; }
.app-onglets a[aria-current="page"] { color: var(--am-accent); }
.app-onglets a[aria-current="page"] svg { fill: color-mix(in srgb, currentColor 18%, transparent); }
.app-onglets a:focus-visible { outline: 3px solid var(--am-accent); outline-offset: -3px; }
html.avec-onglets body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

/* Application installée : barre du haut opaque (pas de flou), sous la barre d'état du téléphone */
.app-haut { position: sticky; top: 0; z-index: 55; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
  padding: env(safe-area-inset-top) 6px 0; min-height: calc(52px + env(safe-area-inset-top));
  background: var(--am-bg); border-bottom: 1px solid transparent; transition: border-color .2s; }
.app-haut.defile { border-bottom-color: var(--am-trait); }
.app-haut-titre { margin: 0; text-align: center; font: 800 1.05rem/1.2 var(--am-f-titre); color: var(--am-texte);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-haut-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px;
  color: var(--am-texte); background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.app-haut-btn svg { width: 22px; height: 22px; }
a.app-haut-btn { color: var(--am-accent); }
.app-haut-btn:active { background: var(--am-trait); }
.app-haut-btn:focus-visible { outline: 3px solid var(--am-accent); outline-offset: -3px; }
/* L'en-tête et le fil d'Ariane du site font doublon avec la barre du haut et les onglets */
html.en-app .sg-nav, html.en-app nav.sticky.top-0, html.en-app .chap-fil, html.en-app .aa-fil { display: none !important; }
html.en-app, html.en-app body { background: var(--am-bg); }
/* Parcours dans l'application : choix du chapitre dans la barre du haut, liste en panneau depuis le bas */
.app-haut .chap-choix { justify-self: center; min-width: 0; }
.app-haut .chap-choix > button { min-height: 40px; max-width: 100%; padding: 0 14px; border-radius: 999px; border: 1px solid var(--am-trait);
  background: var(--am-surface); color: var(--am-texte); font: 800 1rem var(--am-f-titre); -webkit-tap-highlight-color: transparent; }
.app-haut .chap-liste { position: fixed; left: 0; right: 0; top: auto; bottom: 0; z-index: 80; width: auto; max-height: 78vh;
  padding: 8px 10px calc(16px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; border: 0;
  box-shadow: 0 -20px 50px -20px rgb(11 31 58 / .45); overscroll-behavior: contain; }
.app-haut .chap-liste::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--am-trait); margin: 2px auto 10px; }
.app-haut .chap-liste a { min-height: 54px; font-size: 1rem; }
.app-haut .chap-liste a.verrou[aria-disabled="true"] { opacity: .6; }
.app-voile { position: fixed; inset: 0; z-index: 75; background: rgb(6 14 27 / .45); display: none; }
html:has(.chap-choix.ouvert) .app-voile { display: block; }
html:has(.chap-choix.ouvert) body { overflow: hidden; }
/* La barre du haut forme son propre plan : on la passe au-dessus du voile pour que le panneau le soit aussi */
html:has(.chap-choix.ouvert) .app-haut { z-index: 90; }

/* Demande de compte (visiteur), en panneau depuis le bas */
.app-compte { position: fixed; inset: 0; z-index: 100; }
.app-compte-voile { position: absolute; inset: 0; background: rgb(6 14 27 / .5); }
.app-compte-panneau { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  background: var(--am-surface); color: var(--am-texte); border-radius: 22px 22px 0 0; box-shadow: 0 -20px 50px -20px rgb(11 31 58 / .45);
  max-width: 560px; margin: 0 auto; animation: app-monte .22s ease-out; }
.app-compte-poignee { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--am-trait); margin: 0 auto 16px; }
.app-compte-panneau h2 { font: 800 1.35rem/1.2 var(--am-f-titre); margin: 0 0 8px; }
.app-compte-panneau p { margin: 0 0 18px; color: var(--am-texte-2); font: 400 1rem/1.5 var(--am-f-texte); }
.app-compte-btn { display: flex; align-items: center; justify-content: center; min-height: 52px; border-radius: 14px; text-decoration: none;
  background: var(--am-accent); color: #fff; font: 800 1.05rem var(--am-f-titre); }
html.dark .app-compte-btn { color: #0B1F3A; }
.app-compte-lien { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin-top: 4px;
  background: none; border: 0; color: var(--am-accent); font: 700 1rem var(--am-f-texte); text-decoration: none; cursor: pointer; }
.app-compte-lien:last-child { color: var(--am-texte-2); font-weight: 400; }
@keyframes app-monte { from { transform: translateY(40px); opacity: 0; } }

/* Tour guidé du premier lancement */
.app-tuto-voile { position: fixed; inset: 0; z-index: 95; }
html.tuto-actif .app-onglets { z-index: 97; }
html.tuto-actif .app-onglets a { pointer-events: none; }
.app-onglets a.tuto-cible { color: var(--am-accent); background: var(--am-surface); box-shadow: 0 0 0 9999px rgb(6 14 27 / .6), 0 0 0 2px var(--am-accent); position: relative; z-index: 1; }
html.tuto-actif:has(.app-tuto.centre) .app-tuto-voile { background: rgb(6 14 27 / .6); }
.app-tuto { position: fixed; z-index: 98; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto;
  padding: 18px; border-radius: 18px; background: var(--am-surface); color: var(--am-texte); box-shadow: 0 20px 50px -16px rgb(0 0 0 / .5);
  animation: app-monte .2s ease-out; }
.app-tuto::after { content: ""; position: absolute; bottom: -8px; left: calc(var(--fleche, 50%) - 12px - 8px); width: 16px; height: 16px;
  background: var(--am-surface); transform: rotate(45deg); border-radius: 0 0 4px 0; }
.app-tuto.centre { bottom: auto; top: 50%; transform: translateY(-50%); animation: none; }
.app-tuto.centre::after { display: none; }
.app-tuto-pas { margin: 0 0 4px; font: 700 .8rem var(--am-f-texte); color: var(--am-texte-2); }
.app-tuto h2 { margin: 0 0 6px; font: 800 1.2rem/1.2 var(--am-f-titre); }
.app-tuto p { margin: 0; font: 400 1rem/1.45 var(--am-f-texte); color: var(--am-texte-2); }
.app-tuto h2 + p { margin-bottom: 14px; }
.app-tuto-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.app-tuto-actions button { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 0; background: none; color: var(--am-texte-2);
  font: 700 1rem var(--am-f-texte); cursor: pointer; }
.app-tuto-actions .app-tuto-suivant { background: var(--am-accent); color: #fff; padding: 0 22px; }
html.dark .app-tuto-actions .app-tuto-suivant { color: #0B1F3A; }
@media (prefers-reduced-motion: reduce) { .app-compte-panneau, .app-tuto { animation: none; } }

/* Dans l'application installée, le pied de page du site ne sert à rien */
html.en-app footer { display: none; }

/* Écran d'accueil de l'application */
.app [hidden] { display: none !important; }
.app { padding: 18px 16px 24px; max-width: 560px; margin: 0 auto; }
.app-tete { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.app-tete img { width: 44px; height: 44px; }
.app-tete h1 { font: 800 1.45rem/1.15 var(--am-f-titre); margin: 0; }
.app-tete p { margin: 2px 0 0; color: var(--am-texte-2); font-size: .95rem; }
.app-chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.app-chiffre { border: 1px solid var(--am-trait); border-radius: 14px; background: var(--am-surface); padding: 12px 10px; text-align: center; }
.app-chiffre b { display: block; font: 800 1.35rem/1.1 var(--am-f-titre); }
.app-chiffre span { font-size: .8rem; color: var(--am-texte-2); }
.app-chiffre.flamme b { color: #E8743B; }
.app-carte { display: block; border-radius: 18px; padding: 18px; margin-bottom: 12px; text-decoration: none; color: inherit;
  border: 1px solid var(--am-trait); background: var(--am-surface); }
.app-carte.forte { background: var(--nuit); border-color: var(--nuit); color: #EAF1FA; }
.app-carte small { display: block; font-size: .85rem; color: var(--am-texte-2); margin-bottom: 4px; }
.app-carte.forte small { color: #7CC0F5; }
.app-carte h2 { font: 800 1.25rem/1.2 var(--am-f-titre); margin: 0 0 6px; }
.app-carte p { margin: 0 0 14px; font-size: .98rem; color: var(--am-texte-2); }
.app-carte.forte p { color: #A3B3C9; }
.app-carte .faire { display: flex; align-items: center; justify-content: center; min-height: 52px; border-radius: 14px;
  background: var(--bleu); color: #fff; font: 800 1.05rem var(--am-f-titre); }
html.dark .app-carte .faire, .app-carte.forte .faire { background: #7CC0F5; color: #0B1F3A; }
.app-carte .fait { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: 14px;
  background: rgb(52 199 123 / .15); color: var(--vert); font-weight: 800; }
.app-carte.forte .fait { color: #4ADE9A; }
.app-barre { height: 8px; border-radius: 99px; background: var(--am-trait); overflow: hidden; margin: 0 0 14px; }
.app-barre i { display: block; height: 100%; background: var(--vert-vif); border-radius: inherit; }
.app-liens { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.app-liens a { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 14px;
  border: 1px solid var(--am-trait); background: var(--am-surface); color: var(--am-texte); text-decoration: none; font-weight: 700; }
.app-plein { text-align: center; margin-top: 18px; font-size: .9rem; }
.app-plein a, .app-plein button { color: var(--am-texte-2); background: none; border: 0; font: inherit; text-decoration: underline; cursor: pointer; min-height: 44px; }
.app-plein + .app-plein { margin-top: 0; }

/* Grands écrans (ordinateur, tablette paysage, télévision) dans l'application installée :
   les onglets deviennent une colonne à gauche et l'accueil passe sur deux colonnes */
@media (min-width: 900px) {
  html.en-app .app-onglets { top: 0; right: auto; width: 6rem; grid-template-columns: none; grid-auto-rows: min-content; align-content: start;
    gap: .4rem; padding: calc(1rem + env(safe-area-inset-top)) .6rem 1rem calc(.6rem + env(safe-area-inset-left)); border-top: 0; border-right: 1px solid var(--am-trait); }
  html.en-app .app-onglets a { min-height: 4rem; font-size: .78rem; }
  html.en-app .app-onglets a svg { width: 1.6rem; height: 1.6rem; }
  html.en-app.avec-onglets body { padding-bottom: 0; padding-left: calc(6rem + env(safe-area-inset-left)); }
  html.en-app .app-haut { grid-template-columns: 3rem 1fr 3rem; padding-left: 1rem; padding-right: 1rem; }
  .app { max-width: 1040px; padding: 2rem 2.5rem 3rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: stretch; }
  .app > .app-tete, .app > .app-chiffres, .app > #carteDefi, .app > .app-liens, .app > .app-plein { grid-column: 1 / -1; }
  .app > .app-tete, .app > .app-chiffres { margin-bottom: .5rem; }
  .app-carte { margin-bottom: 0; display: flex; flex-direction: column; }
  .app-carte .faire, .app-carte .fait { margin-top: auto; }
  .app-chiffre b { font-size: 1.8rem; }
  .app-tuto.cote { animation: none; left: var(--x); right: auto; bottom: auto; top: var(--y); transform: translateY(-50%); width: min(360px, 40vw); margin: 0; }
  .app-tuto.cote::after { bottom: auto; top: calc(50% - 8px); left: -8px; border-radius: 0 0 0 4px; }
}
/* Télévision et très grands écrans : tout grandit avec l'écran pour rester lisible à distance */
@media (min-width: 1700px) { html.en-app { font-size: 20px; } .app { max-width: 1280px; } }
@media (min-width: 2400px) { html.en-app { font-size: 26px; } .app { max-width: 1600px; } }
