:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-light: #60a5fa;

  --color-accessible: #2563eb;
  --color-partial: #f59e0b;
  --color-none: #e11d48;
  --color-unknown: #64748b;

  --ink-900: #0b1120;
  --ink-700: #334155;
  --ink-500: #5b6b80;
  --surface: #ffffff;
  --surface-alt: #f3f6fb;
  --border: #e2e8f0;
  --divider: rgba(11, 17, 32, 0.08);

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow-soft: 0 10px 30px -12px rgba(11, 17, 32, 0.25);
  --shadow-pop: 0 20px 50px -18px rgba(11, 17, 32, 0.35);
  --header-h: 76px;
  --sidebar-w: 300px;
  --gap: 16px;
  --content-top: calc(var(--header-h) + var(--gap) * 2);

  /* glass system */
  --glass: rgba(255, 255, 255, 0.6);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-shadow: 0 8px 32px -12px rgba(15, 23, 42, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  --glass-blur: blur(20px) saturate(180%);
  --ease: cubic-bezier(.16, .84, .44, 1);

  /* Mode sombre (MAP-DESIGN-SYSTEM.md, section « Mode sombre ») : jetons
     ajoutés au standard pour qu'aucune couleur de surface ne soit en dur. */
  color-scheme: light;
  --brand-ink: var(--brand-dark);           /* texte et liens de marque */
  --party-ink: #15803d;                     /* « Projet Montréal » dans le sous-titre */
  --surface-hover: rgba(255, 255, 255, 0.55);
  --surface-active: rgba(255, 255, 255, 0.85);
  --overlay: rgba(11, 17, 32, 0.45);
  --scrim: rgba(11, 17, 32, 0.35);
  --scrollbar: rgba(11, 17, 32, 0.22);
  --attribution-bg: rgba(255, 255, 255, 0.7);
  --page-bg:
    radial-gradient(1100px 650px at 85% -10%, rgba(96, 165, 250, 0.18), transparent 60%),
    radial-gradient(900px 600px at -5% 110%, rgba(129, 140, 248, 0.12), transparent 60%),
    var(--surface-alt);
  --tile-filter: grayscale(55%) brightness(1.06) contrast(0.92) saturate(0.8);
}

