:root {
  --ink: #1f2a24;
  --ink-soft: #5b6660;
  --paper: #fdfcf9;
  --line: rgba(31, 42, 36, 0.14);        /* séparateurs décoratifs */
  --line-strong: #82877f;                  /* bordures de composants interactifs (contraste 3:1) */
  --brand: #1f6b4a;     /* vert : UNIQUEMENT le sémantique « 100% vegan » */
  --accent: #c2401f;    /* terre cuite (tomate) : liens, focus, actions — 4.6:1 sur le fond */
  --shadow-press: 2px 2px 0 var(--ink);   /* ombre dure style tampon/print */
  --c-vegan: #1aa64c;   /* 100% vegan : vert (pins, graphiques — contraste 3:1) */
  --c-vegan-strong: #0f7a37; /* même vert, version foncée pour texte blanc dessus (4.5:1) */
  --c-autre: #6b7280;   /* autres lieux (options vegan + carnées) : gris neutre */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

/* ---- Accessibilité ---- */

/* Focus clavier toujours visible (3px, contraste suffisant partout). */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
/* Sur fond sombre (footer, lightbox — foncés dans les deux thèmes) : outline clair fixe. */
.foot :focus-visible, .lightbox :focus-visible { outline-color: #fdfcf9; }

/* Lien d'évitement « aller au contenu », visible uniquement au focus. */
.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  border-radius: 3px;
  text-decoration: none;
}
.skip-link:focus-visible { top: 12px; outline-color: var(--paper); }

/* Texte réservé aux lecteurs d'écran. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Pointeur tactile : cibles d'au moins 44px (WCAG 2.5.5). */
@media (pointer: coarse) {
  .chip, .filters-btn, .brand, .map-fullscreen, .back,
  .foot-col a, .day-picker button, .dialog-actions button {
    min-height: 44px;
  }
}

/* Mouvement réduit : aucune animation ni transition. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

html { height: 100%; }

/* body en flex colonne pleine hauteur : .page grandit, le footer reste
   au minimum en bas de la page même sur les pages courtes (fiches). */
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--ink);
}

.page { flex: 1 0 auto; width: 100%; }

/* Pages hors carte : fond teinté + trame papier très légère (bruit SVG
   inline, opacité ~5 %) pour détacher les cards (paper) de la page. */
body:not(.carte) {
  border-top: 4px solid var(--accent);
  background-color: #f9f0de; /* crème chaud « soleil » */
  /* halo terre cuite très léger en haut de page + trame papier (bruit SVG) */
  background-image:
    radial-gradient(1100px 420px at 50% -120px, rgba(194, 64, 31, 0.09), rgba(194, 64, 31, 0) 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

#map {
  position: relative;
  height: 44vh;
  min-height: 260px;
  background: #eae2cf;
}

/* Page /carte/ : la carte reprend tout l'écran. */
body.carte #map {
  position: absolute;
  inset: 0;
  height: auto;
}

/* Notice « fond de carte indisponible » (tuiles bloquées par un bloqueur,
   ex. uBlock Origin) : posée en bas au centre de la carte, au-dessus du
   canvas MapLibre mais sous le HUD. */
