/* GExplore Québec — feuille unique, mobile d'abord.
   Palette : bleu Québec et blanc, thème clair et sombre.

   --bleu vaut #003399 : c'est l'équivalent HTML du PMS 293 fixé par le
   standard graphique du gouvernement du Québec, celui des rectangles du
   fleurdelisé. Sur blanc il donne un contraste de 12,6:1, très au-delà du
   4,5:1 exigé — le texte blanc sur bleu passe donc aussi bien que l'inverse.

   L'ambre et le rouge subsistent, mais uniquement comme signaux : un
   avertissement de position refusée et un bouton de suppression doivent se
   distinguer de l'identité, pas s'y fondre. */

:root {
  --bleu: #003399;
  --bleu-fonce: #002270;
  --bleu-clair: #e7edfa;
  --ambre: #b3600f;

  --fond: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eceff7;
  --bord: #d8dde9;
  --texte: #14161c;
  --texte-doux: #5c6270;
  --ombre: 0 1px 3px rgba(16, 22, 40, .08), 0 4px 16px rgba(16, 22, 40, .06);

  --rayon: 14px;
  --marge: 16px;
  /* Encoche et barre gestuelle : sans ces réserves, le contenu passe dessous
     sur les téléphones récents. */
  --haut: env(safe-area-inset-top, 0px);
  --bas: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* #003399 serait illisible sur fond sombre : on remonte la clarté du même
       bleu jusqu'à repasser au-dessus de 4,5:1 contre le fond. L'identité
       tient à la teinte, pas à la valeur exacte. */
    --bleu: #7ba4f0;
    --bleu-fonce: #0a1428;
    --bleu-clair: #17243f;
    --ambre: #e0a35c;

    --fond: #101218;
    --surface: #191d26;
    --surface-2: #232833;
    --bord: #333a49;
    --texte: #e9ebf0;
    --texte-doux: #969cab;
    --ombre: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; flex-direction: column; height: 100%; }

.view {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--haut) + var(--marge)) var(--marge) var(--marge);
}

/* ---------------- barre d'onglets ---------------- */

.tabs {
  display: flex;
  border-top: 1px solid var(--bord);
  background: var(--surface);
  padding-bottom: var(--bas);
}
.tabs[hidden] { display: none; }

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  border: 0;
  background: none;
  color: var(--texte-doux);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.tab[aria-current="page"] { color: var(--bleu); font-weight: 600; }
.tab-icon { font-size: 20px; line-height: 1; }

/* ---------------- éléments communs ---------------- */

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 28px 0 10px; }
p  { margin: 0 0 12px; }

.sous-titre { color: var(--texte-doux); margin: 0 0 24px; }

.carte {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--ombre);
}

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--bleu);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  /* 44 px est le minimum tactile confortable ; on ne descend pas en dessous. */
  min-height: 48px;
}
.bouton:disabled { opacity: .5; cursor: default; }
.bouton.secondaire { background: var(--surface-2); color: var(--texte); }
.bouton.danger { background: transparent; color: #c0392b; box-shadow: inset 0 0 0 1px currentColor; }
.bouton + .bouton { margin-top: 8px; }

/* Sélection multiple : régions et thématiques. */
.choix { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

.puce {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--bord);
  border-radius: 999px;
  background: var(--surface);
  color: var(--texte);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  min-height: 40px;
}
.puce[aria-pressed="true"] {
  background: var(--bleu-clair);
  border-color: var(--bleu);
  color: var(--bleu);
  font-weight: 600;
}
.puce .compte { color: var(--texte-doux); font-size: 12px; font-weight: 400; }
.puce[aria-pressed="true"] .compte { color: inherit; opacity: .75; }

/* ---------------- état de la balade ---------------- */

.etat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--rayon);
  background: var(--surface);
  border: 1px solid var(--bord);
  margin-bottom: 16px;
}
.etat.active { background: var(--bleu-clair); border-color: var(--bleu); }

.pastille {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--texte-doux);
  flex: none;
}
.etat.active .pastille {
  background: var(--bleu);
  animation: pouls 2s ease-in-out infinite;
}
@keyframes pouls {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.8); }
}
/* Un point qui clignote sans fin gêne certaines personnes, et la préférence
   système est le seul endroit où elles peuvent le dire. */
@media (prefers-reduced-motion: reduce) {
  .etat.active .pastille { animation: none; }
}

.etat-texte { flex: 1; min-width: 0; }
.etat-titre { font-weight: 600; }
.etat-detail { color: var(--texte-doux); font-size: 14px; }

/* ---------------- liste de lieux ---------------- */

.liste { list-style: none; margin: 0; padding: 0; }

.lieu {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.lieu-vignette {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-2);
  flex: none;
}
.lieu-texte { flex: 1; min-width: 0; }
.lieu-nom { font-weight: 600; }
.lieu-detail {
  color: var(--texte-doux);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- fiche d'un lieu ---------------- */

.fiche-entete {
  margin: calc(-1 * var(--marge)) calc(-1 * var(--marge)) 0;
  position: relative;
}
.fiche-images {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
}
.fiche-images img {
  width: 100%;
  height: 100%;
  flex: none;
  object-fit: cover;
  scroll-snap-align: center;
}
.retour {
  position: absolute;
  top: calc(var(--haut) + 10px);
  left: 10px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.fiche-titre { margin-top: 16px; }

.etiquettes { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.etiquette {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--texte-doux);
  font-size: 13px;
}

#carte {
  height: 220px;
  border-radius: var(--rayon);
  border: 1px solid var(--bord);
  margin: 12px 0;
  z-index: 0; /* Leaflet pose 400+ sur ses panneaux ; sans cela il déborde. */
}

.infos { list-style: none; margin: 16px 0 0; padding: 0; }
.infos li {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--bord);
  font-size: 15px;
}
.infos .cle { color: var(--texte-doux); flex: none; width: 84px; }
.infos a { color: var(--bleu); }

.credit { color: var(--texte-doux); font-size: 12px; margin-top: 20px; }

/* ---------------- divers ---------------- */

.vide {
  text-align: center;
  color: var(--texte-doux);
  padding: 48px 24px;
}
.vide-icone { font-size: 40px; display: block; margin-bottom: 12px; }

.alerte {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fdf0e4;
  color: #7a3d05;
  font-size: 14px;
  margin-bottom: 12px;
}
@media (prefers-color-scheme: dark) {
  .alerte { background: #3a2a14; color: #f0c48a; }
}

.chargement { text-align: center; color: var(--texte-doux); padding: 40px; }