/* Valeurs du « dashboard verre » (requetes-311/docs/glass.css). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand-ink: #93c5fd;
    --party-ink: #6ee7a0;
    --color-accessible: #3b82f6;
    --ink-900: #e4eee8;
    --ink-700: #b4c4bb;
    --ink-500: #8b9d94;
    --surface: rgba(255, 255, 255, 0.12);
    --surface-alt: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.1);
    --divider: rgba(255, 255, 255, 0.08);
    --glass: rgba(24, 33, 29, 0.62);
    --glass-strong: rgba(34, 45, 40, 0.82);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 10px 36px -8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --shadow-soft: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
    --shadow-pop: 0 24px 60px -16px rgba(0, 0, 0, 0.6);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --surface-active: rgba(255, 255, 255, 0.1);
    --overlay: rgba(0, 0, 0, 0.5);
    --scrim: rgba(0, 0, 0, 0.45);
    --scrollbar: rgba(255, 255, 255, 0.18);
    --attribution-bg: rgba(24, 33, 29, 0.75);
    --page-bg: #0b1310;
    --tile-filter: invert(1) hue-rotate(180deg) saturate(0.35) brightness(0.88) contrast(0.92);
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink-900);
  background: var(--page-bg);
  overflow: hidden;
}

::selection { background: rgba(37, 99, 235, 0.25); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 3000;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: var(--brand-dark);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-pop);
  transform: translateY(calc(-100% - 16px));
  transition: transform 0.18s var(--ease);
}

.skip-link:focus { transform: translateY(0); }

#map:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }

.sidebar {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

h1, h2, h3, .brand-word {
  font-family: 'Poppins', 'Inter', sans-serif;
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  top: var(--gap);
  left: var(--gap);
  right: var(--gap);
  height: var(--header-h);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--ink-900);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.sidebar-toggle:hover {
  background: var(--glass-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.sidebar-toggle:active { transform: translateY(0) scale(0.96); }

.sidebar-toggle svg { width: 19px; height: 19px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 1;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--brand-light), var(--brand-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px -4px rgba(29, 78, 216, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
  transition: transform 0.25s var(--ease);
}

.brand:hover .brand-mark { transform: rotate(-4deg) scale(1.04); }

.brand-mark svg { width: 24px; height: 24px; }

.brand-text { line-height: 1.15; min-width: 0; }

.brand-word {
  margin: 0;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-word-mobile { display: none; }

.brand-sub {
  font-size: 0.72rem;
  color: var(--ink-500);
  font-weight: 500;
  margin-top: 2px;
}

.brand-sub strong {
  color: var(--brand-ink);
  font-weight: 700;
}

.brand-sub-mobile {
  display: none;
  font-size: 0.68rem;
  color: var(--brand-ink);
  font-weight: 600;
  white-space: nowrap;
}

.brand-party { color: var(--party-ink); font-weight: 700; }

.about-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(140deg, var(--brand-light), var(--brand-dark));
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 14px -4px rgba(29, 78, 216, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.about-btn svg { width: 16px; height: 16px; position: relative; z-index: 1; }

.about-btn::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--brand);
  opacity: 0.4;
  animation: pulse-ring 2.6s ease-out infinite;
  pointer-events: none;
}

.about-btn:hover {
  box-shadow: 0 8px 22px -4px rgba(29, 78, 216, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: translateY(-1px) scale(1.1);
}

.about-btn:active { transform: scale(0.94); }

@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 0.45; }
  80% { transform: scale(1.7); opacity: 0; }
  100% { transform: scale(1.7); opacity: 0; }
}

.header-spacer { flex: 1; }

.header-arrondissement select {
  appearance: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-900);
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 9px 30px 9px 16px;
  width: 190px;
  outline: none;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}

.header-arrondissement select:hover,
.header-arrondissement select:focus {
  border-color: var(--brand);
  box-shadow: var(--shadow-pop);
}

.header-arrondissement select:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45), var(--shadow-pop);
}

.header-search {
  position: relative;
}

.header-search input {
  appearance: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-900);
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 9px 16px;
  width: 240px;
  outline: none;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.header-search input:hover,
.header-search input:focus {
  border-color: var(--brand);
  box-shadow: var(--shadow-pop);
}

.header-search input:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45), var(--shadow-pop);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 1200;
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  animation: results-pop 0.18s var(--ease);
}

.search-results[hidden] { display: none; }

.search-results button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.search-results button:hover,
.search-results button:active,
.search-results button:focus-visible {
  background: rgba(37, 99, 235, 0.1);
}

.search-results .name {
  font-weight: 600;
  font-size: 0.86rem;
  display: block;
}

.search-results .address {
  font-size: 0.74rem;
  color: var(--ink-500);
  display: block;
}

.search-results .badge { margin-top: 5px; }

.search-results .search-empty {
  cursor: default;
  font-size: 0.82rem;
  color: var(--ink-500);
  text-align: center;
  padding: 14px 12px;
}

@keyframes results-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Map ---------- */

#map {
  position: absolute;
  inset: 0;
  background: var(--page-bg);
}

.map-tiles-muted {
  filter: var(--tile-filter);
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: fixed;
  top: var(--content-top);
  left: var(--gap);
  bottom: var(--gap);
  width: var(--sidebar-w);
  border-radius: var(--radius-lg);
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  z-index: 950;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

@media (min-width: 761px) {
  body.sidebar-collapsed .sidebar {
    opacity: 0;
    pointer-events: none;
    transform: translateX(calc(-100% - var(--gap)));
  }
}

.sidebar-section {
  padding: 18px 10px 14px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-section h2 {
  margin: 0 8px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
}

.sidebar-close {
  display: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--glass-strong);
  color: var(--ink-900);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}

.sidebar-close:hover { background: var(--surface); transform: scale(1.08); }

#layer-toggles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#layer-toggles li {
  display: flex;
  align-items: center;
  gap: 2px;
}

#layer-toggles label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}

#layer-toggles label:hover { background: var(--surface-hover); transform: translateX(2px); }

#layer-toggles input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand-dark);
  cursor: pointer;
  flex-shrink: 0;
}

#layer-toggles .swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 2px 6px -2px rgba(11, 17, 32, 0.4);
  transition: transform 0.18s var(--ease);
}

#layer-toggles label:hover .swatch { transform: scale(1.08); }

#layer-toggles .swatch svg { width: 14px; height: 14px; }

/* En-tête d'un groupe de sous-catégories (ex: Stationnement), avec sa liste
   indentée juste dessous plutôt qu'à côté (contrairement aux autres <li>). */
#layer-toggles li.layer-group {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}

.layer-group-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.layer-group-row label { font-weight: 700; }

/* Bouton chevron qui replie/déplie la liste des sous-catégories, sans toucher à leur
   visibilité sur la carte (seule la case à cocher fait ça). */
