/* L'editeur d'itineraire (itineraire.js). Prefixe it- : les noms courts sont
   deja pris dans l'application.

   L'ecran reprend .mu-plein (muscu.css) pour que le retour d'Android sache le
   fermer, mais une carte n'a rien a faire d'une marge de page ni d'un
   defilement : on les retire ici, et la carte prend toute la place entre la
   rangee des sports et le panneau des chiffres. */

.mu-plein.it-plein {
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

.it-haut {
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 6px 18px;
}
.it-titre { flex: 1; min-width: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.it-haut .mu-fermer { min-height: 44px; }

/* Les sports sur une seule ligne qui defile au doigt : dix jetons ne tiennent
   pas sur 390 px, et deux lignes voleraient la hauteur de la carte. Les
   jetons de l'application font 34 px de haut ; ici on les monte a 44, on les
   touche en tenant le telephone d'une main. */
.jetons.it-sports {
  flex: 0 0 auto; flex-wrap: nowrap; gap: 8px;
  overflow-x: auto; overscroll-behavior-x: contain;
  padding: 4px 14px 10px; scrollbar-width: none;
}
.it-sports::-webkit-scrollbar { display: none; }
.jetons.it-sports[hidden] { display: none; }
.it-sports .jeton, .it-sports-feuille .jeton {
  flex: 0 0 auto; min-height: 44px; padding: 0 15px; font-size: .84rem; white-space: nowrap;
}
.jetons.it-sports-feuille { gap: 8px; margin-bottom: 14px; }

/* La carte. Le z-index de .it-carte n'est pas decoratif : Leaflet empile ses
   couches entre 200 et 700 ; sans contexte ferme autour d'elles, elles
   passeraient au-dessus du bandeau et des outils (meme piege que #traceCarte
   dans index.html). */
.it-zone { position: relative; flex: 1 1 auto; min-height: 220px; }
.it-carte { position: absolute; inset: 0; z-index: 0; background: var(--fond2); }
.it-sans-carte {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 30px; text-align: center; color: var(--texte2); font-size: .9rem; line-height: 1.5;
}
/* Le panneau du bas mord de 16 px sur la carte (ses coins arrondis) : les
   commandes du bas de Leaflet remontent d'autant pour rester visibles. */
.it-carte .leaflet-bottom { bottom: 16px; }
.it-carte .leaflet-control-zoom { margin-left: 10px; margin-bottom: 10px; border: 0; box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .6); }
.it-carte .leaflet-control-zoom a {
  width: 44px; height: 44px; line-height: 44px; font-size: 20px; font-weight: 500;
}

/* Ce qui se passe, dit en une ligne en haut de la carte : quoi toucher, le
   calcul en cours, ou le hors-reseau. Fond presque opaque : en plein soleil,
   un fond translucide sur une carte claire ne se lit pas. */
.it-bandeau {
  position: absolute; z-index: 2; top: 10px; left: 12px; right: 12px;
  margin: 0 auto; width: fit-content; max-width: calc(100% - 24px);
  background: rgba(11, 14, 20, .9); border: 1px solid var(--bord); border-radius: 14px;
  padding: 8px 14px; font-size: .84rem; line-height: 1.35; color: var(--texte);
  text-align: center; text-wrap: balance; pointer-events: none;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .7);
}
.it-bandeau[hidden] { display: none; }
.it-bandeau.it-alerte { color: var(--attention); border-color: rgba(251, 191, 36, .45); }
.it-bandeau.it-repere { color: var(--attention); border-color: rgba(251, 191, 36, .6); }
.it-bandeau.it-calcul { color: var(--texte2); }
.it-bandeau.it-calcul::before {
  content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid rgba(192, 132, 252, .35); border-top-color: #c084fc; border-radius: 50%;
  animation: it-tourne .8s linear infinite;
}
@keyframes it-tourne { to { transform: rotate(360deg); } }

/* Les trois outils, sous le pouce droit, dans le style des boutons ronds de
   l'ecran de trajet. */
.it-outils {
  position: absolute; z-index: 2; right: 10px; bottom: 44px;
  display: flex; flex-direction: column; gap: 10px;
}
.it-outil {
  width: 48px; height: 48px; min-height: 0; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11, 14, 20, .88); border: 1px solid var(--bord); color: var(--texte);
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .6);
}
.it-outil.on { color: var(--attention); border-color: var(--attention); background: rgba(40, 32, 10, .92); }
.it-outil.it-cherche svg { animation: it-cherche 1s ease-in-out infinite; }
@keyframes it-cherche { 50% { opacity: .35; } }

