:root {
  /* Ces valeurs sont écrasées au chargement par config.json (voir js/theme.js).
     Elles servent de repli si le fichier est absent. */
  --bg: #f5f5f5;
  --ink: #222222;
  --panel: #ffffff;
  --header-bg: #111111;
  --header-text: #ffffff;
  --accent: #e67e22;
  --line: #eee;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 0.8rem;
  padding: 0.7rem 1rem;
  background: var(--header-bg);
  color: var(--header-text);
  flex-wrap: wrap;
}

header h1 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Les <select> natifs sont énormes sur Android s'ils héritent de la police
   système. On les contraint pour qu'ils tiennent sur une ligne. */
.controls select {
  font-size: 0.85rem;
  max-width: 100%;
}

select {
  padding: 0.25rem 0.5rem;
}

.mode-toggle button {
  padding: 0.3rem 0.8rem;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.16);
  color: var(--header-text);
  font: inherit;
  font-size: 0.85rem;
}

.mode-toggle button.active {
  background: var(--accent);
}

main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

#map {
  width: 100%;
  height: 320px;
  border-radius: 6px;
  background: #ddd;
}

.route-links {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}

.route-links a {
  color: #b35c10;
}

#stop-section, #stop-detail {
  background: var(--panel);
  border-radius: 6px;
  padding: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#stop-section h2 { margin: 0; font-size: 1rem; }
#stop-start-info { margin: 0.35rem 0 0; color: #666; font-size: 0.9rem; }

#stop-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

#stop-list li {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

#stop-list li:hover { background: #fafafa; }
#stop-list li:last-child { border-bottom: none; }

.thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  margin-right: 0.6rem;
  border-radius: 4px;
  flex-shrink: 0;
  background: #ddd;
}

.li-text { display: flex; flex-direction: column; gap: 0.15rem; }
.li-name { font-weight: 600; }
.li-short { font-size: 0.85rem; color: #666; }

.detail-img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  margin: 0.5rem 0;
  border-radius: 4px;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.btn {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}

.btn.secondary { background: #333; }

footer {
  padding: 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: #777;
}

footer a { color: #777; }

.hidden { display: none; }

@media (max-width: 640px) {
  /* Ligne 1 : retour + titre tronqué + langue.
     Ligne 2 : parcours et mode, sur toute la largeur. */
  header {
    padding: 0.6rem 0.8rem;
    row-gap: 0.55rem;
  }

  header h1 {
    font-size: 0.92rem;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .controls {
    flex: 1 1 100%;
    gap: 0.45rem;
  }

  .tour-picker {
    flex: 1 1 100%;
    gap: 0.45rem;
  }

  .tour-picker select {
    flex: 1 1 auto;
    min-width: 0;
  }

  .mode-toggle {
    display: flex;
    flex: 1 1 auto;
  }

  .mode-toggle button {
    flex: 1 1 auto;
    padding: 0.45rem 0.6rem;
  }

  #language-select { flex: 0 0 auto; }

  #map { height: 300px; }

  main { padding: 0.8rem; }

  .thumb { width: 52px; height: 52px; }

  .detail-actions .btn { flex: 1 1 auto; text-align: center; }
}

/* Leaflet numbered markers */
.num-marker span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.leaflet-container {
  border-radius: 6px;
  font: inherit;
}

/* Sélecteur de parcours */
.tour-picker {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  opacity: 0.9;
}

/* Bloc « En savoir plus » */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.link-btn:hover { text-decoration: underline; }

.long-text {
  border-left: 3px solid var(--accent);
  padding-left: 0.9rem;
  margin: 0.6rem 0;
}

.long-text p {
  margin: 0;
  line-height: 1.65;
  color: #444;
}

#stop-detail picture { display: contents; }

/* Lien retour vers l'accueil (page parcours) */
.home-link {
  color: var(--header-text);
  text-decoration: none;
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0.75;
  margin-right: 0.6rem;
}

.home-link:hover { opacity: 1; }

/* Numéro de version affiché en pied de page : permet de vérifier d'un coup
   d'oeil, sur n'importe quel appareil, que les fichiers ne sont pas en cache. */
.build { opacity: 0.5; }
