/* map: Carte mode, mini-maps, placing window, Leaflet theme, public share page */

/* ---------- Leaflet, in the app's look (square, theme colours) ---------- */
.leaflet-container { font: inherit; font-size: .85rem; background: var(--surface-2); color: var(--text); }
.leaflet-container a { color: var(--accent); }
.leaflet-bar, .leaflet-touch .leaflet-bar { border: 1px solid var(--line-strong); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.leaflet-bar a, .leaflet-touch .leaflet-bar a { background: var(--surface); color: var(--text); border-bottom-color: var(--line); }
.leaflet-bar a:hover, .leaflet-bar a:focus { background: var(--surface-2); color: var(--text); }
.leaflet-bar a.leaflet-disabled { background: var(--surface-2); color: var(--muted); }
.leaflet-container .leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--muted); }
.leaflet-container .leaflet-control-attribution a { color: var(--text); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.leaflet-popup-content-wrapper { border: 1px solid var(--line-strong); padding: 0; }
.leaflet-popup-content { margin: .7rem 1.7rem .7rem .9rem; font-size: .9rem; line-height: 1.35; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-container a.leaflet-popup-close-button:hover { color: var(--text); }
:root[data-theme="dark"] .omap .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.55); }
.map-offline { position: absolute; left: .5rem; bottom: 1.7rem; z-index: 450; max-width: min(26rem, calc(100% - 1rem));
  background: var(--surface); color: var(--text); border: 1px solid var(--warn); border-left-width: 4px; padding: .3rem .55rem; font-size: .78rem; pointer-events: none; }

/* ---------- markers: a square tag whose tail tip is the position ---------- */
.mk-icon { background: none; border: 0; }
.mk-icon:focus { outline: none; }
.mk { position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 7px)); min-width: 26px; height: 24px; padding: 0 .35rem;
  display: grid; place-items: center; background: var(--c, var(--accent)); color: var(--ct, var(--accent-ink)); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.45); font-weight: 700; font-size: .8rem; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk::after, .mk::before { content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); width: 0; height: 0; border-style: solid; border-color: transparent; border-bottom-width: 0; }