.layer-group-collapse {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-500);
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.layer-group-collapse svg { width: 16px; height: 16px; transition: transform 0.18s var(--ease); }

.layer-group-collapse.collapsed svg { transform: rotate(-90deg); }

.layer-group-collapse:hover { background: var(--surface-active); color: var(--brand-ink); }

#layer-toggles .layer-subgroup {
  list-style: none;
  margin: 0;
  padding: 0 0 0 22px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#layer-toggles .layer-subgroup[hidden] { display: none; }

#layer-toggles .layer-label { flex: 1; }

/* Bouton ⓘ discret à droite de chaque catégorie (cible de 28px, WCAG 2.5.8). */
.layer-info-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-500);
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.layer-info-btn svg { width: 16px; height: 16px; }

.layer-info-btn:hover,
.layer-info-btn[aria-expanded="true"] {
  background: var(--surface-active);
  color: var(--brand-ink);
}

.layer-info-btn:focus-visible { border-radius: 50%; }

/* Petit panneau d'information d'une catégorie, positionné en JS à côté du bouton. */
.layer-info {
  position: fixed;
  z-index: 1500;
  width: min(340px, calc(100vw - 2 * var(--gap)));
  max-height: calc(100vh - 2 * var(--gap));
  overflow-y: auto;
  padding: 18px 18px 16px;
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow), var(--shadow-pop);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-700);
  animation: results-pop 0.18s var(--ease);
}

.layer-info[hidden] { display: none; }

.layer-info:focus { outline: none; }
.layer-info:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.layer-info h3 {
  margin: 0 32px 8px 0;
  font-size: 0.98rem;
  line-height: 1.3;
  color: var(--ink-900);
}

.layer-info h4 {
  margin: 14px 0 4px;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.layer-info p { margin: 0; }

.layer-info ul { margin: 0; padding-left: 18px; }

.layer-info li + li { margin-top: 2px; }

.layer-info a { color: var(--brand-ink); }

.layer-info .layer-info-contribute {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
}

.layer-info-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--ink-900);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s var(--ease);
}

.layer-info-close:hover { background: var(--surface); }

#layer-toggles .layer-count {
  font-size: 0.7rem;
  color: var(--ink-500);
  font-weight: 600;
  background: var(--surface-alt);
  border-radius: 999px;
  padding: 2px 7px;
  flex-shrink: 0;
}

/* Couleur plutôt qu'opacité pour garder un contraste suffisant (WCAG AA). */
#layer-toggles input:not(:checked) ~ .layer-label,
#layer-toggles input:not(:checked) ~ .layer-count {
  color: var(--ink-500);
}

#layer-toggles input:not(:checked) ~ .swatch { opacity: 0.45; }

/* La case d'un groupe est décochée mais indéterminée quand certaines de ses
   sous-catégories sont actives : pas de raison de l'estomper comme si tout était
   désactivé. */
#layer-toggles input:indeterminate ~ .layer-label,
#layer-toggles input:indeterminate ~ .layer-count {
  color: inherit;
}

#layer-toggles input:indeterminate ~ .swatch { opacity: 1; }

.layers-clear {
  display: block;
  margin: 8px auto 0;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--ink-500);
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.layers-clear:hover { background: var(--surface-active); color: var(--ink-700); }

.commerces-hidden .header-search { display: none; }

.badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  margin-top: 6px;
  letter-spacing: 0.01em;
}

.badge.accessible { background: var(--color-accessible); }
.badge.partiellement { background: var(--color-partial); color: #1a1a1a; }
.badge.non-accessible { background: var(--color-none); }
.badge.inconnu { background: var(--color-unknown); }

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 940;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

/* ---------- Leaflet controls ---------- */

.leaflet-control-attribution {
  font-size: 10px !important;
  background: var(--attribution-bg) !important;
  color: var(--ink-700);
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  border-radius: var(--radius-sm) 0 0 0 !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--glass-strong) !important;
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  box-shadow: var(--glass-shadow) !important;
  margin: 0 var(--gap) 8px 0 !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: transparent !important;
  border-bottom: 1px solid var(--glass-border) !important;
  color: var(--ink-900) !important;
  transition: background 0.15s var(--ease);
}

.leaflet-control-zoom a:last-child { border-bottom: none !important; }
.leaflet-control-zoom a:hover { background: var(--surface-hover) !important; }

/* ---------- Markers ---------- */

.pin-marker {
  position: relative;
  animation: marker-pop 0.45s var(--ease) backwards;
}