.map-notice {
  position: absolute;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: min(92%, 420px);
  padding: 10px 12px;
  background: var(--paper, #fdfcf9);
  color: var(--ink, #20261f);
  border: 1px solid rgba(32, 38, 31, 0.18);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(15, 20, 17, 0.18);
  font-size: 13px;
  line-height: 1.45;
}

.map-notice .btn-ico { width: 16px; height: 16px; margin-top: 1px; color: #b3540e; }

.map-notice p { margin: 0; }

.map-notice code { font-size: 12px; background: rgba(32, 38, 31, 0.08); padding: 0 4px; border-radius: 4px; }

.map-notice-close {
  flex: none;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 2px;
  margin: -2px -4px 0 0;
}

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

/* Sur toutes les pages (home comme /carte/), le HUD flotte au-dessus de
   la carte, en haut. Double déclaration de padding-top : fallback à 12px
   si env() n'est pas supporté (sinon la pill marque serait coupée). */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px 0 0;
  padding: calc(12px + env(safe-area-inset-top)) 0 0;
  pointer-events: none;
}

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

/* Home mobile : la mini-carte est plus haute pour accueillir le HUD. */
@media (max-width: 640px) {
  body:not(.carte) #map { height: 56vh; min-height: 300px; }
}

/* Accueil : nav de filtres inline, dans le flow sous le titre « N lieux ».
   Vide tant que app.js n'a pas posé les chips (masquée par :empty). */
.filters-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  margin: 0 0 12px;
}

.filters-inline:empty { display: none; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 12px 6px;
  padding: 8px 14px;
  font: 600 13px/1 var(--font);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  box-shadow: var(--shadow-press);
  text-decoration: none;
}
.back-ico, .btn-ico { width: 15px; height: 15px; flex: none; }

/* Barre du bas sur /carte/ mobile : « Vue liste » à gauche, « Filtrer… »
   à droite — même taille/poids de police, même hauteur. Les sélecteurs
   sont scopés à body.carte (spécificité 0,2,1) pour battre la règle de
   base .filters-btn (left: 50%) définie plus bas, quel que soit l'ordre
   des règles dans le fichier. */
@media (max-width: 640px) {
  body.carte .back, body.carte .filters-btn {
    position: fixed;
    bottom: calc(30px + env(safe-area-inset-bottom));
    margin: 0;
    z-index: 3;
    transform: none;
  }
  body.carte .back { left: 12px; }
  body.carte .filters-btn { left: auto; right: 12px; }
  body.carte .applied-filters { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* Lien marque vers la page /a-propos/. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px;
  padding: 7px 14px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: left;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  box-shadow: var(--shadow-press);
}
.brand:hover { color: var(--accent); border-color: var(--accent); }

.brand .info {
  flex: 0 0 auto;
  color: var(--ink-soft);
}

/* Nom de marque + icône tomate (sprite #icon-tomate). */
.brand-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.brand-icon { width: 18px; height: 18px; flex: none; }

/* Pill d'attribution sous le titre : visible au chargement, elle
   disparaît au premier geste utilisateur sur mobile (app.js pose hidden). */
.attrib-pill {
  margin: 6px 12px 0;
  padding: 5px 11px;
  font: 500 11px/1.4 var(--font);
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  box-shadow: 0 1px 6px rgba(20, 30, 25, 0.14);
}

.attrib-pill[hidden] { display: none; }

.attrib-pill a {
  color: var(--ink-soft);
  text-underline-offset: 2px;
}

/* Badge hors ligne : en bas à gauche sur desktop, dans la pile du
   titre sur mobile (voir les media queries qui suivent). */
.offline {
  position: fixed;
  left: 12px;
  bottom: calc(30px + 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: 3px;
}

/* Sur mobile, la pill passe sur deux lignes : tuiles sur la première,
   source des données sur la seconde. Le badge hors ligne rejoint la
   pile du titre, juste sous le chip (et sous la pill d'attribution
   tant qu'elle est visible). */
@media (max-width: 640px) {
  .attrib-pill .l1 { display: block; }
  .attrib-pill .sep { display: none; }
  .offline { position: static; margin: 6px 12px 0; }
}

/* Sur desktop, l'attribution reste visible en permanence, ancrée en
   bas à gauche de la carte : en fixed sur /carte/ (carte plein écran),
   en absolute sur l'accueil où le HUD épouse la hauteur de la
   mini-carte (voir body:not(.carte) .hud ci-dessous). */
@media (min-width: 641px) {
  .attrib-pill {
    position: fixed;
    left: 12px;
    bottom: calc(30px + env(safe-area-inset-bottom));
    z-index: 3;
    margin: 0;
  }

  /* Le badge hors ligne ne recouvre pas la pill. */
  .offline { bottom: calc(74px + env(safe-area-inset-bottom)); }

  /* Accueil : le HUD fait la hauteur de la mini-carte (44vh, comme
     body:not(.carte) #map) pour que la pill se pose en bas à gauche
     de la carte et non en bas de la page. */
  body:not(.carte) .hud { height: 44vh; min-height: 260px; }
  body:not(.carte) .attrib-pill { position: absolute; left: 12px; bottom: 12px; }
  body:not(.carte) .offline { position: absolute; left: 12px; bottom: 64px; }
}

/* Les chips passent à la ligne (wrap) : pas de scroll horizontal. */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  padding: 8px 12px calc(8px + env(safe-area-inset-top) * 0);
}

.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-soft);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(20, 30, 25, 0.10);
  cursor: pointer;
}

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

