:root {
  --monument: #5c3b1e;
  --plaque: #9a6b2f;
  --sepulture: #3e5c2c;
  --autre: #74863f;
  --a_relier: #a39276;
  --ink: #2b1d12;
  --paper: #fbf6ea;
  --muted: #6b5b4d;
  --line: #e2d6bd;
  --banner-h: 52px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--paper); }
a { color: #5c3b1e; }

#banner {
  position: fixed; inset: 0 0 auto 0; height: var(--banner-h); z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px;
  background: linear-gradient(90deg, #4a3019, #3e5c2c); color: #fff8ee; box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
#banner h1 { margin: 0; font-size: clamp(14px, 2.6vw, 22px); font-weight: 700; line-height: 1.15; }
#nearest {
  flex: none; border: 0; border-radius: 18px; padding: 7px 14px; font: inherit; font-weight: 600; cursor: pointer;
  background: #fff8ee; color: #4a3019;
}
#nearest:hover { background: #ffe9cc; }
/* menu burger : petits écrans seulement (légende et options masquées tant qu'il est fermé) */
#menu-toggle {
  display: none; flex: none; width: 38px; height: 38px; border: 0; border-radius: 8px; cursor: pointer;
  background: rgba(255, 248, 238, .18); color: #fff8ee; font-size: 22px; line-height: 1;
}
#menu-toggle[aria-expanded="true"] { background: #fff8ee; color: #4a3019; }

#map { position: fixed; inset: var(--banner-h) 0 0 0; background: #e8dcc2; }

/* panneaux repliables : légende et options d'affichage */
#panel {
  position: fixed; top: calc(var(--banner-h) + 10px); left: 10px; z-index: 2; width: min(320px, calc(100vw - 20px));
  max-height: calc(100vh - var(--banner-h) - 60px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
}
.box { background: var(--paper); border-radius: 8px; box-shadow: 0 1px 6px rgba(0, 0, 0, .25); }
.box > summary { list-style: none; cursor: pointer; padding: 9px 12px; display: flex; flex-direction: column; position: relative; padding-right: 30px; }
.box > summary::-webkit-details-marker { display: none; }
.box > summary::after { content: "▾"; position: absolute; right: 12px; top: 10px; color: var(--muted); transition: transform .15s; }
.box:not([open]) > summary::after { transform: rotate(-90deg); }
.box .title { font-weight: 700; }
.box .sub { color: var(--muted); font-size: 12px; }
.box .content { padding: 0 12px 10px; border-top: 1px solid var(--line); padding-top: 8px; }

.kind { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.kind .sw { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--c); }
.kind small { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 3px; font-weight: 600; margin-bottom: 6px; }
.field select { font: inherit; font-weight: normal; padding: 4px; border: 1px solid #c9b49c; border-radius: 4px; background: #fff; max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.cta { margin: 10px 0; padding: 10px; border-radius: 6px; background: #fff1de; border: 1px solid #f0d6b0; font-size: 13px; }
.cta p { margin: 4px 0 8px; }
.cta a { display: inline-block; margin: 2px 8px 2px 0; }
.cta .btn, .popup .mgw .btn { padding: 5px 10px; border-radius: 4px; background: #5c3b1e; color: #fff; text-decoration: none; font-weight: 600; }
.cta .btn:hover, .popup .mgw .btn:hover { background: #3e5c2c; }

/* fiche d'un lieu */
.maplibregl-popup-content { font: 13px/1.4 system-ui, sans-serif; color: var(--ink); max-width: 280px; }
.popup h3 { margin: 0 0 2px; font-size: 15px; }
.popup .kind-label { color: var(--muted); font-size: 12px; margin: 0 0 6px; }
.popup dl { margin: 4px 0; display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; font-size: 12px; }
.popup dt { color: var(--muted); }
.popup dd { margin: 0; overflow-wrap: anywhere; }
.popup .links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.popup .links a, .popup .links button {
  font: inherit; font-size: 12px; padding: 3px 8px; border-radius: 4px; border: 1px solid #c9b49c;
  background: #fff; color: var(--ink); text-decoration: none; cursor: pointer;
}
.popup .links a:hover, .popup .links button:hover { background: #fff1de; }
.popup .josm-status { font-size: 11px; color: var(--muted); margin: 4px 0 0; }

/* choix du fond de carte (bouton MapLibre) */
.basemap-ctrl { position: relative; }
.basemap-ctrl > button { width: 29px; height: 29px; font-size: 16px; }
.basemap-ctrl .menu {
  position: absolute; top: 0; right: 36px; width: 230px; max-height: 60vh; overflow-y: auto; padding: 6px;
  background: #fff; border-radius: 4px; box-shadow: 0 0 0 2px rgba(0, 0, 0, .1); font: 13px system-ui, sans-serif;
}
.basemap-ctrl .menu select { width: 100%; font: inherit; }

@media (max-width: 600px) {
  :root { --banner-h: 56px; }
  #banner { padding: 0 10px; gap: 8px; }
  #nearest { padding: 7px 10px; }
  #nearest .label { display: none; }
  #menu-toggle { display: block; }
  #banner h1 { flex: 1; }
  body:not(.menu-open) #panel { display: none; }
  /* panneaux en bas d'écran, pleine largeur, repliés par défaut (voir app.js) */
  #panel { top: auto; bottom: 48px; left: 8px; right: 8px; width: auto; max-height: 55vh; }
  .maplibregl-popup-content { max-width: 240px; }
}

/* pictogrammes Fork Awesome servis avec la carte (vendor/, sans CDN) */
@font-face { font-family: "ForkAwesomeLocal"; src: url("vendor/fork-awesome/forkawesome-webfont.woff2") format("woff2"); font-display: block; }
.kind .sw.ico {
  width: 22px; height: 22px; border-width: 1.5px; display: inline-flex; align-items: center; justify-content: center;
  font: normal 12px/1 "ForkAwesomeLocal"; color: #fff; font-style: normal;
}
.popup .rc-alert { margin: 6px 0 0; padding: 5px 7px; border-radius: 4px; background: #fff4d6; border: 1px solid #f0c96b; font-size: 12px; }
.kind .sw.ico svg { width: 13px; height: 13px; fill: #fff; }
#nearest .obelisk { width: 16px; height: 16px; fill: currentColor; vertical-align: -3px; }
#banner .brand { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.credits { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.btn-line { margin: 6px 0 2px; font: inherit; padding: 5px 10px; border-radius: 4px; border: 1px solid #c9b49c; background: #fff; cursor: pointer; }
.btn-line[aria-pressed="true"] { background: #fff1de; border-color: #e0a95a; }
.popup .mgw { margin: 6px 0; }
.popup .mgw .btn { display: inline-block; font-size: 12px; }
.popup .photo img { display: block; width: 100%; max-height: 180px; object-fit: cover; border-radius: 4px; margin: 4px 0; }
.popup code, .cta code { font-size: 11px; background: #efe5cf; padding: 0 3px; border-radius: 3px; overflow-wrap: anywhere; }
