/* =========================================================
   The Jewelry Map — Charte V2.1 (per Brief Claude Code.html)
   Vanilla + Leaflet · Publique + DM Serif · 5-colour palette.
   ========================================================= */
html, body { height: 100%; }
.jm { display: flex; flex-direction: column; height: 100dvh; background: #fff; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-sans); font-weight: 700; font-size: 15px; line-height: 1; border: 1px solid transparent; border-radius: 8px; padding: 13px 22px; cursor: pointer; transition: background var(--dur), color var(--dur); text-decoration: none; }
.btn:active { transform: scale(0.99); }
.btn-lg { padding: 15px 30px; font-size: 16px; }
.btn-primary { background: var(--bleu-fonce); color: #fff; border-color: var(--bleu-fonce); }
.btn-primary:hover { background: var(--bleu-fonce-hover); }
.btn-secondary { background: #fff; color: var(--bleu-fonce); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--neutral-50); }
.meta { font-family: var(--font-sans); font-size: 15px; color: var(--fg3); }

/* badges */
.badge { display: inline-flex; align-items: center; font-family: var(--font-sans); font-weight: 700; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; padding: 5px calc(12px - 0.14em) 5px 12px; border-radius: var(--radius-pill); border: 1px solid transparent; white-space: nowrap; }
.badge--bleu-fonce { background: var(--bleu-fonce-soft); color: var(--bleu-fonce); border-color: var(--bleu-fonce-line); }
.badge--bleu-clair { background: var(--bleu-clair-soft); color: var(--bleu-fonce); border-color: var(--bleu-clair-line); }
.badge--blanc { background: #fff; color: var(--fg1); border-color: var(--line-strong); }
.badge--noir { background: var(--noir); color: #fff; }
.badge--sector { background: var(--neutral-50); color: var(--fg2); border-color: var(--line); }

/* ===== Header ===== */
.jm-header { flex: 0 0 auto; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: rgba(255,255,255,0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); z-index: 30; }
.jm-logo { height: 34px; width: auto; }
.jm-dates { font-family: var(--font-sans); font-weight: 700; font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg3); }

/* ===== Home ===== */
.jm-home { flex: 1; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; position: relative; padding: 40px 24px 0; overflow: hidden; }
.jm-home.is-active { display: flex; }
.jm-home-inner { position: relative; z-index: 2; max-width: 640px; }
.jm-home-logo { height: 56px; width: auto; margin: 0 auto 30px; display: block; }
.jm-home-title { font-family: var(--font-serif); font-weight: 400; font-size: clamp(40px, 8vw, 66px); line-height: 1.05; color: var(--bleu-fonce); letter-spacing: -0.01em; }
.jm-home-intro { font-family: var(--font-sans); font-weight: 300; font-size: 18px; line-height: 1.65; color: var(--fg2); max-width: 30em; margin: 22px auto 34px; }
.jm-home-fade { position: absolute; left: 0; right: 0; bottom: 0; height: 34%; background: linear-gradient(to top, var(--gris-clair), transparent); pointer-events: none; z-index: 1; }

/* ===== App shell ===== */
.jm-app { flex: 1; display: none; flex-direction: column; min-height: 0; }
.jm-app.is-active { display: flex; }
.jm-toolbar { display: none; }
.jm-body { flex: 1; display: flex; min-height: 0; }

/* sidebar */
.jm-sidebar { width: 420px; flex: 0 0 420px; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.jm-filters { border-bottom: 1px solid var(--line); padding: 18px 20px; }
.jm-list { padding: 8px 20px 24px; }
.jm-list-head { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 0 10px; }
.jm-list-title { font-family: var(--font-serif); font-weight: 400; font-size: 26px; color: var(--bleu-fonce); }
.jm-empty { text-align: center; color: var(--fg-muted); padding: 40px 0; font-family: var(--font-sans); }

/* list cards */
.jm-card { padding: 15px 0; border-top: 1px solid var(--line); cursor: pointer; }
.jm-card:first-child { border-top: 0; }
.jm-card.is-active { background: var(--bleu-clair-soft); margin: 0 -20px; padding: 15px 20px; border-radius: 8px; border-top-color: transparent; }
.jm-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.jm-card-title { font-family: var(--font-serif); font-weight: 400; font-size: 21px; line-height: 1.2; color: var(--bleu-fonce); }
.jm-card-meta { font-family: var(--font-sans); font-size: 15.5px; color: var(--fg3); margin-top: 7px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.jm-card-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--fg-muted); display: inline-block; }
.jm-card-appt { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-family: var(--font-sans); font-weight: 700; font-size: 14.5px; color: var(--bleu-fonce); }

/* map */
.jm-map-wrap { flex: 1; position: relative; min-width: 0; background: #e9e7e2; z-index: 0; /* confine Leaflet's z-index:1000 controls below sheets/overlays */ }
#map { position: absolute; inset: 0; background: #e9e7e2; }
.leaflet-container { font-family: var(--font-sans); background: #e9e7e2; }
.jm-marker { background: none; border: none; }

/* stacked-pin count bubble */
.jm-stack { position: relative; }
.jm-stack-count { position: absolute; top: -8px; right: -12px; background: var(--bleu-fonce); color: #fff; font-family: var(--font-sans); font-weight: 700; font-size: 11px; line-height: 1; padding: 3px 7px; border-radius: 999px; border: 2px solid #fff; box-shadow: var(--shadow-md); }

/* legend */
/* Collapsed behind the floating button on every viewport — an always-open
   panel covers pins in the south-east of the map. */
.jm-legend { position: absolute; right: 14px; bottom: 74px; z-index: 530; width: 224px; background: rgba(255,255,255,0.95); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 14px 18px 16px; display: none; flex-direction: column; gap: 7px; max-height: 55dvh; overflow-y: auto; }
.jm-legend.open { display: flex; }
.jm-legend-btn { display: inline-flex; position: absolute; right: 14px; bottom: 20px; z-index: 520; align-items: center; gap: 7px; font-family: var(--font-sans); font-weight: 700; font-size: 14px; padding: 10px 15px; border-radius: var(--radius-pill); background: #fff; color: var(--bleu-fonce); border: 1px solid var(--line-strong); box-shadow: var(--shadow-md); cursor: pointer; }
.jm-legend-head { font-family: var(--font-sans); font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg3); margin: 10px 0 3px; }
.jm-legend-head:first-child { margin-top: 0; }
.jm-legend-row { display: flex; align-items: center; gap: 9px; font-family: var(--font-sans); font-size: 15px; color: var(--fg2); }
.jm-legend-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }

/* detail (desktop right panel) */
.jm-detail { width: 400px; flex: 0 0 400px; border-left: 1px solid var(--line); overflow-y: auto; background: #fff; }
.jm-detail-inner { padding: 24px 24px 32px; }
.jm-detail-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.jm-detail-title { font-family: var(--font-serif); font-weight: 400; font-size: 33px; line-height: 1.12; color: var(--bleu-fonce); margin: 14px 0 20px; }
.jm-fact { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.jm-fact:first-of-type { border-top: 1px solid var(--line); }
.jm-fact svg { flex: 0 0 auto; color: var(--bleu-fonce); margin-top: 1px; }
.jm-fact-k { font-family: var(--font-sans); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg3); }
.jm-fact-v { font-family: var(--font-sans); font-size: 17.5px; color: var(--fg1); margin-top: 3px; }
.jm-detail-actions { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.jm-detail-actions .row { display: flex; gap: 10px; }
.jm-detail-actions .row .btn { flex: 1; }
.jm-detail-close { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 12px 12px 0; background: #fff; }
.jm-x { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--fg2); cursor: pointer; }
.jm-x:hover { background: var(--neutral-50); }

/* ===== Filters ===== */
.jm-fgroup { margin-bottom: 18px; }
.jm-fgroup:last-child { margin-bottom: 0; }
.jm-fgroup-h { font-family: var(--font-sans); font-weight: 700; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg3); margin-bottom: 10px; }
.jm-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.jm-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-sans); font-weight: 700; font-size: 15px; padding: 11px 17px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: #fff; color: var(--fg2); cursor: pointer; transition: all var(--dur); }
.jm-chip:hover { border-color: var(--bleu-fonce); }
.jm-chip.is-on { background: var(--bleu-fonce); color: #fff; border-color: var(--bleu-fonce); }
.jm-chip .chk { display: none; }
.jm-chip.is-on .chk { display: inline-flex; }

/* date dual-range */
.jm-range { position: relative; height: 34px; margin: 6px 2px 0; }
.jm-range-track { position: absolute; left: 0; right: 0; top: 15px; height: 3px; border-radius: 3px; background: var(--line-strong); }
.jm-range-fill { position: absolute; top: 15px; height: 3px; border-radius: 3px; background: var(--bleu-fonce); }
.jm-range input { position: absolute; left: 0; right: 0; top: 6px; width: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.jm-range input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--bleu-fonce); cursor: pointer; box-shadow: var(--shadow-sm); }
.jm-range input::-moz-range-thumb { pointer-events: auto; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--bleu-fonce); cursor: pointer; }
.jm-range-labels { display: flex; justify-content: space-between; font-family: var(--font-sans); font-size: 14px; color: var(--fg3); margin-top: 2px; }

/* ===== Mobile view toggle (lives in the toolbar row) ===== */
.jm-viewtoggle { display: none; margin-left: auto; background: var(--bleu-fonce); border-radius: var(--radius-pill); padding: 3px; gap: 2px; flex: 0 0 auto; }
.jm-viewtoggle button { border: 0; background: none; color: rgba(255,255,255,0.75); font-family: var(--font-sans); font-weight: 700; font-size: 14px; padding: 8px 16px; border-radius: var(--radius-pill); cursor: pointer; }
.jm-viewtoggle button.is-on { background: #fff; color: var(--bleu-fonce); }

/* ===== Mobile sheets ===== */
.jm-scrim { position: fixed; inset: 0; background: rgba(26,36,58,0.38); z-index: 700; }
.jm-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 710; background: #fff; border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; box-shadow: var(--shadow-lg); max-height: 86dvh; display: flex; flex-direction: column; animation: sheetup 300ms var(--ease-out); }
@keyframes sheetup { from { transform: translateY(100%); } to { transform: none; } }
.jm-sheet-handle { width: 40px; height: 4px; border-radius: 999px; background: var(--neutral-300); margin: 12px auto 4px; }
.jm-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px 14px; border-bottom: 1px solid var(--line); }
.jm-sheet-head h2 { font-family: var(--font-serif); font-weight: 400; font-size: 22px; color: var(--bleu-fonce); }
.jm-sheet-x { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--fg2); cursor: pointer; }
.jm-sheet-body { padding: 18px 20px; overflow-y: auto; }
.jm-sheet-foot { display: flex; align-items: center; gap: 14px; padding: 14px 20px calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.jm-sheet-foot .btn { flex: 1; }
.jm-reset { background: none; border: 0; color: var(--fg2); font-family: var(--font-sans); font-weight: 700; font-size: 14px; cursor: pointer; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .jm-header { height: 56px; padding: 0 18px; }
  .jm-logo { height: 28px; }
  .jm-toolbar { display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
  .jm-filter-btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-sans); font-weight: 700; font-size: 15px; padding: 10px 17px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: #fff; color: var(--bleu-fonce); cursor: pointer; }
  .jm-filter-count { background: var(--bleu-fonce); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 8px; }
  .jm-body { position: relative; }
  .jm-sidebar { position: absolute; inset: 0; width: 100%; flex-basis: auto; border-right: 0; background: #fff; z-index: 10; }
  .jm-filters { display: none; }
  .jm-app[data-view="map"] .jm-sidebar { display: none; }
  .jm-app[data-view="list"] .jm-map-wrap { visibility: hidden; }
  .jm-viewtoggle { display: inline-flex; }
  .jm-detail { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; flex-basis: auto; max-height: 84dvh; border-left: 0; border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; box-shadow: var(--shadow-sheet); z-index: 720; animation: sheetup 300ms var(--ease-out); }
}

@media (min-width: 769px) {
  .jm-sheet, .jm-scrim { display: none !important; }
}