.chip .clock { flex: 0 0 auto; }

.chip .count { color: inherit; font-weight: 500; }

.chip[aria-pressed="true"] {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: var(--shadow-press);
}

/* Sur mobile, les chips partent dans la modale ouverte par le bouton du bas. */
@media (max-width: 640px) {
  .filters { display: none; }
}

/* ---- Bouton filtres + récapitulatif (mobile) ---- */

/* Le bouton n'apparaît qu'en mobile (les chips sont dans le HUD sur
   desktop) : la media query plus bas le repasse en inline-flex. */
.filters-btn {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(30px + env(safe-area-inset-bottom));
  z-index: 3;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  font: 600 13px/1 var(--font);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  cursor: pointer;
  box-shadow: var(--shadow-press);
}

.applied-filters {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}

.applied-filters[hidden] { display: none; }
.applied-filters .chip { pointer-events: auto; }

@media (max-width: 640px) {
  .filters-btn { display: inline-flex; }
}

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

/* Sprite d'icônes : jamais affiché, réduit à rien mais référençable
   par <use> (width/height 0 plutôt que display:none, qui casse
   <use> sur d'anciens Safari). */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.marker {
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* MapLibre pose son propre transform inline sur .marker (position) :
   la rotation vit dans l'enfant .pin, sinon elle est écrasée. L'épingle
   penche à gauche (-20°) et l'icône compense pour rester droite. Le
   léger décalage ramène la pointe de l'épingle exactement sur le
   point ancré (le bas-centre de .marker). */
.marker .pin {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(20, 30, 25, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(8px, -4px) rotate(-20deg);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Pin du lieu sélectionné (sheet ouverte) : grossi + halo, au-dessus des autres. */
.marker.selected { z-index: 30; }
.marker.selected .pin {
  transform: translate(8px, -4px) rotate(-20deg) scale(1.35);
  box-shadow: 0 0 0 3px var(--paper), 0 6px 16px rgba(20, 30, 25, 0.45);
}

.marker .cat-icon {
  width: 16px;
  height: 16px;
  color: #fff;
  transform: rotate(20deg);
}

/* Certains glyphs ont plus de marge interne : icône agrandie pour
   équilibrer la taille perçue dans l'épingle. */
.marker .cat-icon[data-icon="icon-glacier"] { width: 18px; height: 18px; }
.marker .cat-icon[data-icon="icon-cafe"] { width: 21px; height: 21px; }
.marker .cat-icon[data-icon="icon-snack"] { width: 22px; height: 22px; }

.marker[data-cat="vegan"] .pin { background: var(--c-vegan); }
.marker[data-cat="autre"] .pin { background: var(--c-autre); }

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

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

  /* Le petit × par défaut de MapLibre est trop discret et collé au
     coin : plus grand, détaché des bords, zone de clic confortable. */
  .maplibregl-popup-close-button {
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    font-size: 22px;
    line-height: 30px;
    border-radius: 50%;
    color: var(--ink-soft);
  }

  .maplibregl-popup-close-button:hover {
    background: rgba(20, 30, 25, 0.08);
  }
}

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

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

.place-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

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

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

.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; white-space: pre-line; }

/* Bouton « Plus d'infos sur ce lieu » : en bas de la sheet, centré, sans flèche. */
.place-more {
  display: block;
  width: fit-content;
  margin: 16px auto 4px;
  padding: 10px 20px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 3px;
  box-shadow: var(--shadow-press);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.place-more:hover { background: var(--accent); border-color: var(--accent); }

.place .photos {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 12px 0 0;
}

.place .photos::-webkit-scrollbar { display: none; }

.place .photos img {
  flex: 0 0 auto;
  height: 96px;
  border-radius: 4px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}

/* ---- Lightbox ---- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 20, 17, 0.86);
  color: #fff;
  padding: 16px;
}

.lightbox[hidden] { display: none; }

.lightbox figure {
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 2px;
}

.lightbox-close, .lightbox-nav {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  padding: 0;
}

.lightbox-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; }

.lightbox-nav[hidden] { display: none; }

.lightbox-nav.prev { position: absolute; left: 10px; }
.lightbox-nav.next { position: absolute; right: 10px; }

.lightbox-count {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  margin: 0;
  font: 600 13px/1 var(--font);
  color: rgba(255, 255, 255, 0.85);
}

.lightbox-close:focus-visible, .lightbox-nav:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

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

.scrim {
  position: fixed;
  inset: 0;
  z-index: 3;
  background: rgba(31, 42, 36, 0.45);
}
.scrim[hidden] { display: none; }

.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: 8px 8px 0 0;
  box-shadow: 0 -4px 24px rgba(20, 30, 25, 0.2);
  max-height: 62vh;
  overflow-y: auto;
  /* Empêche le geste de défilement de « remonter » au rafraîchissement
     de la page (pull-to-refresh) quand on tire l'encart vers le bas. */
  overscroll-behavior-y: contain;
  -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; }
}