/* Le panneau des chiffres. Il remonte un peu sur la carte pour que ses coins
   arrondis se detachent sur elle, comme le panneau de l'ecran de trajet. */
.it-panneau {
  position: relative; z-index: 3; flex: 0 0 auto; margin-top: -16px;
  background: var(--fond2); border-top: 1px solid var(--bord); border-radius: 18px 18px 0 0;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, .7);
}
.it-chiffres { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1.25fr; gap: 6px; transition: opacity .2s; }
.it-chiffre { min-width: 0; }
.it-chiffre b {
  display: block; font-size: 1.15rem; font-weight: 700; line-height: 1.15;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.it-chiffre span { display: block; font-size: .72rem; color: var(--texte2); margin-top: 2px; }
.it-perime { opacity: .45; }

.it-profil { position: relative; height: 64px; margin: 10px 0 12px; transition: opacity .2s; }
.it-profil svg { position: absolute; left: 0; top: 0; }
.it-profil-note {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--bord); border-radius: 10px;
  font-size: .8rem; color: var(--texte2); text-align: center; padding: 0 12px;
}
.it-profil-note[hidden] { display: none; }

.it-actions { display: flex; gap: 8px; }
.it-actions button { flex: 1; min-height: 48px; font-size: .95rem; }
.it-actions button.principal { flex: 1.3; }

/* Les epingles. Le cadre (44 x 52) est plus grand que le dessin pour que le
   doigt n'ait pas a viser juste ; le dessin est pose en bas, sa pointe sur le
   point. Pas de menu du navigateur ni de selection de texte a l'appui long :
   c'est le geste qui souleve l'epingle. */
.leaflet-marker-icon.it-epingle,
.leaflet-marker-icon.it-etoile,
.leaflet-marker-icon.it-maison,
.leaflet-marker-icon.it-tours {
  background: none; border: 0;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: none;
}
.it-epingle svg {
  position: absolute; left: 5px; top: 7px; overflow: visible;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .55));
  transition: transform .16s cubic-bezier(.2, .9, .3, 1.2), filter .16s ease-out;
}
.it-epingle text { font-family: inherit; font-variant-numeric: tabular-nums; }
/* Soulevee : plus grosse, et une ombre plus longue, comme si elle quittait la
   carte. Le transform va sur le dessin, jamais sur le cadre : c'est le cadre
   que Leaflet deplace avec son propre transform. */
.it-epingle.it-souleve svg {
  transform: scale(1.35);
  filter: drop-shadow(0 14px 8px rgba(0, 0, 0, .45));
}
.it-glisse .it-carte { cursor: grabbing; }

.it-etoile svg {
  position: absolute; left: 8px; top: 8px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .8));
}
/* La maison : 44 px pour le doigt, le dessin (26 px) au milieu. */
.it-maison svg {
  position: absolute; left: 9px; top: 9px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .8));
}

/* Les tours nommes, en etiquettes posees a leur depart. Le marqueur de
   Leaflet ne mesure rien (0 x 0, pile sur le point) : la colonne est accrochee
   par le bas et centree dessus, la tige finit sur le point. Un fond sombre
   presque plein, comme le bandeau : en plein soleil sur une carte claire, un
   fond leger ne se lit plus. Le petit rond dit a qui est le tour : violet, la
   couleur des itineraires prevus, pour les miens ; bleu pour ceux des amis. */
.it-tour {
  position: absolute; left: 0; bottom: 0; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.it-tour-nom {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  max-width: 190px; padding: 5px 12px 6px 23px; border-radius: 12px;
  background: rgba(11, 14, 20, .92); border: 1px solid rgba(192, 132, 252, .6);
  color: var(--texte); line-height: 1.22; cursor: pointer; white-space: nowrap;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, .75);
}
.it-tour-nom::before {
  content: ''; position: absolute; left: 10px; top: 50%; width: 7px; height: 7px;
  margin-top: -3.5px; border-radius: 50%; background: #c084fc;
}
/* La zone d'appui deborde de l'etiquette : 44 px de haut au moins, sans
   grossir le dessin sur la carte. */
