/* =========================================================
   Recouvre-moi si tu peux · « carto épurée, accents LFI »
   ========================================================= */

/* ---- Polices auto-hébergées : à changer ICI uniquement ---- */
@font-face { font-family: "Public Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/PublicSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/PublicSans-Bold.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 900; font-style: normal; font-display: swap; src: url("../fonts/PublicSans-Black.woff2") format("woff2"); }

:root {
  --police-titre: "Public Sans", system-ui, sans-serif;
  --police-corps: "Public Sans", system-ui, sans-serif;

  /* Charte (les deux jeux de violet/rouge sont gardés) */
  --c-blanc: #FFFFFF;
  --c-creme: #FFFCF4;
  --c-charbon: #212320;
  --c-violet: #4C0297;
  --c-violet-vif: #7b13d6;
  --c-rouge: #D1271C;
  --c-rouge-vif: #f91616;
  --c-vert: #2e9959;
  --c-jaune: #f9c900;
  --c-bleu: #3885f4;
  --c-rose: #ed5fb1;
  --c-gris: #8A8D87;

  /* Rôles, thème clair */
  --fond: var(--c-blanc);
  --surface: var(--c-creme);
  --texte: var(--c-charbon);
  --texte-doux: #4f524c;
  --trait: var(--c-charbon);
  --accent: var(--c-violet);
  --sur-accent: var(--c-blanc);
  --urgence: var(--c-rouge);
  --sur-urgence: var(--c-blanc);

  --rayon: 3px;
  --ep: 2px;
  --zone: 48px;
  color-scheme: light dark;
}

/* Thème sombre automatique, selon le réglage du téléphone */
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #212320;
    --surface: #2b2d29;
    --texte: #FFFCF4;
    --texte-doux: #cfcbbf;
    --trait: #FFFCF4;
    --accent: #B98CFF;   /* violet éclairci, contraste AA sur charbon */
    --sur-accent: #212320;
    --sur-urgence: #FFFCF4;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 400 16px/1.4 var(--police-corps);
  background: var(--fond);
  color: var(--texte);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); font-weight: 700; }
[hidden] { display: none !important; }

/* ---- Typo ---- */
.grand-titre {
  font: 900 44px/.95 var(--police-titre); text-transform: uppercase; letter-spacing: -.01em;
  margin: 22px 0 14px;
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 7px; text-underline-offset: 7px; text-decoration-skip-ink: none;
}
.sous-titre { font: 900 15px/1 var(--police-titre); text-transform: uppercase; letter-spacing: .07em; margin: 28px 0 10px; }
.accroche { font-size: 19px; font-weight: 700; margin: 6px 0 0; }
.mention { font-size: 13px; color: var(--texte-doux); margin-top: 32px; }

/* ---- Composants ---- */
.logo-slot {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center; text-align: center;
  border: 2px dashed var(--texte-doux); border-radius: var(--rayon);
  font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--texte-doux); line-height: 1;
}
.logo-slot--grand { width: 96px; height: 96px; font-size: 12px; }
.logo-slot img { width: 100%; height: 100%; object-fit: contain; }
.logo-slot--image { border: 0; }

.btn {
  min-height: 58px; padding: 0 14px; cursor: pointer; text-decoration: none; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--fond); color: var(--texte);
  border: var(--ep) solid var(--trait); border-radius: var(--rayon);
  font: 900 16px/1.1 var(--police-titre); text-transform: uppercase; letter-spacing: .03em;
}
.btn:active { transform: translateY(2px); }
.btn--accent { background: var(--accent); color: var(--sur-accent); border-color: var(--c-charbon); }
.btn--urgence { background: var(--urgence); color: var(--sur-urgence); border-color: var(--c-charbon); }
.btn--geant { width: 100%; min-height: 68px; font-size: 21px; }

/* ---- Mise en page ---- */
#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; }
.page { padding: 24px 20px calc(32px + env(safe-area-inset-bottom)); }
.page:first-child { padding-top: calc(28px + env(safe-area-inset-top)); }
.page--centre { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }

.barre {
  position: sticky; top: 0; z-index: 10;
  height: calc(58px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0 14px;
  display: flex; align-items: center; gap: 10px;
  background: var(--fond); border-bottom: var(--ep) solid var(--trait);
}
.barre__nom { font: 900 21px/1 var(--police-titre); text-transform: uppercase; letter-spacing: .01em; }
.barre .icone-btn { margin-left: -8px; }
.icone-btn {
  width: var(--zone); height: var(--zone); display: grid; place-items: center;
  border: 0; background: none; border-radius: var(--rayon); cursor: pointer; color: var(--texte);
}
.ico { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: square; stroke-linejoin: miter; }

.titre {
  font: 900 30px/1.08 var(--police-titre); margin: 0 0 14px;
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 5px; text-underline-offset: 6px; text-decoration-skip-ink: none;
}
.intro { color: var(--texte-doux); margin: 0 0 8px; }
.aide { display: block; font-size: 14px; font-weight: 400; color: var(--texte-doux); margin: 6px 0 0; }
.facultatif { font-weight: 400; color: var(--texte-doux); }
.pile { display: grid; gap: 10px; }
.deux-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn--contour { background: var(--fond); }
.btn--plein { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Formulaires ---- */
.formulaire { margin-top: 8px; }
.champ { display: block; font-weight: 700; margin: 16px 0 0; }
.champ input, .champ select {
  display: block; width: 100%; margin-top: 6px; padding: 0 12px; min-height: 54px;
  background: var(--fond); color: var(--texte);
  border: var(--ep) solid var(--trait); border-radius: var(--rayon); font-size: 17px; font-weight: 400;
}
.champ select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.erreur { color: var(--urgence); font-weight: 700; min-height: 1.4em; margin: 14px 0 10px; }
@media (prefers-color-scheme: dark) { .erreur { color: #ff8a80; } }
.case { display: flex; align-items: center; gap: 12px; min-height: var(--zone); margin: 14px 0; font-weight: 700; cursor: pointer; }
.case input { width: 26px; height: 26px; accent-color: var(--accent); }
.lien {
  display: inline-block; min-height: var(--zone); margin-top: 12px; padding: 0;
  background: none; border: 0; cursor: pointer; color: var(--accent);
  font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
.lien--petit { min-height: 0; margin: 0; font-size: inherit; }

/* ---- Éléments ---- */
.tampon {
  display: inline-flex; align-items: center; padding: 5px 9px 4px;
  border: 3px solid var(--texte); border-radius: 2px; transform: rotate(-1.5deg);
  font: 900 13px/1 var(--police-titre); text-transform: uppercase; letter-spacing: .08em;
}
.tampon--superadmin, .tampon--admin { border-color: var(--accent); color: var(--accent); }
.tampon--actif { border-color: var(--c-vert); }
.tampon--desactive, .tampon--expire, .tampon--epuise { border-color: var(--c-gris); color: var(--texte-doux); }
.ligne-statut { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 20px; }
.encart { padding: 14px 16px; background: var(--surface); border-left: 6px solid var(--accent); font-weight: 700; }
.code-affiche {
  margin: 12px 0 16px; padding: 16px 10px; text-align: center;
  border: 3px solid var(--trait); border-radius: var(--rayon); background: var(--surface);
  font: 900 26px/1.2 var(--police-titre); letter-spacing: .08em; word-break: break-all;
  font-variant-numeric: tabular-nums; user-select: all;
}
.code-cree { padding: 4px 0 20px; border-bottom: var(--ep) solid var(--trait); }
.liste-codes { list-style: none; margin: 0; padding: 0; border-top: var(--ep) solid var(--trait); }
.liste-codes li { padding: 14px 0; border-bottom: 1px solid var(--texte-doux); }
.liste-codes__tete { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.liste-codes .deux-colonnes { margin-top: 10px; }
.liste-codes .btn { min-height: 48px; font-size: 14px; }
.etat__liste { list-style: none; margin: 0 0 20px; padding: 0; border-top: var(--ep) solid var(--trait); }
.etat__liste li {
  display: grid; grid-template-columns: 16px 1fr; align-items: start; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--texte-doux); font-weight: 700;
}
.etat__liste li::before {
  content: ""; width: 16px; height: 16px; margin-top: 2px; border: 2px solid var(--c-charbon);
  background: var(--c-gris);
}
.etat__liste li[data-etat="ok"]::before { background: var(--c-vert); }
.etat__liste li[data-etat="ko"]::before { background: var(--c-rouge); }
.etat__liste li[data-etat="attente"]::before { background: var(--c-jaune); }
.etat__liste small { display: block; font-weight: 400; color: var(--texte-doux); }
.installer p { margin: 0 0 14px; }

/* ---- Finitions (étape f) ---- */
.case--haute { align-items: flex-start; font-weight: 400; font-size: 15px; line-height: 1.4; }
.case--haute input { margin-top: 2px; flex: none; }
.btn--danger { border-color: var(--urgence); color: var(--urgence); }
@media (prefers-color-scheme: dark) { .btn--danger { color: #ff8a80; border-color: #ff8a80; } }
.texte-long p, .texte-long li { max-width: 62ch; }
.texte-long ul { padding-left: 1.2em; margin: 0 0 12px; }
.texte-long li { margin-bottom: 6px; }
/* Petits liens dans une liste : zone tactile agrandie sans changer le texte */
.historique .lien--petit, .meta .lien--petit { padding: 10px 4px; margin: -10px 0; }

/* Mouvement réduit (réglage du téléphone) : pas d'animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
.grand-titre { font-size: clamp(32px, 10vw, 46px); }

/* Logo « coup de colle » : symbole étroit, centré dans son emplacement carré ; blanc en mode sombre */
.logo-slot--image { border: 0; background: none; position: relative; }
.logo-slot--image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
@media (prefers-color-scheme: dark) { .logo-slot--image img { filter: brightness(0) invert(1); } }

/* Logo complet de l'écran d'entrée (couleur, ou blanc en mode sombre). */
.logo-complet { margin: 4px 0 8px; line-height: 0; }
.logo-complet img { display: block; width: 100%; max-width: 420px; height: auto; }

/* Écran de lancement : seulement dans l'appli installée (pas dans le navigateur). */
#lancement { display: none; }
@media (display-mode: standalone), (display-mode: fullscreen) {
  #lancement {
    position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #E5221B 0%, #9B1C9E 55%, #5A0FC8 100%);
    transition: opacity .4s ease;
  }
  #lancement img { width: min(84vw, 480px); height: auto; }
  #lancement.lancement--fini { opacity: 0; pointer-events: none; }
}

/* « SI TU PEUX » : bandeau penché sous le titre de la carte, rappel du bandeau « JURA » du logo. */
.barre__nom:has(.barre__suite) { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.barre__suite {
  display: block; white-space: nowrap; padding: 2px 7px 1px; background: var(--accent); color: #fff;
  font: 900 10.5px/1.1 var(--police-titre); letter-spacing: .08em; transform: rotate(-3deg);
}

/* ---- Pop-ups plein écran (installation, tutoriel) ---- */
.voile, #tutoriel { position: fixed; inset: 0; z-index: 5000; }
.voile { display: flex; align-items: flex-end; justify-content: center; padding: 16px; background: rgb(0 0 0 / .55); }
.carte-pop {
  width: min(100%, 440px); background: var(--fond); color: var(--texte);
  border: var(--ep) solid var(--trait); border-radius: var(--rayon); padding: 18px 16px 16px;
  display: grid; gap: 10px; box-shadow: 0 10px 30px rgb(0 0 0 / .3);
}
.carte-pop .titre { margin: 0; font-size: 24px; text-transform: uppercase; }
.carte-pop p { margin: 0; line-height: 1.4; }
.carte-pop__icone { width: 72px; height: 72px; border-radius: 16px; justify-self: center; }
#pop-installation .carte-pop { text-align: center; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

/* Tutoriel : la lumière découpe l'élément expliqué dans un voile sombre. */
#tutoriel { display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
#tutoriel.tuto--sombre { background: rgb(0 0 0 / .6); align-items: center; }
#tutoriel.tuto--haut { align-items: flex-start; padding-top: calc(16px + env(safe-area-inset-top)); }
.tuto-lumiere {
  position: fixed; border-radius: 6px; pointer-events: none;
  box-shadow: 0 0 0 4px var(--c-jaune), 0 0 0 9999px rgb(0 0 0 / .6); transition: all .25s ease;
}
.tuto-carte { position: relative; }
.tuto-compte { font-weight: 700; font-size: 13px; color: var(--texte-doux); }
.tuto-pictos { display: flex; gap: 14px; justify-content: center; }
.tuto-pictos svg { width: 56px; height: 56px; }
.tuto-boutons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; pointer-events: none; }
.tuto-boutons .btn { min-height: 40px; font-size: 13px; padding: 4px 6px; }
.tuto-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 4px; }
.tuto-nav > div { display: flex; gap: 8px; }
.tuto-nav .btn { min-height: 48px; }
.tuto-nav .lien { min-height: 44px; }
@media (prefers-reduced-motion: reduce) { .tuto-lumiere { transition: none; } }