.pin-marker .pin {
  width: 100%;
  height: 100%;
  border-radius: 50% 50% 50% 0;
  background: linear-gradient(140deg, var(--pin-light), var(--pin-dark));
  transform: rotate(-45deg);
  box-shadow: 0 6px 14px -4px var(--pin-dark), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.pin-marker .pin svg {
  width: 15px;
  height: 15px;
  transform: rotate(45deg);
}

/* Niveau d'accessibilité du commerce, en coin du marqueur. */
.pin-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(11, 17, 32, 0.35);
}

.pin-marker:hover .pin {
  transform: rotate(-45deg) scale(1.12);
  box-shadow: 0 10px 20px -4px var(--pin-dark);
}

/* Stationnements / débarcadères : goutte un peu plus petite que les autres couches. */
.pin-marker-sm .pin svg {
  width: 12px;
  height: 12px;
}

/* Les feux sonores sont nombreux : une pastille ronde, plus discrète qu'une goutte. */
.dot-marker .pin {
  border-radius: 50%;
  transform: none;
  border-width: 1.5px;
  box-shadow: 0 2px 6px -2px var(--pin-dark);
}

.dot-marker .pin svg {
  width: 10px;
  height: 10px;
  transform: none;
}

.dot-marker:hover .pin {
  transform: scale(1.25);
  box-shadow: 0 4px 10px -2px var(--pin-dark);
}

@keyframes marker-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- Popups ---------- */

.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--glass-shadow) !important;
  padding: 0 !important;
  overflow: hidden;
  background: var(--glass-strong) !important;
  color: var(--ink-900) !important; /* Leaflet impose #333, illisible en sombre */
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}

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

.leaflet-popup-content { margin: 0 !important; }

.leaflet-popup-tip {
  box-shadow: var(--shadow-soft) !important;
  background: var(--glass-strong) !important;
}

.popup-content {
  font-family: 'Inter', sans-serif;
  padding: 14px 16px 16px;
  animation: fade-in 0.18s var(--ease);
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.popup-content h3 {
  margin: 0 0 3px;
  font-size: 0.98rem;
  font-weight: 600;
}

.popup-content .popup-address {
  color: var(--ink-500);
  font-size: 0.78rem;
}

.popup-field {
  margin-top: 5px;
  font-size: 0.8rem;
  color: var(--ink-700);
}

.popup-field a {
  color: var(--brand-ink);
  font-weight: 600;
}

.popup-field-label {
  display: inline-block;
  font-weight: 600;
  color: var(--ink-500);
  margin-right: 0.35rem;
}

/* Stations de métro et REM : pastille de la couleur de ligne (GTFS route_color),
   et avertissement quand le quai d'une ligne n'est pas accessible. */
.popup-line-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 0;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.7);
}

.popup-warning { color: #b91c1c; font-weight: 700; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .popup-warning { color: #fca5a5; }
}

/* Nombre de logements adaptés, isolé en tête du popup des logements. */
.popup-highlight {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.22);
}

.popup-highlight-number {
  flex-shrink: 0;
  min-width: 44px;
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--brand-ink);
}

.popup-highlight-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--ink-700);
}

.popup-highlight-text strong {
  font-size: 0.86rem;
  color: var(--ink-900);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .popup-highlight {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(147, 197, 253, 0.25);
  }
}

.popup-bullets {
  margin: 3px 0 0;
  padding-left: 18px;
}

.popup-bullets li {
  margin-bottom: 3px;
}

.popup-bullets li:last-child { margin-bottom: 0; }

.popup-content .popup-subsection {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
}

.popup-content .popup-subsection-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.popup-content .popup-subsection-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-500);
}

.popup-content .popup-subsection .badge { margin-top: 0; }

.popup-content .popup-subsection-notes {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-700);
}

.popup-content .review {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-700);
}

.popup-content .review a {
  display: inline-flex;
  margin-top: 8px;
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: var(--brand-dark);
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}

.popup-content .review a:hover { background: var(--brand); transform: translateY(-1px); }

.popup-content .review a.review-source-link {
  display: inline;
  margin-top: 0;
  padding: 0;
  background: none;
  border-radius: 0;
  color: inherit;
  font-weight: inherit;
  text-decoration: underline;
}

.popup-content .review a.review-source-link:hover { background: none; transform: none; }

.popup-content .popup-images {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
}

.popup-content .popup-image {
  flex: 0 0 auto;
  width: 120px;
  margin: 0;
}

