/*
 * La page d'un voyage (voyages/templates/voyages/voyage.html), « Modifier le voyage » (modifier.html),
 * « Raconte ta journée » (raconter.html) et « Mon voyage en cours » (en_cours.html).
 * La carte : les départements (comme « Ma collection »), la ligne vermillon d'étape en étape, un point numéroté
 * par étape, et la carte postale de l'étape mise en avant au passage de la ligne (static/js/voyage.js).
 * Positions et tailles sont des attributs SVG (voyages/carte.py) ; ici, seulement les couleurs et l'animation.
 * Puis les compteurs, la frise verticale (un repère par jour, les cartes en polaroïds) et le partage.
 */
.voyage {
  padding-top: var(--esp-4);
}

.voyage-auteur {
  margin-bottom: var(--esp-1);
  color: var(--encre-douce);
  font-weight: 600;
}

.voyage-titre {
  margin-bottom: var(--esp-1);
  overflow-wrap: anywhere;
}

.voyage-resume {
  color: var(--encre-douce);
  font-weight: 600;
}

.voyage-sous-titre {
  margin-top: var(--esp-6);
}

/* « En voyage » : le voyage est en cours (voyages/carnet.py), une étiquette de bagage vermillon. */
.voyage-auteur .etiquette-bagage {
  margin-right: var(--esp-1);
}

.voyage-actions-auteur {
  display: flex;
  flex-wrap: wrap;
  gap: var(--esp-2);
  margin-top: var(--esp-3);
}

.voyage-actions-auteur form {
  margin: 0;
}

/* Les compteurs du voyage : jours, étapes, km, départements, jours racontés. */
.voyage-compteurs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: var(--esp-2);
  margin: var(--esp-4) 0 0;
  padding: 0;
  list-style: none;
}

.compteur {
  display: flex;
  flex-direction: column;
  padding: var(--esp-3);
  border-radius: var(--rayon-md);
  background: var(--carton);
  box-shadow: var(--ombre-carte);
}

.compteur-nombre {
  color: var(--encre);
  font: 800 1.75rem/1.1 var(--texte);
}

.compteur-nom {
  color: var(--encre-douce);
  font-size: 0.875rem;
  line-height: 1.3;
}

.voyage-aide {
  color: var(--encre-douce);
  font-size: 0.875rem;
}

/* La carte, et les encarts d'outre-mer à côté */
.voyage-carte {
  display: flex;
  flex-wrap: wrap;
  gap: var(--esp-3);
  margin-top: var(--esp-5);
}

.voyage-cadre {
  flex: 1 1 100%;
  margin: 0;
}

.voyage-encart {
  flex: 0 1 12rem;
}

.voyage-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--rayon-md);
  background: var(--mer);
  box-shadow: var(--ombre-carte);
}

.voyage-cadre-nom {
  margin-top: var(--esp-1);
  color: var(--encre-douce);
  font-size: 0.875rem;
  font-weight: 600;
}

.voyage-departement {
  fill: var(--terre);
  stroke: var(--trait-fort);
  stroke-linejoin: round;
}

.voyage-departement-visite {
  fill: var(--vermillon-pale);
}

.voyage-segment {
  fill: none;
  stroke: var(--vermillon);
  stroke-linecap: round;
}

.voyage-point circle {
  fill: var(--vermillon);
  stroke: var(--carton);
  stroke-width: 0.3%;
}

.voyage-point text {
  fill: var(--sur-vermillon);
  font-family: var(--texte);
  font-weight: 700;
}

/* La carte postale d'une étape : cachée, sauf mise en avant (passage de la ligne, ou étape survolée). */
.voyage-vignette {
  opacity: 0;
  transform: scale(0.6);
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
  pointer-events: none;
}

.voyage-vignette.en-avant {
  opacity: 1;
  transform: none;
}

.voyage-vignette rect {
  fill: var(--carton);
  stroke: var(--trait-fort);
  stroke-width: 0.2%;
}

.voyage-vignette text {
  fill: var(--encre);
  font-family: var(--affiche);
  text-transform: uppercase;
}

/*
 * Le parcours animé (voyage.js ajoute .parcours-anime) : chaque segment, long de 1 (pathLength), se dessine
 * en faisant glisser son pointillé ; chaque point apparaît quand la ligne l'atteint.
 * Sans JavaScript ou avec « réduire les animations », rien de tout cela : la ligne est là d'un coup.
 */
.parcours-anime .voyage-segment {
  opacity: 0;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  transition-property: stroke-dashoffset;
  transition-timing-function: ease-in-out;
}

.parcours-anime .voyage-segment.trace {
  opacity: 1;
  stroke-dashoffset: 0;
}