/* Mobile : la sheet remonte d'au moins 40vh pour bien occuper l'écran. */
@media (max-width: 640px) {
  .sheet { min-height: 40vh; }
}

/* ---- Modales (filtres) ---- */

dialog.filters-modal {
  width: min(440px, calc(100% - 24px));
  margin: auto;
  border: 0;
  padding: 18px 20px 16px;
  background: var(--paper);
  border-radius: 3px;
  color: var(--ink);
  /* Idem bottom sheet : pas de pull-to-refresh quand on tire la
     modale alors qu'elle est déjà en haut de son défilement. */
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

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

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

.filters-modal h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.01em; }
.filters-modal p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.55; color: var(--ink-soft); }

.filters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 320px;
}

.filters-list .chip { padding: 9px 13px; }

/* ---- Modale « ouvert le… » ---- */

.day-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.day-picker button {
  flex: 1 0 auto;
  padding: 8px 14px;
  font: 600 13px/1 var(--font);
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  cursor: pointer;
}

.day-picker button[aria-pressed="true"] {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.time-field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  font: 600 13px/1 var(--font);
  color: var(--ink);
}

.time-field input {
  padding: 7px 10px;
  font: 600 15px/1 var(--font);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}

.open-at-count { min-height: 20px; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.dialog-actions .remove {
  padding: 8px 14px;
  font: 600 13px/1 var(--font);
  color: var(--ink-soft);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dialog-actions .apply {
  padding: 9px 16px;
  font: 600 13px/1 var(--font);
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 3px;
  box-shadow: var(--shadow-press);
  cursor: pointer;
}

.dialog-actions .apply:hover { background: var(--accent); border-color: var(--accent); }
.dialog-actions .remove[hidden] { display: none; }

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

  .filters-list { max-width: none; }
}

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

.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: 4px;
}

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

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

/* ---- home : mini-carte + liste de cards ---- */

.mini-map { position: relative; }