.popup-content .popup-image img {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.popup-content .popup-image figcaption {
  margin-top: 4px;
  font-size: 0.7rem;
  line-height: 1.3;
  color: var(--ink-700);
}

/* ---------- About modal ---------- */

.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 1800;
  background: var(--overlay);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.about-overlay.open { opacity: 1; pointer-events: auto; }

.about-modal {
  position: relative;
  width: min(440px, 100%);
  max-height: min(84vh, 640px);
  overflow-y: auto;
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow), var(--shadow-pop);
  padding: 30px 26px 26px;
  transform: scale(0.94) translateY(8px);
  opacity: 0;
  transition: transform 0.28s var(--ease), opacity 0.28s var(--ease);
}

.about-overlay.open .about-modal { transform: scale(1) translateY(0); opacity: 1; }

.about-modal h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.about-modal-desc {
  margin: 0 0 22px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink-700);
}

.about-modal-desc strong { color: var(--brand-ink); }

.about-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--ink-900);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}

.about-modal-close:hover { background: var(--surface); transform: scale(1.08); }

.about-people {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.about-person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}

a.about-person:hover { background: var(--surface-hover); transform: translateX(2px); }

.about-person img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(11, 17, 32, 0.22);
}

.about-person-name { font-weight: 700; font-size: 0.9rem; }

.about-person-role { font-size: 0.76rem; color: var(--ink-500); }

.about-suggest-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 18px;
  padding: 11px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(140deg, #4ade80, #15803d);
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px -4px rgba(21, 128, 61, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.about-suggest-link svg { width: 17px; height: 17px; flex-shrink: 0; }

.about-suggest-link:hover {
  box-shadow: 0 8px 22px -4px rgba(21, 128, 61, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.about-suggest-link:active { transform: translateY(0) scale(0.98); }

.about-privacy {
  display: block;
  margin-top: 16px;
  text-align: center;
  font-size: 0.76rem;
  color: var(--ink-500);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-privacy:hover { color: var(--brand-ink); }

.suggestion-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.suggestion-form label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-500);
  margin-top: 10px;
}

.suggestion-form label:first-child { margin-top: 0; }

.suggestion-form textarea,
.suggestion-form input[type="text"] {
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink-900);
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.suggestion-form textarea:focus,
.suggestion-form input[type="text"]:focus {
  border-color: #15803d;
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.18);
}

.suggestion-submit {
  margin-top: 16px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(140deg, #4ade80, #15803d);
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px -4px rgba(21, 128, 61, 0.6);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.suggestion-submit:hover {
  box-shadow: 0 8px 22px -4px rgba(21, 128, 61, 0.75);
  transform: translateY(-1px);
}

.suggestion-submit:active { transform: translateY(0) scale(0.98); }

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  :root { --gap: 10px; --header-h: 104px; }
  /* Sans la recherche, l'en-tête mobile tient sur une seule rangée. */
  html.commerces-hidden { --header-h: 62px; }

  .site-header {
    height: auto;
    flex-wrap: wrap;
    align-content: flex-start;
    row-gap: 10px;
    gap: 8px;
    padding: 12px 10px;
  }

  .brand-sub { display: none; }
  .brand-sub-mobile { display: block; }
  .header-spacer { display: none; }

  .header-arrondissement { order: 9; flex: 1 1 100%; min-width: 0; }
  .header-arrondissement select { width: 100%; font-size: 16px; padding: 9px 30px 9px 12px; }

  .header-search { order: 10; flex: 1 1 100%; min-width: 0; }
  .header-search input { width: 100%; font-size: 16px; padding: 9px 12px; }

  .sidebar-toggle { width: 34px; height: 34px; }

  .brand-mark { width: 36px; height: 36px; }
  .brand-mark svg { width: 20px; height: 20px; }
  .brand-word { font-size: 0.95rem; }
  .brand-word-full { display: none; }
  .brand-word-mobile { display: inline; }

  /* Le titre prend la place restante (et s'ellipse au besoin) pour garder
     le bouton ⓘ sur la même ligne. */
  .brand { flex: 1 1 0; }

  .about-btn { width: 28px; height: 28px; }
  .about-btn svg { width: 14px; height: 14px; }

  .sidebar {
    width: min(85vw, 320px);
    z-index: 1450;
    box-shadow: var(--glass-shadow), var(--shadow-pop);
    transform: translateX(calc(-100% - var(--gap)));
    transition: transform 0.3s var(--ease);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-close { display: flex; }

  .sidebar-scrim.open {
    opacity: 1;
    pointer-events: auto;
    z-index: 1440;
  }
}