.mk::after { border-width: 9px 7px 0; border-top-color: #fff; z-index: -1; }
.mk::before { border-width: 6px 4px 0; border-top-color: var(--c, var(--accent)); z-index: 1; }
.mk.pin { min-width: 20px; height: 20px; padding: 0 .25rem; font-size: .75rem; }
.mk.pin .mk-n:empty::before { content: ""; display: block; width: 6px; height: 6px; background: var(--ct, var(--accent-ink)); }
.mk.drag { cursor: move; }
.mk.preview { --c: var(--warn); --ct: #fff; outline: 2px dashed var(--warn); outline-offset: 2px; }
.mk.zero { transform: translate(-50%, -50%); min-width: 0; width: 13px; height: 13px; padding: 0; background: var(--surface); border: 2px solid var(--muted); box-shadow: 0 0 0 1px #fff; }
.mk.zero::before, .mk.zero::after, .mk.cl::before, .mk.cl::after { display: none; }
.mk.cl { transform: translate(-50%, -50%); min-width: 34px; height: 34px; font-size: .9rem; padding: 0 .4rem;
  box-shadow: 3px 3px 0 0 #fff, 5px 5px 0 0 var(--c, var(--accent)), 0 2px 7px rgba(0,0,0,.45); }
.mk.on { outline: 3px solid var(--text); outline-offset: 2px; }
.mk-icon:focus-visible .mk { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Carte mode ---------- */
.mapmode { display: flex; flex-direction: column; gap: .6rem; }
.map-bar { margin-bottom: 0; }
.map-bar .check { margin: 0 .3rem; }
.map-stats { margin-left: auto; }
.map-legend { display: flex; flex-wrap: wrap; gap: .25rem .9rem; align-items: center; font-size: .85rem; min-height: 1.3rem; }
.map-legend .lg { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.map-legend .lg i, .mp-type i { width: .72rem; height: .72rem; flex: none; background: var(--c); border: 1px solid color-mix(in srgb, var(--text) 25%, transparent); }
.map-main { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: .8rem; align-items: start; }
.map-canvas { height: max(440px, calc(100vh - 290px)); border: 1px solid var(--line-strong); background: var(--surface-2); position: relative; z-index: 0; }
.map-canvas > .empty, .map-canvas > .notice { margin: 1rem; }
.map-side { display: flex; flex-direction: column; max-height: max(440px, calc(100vh - 290px)); min-width: 0; }
.map-side > .ph h2 { font-size: .95rem; }
.map-side .side-body { overflow: auto; flex: 1 1 auto; }
.side-intro { margin: 0; padding: .55rem .8rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.todo-list { list-style: none; margin: 0; padding: 0; }
.todo { padding: .55rem .8rem; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .35rem; }
.todo.hl { box-shadow: inset 4px 0 0 var(--accent); background: var(--accent-soft); }
.todo-h { display: flex; gap: .5rem; align-items: baseline; justify-content: space-between; }
.todo-h b { overflow-wrap: anywhere; }
.todo-sug { display: flex; gap: .4rem; align-items: center; }
.todo-sug > .primary { flex: none; }
.sug-see { flex: 1 1 auto; min-width: 0; display: block; text-align: left; font-size: .84rem; padding: .3rem .5rem; border: 1px dashed var(--line-strong); background: var(--surface-2); overflow-wrap: anywhere; }
.sug-see .sug-lbl { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.todo-act { display: flex; gap: .4rem; }

/* place card in a popup */
.mp-h { display: flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; font-size: 1rem; }
.mp-meta { display: flex; flex-wrap: wrap; gap: .25rem .8rem; align-items: center; margin: .35rem 0 .3rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line-strong); font-size: .85rem; }
.mp-list, .mp-places { list-style: none; margin: 0; padding: 0; }
.mp-list li, .mp-places li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.mp-list li:last-child, .mp-places li:last-child { border-bottom: 0; }
.leaflet-container .mp-list a { color: var(--text); text-decoration: none; font-weight: 600; }
.leaflet-container .mp-list a:hover { color: var(--accent); text-decoration: underline; }
.mp-list .code { color: var(--accent); font-size: .8rem; }
.mp-sub { display: flex; flex-wrap: wrap; gap: .1rem .6rem; font-size: .8rem; margin-top: .15rem; }
.mp-type { display: inline-flex; gap: .25rem; align-items: center; }
.itin { font-weight: 600; white-space: nowrap; }

/* projects without a place */
.map-tray { border: 1px solid var(--line-strong); background: var(--surface); }
.map-tray > summary { cursor: pointer; padding: .5rem .8rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: var(--surface-2); list-style: none; }
.map-tray > summary::-webkit-details-marker { display: none; }
.map-tray > summary::before { content: "▸"; color: var(--muted); }
.map-tray[open] > summary::before { content: "▾"; }
.map-tray[open] > summary { border-bottom: 1px solid var(--line-strong); }
.tray-list { max-height: 340px; overflow: auto; }
.tray-item { display: flex; gap: .3rem .7rem; align-items: baseline; flex-wrap: wrap; padding: .42rem .8rem; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.tray-item:last-child { border-bottom: 0; }
.tray-item:hover { background: var(--accent-soft); }
.tray-item .code { color: var(--accent); font-size: .85rem; }
.tray-title { font-weight: 600; }

@media (max-width: 900px) {
  .map-main { grid-template-columns: 1fr; }
  .map-canvas { height: 62vh; min-height: 320px; }
  .map-side { max-height: none; }
  .map-stats { margin-left: 0; flex-basis: 100%; }
}

/* ---------- mini-map ---------- */
.minimap { display: flex; flex-direction: column; gap: .55rem; }
.mm-map { border: 1px solid var(--line-strong); background: var(--surface-2); position: relative; z-index: 0; }
.mm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.mm-list li { display: flex; gap: .55rem; align-items: flex-start; }
.mm-num { flex: none; min-width: 1.35rem; height: 1.35rem; margin-top: .05rem; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700; }
.mm-num.off { background: none; border: 1px dashed var(--line-strong); }
.mm-name { display: flex; flex-wrap: wrap; gap: .1rem .8rem; align-items: baseline; }
.mm-notes { font-size: .9rem; white-space: pre-wrap; margin-top: .3rem; padding: .35rem .55rem; background: var(--surface-2); border-left: 3px solid var(--line-strong); }
.mm-none { margin: 0; }

/* ---------- placing window ---------- */
.place-map { height: 48vh; min-height: 260px; border: 1px solid var(--line-strong); background: var(--surface-2); position: relative; z-index: 0; }
.place-map.placing.leaflet-grab { cursor: crosshair; }
.place-modal #geo-help { margin-top: 0; }
.geo-search { display: flex; gap: .5rem; align-items: flex-end; }
.geo-search .field { margin-bottom: 0; }
.geo-search input { width: 100%; }
.geo-sugs { display: flex; flex-direction: column; margin: .45rem 0 .6rem; max-height: 190px; overflow: auto; }
.geo-sugs:has(.geo-sug) { border: 1px solid var(--line); }
.geo-sug { justify-content: space-between; text-align: left; border: 0; border-bottom: 1px solid var(--line); padding: .38rem .55rem; gap: .6rem; }
.geo-sug:last-child { border-bottom: 0; }
.geo-sug.on { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.geo-foot { margin-top: .5rem; justify-content: space-between; }
.place-modal .check { margin-top: .5rem; }

/* ---------- public share page (/partage/…) ---------- */
.pub-top { background: var(--surface); border-bottom: 2px solid var(--line-strong); }
.pub-top-in { max-width: 760px; margin: 0 auto; padding: .55rem 1rem; display: flex; align-items: center; gap: .4rem .8rem; flex-wrap: wrap; }
.pub-top .brand { order: 1; }
.pub-top .ro { order: 2; margin-left: auto; font-size: .8rem; color: var(--muted); }
main.pub { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.pub-kicker { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; margin-bottom: .4rem; }
.pub-kicker .code { color: var(--accent); margin-right: .2rem; }
.pub h1 { font-size: 1.5rem; margin: 0 0 .45rem; overflow-wrap: anywhere; }
.pub-meta { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
.pub-sections { display: flex; flex-direction: column; gap: 1rem; }
.pub-sections > .panel + .panel { margin-top: 0; }
.pub .panel > .ph h2 { font-size: .95rem; }
.slots { list-style: none; margin: 0; padding: 0; }
.slots li { padding: .45rem 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .1rem; }
.slots li:first-child { padding-top: 0; }
.slots li:last-child { border-bottom: 0; padding-bottom: 0; }
.slots .when { font-weight: 700; font-size: 1.02rem; }
.slots .lab { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.pub .kv { margin: .6rem 0 0; }
.pub-links { list-style: none; margin: 0; padding: 0; }
.pub-links li { padding: .3rem 0; overflow-wrap: anywhere; }
.pub-contact { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; }
.pub-contact .who-n { font-weight: 700; }
.pub-foot { color: var(--muted); font-size: .85rem; margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.pub-foot p { margin: .25rem 0; }
.pub-error { margin-top: 8vh; }
.pub-error p { margin: .3rem 0; }
@media (max-width: 700px) {
  main.pub { padding: .8rem 1rem 2rem; }
  .pub h1 { font-size: 1.3rem; }
}
@media print {
  .pub-top .ro, .mm-map { display: none !important; }
}
