/* Carte du parcours (page Parcours).
   Présentée comme une planche cartographique : fond clair, titre, choix du fond, légende,
   orientation, échelle et crédits. Elle reste claire quel que soit le thème du site. */

.planche {
  --surface: #FFFFFF;
  --ink: #13202F;
  --muted: #566274;
  --line: #D9DFE5;
  --accent: #0E6B57;
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--ombre);
  overflow: hidden;
  /* Les calques Leaflet ont des z-index de 400 à 1000 : sans cette isolation, la carte passait
     par-dessus l'en-tête fixe du site (z-index 50) quand on faisait défiler la page. */
  isolation: isolate;
}
.planche-titre {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.planche-bouton {
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  padding: 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.planche-bouton:hover { border-color: var(--muted); }
/* Choix du fond de carte : boutons en pastilles, comme les filtres de la Cartothèque */
.planche-fonds {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  font-size: .88rem;
}
.planche-fonds > span { color: var(--muted); font-weight: 600; margin-right: 2px; }
.planche-fonds button {
  font: inherit;
  font-weight: 600;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.planche-fonds button:hover { border-color: var(--muted); }
.planche-fonds button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }

.mapstage { position: relative; }
/* Hauteur qui suit l'écran : la France occupe plus de place sur un grand écran */
#map { height: clamp(520px, 74vh, 860px); background: #E9EDF0; font-family: var(--sans); }
#map:focus { outline: none; }
.leaflet-container { background: #E9EDF0; }
/* La carte est dans une <figure> : on annule le cadre que le site donne aux images de figure
   (figure img, style.css), sinon chaque tuile du fond aurait sa bordure et la carte serait quadrillée. */
.planche .leaflet-container img { border: 0; border-radius: 0; }
/* Même chose pour les liens (figure a, style.css) : les crédits restent sur une ligne */
.planche .leaflet-container a { cursor: pointer; }
.planche .leaflet-control-attribution a { display: inline; }

/* Symboles des lieux : rond = alternance, carré = formation, numéro = ordre chronologique */
.forme {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid #FFFFFF;
  box-shadow: 0 0 0 1px rgba(19, 32, 47, .35);
  background: #0E6B57;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
}
.forme.edu { background: #B7720E; border-radius: 3px; }

.lieu-icone { background: none; border: 0; }
.lieu { position: relative; width: 0; height: 0; }
.lieu-symbole {
  position: absolute;
  left: var(--dx);
  top: var(--dy);
  transform: translate(-11px, -50%); /* centre le symbole sur le point, le nom à droite */
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
}
.lieu-nom { font-size: 14px; font-weight: 600; color: #1F2A37; text-shadow: 0 0 2px #FFF, 0 0 2px #FFF, 0 0 3px #FFF; }
.lieu.hot .forme, .lieu.actif .forme { box-shadow: 0 0 0 3px rgba(19, 32, 47, .3); }
.renvoi { position: absolute; left: 0; top: 0; overflow: visible; }
.renvoi line { stroke: #5E6B78; stroke-width: 1; }
.point-exact { position: absolute; left: -2.5px; top: -2.5px; width: 5px; height: 5px; border-radius: 50%; background: #13202F; }

/* Étiquettes des régions et des villes de repère */
.rlabel, .clabel { background: none; border: 0; }
.rlabel span { display: block; transform: translate(-50%, -50%); white-space: nowrap; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #8C97A3; pointer-events: none; }
.clabel span { display: flex; align-items: center; gap: 4px; transform: translate(-2px, -50%); white-space: nowrap; font-size: 12px; color: #5E6A76; pointer-events: none; }
.clabel span::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #8C97A3; }
/* En vue d'ensemble, seuls les lieux sont nommés ; régions et villes apparaissent en zoomant */
#map[data-z="low"] .clabel, #map[data-z="low"] .rlabel { display: none; }
#map[data-z="high"] .rlabel { opacity: .5; }

/* Habillage : orientation, légende, échelle, zoom */
.nord { position: absolute; z-index: 500; left: 16px; top: 14px; width: 20px; height: 34px; pointer-events: none; }
.nord path { fill: #13202F; }
.nord text { font: 700 11px var(--sans); fill: #13202F; text-anchor: middle; }
/* Liseré blanc : la flèche reste lisible sur les photos aériennes */
.nord path, .nord text { stroke: #FFFFFF; stroke-width: 2px; stroke-linejoin: round; paint-order: stroke; }
.legende {
  position: absolute;
  z-index: 500;
  left: 12px;
  bottom: 12px;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: .9rem;
}
.legende span { display: flex; align-items: center; gap: 8px; }
.legende .forme { width: 14px; height: 14px; border-width: 1px; }
.legende-note { color: var(--muted); font-size: .8rem; }
.leaflet-bar { border: 1px solid var(--line) !important; box-shadow: none !important; }
.leaflet-bar a { color: var(--ink); }
.leaflet-control-scale-line { background: rgba(255, 255, 255, .85); border-color: #5E6B78; color: var(--ink); font-size: 11px; }
/* Crédits des données (obligatoires) : discrets, dans le coin de la carte */
.leaflet-control-attribution.leaflet-control { background: rgba(255, 255, 255, .85); color: var(--muted); font-size: 11px; padding: 1px 6px; }
.leaflet-control-attribution a { color: var(--ink); }

/* Fiche d'un lieu (à droite de la carte) */
.mapcard {
  position: absolute;
  z-index: 600;
  right: 12px;
  top: 12px;
  width: 360px;
  max-width: calc(100% - 24px);
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(19, 32, 47, .12);
}
.mapcard .x { position: absolute; right: 10px; top: 10px; width: 28px; height: 28px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 16px; line-height: 1; }
.fiche-entete { display: flex; gap: 10px; align-items: center; padding-right: 30px; }
.fiche-entete b { display: block; line-height: 1.25; }
.fiche-entete div span { display: block; font-size: .85rem; color: var(--muted); }
/* Logo d'une structure (fiche et liste des lieux) : toujours sur fond blanc, comme prévu par les chartes */
.logo-lieu { display: block; width: 72px; height: 54px; flex: none; padding: 4px; background: #FFFFFF; border: 1px solid #D9DFE5; border-radius: 6px; }
.logo-lieu img { display: block; width: 100%; height: 100%; object-fit: contain; }
.fiche-role { font-size: .95rem; font-weight: 700; color: var(--accent); }
.mapcard ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .95rem; }
.mapcard .go { font-weight: 600; color: var(--accent); text-decoration: none; }
.mapcard .go:hover { text-decoration: underline; }

/* ---------- Frise des lieux ----------
   Un fil vertical relie les six étapes ; chaque étape porte le symbole de la carte
   (rond vert = alternance, carré ocre = formation) et une carte avec dates, structure et rôle. */
.frise-bloc { margin-top: 32px; }
.frise-titre { margin: 0 0 14px 50px; font-family: var(--mono); font-size: .74rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.frise { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.frise li { position: relative; }
/* Le fil : un tronçon de chaque symbole au suivant (hauteur de l'étape + l'écart entre deux étapes) */
.frise li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 28px;
  width: 2px;
  height: calc(100% + 14px);
  background: var(--line);
}
.frise li:first-child::before { background: linear-gradient(var(--accent), var(--line)); }
.place {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.frise-noeud { position: relative; z-index: 1; display: grid; place-items: center; height: 56px; }
.frise-noeud .forme {
  width: 30px;
  height: 30px;
  font-size: 14px;
  box-shadow: 0 0 0 5px var(--bg), 0 0 0 6px var(--line); /* anneau couleur du fond : le fil passe derrière */
  transition: transform .2s ease;
}
.frise-carte {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
/* Petite pointe vers le symbole */
.frise-carte::before {
  content: "";
  position: absolute;
  left: 44px;
  top: 22px;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
  transition: border-color .2s ease;
}
.place:hover .frise-carte, .place:focus-visible .frise-carte { border-color: var(--muted); transform: translateX(3px); }
.place:hover .frise-carte::before, .place:focus-visible .frise-carte::before { border-color: var(--muted); }
.place:hover .frise-noeud .forme { transform: scale(1.1); }
.place:focus-visible { outline: none; }
.place:focus-visible .frise-carte { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Lieu ouvert sur la carte */
.place.on .frise-carte { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.place.edu.on .frise-carte { border-color: #B7720E; box-shadow: inset 3px 0 0 #B7720E; }
.place.on .frise-carte::before { border-color: var(--accent); }
.place.edu.on .frise-carte::before { border-color: #B7720E; }
.place.on .frise-noeud .forme { transform: scale(1.15); box-shadow: 0 0 0 5px var(--bg), 0 0 0 7px var(--accent); }
.place.edu.on .frise-noeud .forme { box-shadow: 0 0 0 5px var(--bg), 0 0 0 7px #B7720E; }

.frise-haut { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.frise-haut .dates { font-size: .92rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.frise-org { display: flex; align-items: center; gap: 14px; }
.frise-org .logo-lieu { width: 64px; height: 48px; }
.frise-org b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.5rem; line-height: 1.1; }
.frise-org .where { display: block; font-size: .92rem; color: var(--muted); }
.place .rl { display: block; font-size: .97rem; font-weight: 600; line-height: 1.4; padding-top: 10px; border-top: 1px solid var(--line); }
.kind { font-size: .8rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.kind.pro { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.kind.edu { background: rgba(183, 114, 14, .14); color: #8F5A0B; }
:root[data-theme="dark"] .kind.edu { color: #E8A93C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kind.edu { color: #E8A93C; } }
@media (prefers-reduced-motion: reduce) {
  .frise-carte, .frise-noeud .forme { transition: none; }
  .place:hover .frise-carte { transform: none; }
}

/* Grand écran : la carte à gauche reste visible pendant qu'on parcourt la frise à droite */
@media (min-width: 1200px) {
  .parcours-grille { display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 500px); gap: 40px; align-items: start; }
  .parcours-grille .planche { position: sticky; top: calc(var(--hauteur-entete, 70px) + 16px); }
  .parcours-grille #map { height: clamp(480px, calc(100vh - var(--hauteur-entete, 70px) - var(--hauteur-pied, 56px) - 150px), 820px); }
  .parcours-grille .frise-bloc { margin-top: 0; }
}
@media (max-width: 680px) {
  #map { height: 460px; }
  /* Vue d'ensemble sur téléphone : seulement les numéros, la frise sous la carte donne les noms */
  #map[data-z="low"] .lieu-nom { display: none; }
  .frise-titre { margin-left: 0; }
  .frise-org .logo-lieu { width: 52px; height: 40px; }
  /* Sur mobile, la légende puis la fiche du lieu choisi passent sous la carte */
  .legende { position: static; grid-auto-flow: column; justify-content: start; gap: 6px 16px; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
  .legende b { display: none; }
  .mapcard { position: static; width: auto; max-width: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
}