.parcours-anime .voyage-point {
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.parcours-anime .voyage-point.atteint {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .voyage-vignette {
    transform: none;
    transition: none;
  }
}

/* La liste des étapes, lisible sans la carte */
.voyage-etapes {
  display: grid;
  gap: var(--esp-3);
  margin: 0 0 var(--esp-5);
  padding: 0;
  list-style: none;
}

.voyage-etape {
  border-radius: var(--rayon-sm);
  background: var(--carton);
  box-shadow: var(--ombre-carte);
  transition: box-shadow 0.25s ease-out;
}

.voyage-etape.en-avant {
  box-shadow: 0 0 0 var(--trait-tampon) var(--vermillon), var(--ombre-carte);
}

.voyage-etape-lien {
  display: flex;
  align-items: center;
  gap: var(--esp-3);
  min-height: var(--cible-tactile);
  padding: var(--esp-2);
  border-radius: var(--rayon-sm);
  color: var(--encre);
  text-decoration: none;
}

.voyage-etape-numero {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--vermillon);
  color: var(--sur-vermillon);
  font: 700 0.875rem/1 var(--texte);
  font-variant-numeric: tabular-nums;
}

.voyage-etape-photo {
  flex: 0 0 auto;
  width: 4.5rem;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--rayon-xs);
  background: var(--chargement);
}

.voyage-etape-texte {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.voyage-etape-lieu {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.voyage-etape-detail {
  color: var(--encre-douce);
  font-size: 0.875rem;
}

.voyage-etape-voir {
  color: var(--vermillon);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* « Modifier le voyage » */
.voyage-renommer {
  margin-top: var(--esp-5);
}

.voyage-etapes-a-modifier .voyage-etape {
  padding-bottom: var(--esp-2);
}

.voyage-etape-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--esp-2);
  padding: 0 var(--esp-2);
}

.voyage-etape-actions form {
  margin: 0;
}

.voyage-retour {
  margin-top: var(--esp-5);
}

/*
 * La frise : une ligne verticale, un repère numéroté par jour (voyage vécu) ou par étape, les cartes postales
 * et la photo du jour en polaroïds, puis la journée racontée (la phrase à la main, les autres réponses).
 * voyage.js ajoute .frise-animee puis .arrive sur chaque passage qui entre à l'écran : sans lui, ou avec
 * « réduire les animations », tout est là d'un coup.
 */
.frise-liste {
  margin: 0;
  padding: 0 0 0 calc(var(--esp-6) + var(--esp-3));
  list-style: none;
}

.frise-passage {
  position: relative;
  padding-bottom: var(--esp-6);
}

/* La ligne, d'un repère au suivant */
.frise-passage::before {
  position: absolute;
  top: var(--esp-6);
  bottom: 0;
  left: calc(-1 * (var(--esp-6) + var(--esp-3)) + var(--esp-4) - var(--trait-tampon) / 2);
  width: var(--trait-tampon);
  background: var(--vermillon);
  content: "";
  transform-origin: top;
}

.frise-passage:last-child::before {
  bottom: var(--esp-6);
}

.frise-repere {
  position: absolute;
  top: 0;
  left: calc(-1 * (var(--esp-6) + var(--esp-3)));
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--esp-6);
  height: var(--esp-6);
  border-radius: 50%;
  background: var(--vermillon);
  box-shadow: 0 0 0 var(--esp-1) var(--papier);
  color: var(--sur-vermillon);
  font: 700 0.875rem/1 var(--texte);
  font-variant-numeric: tabular-nums;
}

.frise-passage-vide .frise-repere {
  border: var(--trait-tampon) dashed var(--trait-fort);
  background: var(--papier);
  color: var(--encre-douce);
}

.frise-titre {
  display: flex;
  flex-direction: column;
  margin: 0;
  font-size: 1rem;
}

.frise-numero {
  color: var(--encre-douce);
  font: 600 0.875rem/1.6 var(--texte);
}

.frise-date {
  font-size: 1.125rem;
  font-weight: 700;
}

.frise-lieu {
  margin: 0;
  color: var(--encre);
  font: 400 1.375rem/1.2 var(--affiche);
  overflow-wrap: anywhere;
}

.frise-polaroids {
  display: flex;
  flex-wrap: wrap;
  gap: var(--esp-4) var(--esp-3);
  margin: var(--esp-3) 0;
  padding: 0;
  list-style: none;
}

.polaroid {
  flex: 0 1 calc(50% - var(--esp-2));
  max-width: 12rem;
  padding: var(--esp-2) var(--esp-2) 0;
  border-radius: var(--rayon-xs);
  background: var(--carton);
  box-shadow: var(--ombre-carte);
  rotate: -2deg;
  transition: box-shadow 0.25s ease-out;
}