.map-fullscreen {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(31, 42, 36, 0.12);
}

.liste {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 12px calc(48px + env(safe-area-inset-bottom));
}

.liste-head h2 {
  margin: 0 0 10px;
  font-size: 24px;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 9px;
}

.liste-head h2 .brand-icon { width: 22px; height: 22px; }

.liste-empty { color: var(--ink-soft); font-size: 14.5px; }

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 720px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}

.card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 12px 14px;
  overflow: hidden;
  box-shadow: 3px 3px 0 rgba(31, 42, 36, 0.10);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(31, 42, 36, 0.16);
}

/* Photo affichée par défaut en haut de la card (première photo du lieu). */
.card-photo {
  display: block;
  width: calc(100% + 28px);
  margin: -12px -14px 10px;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
  background: #eae2cf;
}

/* Placeholder des lieux sans photo : fond grisé + icône de la catégorie.
   Affiché en desktop (en mobile la card reste compacte, sans bloc). */
.card-photo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* stripes diagonales discrètes sur fond grisé */
  background:
    repeating-linear-gradient(-45deg, rgba(31, 42, 36, 0.045) 0 10px, transparent 10px 20px),
    #e7dfcc;
}
.card-photo-empty .cat-icon { width: 56px; height: 56px; color: var(--ink-soft); }
.card-photo-empty-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
@media (max-width: 719px) {
  .card-photo-empty { display: none; }
}

.card-main {
  display: block;
  color: inherit;
  text-decoration: none;
}

/* Lien étendu sur toute la card */
.card-main::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: 4px; }

.card-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 17px;
}


.card-where {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  color: var(--ink-soft);
}

/* Badges = tags à coins francs (6px), pas des pills. */
.badge-type {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 1px 6px;
}

/* Dans la vue liste, le tag de catégorie est un peu plus présent et
   aligné à droite de la ligne de titre. */
.card-top .badge-type {
  margin-left: auto;
  padding: 2px 8px;
}

.open-pill {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--paper);
  background: var(--ink);
  border-radius: 2px;
  padding: 3px 9px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot, var(--ink-soft));
  flex: none;
}


/* ---- fiche lieu /lieux/<slug>/ ---- */

.fiche {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(48px + env(safe-area-inset-bottom));
}

.fiche-nav {
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.fiche-nav a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 14.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.fiche-nav a:hover { text-decoration: underline; }

.fiche-head h1 {
  margin: 0 0 8px;
  font-size: 30px;
  letter-spacing: -0.03em;
}

.fiche-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }

.badge {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  background: var(--badge-color, var(--ink-soft));
  border-radius: 2px;
  padding: 4px 11px;
}

.badge-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line-strong);
  font-weight: 600;
  padding: 2px 6px;
}
.badge-ico { width: 13px; height: 13px; flex: none; }

/* Sur la fiche, le tag de catégorie est plus présent que dans les cards. */
.fiche-badges .badge-type { font-size: 14px; padding: 4px 10px; gap: 6px; }
.fiche-badges .badge-ico { width: 16px; height: 16px; }

.fiche-where { margin: 0 0 12px; font-size: 15px; color: var(--ink); }

/* Lien « Voir la carte avec tous les lieux », juste sous la mini-carte. */
.fiche-maplink { margin: 0; font-size: 13.5px; }

/* Bloc « adresse + carte » de la fiche : regroupé dans une section. */

.fiche-map {
  position: relative; /* ancre la notice .map-notice */
  height: 240px;
  border-radius: 4px;
  border: 1px solid var(--line);
  overflow: hidden;
  margin: 0 0 8px;
  background: #eae2cf;
}
@media (max-width: 640px) {
  .fiche-map { height: 210px; }
}

/* Liens externes (cartes, Instagram, Pixnoy) en fin de fiche, discrets. */
.fiche-annexes .fiche-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

