:root {
  --ink: #1f2a24;
  --ink-soft: #5b6660;
  --paper: #fdfcf9;
  --line: rgba(31, 42, 36, 0.14);
  --brand: #1f6b4a;
  --c-vegan: #1aa64c;
  --c-vege: #8236c9;
  --c-carne: #d9483b;
  --c-verifier: #98a1a8;
  --c-aucun: #444a52;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
}

#map {
  position: absolute;
  inset: 0;
  background: #e8e4da;
}

/* ---- HUD (titre + filtres) ---- */

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: calc(10px + env(safe-area-inset-top)) 0 0;
  pointer-events: none;
}

.hud > * { pointer-events: auto; }

.brand {
  margin: 0 12px;
  padding: 7px 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 1px 6px rgba(20, 30, 25, 0.14);
}

.filters {
  display: flex;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px calc(8px + env(safe-area-inset-top) * 0);
}

.filters::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  font: 600 13px/1 var(--font);
  color: var(--ink);
  background: rgba(253, 252, 249, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.chip .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot);
}

.chip .count { color: var(--ink-soft); font-weight: 500; }
.chip[aria-pressed="true"] .count { color: rgba(255, 255, 255, 0.75); }

.chip[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.chip[aria-pressed="true"] .dot { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9); }

.chip:focus-visible, .about-btn:focus-visible, .sheet-close:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---- Marqueurs ---- */

.marker {
  width: 24px;
  height: 24px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(20, 30, 25, 0.4);
  cursor: pointer;
}

.marker[data-cat="vegan"] { background: var(--c-vegan); }
.marker[data-cat="vege"] { background: var(--c-vege); }
.marker[data-cat="carne"] { background: var(--c-carne); }
.marker[data-cat="verifier"] { background: var(--c-verifier); }
.marker[data-cat="aucun"] { background: var(--c-aucun); }

/* ---- Popup bureau ---- */

@media (min-width: 641px) {
  .maplibregl-popup-content {
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
  }
}

/* ---- Fiche lieu ---- */

.place { max-width: 340px; padding: 14px 16px; }

.place .cat-line {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 4px;
}

.place .cat-line .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dot); }

.place h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: -0.01em; }

.place .where { margin: 0 0 8px; font-size: 14px; color: var(--ink-soft); }

.place .row { margin: 6px 0 0; font-size: 14px; display: flex; gap: 8px; }
.place .row dt { flex: 0 0 auto; margin: 0; font-weight: 600; }
.place .row dd { margin: 0; }

.place .note {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---- Bottom sheet mobile ---- */

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  transform: translateY(102%);
  transition: transform 0.25s ease-out;
  background: var(--paper);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(20, 30, 25, 0.2);
  max-height: 62vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 0 calc(14px + env(safe-area-inset-bottom));
}

.sheet::before {
  content: "";
  display: block;
  width: 38px;
  height: 4px;
  margin: 0 auto 4px;
  border-radius: 2px;
  background: rgba(31, 42, 36, 0.18);
}

.sheet.open { transform: none; }

.sheet .place { max-width: none; padding-top: 6px; }

.sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(31, 42, 36, 0.08);
  color: var(--ink);
  cursor: pointer;
}

@media (min-width: 641px) {
  .sheet { display: none; }
}

/* ---- À propos ---- */

.about-btn {
  position: absolute;
  left: 12px;
  bottom: calc(30px + env(safe-area-inset-bottom));
  z-index: 3;
  padding: 6px 11px;
  font: 600 12.5px/1 var(--font);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(20, 30, 25, 0.14);
}

dialog.about {
  width: min(440px, calc(100% - 24px));
  margin: auto;
  border: 0;
  padding: 18px 20px 16px;
  background: var(--paper);
  border-radius: 16px;
  color: var(--ink);
}

dialog.about::backdrop { background: rgba(15, 20, 17, 0.4); }

dialog.about > .sheet-close { position: absolute; top: 12px; right: 12px; }

.about h2 { margin: 0 0 10px; font-size: 20px; letter-spacing: -0.01em; }
.about p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.55; }

.about-links { margin: 0 0 12px; padding: 0; list-style: none; }
.about-links li { margin: 6px 0; font-size: 14.5px; }

.about a { color: var(--brand); font-weight: 600; text-underline-offset: 2px; }

.about .credits { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-soft); }

@media (max-width: 640px) {
  dialog.about {
    position: fixed;
    inset: auto 0 0 auto;
    width: 100%;
    max-width: none;
    margin: 0;
    max-height: 78vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* ---- Divers ---- */

.offline {
  position: fixed;
  left: 12px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 3;
  margin: 0;
  padding: 6px 10px;
  font: 600 12px/1.3 var(--font);
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
}

.noscript {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 320px;
  padding: 20px;
  text-align: center;
  background: var(--paper);
  border-radius: 12px;
}

.maplibregl-ctrl-attrib { font-size: 11px; }

@media (prefers-reduced-motion: reduce) {
  .sheet { transition: none; }
}