.polaroid:nth-child(even) {
  rotate: 2.5deg;
}

.polaroid.en-avant {
  box-shadow: 0 0 0 var(--trait-tampon) var(--vermillon), var(--ombre-carte);
}

.polaroid-lien {
  display: block;
  min-height: var(--cible-tactile);
  border-radius: var(--rayon-xs);
  color: var(--encre);
  text-decoration: none;
}

.polaroid-lien:focus-visible {
  outline: none;
  box-shadow: var(--anneau);
}

.polaroid-photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--chargement);
}

.polaroid-legende {
  display: block;
  padding: var(--esp-1) 0 var(--esp-2);
  font: 500 1.25rem/1.15 var(--manuscrit);
  text-align: center;
  overflow-wrap: anywhere;
}

.polaroid-lien .polaroid-legende {
  text-decoration: underline;
  text-decoration-color: var(--trait-fort);
  text-underline-offset: 3px;
}

/* La journée racontée */
.journee {
  margin-top: var(--esp-2);
}

.journee-phrase {
  margin: 0 0 var(--esp-2);
  color: var(--encre);
  font: 500 1.625rem/1.25 var(--manuscrit);
  overflow-wrap: anywhere;
}

.journee-reponses {
  display: grid;
  gap: var(--esp-2);
  margin: 0;
  padding: var(--esp-3);
  border-radius: var(--rayon-md);
  background: var(--carton);
  box-shadow: var(--ombre-carte);
}

.journee-reponse dt {
  color: var(--encre-douce);
  font: 700 0.875rem/1.5 var(--texte);
}

.journee-reponse dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.energie {
  display: inline-flex;
  gap: var(--esp-1);
  margin-right: var(--esp-1);
  vertical-align: middle;
}

.energie-point {
  width: 0.75rem;
  height: 0.75rem;
  border: var(--trait-epaisseur) solid var(--vermillon);
  border-radius: 50%;
}

.energie-point-plein {
  background: var(--vermillon);
}

.journee-masquee {
  margin: 0 0 var(--esp-2);
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 600;
}

.journee-signaler {
  margin: var(--esp-1) 0 0;
  font-size: 0.875rem;
}

.journee-signaler a {
  display: inline-flex;
  align-items: center;
  min-height: var(--cible-tactile);
  color: var(--encre-douce);
}

.frise-action {
  margin: var(--esp-3) 0 0;
}

/*
 * L'arrivée de chaque passage (voyage.js) : il glisse en place, la ligne se prolonge, les polaroïds se posent.
 * Jamais d'opacité sur le texte : il reste lisible (et ses contrastes mesurables) pendant le mouvement.
 */
.frise-animee .frise-passage {
  transition: translate 0.5s ease-out;
  translate: 0 var(--esp-5);
}

.frise-animee .frise-passage::before {
  scale: 1 0;
  transition: scale 0.9s ease-in-out 0.2s;
}

.frise-animee .polaroid {
  transition: translate 0.4s ease-out 0.3s, box-shadow 0.25s ease-out;
  translate: 0 calc(-1 * var(--esp-3));
}

.frise-animee .frise-passage.arrive,
.frise-animee .frise-passage.arrive .polaroid {
  translate: none;
}

.frise-animee .frise-passage.arrive::before {
  scale: 1 1;
}

@media (prefers-reduced-motion: reduce) {
  .frise-animee .frise-passage,
  .frise-animee .polaroid {
    transition: none;
    translate: none;
  }

  .frise-animee .frise-passage::before {
    scale: none;
    transition: none;
  }
}

/* Aperçu sans compte : la suite demande un compte (sans compte à rebours ni fausse urgence). */
.voyage-suite {
  margin-bottom: var(--esp-5);
  padding: var(--esp-4);
  border-radius: var(--rayon-md);
  background: var(--soleil-pale);
}

.voyage-suite-titre {
  margin-top: 0;
}

.voyage-suite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--esp-2);
}

/* Le carnet de bord à partager */
.voyage-partage {
  margin-bottom: var(--esp-5);
}

.voyage-partage-apercu {
  display: block;
  width: min(100%, 20rem);
  height: auto;
  margin: var(--esp-3) 0;
  border-radius: var(--rayon-sm);
  background: var(--chargement);
  box-shadow: var(--ombre-carte);
}

.voyage-partage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--esp-2);
}

/* « Raconte ta journée » et « Mon voyage en cours » */
.raconter {
  padding-top: var(--esp-4);
}

