/* Trouvia map app. Loaded after trouvia.css; owns every map style. */
:root { --header-h: 52px; }
html { scroll-behavior: auto; }
body { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.site-header .grow { flex: 1; }
.site-header .brand svg, .site-header .brand img { height: 28px; }

/* ---------- Full-screen map ---------- */
.app { position: relative; flex: 1; min-height: 0; background: var(--surface-2); overflow: hidden; }
#map { position: absolute; inset: 0; }
#map[data-scheme="dark"] .maplibregl-canvas { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.7); }
.map-missing { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 24px; color: var(--muted); }
.maplibregl-ctrl-top-right { top: 56px; }
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { z-index: 1; }

/* ---------- Floating chips (top left) ---------- */
.chips { position: absolute; top: 10px; left: 10px; z-index: 5; display: flex; gap: 8px; align-items: flex-start; max-width: calc(100% - 20px); }
.fwrap { position: relative; }
.pill { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--edge); background: var(--surface); color: var(--ink); box-shadow: 0 2px 0 var(--edge); font-family: var(--font-display); font-weight: 700; font-size: .92rem; line-height: 1; }
.pill:hover { background: var(--surface-2); }
.pill[aria-expanded="true"] { background: var(--ink); color: var(--bg); }
.pill svg { width: 17px; height: 17px; flex: none; }
.pill .n { font-variant-numeric: tabular-nums; font-weight: 600; }
.pill .flag { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--coral-fill); color: #0e2019; font-size: .75rem; display: inline-grid; place-items: center; }
.panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 6; width: min(300px, calc(100vw - 20px)); display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--surface); border: 2px solid var(--edge); border-radius: var(--r-m); box-shadow: 3px 4px 0 var(--edge); }
.chip { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 12px 4px 8px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: .9rem; text-align: left; }
.chip > span:nth-child(2) { flex: 1; }
.chip[aria-pressed="false"] { background: transparent; color: var(--muted); border-style: dashed; }
.chip[aria-pressed="false"] .glyph { filter: grayscale(1); opacity: .5; }
.chip .n { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
.glyph { width: 24px; height: 24px; border-radius: 50%; background: var(--c); border: 1.5px solid #0e2019; display: inline-grid; place-items: center; color: #0e2019; flex: none; }
.glyph svg { width: 14px; height: 14px; }

/* ---------- Banners and states ---------- */
.map-note { position: absolute; top: 58px; left: 10px; z-index: 3; max-width: calc(100% - 70px); }
.map-note .badge { white-space: normal; }
.state:empty, .state:not(.pillstate):not(.card) { display: none; }
.state.pillstate { position: absolute; z-index: 4; top: 58px; left: 50%; translate: -50% 0; width: max-content; max-width: calc(100% - 24px); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 8px 14px; border-radius: var(--r-m); background: var(--surface); border: 1.5px solid var(--line); font-size: .9rem; color: var(--muted); }
.state.pillstate p { margin: 0; }
.state.pillstate:has(.btn) { top: 104px; }
.state.card { position: absolute; z-index: 6; top: 50%; left: 50%; translate: -50% -50%; width: min(340px, calc(100% - 32px)); display: grid; gap: 12px; justify-items: center; text-align: center; padding: 22px; background: var(--surface); border: 2px solid var(--edge); border-radius: var(--r-l); box-shadow: 4px 6px 0 var(--edge); }
.state.card p { margin: 0; font-weight: 700; font-family: var(--font-display); }

/* ---------- Bottom dock: two actions and the month slider ---------- */
.dock { position: absolute; left: 12px; right: 12px; bottom: 30px; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
.dock > * { pointer-events: auto; }
.cta { display: flex; gap: 10px; justify-content: center; width: 100%; }
.cta .btn { font-size: .98rem; padding: .78em 1.2em; min-height: 46px; text-align: center; }
.cta .btn.primary { font-size: 1.04rem; padding-inline: 1.5em; }
.btn.coral { background: var(--coral-fill); color: #0e2019; }
.scrub { width: min(100%, 440px); display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; background: var(--surface); border: 1.5px solid var(--edge); border-radius: 999px; box-shadow: 0 2px 0 var(--edge); }
.scrub .play { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line); background: transparent; color: var(--muted); display: grid; place-items: center; }
.scrub .play:hover, .scrub .play[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); background: var(--surface-2); }
.scrub .play svg { width: 14px; height: 14px; }
.scrub input[type="range"] { flex: 1; min-width: 0; height: 36px; margin: 0; accent-color: var(--spruce-fill); background: transparent; cursor: pointer; }
.mlabel { flex: none; min-width: 7.6em; text-align: right; font-family: var(--font-display); font-weight: 700; font-size: .88rem; line-height: 1.1; position: relative; }
.mlabel .now { display: inline-block; width: 8px; height: 8px; margin-left: 5px; border-radius: 50%; background: var(--coral-fill); border: 1.5px solid var(--edge); vertical-align: 1px; }

/* ---------- List: drawer (desktop) and bottom sheet (mobile) ---------- */
.drawer { position: absolute; z-index: 7; top: 0; right: 0; bottom: 0; width: min(380px, 100%); display: flex; flex-direction: column; background: var(--bg); border-left: 2px solid var(--edge); box-shadow: -4px 0 0 rgb(0 0 0 / .08); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 1.1rem; flex: 0 1 auto; }
.drawer-head h2:focus { outline: none; }
.drawer-head h2:focus-visible { outline: 3px solid var(--focus); }
.drawer-head .muted { flex: 1; }
.x { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: 1.3rem; line-height: 1; }
.x:hover { border-color: var(--ink); }
.list { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.list > li { border-bottom: 1px solid var(--line); }
.list-empty { margin: 0; padding: 16px; }
.item { display: grid; grid-template-columns: 30px 1fr; gap: 12px; width: 100%; text-align: left; background: none; border: 0; padding: 12px 16px; align-items: start; }
.item:hover { background: var(--surface-2); }
.item .glyph { width: 30px; height: 30px; margin-top: 2px; }
.item .glyph svg { width: 17px; height: 17px; }
.item .ttl { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; line-height: 1.25; display: block; }
.item .meta { font-size: .88rem; color: var(--muted); display: block; margin-top: 2px; }
.item .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.list > li.sel { background: var(--surface); box-shadow: inset 4px 0 0 var(--yellow-deep); }
.privacy { padding: 10px 16px; font-size: .8rem; color: var(--muted); border-top: 1.5px solid var(--line); background: var(--surface); }
.privacy p { margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  .drawer:not([hidden]) { animation: drawer-in .22s ease-out; }
  @keyframes drawer-in { from { translate: 40px 0; opacity: 0; } }
}
@media (min-width: 900px) {
  .drawer-open .maplibregl-ctrl-top-right { right: 380px; }
  .drawer-open .dock { right: 392px; }
}
@media (max-width: 899px) {
  .drawer { top: auto; left: 0; width: 100%; max-height: 62%; height: 62%; border-left: 0; border-top: 2px solid var(--edge); border-radius: var(--r-l) var(--r-l) 0 0; box-shadow: 0 -4px 0 rgb(0 0 0 / .08); }
  .drawer-head::before { content: ""; position: absolute; top: 6px; left: 50%; translate: -50% 0; width: 40px; height: 4px; border-radius: 4px; background: var(--line); }
  .drawer-head { position: relative; padding-top: 16px; }
  @keyframes drawer-in { from { translate: 0 40px; opacity: 0; } }
  .drawer-open .dock { display: none; }
}
@media (max-width: 480px) {
  .cta { gap: 8px; }
  .cta .btn { padding-inline: .9em; font-size: .92rem; }
  .cta .btn.primary { flex: 1.5; padding-inline: .9em; font-size: .96rem; }
  .cta .btn.coral { flex: 1; }
  .mlabel { min-width: 6.4em; font-size: .82rem; }
  .brand svg, .brand img { height: 26px; }
}

/* ---------- Markers and popup ---------- */
.mk { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 2px solid #0e2019; box-shadow: 1.5px 2px 0 #0e2019; display: grid; place-items: center; color: #0e2019; padding: 0; cursor: pointer; }
.mk svg { width: 16px; height: 16px; rotate: var(--rot, 0deg); }
.mk.t-weekend { width: 36px; height: 36px; }
.mk.t-reuse { width: 26px; height: 26px; }
.mk.t-reuse svg { width: 14px; height: 14px; }
#map[data-scheme="dark"] .mk { box-shadow: 0 0 0 1.5px rgb(255 255 255 / .6); }
.mk:hover, .mk.sel { z-index: 5; outline: 3px solid var(--yellow); outline-offset: 2px; }
.mk:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.mk.sel { outline-color: #0e2019; box-shadow: 0 0 0 5px var(--yellow), 1.5px 2px 0 5px #0e2019; }
.maplibregl-popup { z-index: 3; }
.maplibregl-popup .maplibregl-popup-content { background: var(--surface); color: var(--ink); border: 2px solid var(--edge); border-radius: var(--r-m); box-shadow: 3px 4px 0 var(--edge); padding: 14px 16px 12px; font-family: var(--font-body); font-size: .92rem; line-height: 1.45; }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--edge); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip, .maplibregl-popup-anchor-top-left .maplibregl-popup-tip, .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--edge); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--edge); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--edge); }
.maplibregl-popup .maplibregl-popup-close-button { font-size: 22px; width: 36px; height: 36px; color: var(--ink); border-radius: 50%; }
.pop h3 { font-size: 1.08rem; margin: 6px 26px 4px 0; }
.pop p { margin: 0 0 .4em; }
.pop .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.pop .lbl { font-weight: 700; }
.typeline { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-family: var(--font-display); font-weight: 700; font-size: .8rem; }
.t-weekend { --c: var(--t-weekend); } .t-sale { --c: var(--t-sale); } .t-spotted { --c: var(--t-spotted); }
.t-bazaar { --c: var(--t-bazaar); } .t-repair { --c: var(--t-repair); } .glyph.t-reuse, .mk.t-reuse { --c: var(--t-reuse); color: #f3fbf7; }
.t-spotted.glyph, .mk.t-spotted { border-style: dashed; }

/* ---------- Post dialog ---------- */
dialog { border: 2px solid var(--edge); border-radius: var(--r-l); box-shadow: 6px 8px 0 var(--edge); background: var(--surface); color: var(--ink); padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
dialog::backdrop { background: rgb(5 12 10 / .55); }
.dlg { padding: 20px clamp(16px, 4vw, 26px) 22px; }
.dlg-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.dlg-head h2 { font-size: 1.45rem; margin: 0 0 .2em; }
.field { display: grid; gap: 4px; margin-top: 14px; }
.field > label, fieldset legend { font-family: var(--font-display); font-weight: 700; font-size: .95rem; }
.field .hint { font-size: .82rem; color: var(--muted); }
input[type="text"], input[type="date"], select, textarea { width: 100%; padding: .6em .75em; border: 1.5px solid var(--line); border-radius: var(--r-s); background: var(--bg); min-height: 44px; }
textarea { min-height: 84px; resize: vertical; }
:is(input, select, textarea):user-invalid, :is(input, select, textarea)[aria-invalid="true"] { border-color: var(--coral); box-shadow: 0 0 0 2px color-mix(in srgb, var(--coral) 30%, transparent); }
fieldset { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.types label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: var(--r-s); font-size: .93rem; cursor: pointer; min-height: 44px; }
.types label:has(input:checked) { border-color: var(--ink); background: var(--surface-2); }
.types label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.types input { accent-color: var(--spruce); width: 18px; height: 18px; margin: 0; }
.more { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
.more summary { cursor: pointer; padding: 10px 0; font-family: var(--font-display); font-weight: 700; font-size: .95rem; min-height: 44px; display: flex; align-items: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-msg { margin-top: 14px; padding: 10px 12px; border-radius: var(--r-s); border: 1.5px solid var(--coral); color: var(--coral); font-weight: 700; font-size: .93rem; }
.form-msg:empty { display: none; }
.form-foot { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.done { text-align: left; }
.done .big { display: flex; gap: 14px; align-items: center; }
.donate { margin-top: 18px; padding: 16px; border-radius: var(--r-m); background: var(--surface-2); }
.donate .amounts { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 0; align-items: center; }
.donate .amt { --size: 58px; cursor: pointer; font-size: 1.1rem; }
.donate .amt:hover { rotate: 4deg; }
.toast { position: fixed; left: 50%; bottom: 20px; translate: -50% 0; z-index: 80; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-family: var(--font-display); font-weight: 600; font-size: .92rem; box-shadow: 0 6px 20px rgb(0 0 0 / .25); max-width: calc(100% - 24px); }
.toast:empty { display: none; }
@media (max-width: 400px) { .types { grid-template-columns: 1fr; } .types label { padding-block: 5px; } }

/* Friperies et magasins de seconde main (lieux permanents) */
.t-shop { --c: #b784f5; }
.mk.t-shop { width: 28px; height: 28px; }
.mk.t-shop svg { width: 15px; height: 15px; }
