/* ==========================================================================
   Les Fumiers de Merde — DA tirée du logo :
   bleu nuit / bleu roi / bleu clair / rouge vif / blanc cassé
   ========================================================================== */

:root {
  --fond:        #0b1329;
  --fond-2:      #101d40;
  --panneau:     #142450;
  --panneau-2:   #182b5e;
  --bordure:     #26386c;
  --texte:       #eef1f8;
  --texte-2:     #9fadd2;
  --rouge:       #ef3a50;
  --rouge-vif:   #ff5064;
  --bleu:        #2456c4;
  --bleu-clair:  #5a9cf8;
  --rayon:       14px;
  --ombre:       0 10px 30px rgba(4, 9, 24, .45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* L'attribut hidden doit gagner contre nos display:flex/grid. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: "Barlow", system-ui, sans-serif;
  background: var(--fond);
  color: var(--texte);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--bleu-clair); }

h2, h3, .balade-titre, .hero-scroll span, .pied-devise {
  font-family: "Barlow Condensed", "Barlow", sans-serif;
}

/* ============================== HERO ============================== */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(1100px 650px at 50% -15%, #1d3370 0%, transparent 60%),
    linear-gradient(180deg, #12224c 0%, var(--fond) 78%);
}

.hero-route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .5;
}

.route-trace {
  fill: none;
  stroke: rgba(90, 156, 248, .16);
  stroke-width: 26;
  stroke-linecap: round;
}

.route-axe {
  fill: none;
  stroke: rgba(238, 241, 248, .35);
  stroke-width: 3.5;
  stroke-dasharray: 26 22;
  animation: defile 2.6s linear infinite;
}

.route-point {
  fill: var(--rouge);
  opacity: .55;
}

@keyframes defile {
  to { stroke-dashoffset: -96; }
}

.hero-contenu {
  position: relative;
  padding: 24px;
  animation: arrivee .9s cubic-bezier(.2, .8, .25, 1) both;
}

.hero-logo {
  display: block;
  width: min(78vw, 560px);
  height: auto;
  filter: drop-shadow(0 24px 50px rgba(0, 0, 0, .55));
}

@keyframes arrivee {
  from { opacity: 0; transform: translateY(26px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.hero-scroll {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--texte-2);
  text-decoration: none;
  transition: color .2s;
}

.hero-scroll:hover { color: var(--texte); }

.hero-scroll span {
  font-size: 1.05rem;
  font-weight: 700;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: .14em;
}

.hero-scroll svg {
  width: 26px;
  height: 26px;
  animation: rebond 1.8s ease-in-out infinite;
}

@keyframes rebond {
  0%, 100% { transform: translateY(0); opacity: .55; }
  50%      { transform: translateY(7px); opacity: 1; }
}

/* ============================ SECTION BALADES ============================ */

.balades {
  max-width: 1400px;
  margin: 0 auto;
  padding: 72px 22px 60px;
}

.section-entete { margin-bottom: 34px; }

.section-entete h2 {
  font-size: clamp(2.3rem, 5vw, 3.4rem);
  font-style: italic;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.05;
}

.section-entete h2 em {
  font-style: italic;
  color: var(--rouge-vif);
}

.section-entete p {
  margin-top: 8px;
  color: var(--texte-2);
  font-size: 1.05rem;
}

.balades-zone { position: relative; }

.balades-grille {
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  gap: 22px;
  align-items: start;
}

/* --------------------------- Verrou (mot de passe) ------------------------ */

.verrou {
  position: absolute;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(14vh, 130px) 18px 18px;
  background: rgba(11, 19, 41, .5);
  -webkit-backdrop-filter: blur(14px) saturate(.75);
  backdrop-filter: blur(14px) saturate(.75);
  border-radius: var(--rayon);
  transition: opacity .4s;
}

.verrou.est-ouvert { opacity: 0; pointer-events: none; }

.verrou-carte {
  position: sticky;
  top: min(14vh, 130px);
  display: flex;
  flex-direction: column;
  gap: 13px;
  width: min(400px, 100%);
  padding: 30px 28px 24px;
  text-align: center;
  background: linear-gradient(180deg, var(--panneau-2) 0%, var(--fond-2) 100%);
  border: 1px solid #33477f;
  border-radius: var(--rayon);
  box-shadow: 0 24px 60px rgba(3, 7, 18, .65);
}

.verrou-carte.est-secoue { animation: secousse .4s; }

@keyframes secousse {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
  50%      { transform: translateX(-4px); }
}

.verrou-icone {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  color: var(--rouge-vif);
}

.verrou-carte h3 {
  font-size: 1.7rem;
  font-style: italic;
  font-weight: 800;
  text-transform: uppercase;
}

.verrou-carte p, .verrou-note {
  font-size: .95rem;
  color: var(--texte-2);
}

.verrou-note code {
  color: var(--bleu-clair);
  font-size: .9em;
}

#verrou-mdp {
  width: 100%;
  padding: 12px 14px;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  color: var(--texte);
  font-family: "Barlow", sans-serif;
  font-size: 1rem;
  text-align: center;
}

#verrou-mdp:focus {
  outline: none;
  border-color: var(--bleu-clair);
  box-shadow: 0 0 0 3px rgba(90, 156, 248, .2);
}