/* En-tête des pages hors carte (fiche, à propos) : même bloc marque
   « tomate + texte encre sur fond paper + ombre portée » que le HUD
   des pages carte (classe .brand). */
.page-top { margin: 0 0 16px; }
.page-top .brand { margin: 0; }

.fiche-section { margin: 0 0 20px; }
.fiche-section h2 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.fiche-section p { margin: 0; font-size: 14.5px; line-height: 1.55; white-space: pre-line; }

/* Horaires en clair mais discrets (titre atténué, pas de card). */
.horaires {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  font-family: inherit;
  white-space: pre-wrap;
}

.fiche-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.fiche-photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}

.fiche-ext { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 20px; font-size: 14.5px; }

/* Vrai lien textuel avec icône « externe » (pas de bouton pill). */
.ext-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.ext-link:hover { text-decoration: underline; }
.ext-ico { width: 14px; height: 14px; }


/* Pill « 100% vegan » (cards + fiche) */
.badge-vegan {
  background: var(--c-vegan-strong);
  color: #fff;
}

/* Corps du markdown de la fiche : card en valeur (la note de fin en est
   extraite, réaffichée plus bas en notice). */
.fiche-body {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  box-shadow: 3px 3px 0 rgba(31, 42, 36, 0.10);
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.6;
}
.fiche-body h2 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.fiche-body p { margin: 0 0 10px; }
.fiche-body p:last-child { margin-bottom: 0; }

.fiche-prix { margin: 0 0 20px; font-size: 14px; color: var(--ink); }

