/* Polices servies par le site, sans appel à Google. Fichiers variables, caractères latins seulement. Licence OFL (fonts/LICENCE.txt). */
@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url(fonts/space-grotesk-latin.woff2) format('woff2');
}

:root {
  --ink: #0f1b2d;
  --ink-2: #3a4a62;
  --muted: #5f6e84;
  --line: #e3e8ef;
  --bg: #f6f8fb;
  --card: #ffffff;
  --surface: #ffffff;       /* champs, boutons, puces */
  --bar: #0f1b2d;           /* bandeau du haut */
  --navy: #0f1b2d;          /* fonds foncés sous texte blanc : puce active, puissance, regroupements, messages */
  --handle: #c6cfdb;
  /* Marine et vert sarcelle. Pour recolorer le site, ces variables suffisent. */
  --accent: #0b8276;        /* boutons, sélection : le texte blanc reste lisible dessus */
  --accent-ink: #0a6b62;    /* liens et textes colorés sur fond clair */
  --accent-bright: #2dd4bf; /* sur le bandeau marine */
  --accent-tint: #e2f5f2;   /* fond de survol */
  --accent-glow: rgba(11, 130, 118, .18);
  --accent-line: #a5d8d1;   /* contour des étiquettes de prise */
  /* étiquettes : fond / texte */
  --tag-bg: #eef2f7;
  --ok-bg: #e3f6ea; --ok-ink: #0b6e36;
  --busy-bg: #fff3cf; --busy-ink: #7a5300;
  --down-bg: #fde7e5; --down-ink: #a01d14;
  --free-bg: #e7f0ff; --free-ink: #24518f;
  --price-bg: #f1eaff; --price-ink: #5a2ea6;
  --ok: #0e7f3e;            /* repères : assez foncés pour que le chiffre reste lisible (contraste ≥ 4,5:1) */
  --busy: #e8a400;
  --star: #a86f00;           /* étoile des favoris : assez foncée pour rester visible sur blanc */
  --down: #d92d20;
  --unknown: #4a6fa5;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(15, 27, 45, .12);
  --panel-w: 390px;
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
  color-scheme: light dark;
}
/* Mode sombre : celui de l'appareil au chargement, puis au choix avec le bouton du bandeau (js/theme.js).
   Bien plus agréable la nuit, en voiture. Le fond de carte suit (MAP_STYLE_DARK_URL). */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6edf5;
  --ink-2: #b4c0d0;
  --muted: #8b99ad;
  --line: #26364d;
  --bg: #0b1422;
  --card: #13203a;
  --surface: #182740;
  --bar: #0f1b2d;
  --navy: #2a4670;
  --handle: #3b4d68;
  --accent-ink: #2dd4bf;
  --accent-tint: #123a3a;
  --accent-glow: rgba(45, 212, 191, .25);
  --accent-line: #1f6b62;
  --tag-bg: #1e2d45;
  --ok-bg: #0f3a24; --ok-ink: #6ee7a0;
  --busy-bg: #3d2f05; --busy-ink: #fcd34d;
  --down-bg: #46100c; --down-ink: #fca5a5;
  --free-bg: #12284a; --free-ink: #93c5fd;
  --price-bg: #2a1a4a; --price-ink: #c4b5fd;
  --star: #fcd34d;
  --shadow: 0 6px 24px rgba(0, 0, 0, .45);
}
/* tuiles image (secours sans WebGL) : on les assombrit ; le fond vectoriel a déjà sa version sombre */
[data-theme="dark"] img.leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
/* 100dvh : la hauteur vraiment visible sur mobile, barre d'adresse comprise */
body { display: flex; flex-direction: column; overflow: hidden; height: 100dvh; }
[hidden] { display: none !important; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.noscript { padding: 24px; text-align: center; }
a { color: var(--accent-ink); }
.muted { color: var(--muted); }

/* ---------- barre du haut ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--bar); color: #fff; z-index: 1001;
}
.brand { display: flex; align-items: center; gap: 8px; font-family: 'Space Grotesk', sans-serif; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
.brand svg { width: 30px; height: 34px; }
.brand b { color: var(--accent-bright); font-weight: 700; margin-left: 2px; }
.search { position: relative; flex: 1; max-width: 620px; }
.search input {
  width: 100%; height: 42px; border: 0; border-radius: 999px; padding: 0 18px;
  font: inherit; font-size: 16px; /* 16px minimum : en dessous, iOS zoome sur le champ au focus */ background: var(--surface); color: var(--ink); outline: 3px solid transparent;
}
.search input:focus { outline-color: var(--accent-bright); }
.suggestions {
  position: absolute; top: 48px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); color: var(--ink); border-radius: 12px; box-shadow: var(--shadow); z-index: 2000;
}
.suggestions li { padding: 10px 12px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--accent-tint); }
.suggestions .flag { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.icon-btn {
  width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; display: grid; place-items: center;
}
.icon-btn svg { width: 22px; height: 22px; }
/* bouton clair / sombre : discret sur le bandeau, il affiche le thème vers lequel on bascule */
.theme-btn { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35); }
.theme-btn:hover { box-shadow: inset 0 0 0 1.5px var(--accent-bright); }
.theme-btn .moon, [data-theme="dark"] .theme-btn .sun { display: block; }
.theme-btn .sun, [data-theme="dark"] .theme-btn .moon { display: none; }
.icon-btn.busy { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------- filtres ---------- */
.filters {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 1000;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px;
  padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.plugs { display: flex; gap: 8px; align-items: center; flex: none; }
.filters-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chip.plug[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.sep { width: 1px; height: 22px; background: var(--line); flex: none; }
.tag.plug { background: var(--surface); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent-line); } /* en contour, pour ne pas ressembler à l'étiquette verte « libre » */

/* ---------- mise en page ---------- */
.layout { flex: 1; display: flex; min-height: 0; position: relative; }
.map-wrap { flex: 1; min-width: 0; min-height: 0; position: relative; z-index: 0; } /* les contrôles Leaflet restent sous le panneau */
.map { position: absolute; inset: 0; }
.panel { width: var(--panel-w); flex: none; display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--line); min-height: 0; z-index: 999; }
.panel-handle { display: none; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 16px 8px; }
.panel-head h1 { font-family: 'Space Grotesk', sans-serif; font-size: 20px; margin: 0; }
.panel-head p { margin: 2px 0 0; font-size: 13px; }
.head-actions { display: flex; gap: 6px; flex: none; }
.ghost-btn.fav-toggle { width: auto; padding: 0 10px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.fav-toggle[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.fav-btn { flex: none; border: 0; background: none; padding: 0 2px; margin: -4px -4px 0 0; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.fav-btn[aria-pressed="true"], .fav-btn:hover { color: var(--star); }
.ghost-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; width: 36px; height: 36px; font-size: 18px; cursor: pointer; }
.warnings { margin: 0 12px 12px; padding: 8px 12px; border-radius: 10px; background: var(--busy-bg); color: var(--busy-ink); font-size: 12.5px; }
.warnings div + div { margin-top: 4px; }
.about { margin: 4px 12px 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.about h2 { font-family: 'Space Grotesk', sans-serif; font-size: 14px; margin: 0 0 6px; color: var(--ink); }
.about p { margin: 0 0 6px; }
.about p:last-child { margin-bottom: 0; }
.sort { display: flex; align-items: center; gap: 6px; padding: 0 16px 8px; font-size: 12.5px; }
.sort select { font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
/* partie qui défile : la liste, puis les avertissements sur les sources */
.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.list { list-style: none; margin: 0; padding: 0 12px 2px; }
.panel[aria-busy="true"]:not(.favorites) .list { opacity: .6; }
.credit { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 0; }
.credit a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.credit a:hover { color: var(--accent-ink); }
.j6n { height: 16px; width: auto; }
.install-btn { font: inherit; font-weight: 600; color: #fff; background: var(--navy); border: 0; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sources { font-size: 11.5px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

/* ---------- carte station ---------- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px;
  border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.card:hover, .card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.card-top { display: flex; gap: 10px; align-items: flex-start; }
.card h2 { font-size: 15px; margin: 0; line-height: 1.25; flex: 1; min-width: 0; }
.card-title { all: unset; cursor: pointer; overflow-wrap: anywhere; }
.card-title:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.meta:empty { display: none; }
.details a { overflow-wrap: anywhere; }
.tariff p { overflow-wrap: anywhere; }
.dist { font-family: 'Space Grotesk', sans-serif; font-size: 14px; font-weight: 700; white-space: nowrap; }
.meta { font-size: 12.5px; color: var(--ink-2); margin: 4px 0 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--tag-bg); color: var(--ink-2); }
.tag.kw { background: var(--navy); color: #fff; }
.tag.ok { background: var(--ok-bg); color: var(--ok-ink); }
.tag.busy { background: var(--busy-bg); color: var(--busy-ink); }
.tag.down { background: var(--down-bg); color: var(--down-ink); }
.tag.free { background: var(--free-bg); color: var(--free-ink); }
.tag.price { background: var(--price-bg); color: var(--price-ink); }
.tariff { margin-top: 8px; font-size: 13px; }
.tariff .src { font-size: 10.5px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-right: 6px; }
.tariff p { margin: 3px 0; }
/* dans la liste, tarifs coupés à 2 lignes ; le texte complet s'affiche sur la fiche sélectionnée */
.card:not(.active) .tariff p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.details { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--ink-2); }
.card.active .details { display: block; }
.details dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0 0 10px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions a { text-decoration: none; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 9px; background: var(--accent); color: #fff; }
.actions a.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.empty { padding: 30px 12px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- marqueurs ---------- */
.pin {
  width: 34px; height: 34px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  display: grid; place-items: center; border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
  background: var(--unknown);
}
.pin span { transform: rotate(45deg); color: #fff; font: 700 11px 'Space Grotesk', sans-serif; }
.pin.ok { background: var(--ok); }
.pin.busy { background: var(--busy); }
.pin.busy span { color: #2b1f00; }
.pin.down { background: var(--down); }
.pin.sel { outline: 3px solid var(--accent); outline-offset: 2px; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #2f7cf6; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47,124,246,.25); }
.search-pin { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 4px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.4); }
/* regroupements de bornes (icône de 40 × 40 créée par markercluster), en marine pour ne pas les confondre avec les bornes libres */
.marker-cluster { border-radius: 50%; background: rgba(15, 27, 45, .22); }
.marker-cluster div {
  width: 30px; height: 30px; margin: 5px; border-radius: 50%; text-align: center;
  background: var(--navy); color: #fff; font: 700 12px/30px 'Space Grotesk', sans-serif;
}
.leaflet-popup-content { font-family: Inter, sans-serif; font-size: 13px; }
/* contrôles Leaflet aux couleurs du thème */
.leaflet-container { background: var(--bg); }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--surface); color: var(--ink); border-bottom-color: var(--line); }
.leaflet-container .leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--muted); }
.leaflet-control-attribution a { color: var(--accent-ink); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card); color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 3000;
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); max-width: 90vw;
}
.zoom-hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 998; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; white-space: nowrap; pointer-events: none; }

/* ---------- écrans tactiles : cibles plus grandes ---------- */
@media (pointer: coarse) {
  .chip { padding: 10px 16px; font-size: 14px; }
  .actions a { padding: 11px 16px; font-size: 14px; }
  .ghost-btn { width: 44px; height: 44px; }
  .ghost-btn.fav-toggle { width: auto; padding: 0 12px; }
  .fav-btn { padding: 4px 6px; margin: -8px -8px 0 0; }
  .install-btn { padding: 10px 14px; font-size: 13px; }
  .suggestions li { padding: 13px 12px; }
  .sort select { font-size: 16px; padding: 7px 8px; } /* 16px : pas de zoom iOS */
}

/* ---------- écrans moyens (tablette, petite fenêtre) ---------- */
@media (max-width: 1100px) { :root { --panel-w: 330px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- mobile : panneau en bas ---------- */
@media (max-width: 800px) {
  .brand span { display: none; }
  .layout { flex-direction: column-reverse; }
  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; width: auto; height: 42%;
    border-right: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -6px 24px rgba(15,27,45,.18);
    transition: height .25s ease;
  }
  .panel.collapsed { height: calc(100px + env(safe-area-inset-bottom)); }
  .panel.expanded { height: 82%; }
  .panel-handle { display: block; flex: none; width: 100%; height: 28px; border: 0; background: none; cursor: pointer; position: relative; }
  .panel-handle::after { content: ''; position: absolute; top: 10px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: var(--handle); }
  .panel-head { padding-top: 0; }
  .panel-head { touch-action: none; } /* glisser l'en-tête change la hauteur du panneau */
  .panel.collapsed .panel-scroll, .panel.collapsed .sort { display: none; }
  .leaflet-control-zoom { display: none; } /* pincer pour zoomer */
  /* le bas de la carte est sous le panneau : l'attribution passe en haut */
  .leaflet-bottom.leaflet-right { bottom: auto; top: 0; }
  .zoom-hint { top: 30px; }
  .panel-head h1 { font-size: 17px; }
  .toast { bottom: auto; top: calc(120px + env(safe-area-inset-top)); }
  .filters-label { display: none; }
}