.verrou-btn {
  padding: 12px 16px;
  background: var(--rouge);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: "Barlow", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .15s, transform .15s;
}

.verrou-btn:hover:not(:disabled) { background: var(--rouge-vif); transform: translateY(-1px); }
.verrou-btn:disabled { opacity: .6; cursor: wait; }

.verrou-memoriser {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--texte-2);
  cursor: pointer;
}

.verrou-memoriser input { accent-color: var(--rouge); }

.verrou-erreur {
  min-height: 1.2em;
  font-size: .9rem;
  color: var(--rouge-vif);
}

/* ============================ VÉRIFICATEUR ============================ */

.verif { padding-top: 26px; }

.verif-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 20px;
  border: 2px dashed var(--bordure);
  border-radius: var(--rayon);
  color: var(--texte-2);
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}

.verif-zone:hover, .verif-zone:focus-visible, .verif-zone.est-survolee {
  border-color: var(--bleu-clair);
  background: rgba(90, 156, 248, .06);
  color: var(--texte);
  outline: none;
}

/* Les enfants ne doivent pas déclencher dragleave pendant un glisser. */
.verif-zone > * { pointer-events: none; }

.verif-zone svg {
  width: 34px;
  height: 34px;
  color: var(--bleu-clair);
}

.verif-zone strong {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.25rem;
  font-style: italic;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--texte);
}

.verif-zone span { font-size: .9rem; }

.verif-controles {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: .92rem;
}

.verif-controles li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  color: var(--texte-2);
  overflow-wrap: anywhere;
}

.verif-controles li::before {
  flex-shrink: 0;
  font-weight: 700;
}

.verif-controles .est-ok::before { content: "✓"; color: #2fbf71; }
.verif-controles .est-ko::before { content: "✕"; color: var(--rouge-vif); }
.verif-controles .est-ko { color: var(--rouge-vif); }

/* Rangées fantômes derrière le flou tant que c'est verrouillé */

.squelette {
  height: 56px;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  background: linear-gradient(100deg, var(--panneau) 35%, var(--panneau-2) 50%, var(--panneau) 65%);
  background-size: 220% 100%;
  animation: chatoiement 1.8s linear infinite;
}

.squelette:nth-child(2n) { opacity: .8; }
.squelette:nth-child(3n) { opacity: .65; }

@keyframes chatoiement {
  to { background-position: -120% 0; }
}

/* ------------------------------ Menu gauche ------------------------------ */

.menu-balades { display: flex; flex-direction: column; gap: 10px; }

.balade {
  background: linear-gradient(180deg, var(--panneau) 0%, var(--fond-2) 100%);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  overflow: hidden;
  transition: border-color .2s;
}

.balade.est-ouverte { border-color: #3a55a4; }

.balade-titre {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  color: var(--texte);
  font-size: 1.22rem;
  font-weight: 700;
  font-style: italic;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .02em;
  cursor: pointer;
}

.balade-titre:hover { color: var(--rouge-vif); }

.balade-nom { flex: 1; min-width: 0; }

.badge-jours {
  flex-shrink: 0;
  font-family: "Barlow", sans-serif;
  font-style: normal;
  font-size: .8rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--bleu);
  color: #fff;
  letter-spacing: .04em;
}

.balade-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--texte-2);
  transition: transform .3s;
}