/* Notice de fin (info si 100% vegan, warning sinon). */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 20px;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.5;
}
.notice-ico { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.notice-info { background: #e9f5ee; border-color: #bfe0cd; color: var(--brand); }
.notice-warning { background: #fbf0dc; border-color: #ecd3a4; color: #7a5a1e; }

/* ---- page /a-propos/ ---- */

.apropos {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(48px + env(safe-area-inset-bottom));
}

.apropos h1 { margin: 0 0 10px; font-size: 30px; letter-spacing: -0.03em; }

/* Le corps de a-propos.md est du markdown pur : lead = 1er paragraphe
   après le h1, nav (liens vers les vues) = 2e paragraphe. */
.apropos > h1 + p { margin: 0 0 10px; font-size: 17px; line-height: 1.55; }
.apropos > h1 + p + p { margin: 0 0 24px; font-size: 14.5px; }

.apropos h2 {
  margin: 22px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.apropos p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; }
.apropos p:last-child { margin-bottom: 0; }
.apropos a { color: var(--accent); font-weight: 600; text-underline-offset: 2px; }

/* ---- Footer global ---- */

/* Fond foncé bien distinct du contenu, marge haute généreuse : on voit
   clairement que c'est un footer. Masqué sur /carte/ (la carte couvre
   tout l'écran ; l'attribution y flotte en bas à gauche de la carte). */
.foot {
  margin-top: 48px;
  background: var(--ink);
  color: rgba(253, 252, 249, 0.82);
  padding: 30px 16px calc(30px + env(safe-area-inset-bottom));
}

body.carte .foot { display: none; }

.foot-inner {
  max-width: 860px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

/* Le footer est foncé dans les deux thèmes (var(--ink) puis #171410 en
   sombre) : son texte est donc toujours une couleur claire fixe, jamais
   var(--paper) qui devient foncé en thème sombre. */
.foot-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fdfcf9;
}

.foot-brand .brand-icon { width: 24px; height: 24px; }

/* Deux colonnes de liens : « Plan du site » et « Source ». */
.foot-cols {
  display: grid;
  gap: 18px;
}

@media (min-width: 641px) {
  .foot-cols { grid-template-columns: 1fr 1fr; max-width: 520px; }
}

.foot-col h2 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(253, 252, 249, 0.55);
}

.foot-col a {
  display: block;
  padding: 3px 0;
  font-size: 14px;
  color: #fdfcf9;
  text-decoration: none;
}

.foot-col a:hover { text-decoration: underline; text-underline-offset: 3px; }

.foot-credits {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid rgba(253, 252, 249, 0.18);
  font-size: 12.5px;
  line-height: 1.7;
  color: rgba(253, 252, 249, 0.62);
}

.foot-credits a { color: inherit; text-underline-offset: 2px; }
.foot-credits code { font-size: 11.5px; }

/* Bouton « Vider le cache » : le footer est foncé dans les deux thèmes,
 * couleurs claires fixes comme le reste du footer. */
.foot-btn {
  font: inherit;
  font-size: 12.5px;
  color: #fdfcf9;
  background: none;
  border: 1px solid rgba(253, 252, 249, 0.35);
  border-radius: 3px;
  padding: 2px 10px;
  cursor: pointer;
}
.foot-btn:hover { background: rgba(253, 252, 249, 0.12); }
.foot-btn:disabled { opacity: 0.6; cursor: wait; }

/* ---- Thème sombre (prefers-color-scheme) ----
   Uniquement l'UI : la carte géographique (fond #map, tuiles bright.json,
   couleurs des pins --c-vegan/--c-autre) reste claire dans les deux thèmes.
   Exception : la popup MapLibre est une surcouche d'UI, elle est assombrie. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark; /* contrôles natifs (dialogs, input time, scrollbars) */
    --ink: #f2ede2;          /* texte principal : blanc cassé chaud */
    --ink-soft: #c9c1af;     /* texte secondaire (≥ 7:1 sur --paper) */
    --paper: #37312a;        /* surfaces (cards, chips, modales, sheet) */
    --line: rgba(242, 237, 226, 0.16);
    --line-strong: #a39b88;  /* bordures de composants (≥ 4.6:1 sur --paper) */
    --accent: #f0855a;       /* terre cuite éclaircie : liens/focus ≥ 5:1 sur fond sombre */
    --shadow-press: 2px 2px 0 rgba(0, 0, 0, 0.6);
    /* --brand, --c-vegan, --c-vegan-strong, --c-autre volontairement
       inchangés : sémantique vegan + pins de la carte. */
  }

  body:not(.carte) {
    background-color: #2b251d; /* brun chaud, moins noir que #211d18 */
    background-image: radial-gradient(1100px 420px at 50% -120px, rgba(240, 133, 90, 0.12), rgba(240, 133, 90, 0) 70%);
  }

  /* Placeholder photo : stripes claires sur fond sombre. */
  .card-photo-empty {
    background:
      repeating-linear-gradient(-45deg, rgba(242, 237, 226, 0.05) 0 10px, transparent 10px 20px),
      #474036;
  }

  .notice-info { background: rgba(110, 205, 150, 0.12); border-color: rgba(110, 205, 150, 0.4); color: #7ed9a4; }
  .notice-warning { background: rgba(232, 176, 90, 0.12); border-color: rgba(232, 176, 90, 0.45); color: #e8b05a; }

  /* Le footer reste foncé dans les deux thèmes. */
  .foot { background: #171410; }

  /* Popup MapLibre (clic sur un pin) : le CSS vendor force un fond #fff —
     on la ramène sur la surface sombre, avec sa pointe et son ombre. */
  .maplibregl-popup-content {
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
  }
  .maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--paper); }
  .maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--paper); }
  .maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--paper); }
  .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--paper); }
  .maplibregl-popup-close-button:hover { background: rgba(242, 237, 226, 0.14); }

  /* Pastilles sur fond --ink (devenu clair en sombre) : texte foncé.
     Sauf .badge-type (fond transparent) et .badge-vegan (fond vert) qui
     ont leur propre couleur — le :not() évite que cette règle de fin de
     fichier ne les écrase par ordre de source. */
  .offline { color: #211d18; }
  .badge:not(.badge-type):not(.badge-vegan) { color: #211d18; }
}