.raconter-repere {
  margin-bottom: var(--esp-1);
  color: var(--encre-douce);
  font-weight: 600;
}

.raconter-titre {
  margin-bottom: var(--esp-2);
}

.raconter-intro {
  color: var(--encre-douce);
}

.raconter-formulaire {
  margin-top: var(--esp-4);
}

.raconter-photo {
  display: block;
  width: 8rem;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  padding: var(--esp-2) var(--esp-2) var(--esp-5);
  border-radius: var(--rayon-xs);
  background: var(--carton);
  box-shadow: var(--ombre-carte);
  rotate: -2deg;
}

.raconter-supprimer {
  margin-top: var(--esp-5);
}

/* L'énergie de 1 à 5 : les cases radio restent dans la page (clavier, lecteurs d'écran), sous leur étiquette. */
.energie-boutons {
  display: flex;
  flex-flow: row wrap;
  gap: var(--esp-2);
}

.energie-bouton {
  position: relative;
}

.formulaire .energie-case {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
}

.formulaire .energie-libelle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--cible-tactile) + var(--esp-2));
  min-height: var(--cible-tactile);
  border: var(--trait-epaisseur) solid var(--trait-fort);
  border-radius: var(--rayon-md);
  background: var(--carton);
  color: var(--encre);
  font: 700 1.125rem/1 var(--texte);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.formulaire .energie-case:checked + .energie-libelle {
  border-color: var(--vermillon);
  background: var(--vermillon);
  color: var(--sur-vermillon);
}

.formulaire .energie-case:focus-visible + .energie-libelle {
  box-shadow: var(--anneau);
}

/* Le moment préféré, à toucher (comme l'énergie) : des boutons qui passent à la ligne. */
.moments-boutons {
  display: flex;
  flex-flow: row wrap;
  gap: var(--esp-2);
}

.moment-bouton {
  position: relative;
}

.formulaire .moment-case {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
}

.formulaire .moment-libelle {
  display: inline-flex;
  align-items: center;
  min-height: var(--cible-tactile);
  padding: 0 var(--esp-3);
  border: var(--trait-epaisseur) solid var(--trait-fort);
  border-radius: var(--rayon-md);
  background: var(--carton);
  color: var(--encre);
  font: 600 0.9375rem/1.2 var(--texte);
  cursor: pointer;
}

.formulaire .moment-case:checked + .moment-libelle {
  border-color: var(--vermillon);
  background: var(--vermillon);
  color: var(--sur-vermillon);
}

.formulaire .moment-case:focus-visible + .moment-libelle {
  box-shadow: var(--anneau);
}

.moment-autre {
  margin-top: var(--esp-3);
}

/* Le champ libre n'apparaît qu'avec « Autre chose » (sans :has, il reste visible, et rien ne se perd). */
@supports selector(:has(*)) {
  .moment-autre {
    display: none;
  }

  .moments-choix:has(.moment-case[value="autre"]:checked) .moment-autre {
    display: block;
  }
}

.raconter-points {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--esp-2);
  margin: 0 0 var(--esp-4);
  color: var(--encre-douce);
  font-size: 0.9375rem;
}

/* « Ajouter un mot ou un conseil » : replié, écrire reste facultatif. */
.raconter-ecrire {
  margin: 0 0 var(--esp-4);
}

.raconter-ecrire-titre {
  display: flex;
  align-items: center;
  min-height: var(--cible-tactile);
  color: var(--vermillon);
  font-weight: 600;
  cursor: pointer;
}

/* « Ton programme » : parti avec « Je pars », le voyage gardé jour par jour (programme.html). */
.programme {
  margin: var(--esp-4) 0;
  padding: var(--esp-3) var(--esp-4);
  border-radius: var(--rayon-md);
  background: var(--carton);
  box-shadow: var(--ombre-carte);
}

.programme-titre {
  display: flex;
  align-items: center;
  min-height: var(--cible-tactile);
  font: 700 1.125rem/1.3 var(--texte);
  cursor: pointer;
}

.programme-jours {
  display: grid;
  gap: var(--esp-3);
  margin: var(--esp-2) 0 0;
  padding: 0;
  list-style: none;
}

.programme-jour-nom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--esp-2);
  margin: 0 0 var(--esp-1);
  font-weight: 700;
}

.programme-etapes {
  display: grid;
  gap: var(--esp-1);
  margin: 0;
  padding: 0 0 0 var(--esp-3);
  list-style: none;
}

.programme-etapes a {
  display: inline-flex;
  align-items: center;
  min-height: var(--cible-tactile);
}

.programme-nuit {
  color: var(--encre-douce);
}