.balade.est-ouverte .balade-chevron { transform: rotate(180deg); }

.etapes-cadre {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .35s cubic-bezier(.2, .8, .25, 1);
}

.balade.est-ouverte .etapes-cadre { grid-template-rows: 1fr; }

.etapes { list-style: none; overflow: hidden; }

.etapes li:first-child { border-top: 1px solid var(--bordure); }

.etape-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px 11px 18px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--texte-2);
  font-family: "Barlow", sans-serif;
  font-size: .98rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.etape-btn:hover {
  background: rgba(90, 156, 248, .08);
  color: var(--texte);
}

.etape-btn.est-active {
  background: rgba(239, 58, 80, .12);
  border-left-color: var(--rouge);
  color: var(--texte);
  font-weight: 600;
}

.etape-nom { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.etape-meta {
  flex-shrink: 0;
  font-size: .8rem;
  color: var(--bleu-clair);
  font-weight: 600;
  white-space: nowrap;
}

/* ------------------------------ Carte droite ----------------------------- */

.carte-panneau {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 32px);
  height: calc(100svh - 32px);
  min-height: 480px;
}

.info-etape {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: linear-gradient(180deg, var(--panneau-2) 0%, var(--panneau) 100%);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}

.info-texte { flex: 1; min-width: 0; }

.info-balade {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--bleu-clair);
}

.info-balade:empty { display: none; }

.info-nom {
  font-size: 1.45rem;
  font-style: italic;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.info-stats { font-size: .92rem; color: var(--texte-2); }

.info-stats strong { color: var(--texte); font-weight: 600; }

.info-etape.est-erreur .info-stats { color: var(--rouge-vif); }

.info-etape.est-vide .info-nom { color: var(--texte-2); }

.btn-gpx {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--rouge);
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .04em;
  text-decoration: none;
  transition: background .15s, transform .15s;
}

.btn-gpx:hover { background: var(--rouge-vif); transform: translateY(-1px); }

.btn-gpx svg { width: 18px; height: 18px; }

.btn-editer {
  background: var(--bleu);
  border: none;
  cursor: pointer;
  font-family: "Barlow", sans-serif;
  font-size: .95rem;
}

.btn-editer:hover { background: var(--bleu-clair); }

#map, #carte-planif, #carte-verif {
  flex: 1;
  min-height: 0;
  border-radius: var(--rayon);
  border: 1px solid var(--bordure);
  box-shadow: var(--ombre);
  background: var(--fond-2);
  z-index: 0; /* sous le menu déroulant en mobile */
}

/* ============================ PLANIFICATEUR ============================ */

.planif { padding-top: 26px; }

#carte-planif { cursor: crosshair; }

.planif-panneau {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: linear-gradient(180deg, var(--panneau) 0%, var(--fond-2) 100%);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
}

.planif-recherche {
  display: flex;
  gap: 8px;
}

#planif-adresse {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  color: var(--texte);
  font-family: "Barlow", sans-serif;
  font-size: .98rem;
}

#planif-adresse:focus {
  outline: none;
  border-color: var(--bleu-clair);
  box-shadow: 0 0 0 3px rgba(90, 156, 248, .2);
}

#planif-chercher {
  flex-shrink: 0;
  width: 44px;
  background: var(--bleu);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: background .15s;
}

#planif-chercher:hover:not(:disabled) { background: var(--bleu-clair); }
#planif-chercher:disabled { opacity: .6; cursor: wait; }

#planif-chercher svg { width: 19px; height: 19px; vertical-align: middle; }

.planif-resultats {
  list-style: none;
  display: flex;
  flex-direction: column;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  overflow: hidden;
}

.planif-resultats li + li { border-top: 1px solid var(--bordure); }

.planif-resultats button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  color: var(--texte-2);
  font-family: "Barlow", sans-serif;
  font-size: .88rem;
  text-align: left;
  cursor: pointer;
}

.planif-resultats button:hover {
  background: rgba(90, 156, 248, .1);
  color: var(--texte);
}

