/* Communauté Bivio : la palette de web/style.css (nidello.ca), sans police ni script tiers. */
:root {
  --ground: #FCFAF6; --surface: #F5EEE4; --line: #E6DCCC;
  --ink: #241E1A; --muted: #6B5F55; --accent: #C0603A; --accent-hi: #8F4526;
  /* Les boutons pleins : un fond assez foncé pour un texte lisible (contraste 4,5:1). */
  --plein: #A9502F; --sur-plein: #fff;
  /* Le fond de carte des tracés (Natural Earth) : la mer, les terres, les côtes, les frontières. */
  --mer: #DCEAF0; --terre: #F3EEE4; --cote: #A9C3CE; --frontiere: #C9B9A4;
  --serif: "Twemoji Country Flags", "Iowan Old Style", "New York", Georgia, serif;
  --sans: "Twemoji Country Flags", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --ground: #191512; --surface: #221C18; --line: #352C25;
    --ink: #F2EBE1; --muted: #A69789; --accent: #DA8058; --accent-hi: #EC9670;
    --plein: #DA8058; --sur-plein: #191512;
    --mer: #14232A; --terre: #2A241F; --cote: #3D5761; --frontiere: #54483E; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.5 var(--sans); }
main { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; }
a { color: var(--accent); }
a:hover { color: var(--accent-hi); }
ul { list-style: none; padding: 0; margin: 0; }
header.marque { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
header.marque a { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
header.marque img { width: 36px; height: 36px; border-radius: 22.5%; }
header.marque strong { font: 600 28px/1.2 var(--serif); }
header.marque strong span { color: var(--accent); }
header.marque em { font: italic 400 18px/1.2 var(--serif); color: var(--muted); }
.brouillon { margin: 0 0 20px; padding: 8px 12px; border-radius: 10px; font-size: 14px;
  background: #fff3cd; color: #5c4400; border: 1px solid #f0d78a; }
@media (prefers-color-scheme: dark) { .brouillon { background: #3a2f10; color: #f3dc8f; border-color: #5c4a18; } }
h1 { font: 600 32px/1.2 var(--serif); margin: 16px 0 4px; }
.chapeau { color: var(--muted); margin: 0 0 24px; }
.carte { display: block; padding: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; margin-bottom: 12px; color: var(--ink); text-decoration: none; }
a.carte:hover { border-color: var(--accent); }
.carte h2 { font: 600 21px/1.3 var(--serif); margin: 0; }
.meta { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.chiffres { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; font-size: 14px; }
.chiffres b { font: 600 17px/1 var(--serif); margin-right: 3px; }
.carte-apple { height: 62vh; min-height: 360px; max-height: 640px; margin: 12px -16px 4px; border-radius: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; background: var(--surface); }
@media (min-width: 700px) { .carte-apple { margin: 12px 0 4px; border-radius: 12px; border: 1px solid var(--line); } }
svg.trace { display: block; width: 100%; height: auto; aspect-ratio: 8 / 3; margin: 12px 0 4px; border-radius: 10px;
  background: var(--ground); border: 1px solid var(--line); }
svg.trace rect.mer { fill: var(--mer); }
/* Le trait de la même couleur couvre la jointure entre deux cases de terre. */
svg.trace .terre { fill: var(--terre); stroke: var(--terre); stroke-width: 0.8; }
svg.trace .cote { fill: none; stroke: var(--cote); stroke-width: 0.7; stroke-opacity: .8; }
svg.trace .frontiere { fill: none; stroke: var(--frontiere); stroke-width: 0.7; stroke-opacity: .7; stroke-dasharray: 2.5 2; }
svg.trace .route-halo path, svg.trace polyline.halo { fill: none; stroke: var(--mer); stroke-width: 6; stroke-linejoin: round; stroke-linecap: round; opacity: .8; }
svg.trace text.ville { fill: var(--ink); font-family: var(--sans); font-weight: 600; paint-order: stroke; stroke: var(--mer); stroke-width: 3.5px; stroke-linejoin: round; }
svg.trace .route path { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
svg.trace .route path.traversee { stroke-width: 2; stroke-dasharray: 5 5; }
svg.trace polyline { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
svg.trace circle { fill: var(--ground); stroke: var(--accent); stroke-width: 2; }
svg.trace circle.bout { stroke: var(--ink); stroke-width: 2; }
svg.trace circle.bout { fill: var(--accent); }
ol.etapes { list-style: none; padding: 0; margin: 12px 0 0; counter-reset: e; }
ol.etapes li { counter-increment: e; display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px; }
ol.etapes li::before { content: counter(e); flex: none; display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--plein); color: var(--sur-plein); font-size: 12px; font-weight: 700; margin-top: 1px; }
ol.etapes li span { color: var(--muted); margin-left: auto; white-space: nowrap; }
details summary { cursor: pointer; color: var(--accent); font-size: 14px; margin-top: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bouton { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--plein); color: var(--sur-plein);
  text-decoration: none; font-size: 14px; font-weight: 600; }
.bouton.discret { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.bouton[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.vide { color: var(--muted); }
footer { margin-top: 40px; color: var(--muted); font-size: 13px; }
/* La légende des cartes, en bas de la recherche. */
.legende { margin-top: 36px; color: var(--muted); font-size: 13px; }
.legende h2 { margin: 0 0 8px; font-size: 14px; font-weight: 600; color: inherit; }
.legende ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.legende li { display: flex; align-items: center; gap: 10px; }
.legende svg { flex: none; }
.legende + footer { margin-top: 20px; }
/* La recherche de /social. */
.recherche { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; margin: 0 0 12px; }
.recherche label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.recherche label.plein { grid-column: 1 / -1; }
.recherche input, .recherche select { font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%; }
.compte { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.villes { margin: 6px 0 0; font-size: 15px; }
.etoiles { margin: 4px 0 0; color: var(--accent); letter-spacing: 2px; }
/* Signaler : discret, à droite des actions. */
.actions .signaler { margin-left: auto; background: none; border: none; color: var(--muted); font: inherit; font-size: 13px;
  cursor: pointer; text-decoration: underline; padding: 8px 0; }
dialog.signaler { border: 1px solid var(--line); border-radius: 14px; background: var(--ground); color: var(--ink);
  max-width: 420px; width: calc(100% - 32px); padding: 20px; }
dialog.signaler::backdrop { background: rgba(0, 0, 0, .45); }
dialog.signaler h2 { font: 600 20px/1.3 var(--serif); margin: 0 0 8px; }
dialog.signaler label { display: flex; gap: 8px; align-items: center; padding: 5px 0; }
dialog.signaler textarea { width: 100%; font: inherit; margin-top: 8px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 8px; }
dialog.signaler menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 14px 0 0; }

/* Une ligne de la recherche : le texte, puis la miniature du trajet au bout. */
a.ligne-voyage { display: flex; gap: 14px; align-items: stretch; }
a.ligne-voyage .texte { flex: 1; min-width: 0; }
a.ligne-voyage .carte-mini, a.ligne-voyage svg.trace { flex: none; width: 200px; height: 130px; margin: 0;
  border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--ground); pointer-events: none; }
@media (max-width: 560px) {
  a.ligne-voyage { flex-direction: column; }
  a.ligne-voyage .carte-mini, a.ligne-voyage svg.trace { width: 100%; height: 150px; }
}

/* Jour par jour. */
ol.jours { list-style: none; padding: 0; margin: 10px 0 0; }
ol.jours > li { padding: 8px 0; border-top: 1px solid var(--line); }
ol.jours h4 { margin: 0 0 4px; font: 600 14px/1.3 var(--sans); color: var(--accent); text-transform: none; }
ol.jours h4::first-letter { text-transform: uppercase; }
ol.jours ul li { display: flex; gap: 8px; font-size: 15px; padding: 2px 0; }
ol.jours .icone { flex: none; width: 20px; text-align: center; }
ol.jours li.arrivee { font-weight: 600; }
ol.jours li.nuit { color: var(--muted); font-size: 14px; }

/* Noter : cinq étoiles à toucher, puis la moyenne. */
.noteur { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 8px 0 0; }
.etoiles-noter button { font: inherit; font-size: 22px; line-height: 1; padding: 2px 3px; background: none; border: 0;
  cursor: pointer; color: var(--muted); }
.etoiles-noter button.pleine { color: var(--accent); }
.etoiles-noter button:hover { transform: scale(1.12); }
.noteur .moyenne { color: var(--muted); font-size: 14px; }
.resume { margin: 8px 0 0; font-size: 15px; }

/* Les étapes et leurs jours, en une seule liste. */
ol.etapes > li { display: block; }
ol.etapes > li::before { float: left; margin-right: 10px; }
.etape-titre { display: flex; align-items: baseline; gap: 8px; }
.etape-titre strong { font: 600 16px/1.3 var(--sans); }
.etape-titre span { margin-left: auto; color: var(--muted); font-size: 14px; white-space: nowrap; }
ol.etapes ul.jours { list-style: none; padding: 0 0 0 32px; margin: 6px 0 2px; clear: both; }
ol.etapes ul.jours > li { padding: 4px 0; }
ol.etapes ul.jours h4 { margin: 0 0 2px; font: 600 13px/1.3 var(--sans); color: var(--accent); }
ol.etapes ul.jours h4::first-letter { text-transform: uppercase; }
ol.etapes ul.jours ul li { display: flex; gap: 8px; font-size: 15px; padding: 1px 0; border: 0; }
ol.etapes ul.jours ul li::before { content: none; }
ol.etapes ul.jours .icone { flex: none; width: 20px; text-align: center; }
ol.etapes li.libre { color: var(--muted); font-size: 14px; }

/* Seules les étapes sont numérotées ; les jours et activités imbriqués ne comptent pas. */
ol.etapes ul li { counter-increment: none; display: block; border-top: 0; padding: 2px 0; }
ol.etapes ul li::before { content: none !important; }
ol.etapes ul.jours ul li { display: flex; }
ol.etapes > li > .etape-titre { min-height: 22px; }
ol.etapes ul li span { margin-left: 0; color: inherit; white-space: normal; }

/* Les filtres à cocher. */
.choix details { position: relative; }
.choix summary { list-style: none; cursor: pointer; font-size: 15px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choix summary::-webkit-details-marker { display: none; }
.choix summary::after { content: " ▾"; color: var(--muted); }
.choix.actif summary { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.choix .liste-cases { position: absolute; z-index: 10; top: calc(100% + 4px); left: 0; min-width: 220px; max-height: 320px;
  overflow: auto; background: var(--ground); border: 1px solid var(--line); border-radius: 12px; padding: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.choix .tout { display: flex; gap: 6px; margin-bottom: 6px; }
.choix .tout button { flex: 1; font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 8px; cursor: pointer;
  background: var(--surface); color: var(--accent); border: 1px solid var(--line); }
.choix label.case { display: flex; align-items: center; gap: 8px; padding: 5px 4px; font-size: 15px; color: var(--ink); cursor: pointer; }
.choix label.case input { width: 18px; height: 18px; accent-color: var(--accent); }
.recherche .choix label.case { flex-direction: row; }
.choix .liste-cases { min-width: 250px; }
.choix .tout button { white-space: nowrap; }

/* Les menus à cocher : largeur au contenu, boutons entiers, vers la gauche près du bord. */
.choix .liste-cases { min-width: 100%; width: max-content; max-width: min(320px, calc(100vw - 32px)); }
.choix .liste-cases.a-droite { left: auto; right: 0; }
.choix .tout { flex-wrap: wrap; }
.choix .tout button { flex: 1 1 auto; }

/* La liste réserve sa place pendant le chargement : le pied de page ne saute pas. */
#resultats, #voyages { min-height: 100vh; }
button.plus { display: block; margin: 8px auto 0; font: inherit; font-size: 15px; color: var(--accent); background: none;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; cursor: pointer; }
/* Le tracé dessiné tient la place de la carte d'Apple en attendant. */
.carte-mini > svg.trace, .carte-apple > svg.trace { width: 100%; height: 100%; margin: 0; aspect-ratio: auto; }
button.plus[hidden] { display: none; }
.retour { margin: 16px 0 12px; font-size: 15px; }
.retour a { text-decoration: none; }
/* La miniature en image : elle remplit sa case, coupée au besoin. */
picture.carte-mini { display: block; overflow: hidden; border-radius: 10px; background: var(--surface); }
picture.carte-mini img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* Sur un téléphone, la miniature garde les proportions de l'image (le logo d'Apple reste entier). */
@media (max-width: 560px) { a.ligne-voyage picture.carte-mini { height: auto; aspect-ratio: 20 / 13; } }
/* Le tri, aligné sur les menus à cocher : même hauteur, son étiquette lue seulement par VoiceOver. */
.cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.recherche { align-items: end; }
.choix summary { line-height: 24px; height: 42px; box-sizing: border-box; }
/* 16 px : sous cette taille, l'iPhone agrandit la page quand on touche le menu. */
.recherche label.tri select { font-size: 16px; padding: 0 10px; height: 42px; box-sizing: border-box; }

/* « Sélectionner » : cocher des itinéraires, puis « Importer dans Bivio » (barre du bas). */
.outils-liste { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 10px; }
.outils-liste .compte { margin: 0; }
button.selectionner { font: inherit; font-size: 15px; color: var(--accent); background: none; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; }
button.selectionner[aria-pressed="true"] { background: var(--surface); }
a.ligne-voyage { position: relative; }
a.ligne-voyage .coche { display: none; }
body.choisir a.ligne-voyage .coche { display: block; position: absolute; top: 10px; right: 10px; width: 26px; height: 26px;
  border-radius: 50%; border: 2px solid var(--muted); background: var(--ground); }
body.choisir a.ligne-voyage.choisi { border-color: var(--accent); }
body.choisir a.ligne-voyage.choisi .coche { border-color: var(--accent); background: var(--accent); }
body.choisir a.ligne-voyage.choisi .coche::after { content: ""; position: absolute; left: 8px; top: 3px; width: 6px; height: 12px;
  border: solid var(--sur-plein, #fff); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
body.choisir main { padding-bottom: 120px; }
.barre-import { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0, 0, 0, .25); }
.barre-import[hidden], button.selectionner[hidden] { display: none; }
.barre-import .barre-ligne { max-width: 1360px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.barre-import .nombre { color: var(--ink); font-size: 15px; }
.barre-import .aide { max-width: 1360px; margin: 8px auto 0; color: var(--muted); font-size: 13px; }
.barre-import .aide:empty { display: none; }
button.importer { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 16px; font-weight: 600;
  color: var(--sur-plein, #fff); background: var(--plein, var(--accent)); border: none; border-radius: 999px; padding: 10px 18px; cursor: pointer; }
button.importer:disabled { opacity: .45; cursor: default; }
/* L'icône Importer (une flèche qui entre dans un plateau), dessinée en CSS. */
.icone-importer { width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4'/%3E%3C/svg%3E") center / contain no-repeat; }

/* L'image d'Apple Plans d'un voyage, servie par bivio.nidello.ca (logo d'Apple compris). */
.carte-apple-image { display: block; overflow: hidden; border-radius: 10px; background: #1E2328; }
.carte-apple-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.carte-apple-image.carte-large { margin: 12px 0 4px; aspect-ratio: 30 / 17; border: 1px solid var(--line); }
a.ligne-voyage .carte-apple-image.carte-mini { pointer-events: none; }

/* La page se montre une fois traduite (langue.js retire la classe) ; au plus tard après 2 s. */
.traduction main { visibility: hidden; animation: traduite 0s 2s forwards; }
@keyframes traduite { to { visibility: visible; } }

/* La mention d'OpenStreetMap, quand une route en vient (là où Apple n'en a pas). */
.carte-apple-image, .carte-apple, .carte-mini { position: relative; }
.mention-osm { position: absolute; right: 6px; bottom: 6px; z-index: 5; padding: 1px 5px; border-radius: 4px;
  font-size: 10px; line-height: 1.4; color: #fff; background: rgba(0, 0, 0, .55); text-decoration: none; pointer-events: auto; }
a.mention-osm:hover { text-decoration: underline; }
svg.trace text.mention-osm { position: static; font-size: 9px; fill: currentColor; opacity: .7; }
/* Sur la carte Apple vivante, les boutons de zoom occupent le coin : la mention passe au centre. */
.carte-apple > .mention-osm, .carte-mini > .mention-osm { right: auto; left: 50%; transform: translateX(-50%); }
/* Sur une vignette, pas de boutons de zoom : la mention tient sur une ligne, dans le coin. */
.carte-mini > .mention-osm { left: auto; right: 4px; bottom: 4px; transform: none; white-space: nowrap; }
@media (max-width: 560px) { .carte-mini > .mention-osm { font-size: 8px; padding: 0 3px; } }
/* Le lien App Store reste caché tant que Bivio n'est pas en vente (audit A2, 12 nov. 2026). */
[data-app-store][hidden] { display: none !important; }
