/*
 * Charte BartheTech (barthetech.fr) : fond charbon, texte crème, accent rouge-orangé.
 * Mêmes valeurs que les « BRAND INPUTS » de src/app/globals.css du site.
 * Les teintes des prix (vert → jaune → rouge) restent celles de lib.couleurPrix.
 */
@font-face {
  font-display: swap;
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  src: url("../vendor/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

@font-face {
  font-display: swap;
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 900;
  src: url("../vendor/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
}

:root {
  --charbon: #161619;
  --charbon-eleve: #212126;
  --charbon-survol: #2c2c32;
  --creme: #fff8e2;
  --creme-attenue: #c9c2ae;
  --creme-12: rgb(255 248 226 / 12%);
  --creme-16: rgb(255 248 226 / 16%);
  --orange: #dd312e;
  --orange-survol: #c52926;
  --panneau: rgb(22 22 25 / 86%);
  --ombre: 0 12px 32px -16px rgb(0 0 0 / 70%);
  --police: "Inter", ui-sans-serif, system-ui, sans-serif;
  --police-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  --hauteur-barre: 3.25rem;

  color-scheme: dark;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--charbon);
  color: var(--creme);
  font-family: var(--police);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--orange);
  color: var(--creme);
}

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* ── Barre du site ─────────────────────────────────────────────────────── */

.barre {
  position: absolute;
  z-index: 1001;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--hauteur-barre);
  box-sizing: border-box;
  padding: 0 1rem;
  border-bottom: 1px solid var(--creme-12);
  background: rgb(22 22 25 / 92%);
  backdrop-filter: blur(8px);
}

.barre a {
  color: inherit;
  text-decoration: none;
}

.marque {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgb(255 248 226 / 85%);
  font-family: var(--police-mono);
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  transition: color 200ms;
}

.marque:hover {
  color: var(--creme);
}

.marque .point {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--orange);
}

.marque .accent {
  color: var(--orange);
}

.fil {
  color: var(--creme-16);
  font-family: var(--police-mono);
}