.planif-resultats .est-vide {
  padding: 10px 12px;
  font-size: .88rem;
  color: var(--texte-2);
}

.planif-stats {
  font-size: .95rem;
  color: var(--texte-2);
}

.planif-stats strong { color: var(--texte); }

.planif-liste {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 44vh;
  overflow-y: auto;
}

.planif-liste li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.planif-liste .planif-badge {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  font-size: 10px;
  cursor: grab;
}

.planif-liste li.est-cible {
  outline: 2px dashed var(--bleu-clair);
  outline-offset: 2px;
  border-radius: 8px;
}

.planif-fleches {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.planif-fleches button {
  width: 22px;
  height: 15px;
  padding: 0;
  background: none;
  border: none;
  color: var(--texte-2);
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
}

.planif-fleches button:hover:not(:disabled) { color: var(--rouge-vif); }
.planif-fleches button:disabled { opacity: .3; cursor: default; }

.planif-liste input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  color: var(--texte);
  font-family: "Barlow", sans-serif;
  font-size: .92rem;
}

.planif-liste input:focus {
  outline: none;
  border-color: var(--bleu-clair);
}

.planif-suppr {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  background: none;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  color: var(--texte-2);
  font-size: .85rem;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.planif-suppr:hover { color: var(--rouge-vif); border-color: var(--rouge); }

.planif-actions {
  display: flex;
  gap: 8px;
}

.planif-btn {
  flex: 1;
  padding: 9px 10px;
  background: none;
  border: 1px solid var(--bordure);
  border-radius: 10px;
  color: var(--texte-2);
  font-family: "Barlow", sans-serif;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.planif-btn:hover:not(:disabled) { color: var(--texte); border-color: #3a55a4; }
.planif-btn:disabled { opacity: .45; cursor: default; }

#planif-nom {
  width: 100%;
  padding: 11px 14px;
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  color: var(--texte);
  font-family: "Barlow", sans-serif;
  font-size: 1rem;
}

#planif-nom:focus {
  outline: none;
  border-color: var(--bleu-clair);
  box-shadow: 0 0 0 3px rgba(90, 156, 248, .2);
}

.planif-telecharger {
  justify-content: center;
  border: none;
  font-family: "Barlow", sans-serif;
  font-size: 1rem;
  cursor: pointer;
}

.planif-telecharger:disabled {
  opacity: .45;
  cursor: default;
  transform: none;
}


/* Marqueurs de parcours */

.wp {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
  font-family: "Barlow", sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--bleu);
}

.wp-depart { background: #159a4a; }

.wp-arrivee {
  color: #111;
  background:
    conic-gradient(#111 0 25%, #fff 0 50%, #111 0 75%, #fff 0) 0 0 / 10px 10px;
}

.leaflet-tooltip.wp-info {
  font-family: "Barlow", sans-serif;
  font-weight: 600;
}

/* Attribution Leaflet plus discrète sur fond sombre */
.leaflet-control-attribution {
  background: rgba(255, 255, 255, .75) !important;
  font-size: 10px !important;
}

/* ============================== FOOTER ============================== */

.pied {
  border-top: 1px solid var(--bordure);
  margin-top: 30px;
  padding: 44px 22px 50px;
  text-align: center;
  background: linear-gradient(180deg, var(--fond) 0%, #081021 100%);
}

.pied img { opacity: .9; }

.pied-devise {
  margin-top: 12px;
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--texte);
}

.pied-credits {
  margin-top: 10px;
  font-size: .85rem;
  color: var(--texte-2);
}

.pied-credits a { color: var(--texte-2); }
.pied-credits a:hover { color: var(--bleu-clair); }

/* ============================= RESPONSIVE ============================= */

@media (max-width: 900px) {
  .balades { padding-top: 52px; }

  .balades-grille { grid-template-columns: 1fr; }

  .carte-panneau {
    position: static;
    height: auto;
    min-height: 0;
  }

  #map, #carte-planif, #carte-verif { height: 62svh; min-height: 340px; }

  .info-etape { flex-wrap: wrap; gap: 10px; }

  .planif-liste { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .route-axe, .hero-scroll svg, .hero-contenu,
  .squelette, .verrou-carte.est-secoue { animation: none; }
}