.it-tour-nom::after { content: ''; position: absolute; inset: -8px -6px; }
.it-tour-nom b {
  display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  font-size: .8rem; font-weight: 700;
}
.it-tour-nom span {
  display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  font-size: .7rem; color: var(--texte2);
}
.it-tour-nom.it-ami { border-color: rgba(96, 165, 250, .6); }
.it-tour-nom.it-ami::before { background: #60a5fa; }
.it-tour-plus { padding-left: 12px; border-color: var(--bord); }
.it-tour-plus::before { display: none; }
.it-tour-plus b { font-weight: 600; color: var(--texte2); }
.it-tour-nom:active { background: rgba(33, 39, 54, .96); }
/* La tige et le point de depart. Haute comme une epingle numerotee (52 px) :
   un tour part souvent de la maison, la ou le depart est deja pose, et ses
   etiquettes doivent passer au-dessus de l'epingle 1 au lieu de la cacher. */
.it-tour-pied {
  position: relative; display: block; width: 2px; height: 56px; margin-top: -5px;
  background: rgba(232, 234, 237, .85); box-shadow: 0 0 0 1px rgba(11, 14, 20, .5);
}
.it-tour-pied::after {
  content: ''; position: absolute; left: -3px; bottom: -4px; width: 8px; height: 8px;
  border-radius: 50%; background: #e8eaed; border: 2px solid #0b0e14; box-sizing: border-box;
}

/* La feuille d'un tour : ses chiffres en gros, qui l'a fait, sa forme. */
.it-tour-chiffres {
  margin: 0 0 2px; font-size: 1.25rem; font-weight: 700; line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.it-tour-qui { margin: 0 0 12px; font-size: .88rem; color: var(--texte2); }
.it-tour-cadre {
  margin: 0 0 14px; padding: 6px; border-radius: 12px;
  background: var(--fond3); border: 1px solid var(--bord);
}
.it-tour-mini { display: block; width: 100%; height: 120px; }
.it-tour-note { margin: 0 0 12px; font-size: .86rem; line-height: 1.45; color: var(--attention); }

/* La position : le point bleu habituel, avec un halo qui dit « a peu pres
   ici ». */
.it-ici { background: none; border: 0; }
.it-ici i {
  position: absolute; left: 4px; top: 4px; width: 14px; height: 14px; border-radius: 50%;
  background: #60a5fa; border: 2px solid #fff;
  box-shadow: 0 0 0 6px rgba(96, 165, 250, .25), 0 1px 4px rgba(0, 0, 0, .6);
}

/* La feuille qui monte du bas (nommer un repere, enregistrer). C'est aussi un
   .mu-plein, pour le retour d'Android : on lui retire le fond plein et la
   marge, et on la pose en bas sur un voile. */
.mu-plein.it-voile {
  padding: 0; justify-content: flex-end; overflow: hidden;
  background: rgba(0, 0, 0, .55);
  animation: it-voile .2s ease-out both;
}
@keyframes it-voile { from { opacity: 0; } }
.it-feuille {
  background: var(--fond2); border-top: 1px solid var(--bord); border-radius: 18px 18px 0 0;
  max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: it-monte .26s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes it-monte { from { transform: translateY(100%); } }
.it-feuille-tete {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--bord);
}
.it-feuille-tete h2 { flex: 1; margin: 0; font-size: 1rem; }
.it-feuille-corps { padding: 14px 16px 18px; }
.it-resume { font-size: .84rem; color: var(--texte2); margin: 0 0 12px; font-variant-numeric: tabular-nums; }
.it-large { width: 100%; min-height: 50px; font-size: 1rem; }

@media (prefers-reduced-motion: reduce) {
  .it-epingle svg, .it-chiffres, .it-profil { transition: none; }
  .it-bandeau.it-calcul::before, .it-outil.it-cherche svg { animation: none; }
  .mu-plein.it-voile, .it-feuille { animation: none; }
}

/* Les credits de la carte replies en un petit « i » (replierCredits, app.js) :
   obligatoires, mais sans prendre toute la largeur sous le pouce. */
.leaflet-control-attribution.creditsReplies:not(.ouverts) {
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  overflow: hidden; font-size: 0; line-height: 0; cursor: pointer;
  margin: 0 8px 14px 0; box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.leaflet-control-attribution.creditsReplies:not(.ouverts)::before {
  content: 'i'; display: block; width: 22px; text-align: center;
  font: 600 13px/22px system-ui, sans-serif; color: #e6e8ee;
}
.leaflet-control-attribution.creditsReplies.ouverts { border-radius: 8px; cursor: pointer; }

/* Le revetement sous le profil (routage.js dessine la bande, itineraire.js le
   resume). La zone grandit de la hauteur de la bande. */
.it-profil.it-avec-revetement { height: 80px; }
.it-revetements {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  margin: -4px 0 10px; font-size: .78rem; color: var(--texte2, #9aa0ac);
  font-variant-numeric: tabular-nums;
}
.it-revetements[hidden] { display: none; }
.it-rv { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.it-rv-pastille { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.it-rv-inconnu { background: repeating-linear-gradient(45deg, #2a3040 0 2px, #6b7280 2px 3.5px); }
