:root {
  --cream: #f3e4c7;
  --bg: #fbf5ea;
  --surface: #fffaf1;
  --text: #1c3311;
  --muted: #5d6852;
  --border: #e6d7b9;
  --accent: #950e4e;
  --accent-hover: #7a0b40;
  --green: #1c3311;
  --danger: #a3172f;
  --success: #2f5a1f;
  --warning: #8a5a00;
  --radius: 14px;
  --font-title: "Bricolage Grotesque", system-ui, sans-serif;
  --font-text: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;
  font-family: var(--font-text);
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  line-height: 1.55;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

h1, h2, h3 { font-family: var(--font-title); font-weight: 700; letter-spacing: -0.02em; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

header.site {
  padding-top: 48px;
  padding-bottom: 8px;
}

header.site h1 {
  font-size: clamp(2.1rem, 6.5vw, 3.9rem);
  line-height: 1.02;
  margin: 0 0 18px;
}
header.site h1 .accent { color: var(--accent); display: block; }

header.site .lead {
  margin: 0;
  color: var(--muted);
  max-width: 640px;
  font-size: 1.05rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 32px 0 14px;
}

.count, .mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  background: var(--accent);
  color: var(--cream);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn.secondary { background: transparent; color: var(--green); border-color: var(--green); }
.btn.secondary:hover { background: var(--cream); }
.btn.small { padding: 7px 14px; font-size: 0.85rem; }
.btn.success { background: var(--green); border-color: var(--green); }
.btn.success:hover { background: #2a4a1b; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn .arrow { font-family: var(--font-mono); }

/* ---------- Explorateur : liste + carte ---------- */

.explorer {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  height: min(78vh, 680px);
  min-height: 460px;
  margin-bottom: 56px;
  border-radius: 20px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: var(--surface);
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1.5px solid var(--border);
}

.map-frame {
  position: relative;
  min-height: 0;
  background: var(--cream);
}

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

@media (max-width: 820px) {
  .explorer { grid-template-columns: 1fr; grid-template-rows: 58vh auto; height: auto; min-height: 0; }
  .map-frame { order: -1; }
  .panel { border-right: none; border-top: 1.5px solid var(--border); max-height: 70vh; }
}

.landmark {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  background: var(--surface);
  color: var(--green);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(28, 51, 17, 0.08);
}
.map-frame.far .landmark { display: none; }

.maplibregl-popup-content {
  font-family: var(--font-text);
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(28, 51, 17, 0.18);
  min-width: 200px;
}
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-popup-close-button { font-size: 1.2rem; color: var(--muted); padding: 2px 8px; }
.popup .num { font-family: var(--font-mono); font-size: 0.7rem; color: var(--accent); }
.popup strong { display: block; font-family: var(--font-title); font-size: 1.1rem; line-height: 1.15; margin: 2px 0 4px; padding-right: 14px; }
.popup .addr { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); margin: 0 0 12px; }
.popup .btn { color: var(--cream); }

.maplibregl-ctrl-group { border-radius: 10px !important; box-shadow: 0 1px 4px rgba(28, 51, 17, 0.12) !important; }

/* ---------- Liste ---------- */

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1.5px solid var(--green);
}
.panel-head h2 { margin: 0; font-size: 1.35rem; }

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
  position: relative;
}

.entry {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 6px 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.entry:hover, .entry.active { background: var(--cream); }
.entry .btn { grid-column: 2; justify-self: start; margin-top: 6px; }
.entry .badge-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--cream);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}
.entry h3 { margin: 0; font-size: 1.12rem; line-height: 1.2; }
.entry .addr { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); margin: 4px 0 0; }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 32px 16px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

}

footer.site {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  padding-bottom: 40px;
  color: var(--muted);
  font-size: 0.85rem;
}
footer.site p { margin: 0 0 12px; max-width: 760px; }
footer.site strong { color: var(--text); font-weight: 600; }

/* ---------- Dialog / form ---------- */

dialog {
  border: none;
  border-radius: 20px;
  padding: 0;
  width: min(580px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(28, 51, 17, 0.28);
}
dialog::backdrop { background: rgba(28, 51, 17, 0.5); }

.dialog-body { padding: 28px; }
.dialog-body h2 { margin: 0 0 6px; font-size: 1.7rem; }
.dialog-body .intro { margin: 0 0 22px; color: var(--muted); font-size: 0.92rem; }

.close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: none;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
}

form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { form .row { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; position: relative; }
.field label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
}
.field .hint { text-transform: none; letter-spacing: 0; color: var(--muted); }
.field input, .field textarea, .field select {
  font: inherit;
  font-family: var(--font-text);
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.field input::placeholder, .field textarea::placeholder { color: #a39a85; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--green); }
.field .error { color: var(--danger); font-size: 0.8rem; }
.field.invalid input { border-color: var(--danger); }

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  margin: 2px 0 0;
  padding: 4px 0;
  list-style: none;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(28, 51, 17, 0.1);
}
.suggestions li { padding: 8px 12px; cursor: pointer; font-size: 0.9rem; }
.suggestions li:hover, .suggestions li.active { background: var(--cream); }

.form-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.notice { font-size: 0.8rem; color: var(--muted); margin: 14px 0 0; }

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
  margin-bottom: 14px;
}
.alert.error { background: #f6dfe2; color: var(--danger); }
.alert.success { background: #e3e8d3; color: var(--success); }

[hidden] { display: none !important; }