.barre h1 {
  margin: 0;
  color: var(--orange);
  font-family: var(--police-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.liens {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-left: auto;
  font-size: 0.875rem;
}

.liens .secondaire {
  color: rgb(255 248 226 / 85%);
  transition: color 200ms;
}

.liens .secondaire:hover {
  color: var(--creme);
}

.liens .cta {
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  background: var(--orange);
  color: var(--creme);
  font-weight: 500;
  transition:
    background-color 200ms,
    box-shadow 220ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

.liens .cta:hover {
  background: var(--orange-survol);
  box-shadow:
    0 14px 32px -18px rgb(221 49 46 / 52%),
    0 0 0 1px rgb(221 49 46 / 28%);
}

@media (width < 720px) {
  .liens .secondaire {
    display: none;
  }
}

@media (width < 520px) {
  .liens {
    display: none;
  }
}

/* Halo lent autour du point, comme sur le site (brand-dot-pulse). */
@keyframes point-pulse {
  0% {
    box-shadow: 0 0 0 0 rgb(221 49 46 / 55%);
  }

  70% {
    box-shadow: 0 0 0 6px rgb(221 49 46 / 0%);
  }

  100% {
    box-shadow: 0 0 0 0 rgb(221 49 46 / 0%);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .marque .point {
    animation: point-pulse 2.6s ease-out infinite;
  }
}

/* ── Carte ─────────────────────────────────────────────────────────────── */

#carte {
  position: absolute;
  inset: var(--hauteur-barre) 0 0;
}

.leaflet-container {
  background: var(--charbon);
  font-family: var(--police);
  font-size: 0.8125rem;
}

/* Tuiles OSM passées en sombre ; les marqueurs, dans un autre calque, gardent leurs couleurs. */
.leaflet-tile-pane {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(85%) saturate(55%);
}

.leaflet-bar,
.leaflet-touch .leaflet-bar {
  overflow: hidden;
  border: 1px solid var(--creme-12);
  border-radius: 10px;
  box-shadow: var(--ombre);
}

.leaflet-bar a,
.leaflet-bar a.leaflet-disabled {
  border-bottom-color: var(--creme-12);
  background-color: var(--panneau);
  color: var(--creme);
}

.leaflet-bar a:hover,
.leaflet-bar a:focus {
  background-color: var(--charbon-survol);
  color: var(--creme);
}

.leaflet-bar a.leaflet-disabled {
  color: var(--creme-16);
}

.leaflet-container .leaflet-control-attribution {
  background: var(--panneau);
  color: var(--creme-attenue);
  font-size: 0.6875rem;
}

.leaflet-container .leaflet-control-attribution a {
  color: var(--creme-attenue);
}

.leaflet-container .leaflet-control-attribution a:hover {
  color: var(--orange);
}

/* ── Statut ────────────────────────────────────────────────────────────── */

#statut {
  position: absolute;
  z-index: 1000;
  bottom: 20px;
  left: 50%;
  max-width: calc(100% - 32px);
  box-sizing: border-box;
  padding: 0.375rem 0.875rem;
  overflow: hidden;
  border: 1px solid var(--creme-12);
  border-radius: 999px;
  background: var(--panneau);
  box-shadow: var(--ombre);
  color: var(--creme);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  transform: translateX(-50%);
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

#statut.erreur {
  border-color: rgb(221 49 46 / 60%);
  background: #3a1715;
  color: #ffc9c2;
}

/* ── Panneaux (usage, choix du carburant) ──────────────────────────────── */

.usage,
.choix-carburant {
  border: 1px solid var(--creme-12);
  border-radius: 10px;
  background: var(--panneau);
  box-shadow: var(--ombre);
  color: var(--creme);
  backdrop-filter: blur(8px);
}

.usage {
  padding: 0.375rem 0.625rem;
  color: var(--creme-attenue);
  font-family: var(--police-mono);
  font-size: 0.625rem;
  line-height: 1.6;
  white-space: nowrap;
}

.usage .jauge {
  height: 3px;
  margin: 1px 0 2px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--creme-12);
}

.usage .jauge div {
  height: 100%;
}

.usage .jauge div.normal {
  background: #2e7d32;
}

.usage .jauge div.attention {
  background: #f9a825;
}

.usage .jauge div.critique {
  background: #c62828;
}

.choix-carburant {
  padding: 0.5rem 0.625rem;
  font-size: 0.75rem;
}

.choix-carburant label {
  color: var(--orange);
  font-family: var(--police-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.choix-carburant select {
  margin-left: 0.375rem;
  padding: 0.125rem 0.375rem;
  border: 1px solid var(--creme-16);
  border-radius: 6px;
  background: var(--charbon);
  color: var(--creme);
  font: inherit;
  font-family: var(--police);
  font-size: 0.8125rem;
  letter-spacing: normal;
  text-transform: none;
}

.choix-carburant .legende {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.375rem;
  color: var(--creme-attenue);
  font-family: var(--police-mono);
  font-size: 0.6875rem;
  white-space: nowrap;
}

/* Mêmes teintes que lib.couleurPrix et la jauge du quota. */
.choix-carburant .degrade {
  flex: 1;
  min-width: 30px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #2e7d32, #f9a825, #c62828);
}

/* ── Marqueurs : conteneur Leaflet sans taille, la pastille se centre sur la position. ── */

.marqueur .pastille {
  position: absolute;
  padding: 1px 5px;
  border: 1.5px solid var(--charbon);
  border-radius: 9px;
  box-shadow: 0 1px 4px rgb(0 0 0 / 60%);
  font-family: var(--police-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  cursor: pointer;
}

.marqueur .pastille.sans-prix {
  width: 8px;
  height: 8px;
  padding: 0;
  background: #6c6a66;
}

.marqueur:focus-visible {
  outline: none;
}

.marqueur:focus-visible .pastille {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
}

/* ── Bulles des stations ───────────────────────────────────────────────── */

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--charbon-eleve);
  box-shadow: var(--ombre);
  color: var(--creme);
}

.leaflet-popup-content-wrapper {
  border: 1px solid var(--creme-12);
  border-radius: 12px;
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--creme-attenue);
}

.leaflet-container a.leaflet-popup-close-button:hover,
.leaflet-container a.leaflet-popup-close-button:focus {
  color: var(--orange);
}

.station h3 {
  margin: 0 0 2px;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.station .ville {
  margin-bottom: 8px;
  color: var(--creme-attenue);
}

.station table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.station td {
  padding: 4px;
  border-top: 1px solid var(--creme-12);
}

.station td.prix {
  font-family: var(--police-mono);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.station td.maj {
  color: var(--creme-attenue);
  font-family: var(--police-mono);
  font-size: 0.6875rem;
  text-align: right;
}

.station tr.choisi td {
  background: rgb(221 49 46 / 16%);
}

.station tr.choisi td:first-child {
  box-shadow: inset 2px 0 var(--orange);
}

.station .rupture {
  margin-top: 6px;
  color: #ff9d92;
  font-size: 0.75rem;
}

.station .vide {
  color: var(--creme-attenue);
}
