/* Delivery map picker (/order → "Drop a pin on the map") in the paper-cut look.
   Look only: the map, tap/drag pin, fee and distance logic in app.js are unchanged.
   OpenStreetMap tiles stay (tinted with one CSS filter on the tile layer, no per-frame work); attribution stays visible.
   Light = warm rice-paper map in a cut window; dark = night paper (tiles inverted, then tinted bottle green). */

/* --- the frame: the map is a print taped into a window cut in the sheet --- */
.mapframe{position:relative;flex:1;display:flex;min-height:300px;margin:6px 16px 10px}
.mapframe .mapbox{flex:1;min-height:300px;border-radius:2px;background:#EADFC6;
  box-shadow:0 0 0 5px var(--paper,#FAF6EE),0 0 0 6px rgba(31,42,36,.14),7px 9px 0 5px rgba(31,42,36,.12)}
/* cut-window shade + paper fibre over the print (clicks pass through) */
.mapframe .mapbox::after{content:"";position:absolute;inset:0;z-index:450;pointer-events:none;
  background:var(--fibre) 0 0/220px;opacity:.28;mix-blend-mode:multiply}
.mapframe .mapbox::before{content:"";position:absolute;inset:0;z-index:451;pointer-events:none;
  box-shadow:inset 3px 4px 7px rgba(31,42,36,.30),inset 0 0 0 1px rgba(31,42,36,.18)}
/* two strips of butter tape holding the print */
.mapframe::before,.mapframe::after{content:"";position:absolute;z-index:1100;width:64px;height:18px;pointer-events:none;
  background:rgba(241,220,154,.82);box-shadow:1px 2px 0 rgba(31,42,36,.10)}
.mapframe::before{top:-9px;left:-14px;transform:rotate(-24deg)}
.mapframe::after{top:-9px;right:-14px;transform:rotate(24deg)}

/* --- the print: tint OSM toward the paper palette, labels stay crisp --- */
.mapframe .mapbox .leaflet-tile-pane{filter:sepia(.42) saturate(.9) hue-rotate(-6deg) contrast(1.04)}

/* --- pin: folded paper teardrop, shadow falls right/down (one light from the left) --- */
.pinicon,.shopicon{background:none;border:0}
.pinicon svg{display:block;overflow:visible;filter:drop-shadow(2px 3px 0 rgba(31,42,36,.22)) drop-shadow(5px 7px 6px rgba(31,42,36,.25))}
.pp-rim{fill:#FAF6EE}
.pp-a{fill:#17784A}
.pp-b{fill:#0B5A35}
.pp-ring{fill:#FAF6EE}
.pp-dot{fill:#E3B04B}

/* --- You Heng shop front + name flag --- */
.shopicon svg{display:block;overflow:visible;filter:drop-shadow(2px 3px 0 rgba(31,42,36,.22)) drop-shadow(4px 6px 5px rgba(31,42,36,.22))}
.sp-wall{fill:#FAF6EE}.sp-door{fill:#0F4A30}.sp-win{fill:#E3B04B}
.sp-roof,.sp-scallop{fill:#0F4A30}.sp-stripe{fill:#FAF6EE}
.shoptag{position:absolute;left:50%;bottom:100%;transform:translate(-50%,-3px) rotate(-3deg);white-space:nowrap;
  font:700 12px/1 var(--f-ui,system-ui),sans-serif;color:#1F2A24;background:#F1DC9A;padding:4px 7px 5px;border-radius:1px;
  box-shadow:2px 3px 0 rgba(31,42,36,.18)}

/* --- route from the shop + how far we deliver --- */
.maproute{stroke:#0F4A30}
.mapring{stroke:#8A5A2B;stroke-width:2;stroke-dasharray:7 7;stroke-opacity:.55}

/* --- zoom buttons: two paper tiles --- */
.mapframe .mapbox .leaflet-bar{border:0;border-radius:2px;box-shadow:none;filter:drop-shadow(2px 3px 0 rgba(31,42,36,.18)) drop-shadow(4px 6px 6px rgba(31,42,36,.18))}
.mapframe .mapbox .leaflet-bar a,.mapframe .leaflet-touch .leaflet-bar a{width:40px;height:40px;line-height:38px;font:600 22px/38px var(--f-ui,system-ui),sans-serif;
  color:#0F4A30;background:#FAF6EE;border-bottom:1px dashed rgba(15,74,48,.3)}
.mapframe .mapbox .leaflet-bar a:first-child{border-radius:2px 2px 0 0}
.mapframe .mapbox .leaflet-bar a:last-child{border-radius:0 0 2px 2px;border-bottom:0}
.mapframe .mapbox .leaflet-bar a:hover,.mapframe .mapbox .leaflet-bar a:focus-visible{background-color:#F1DC9A;color:#0F4A30}
.mapframe .mapbox .leaflet-bar a.leaflet-disabled{color:rgba(15,74,48,.35);background-color:#EFE7D6}
.mapframe .mapbox .leaflet-control-zoom{margin:12px 0 0 12px}

/* --- attribution: a small paper label (© OpenStreetMap stays readable) --- */
.mapframe .mapbox .leaflet-control-attribution{background:rgba(250,246,238,.92);color:#4E5852;font-size:11px;padding:2px 6px;border-radius:2px 0 0 0}
.mapframe .mapbox .leaflet-control-attribution a{color:#0F4A30}

/* --- night paper (dark theme) --- */
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) .mapframe .mapbox{background:#12281E;box-shadow:0 0 0 5px #1B3D2D,0 0 0 6px rgba(231,203,126,.22),7px 9px 0 5px rgba(0,0,0,.32)}
  :root:not([data-theme="light"]) .mapframe .mapbox .leaflet-tile-pane{filter:invert(.9) hue-rotate(180deg) sepia(.55) saturate(.75) hue-rotate(75deg) brightness(.92) contrast(1.05)}
  :root:not([data-theme="light"]) .mapframe .mapbox::after{opacity:.14;mix-blend-mode:screen}
  :root:not([data-theme="light"]) .mapframe .mapbox::before{box-shadow:inset 3px 4px 8px rgba(0,0,0,.5),inset 0 0 0 1px rgba(231,203,126,.2)}
  :root:not([data-theme="light"]) .mapframe::before,:root:not([data-theme="light"]) .mapframe::after{background:rgba(231,203,126,.7)}
  :root:not([data-theme="light"]) .pp-a{fill:#E7CB7E}
  :root:not([data-theme="light"]) .pp-b{fill:#C9A24A}
  :root:not([data-theme="light"]) .pp-dot{fill:#0F4A30}
  :root:not([data-theme="light"]) .maproute{stroke:#E7CB7E}
  :root:not([data-theme="light"]) .mapring{stroke:#E7CB7E;stroke-opacity:.5}
  :root:not([data-theme="light"]) .sp-roof,:root:not([data-theme="light"]) .sp-scallop,:root:not([data-theme="light"]) .sp-door{fill:#245240}
  :root:not([data-theme="light"]) .mapframe .mapbox .leaflet-bar a{color:#FAF6EE;background-color:#1B3D2D;border-bottom-color:rgba(231,203,126,.3)}
  :root:not([data-theme="light"]) .mapframe .mapbox .leaflet-bar a:hover,:root:not([data-theme="light"]) .mapframe .mapbox .leaflet-bar a:focus-visible{background-color:#245240;color:#E7CB7E}
  :root:not([data-theme="light"]) .mapframe .mapbox .leaflet-bar a.leaflet-disabled{color:rgba(250,246,238,.35);background-color:#16301F}
  :root:not([data-theme="light"]) .mapframe .mapbox .leaflet-control-attribution{background:rgba(18,40,30,.9);color:#C9D6CD}
  :root:not([data-theme="light"]) .mapframe .mapbox .leaflet-control-attribution a{color:#E7CB7E}
}
:root[data-theme="dark"] .mapframe .mapbox{background:#12281E;box-shadow:0 0 0 5px #1B3D2D,0 0 0 6px rgba(231,203,126,.22),7px 9px 0 5px rgba(0,0,0,.32)}
:root[data-theme="dark"] .mapframe .mapbox .leaflet-tile-pane{filter:invert(.9) hue-rotate(180deg) sepia(.55) saturate(.75) hue-rotate(75deg) brightness(.92) contrast(1.05)}
:root[data-theme="dark"] .mapframe .mapbox::after{opacity:.14;mix-blend-mode:screen}
:root[data-theme="dark"] .mapframe .mapbox::before{box-shadow:inset 3px 4px 8px rgba(0,0,0,.5),inset 0 0 0 1px rgba(231,203,126,.2)}
:root[data-theme="dark"] .mapframe::before,:root[data-theme="dark"] .mapframe::after{background:rgba(231,203,126,.7)}
:root[data-theme="dark"] .pp-a{fill:#E7CB7E}
:root[data-theme="dark"] .pp-b{fill:#C9A24A}
:root[data-theme="dark"] .pp-dot{fill:#0F4A30}
:root[data-theme="dark"] .maproute{stroke:#E7CB7E}
:root[data-theme="dark"] .mapring{stroke:#E7CB7E;stroke-opacity:.5}
:root[data-theme="dark"] .sp-roof,:root[data-theme="dark"] .sp-scallop,:root[data-theme="dark"] .sp-door{fill:#245240}
:root[data-theme="dark"] .mapframe .mapbox .leaflet-bar a{color:#FAF6EE;background-color:#1B3D2D;border-bottom-color:rgba(231,203,126,.3)}
:root[data-theme="dark"] .mapframe .mapbox .leaflet-bar a:hover,:root[data-theme="dark"] .mapframe .mapbox .leaflet-bar a:focus-visible{background-color:#245240;color:#E7CB7E}
:root[data-theme="dark"] .mapframe .mapbox .leaflet-bar a.leaflet-disabled{color:rgba(250,246,238,.35);background-color:#16301F}
:root[data-theme="dark"] .mapframe .mapbox .leaflet-control-attribution{background:rgba(18,40,30,.9);color:#C9D6CD}
:root[data-theme="dark"] .mapframe .mapbox .leaflet-control-attribution a{color:#E7CB7E}

/* --- paste / search box (Dec 2026): a butter paper tag with a punched hole, Paste + Find as small paper tiles --- */
.mapfind{display:flex;gap:8px;align-items:stretch;margin:4px 16px 0}
.mf-tag{position:relative;flex:1;min-width:0;display:flex;align-items:center;gap:8px;padding:0 12px 0 26px;min-height:46px;
  background:#F6E7B4;color:#1F2A24;border-radius:3px 10px 10px 3px;box-shadow:2px 3px 0 rgba(31,42,36,.16),inset 0 0 0 1px rgba(31,42,36,.14)}
.mf-tag::before{content:"";position:absolute;left:9px;top:50%;width:8px;height:8px;margin-top:-4px;border-radius:50%;
  background:var(--surface,#FAF6EE);box-shadow:inset 1px 1px 0 rgba(31,42,36,.25)}
.mf-tag svg{width:18px;height:18px;flex:none;color:#0F4A30}
.mf-tag input{flex:1;min-width:0;height:44px;border:0;background:none;color:inherit;font:500 16px/1.2 var(--f-ui,system-ui),sans-serif;outline:none}
.mf-tag input::placeholder{color:rgba(31,42,36,.58)}
.mf-tag:focus-within{box-shadow:2px 3px 0 rgba(31,42,36,.16),inset 0 0 0 2px #0F4A30}
.mf-tag input::-webkit-search-cancel-button{display:none}
.mf-paste,.mf-go{flex:none;min-height:46px;min-width:46px;padding:0 12px;border:0;border-radius:3px;cursor:pointer;
  font:700 14px/1 var(--f-ui,system-ui),sans-serif;box-shadow:2px 3px 0 rgba(31,42,36,.18)}
.mf-paste{background:#FAF6EE;color:#0F4A30;box-shadow:2px 3px 0 rgba(31,42,36,.18),inset 0 0 0 1px rgba(15,74,48,.35)}
.mf-go{background:var(--action,#0F4A30);color:var(--on-action,#FAF6EE)}
.mf-paste:active,.mf-go:active{transform:translate(1px,2px);box-shadow:1px 1px 0 rgba(31,42,36,.18)}
.mf-go:disabled{opacity:.6;cursor:progress}
.mf-msg{margin:6px 18px 0;min-height:0;font:500 13px/1.35 var(--f-ui,system-ui),sans-serif;color:var(--muted-strong,#4E5852)}
.mf-msg:empty{display:none}
.mf-msg.bad{color:var(--chili,#B3261E)}
/* recent places / results: a row of small paper slips that scrolls sideways */
.mf-list{display:flex;gap:8px;align-items:center;overflow-x:auto;margin:8px 0 2px;padding:2px 16px 6px;scrollbar-width:none}
.mf-list::-webkit-scrollbar{display:none}
.mf-list:empty{display:none}
.mf-h{flex:none;font:700 12px/1 var(--f-ui,system-ui),sans-serif;color:var(--muted-strong,#4E5852);text-transform:uppercase;letter-spacing:.04em}
.mf-place{flex:none;display:flex;flex-direction:column;align-items:flex-start;gap:2px;max-width:220px;min-height:44px;padding:6px 10px;border:0;border-radius:2px;cursor:pointer;text-align:left;
  background:#FAF6EE;color:#1F2A24;box-shadow:2px 2px 0 rgba(31,42,36,.14),inset 0 0 0 1px rgba(31,42,36,.14)}
.mf-place span{max-width:200px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font:600 13px/1.2 var(--f-ui,system-ui),sans-serif}
.mf-place small{font:500 11px/1 var(--f-ui,system-ui),sans-serif;color:#4E5852}
/* locate-me: one round paper button on the print, bottom-right (above the attribution) */
.mf-me{position:absolute;right:12px;bottom:30px;z-index:1000;width:44px;height:44px;border:0;border-radius:50%;cursor:pointer;display:grid;place-items:center;
  background:#FAF6EE;color:#0F4A30;filter:drop-shadow(2px 3px 0 rgba(31,42,36,.18)) drop-shadow(4px 6px 6px rgba(31,42,36,.18))}
.mf-me svg{width:22px;height:22px}
.mf-me:active{transform:translate(1px,2px)}
/* details for the driver: same text as the basket's address box */
.mf-note{display:flex;flex-direction:column;gap:4px;margin-bottom:10px;font:600 13px/1.2 var(--f-ui,system-ui),sans-serif;color:var(--muted-strong,#4E5852)}
.mf-note input{height:44px;padding:0 12px;border:1px dashed var(--hairline-strong,rgba(31,42,36,.35));border-radius:3px;background:var(--surface,#FAF6EE);color:var(--ink,#1F2A24);font:500 16px/1.2 var(--f-ui,system-ui),sans-serif}
.mf-note input:focus{outline:2px solid #0F4A30;outline-offset:1px}
.sh-foot:has(.mf-note){flex-direction:column;align-items:stretch}
@media (max-height:700px){.mapframe,.mapframe .mapbox{min-height:220px}}

@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) .mf-tag{background:#245240;color:#FAF6EE;box-shadow:2px 3px 0 rgba(0,0,0,.3),inset 0 0 0 1px rgba(231,203,126,.3)}
  :root:not([data-theme="light"]) .mf-tag::before{background:#12281E}
  :root:not([data-theme="light"]) .mf-tag svg{color:#E7CB7E}
  :root:not([data-theme="light"]) .mf-tag input::placeholder{color:rgba(250,246,238,.6)}
  :root:not([data-theme="light"]) .mf-tag:focus-within{box-shadow:2px 3px 0 rgba(0,0,0,.3),inset 0 0 0 2px #E7CB7E}
  :root:not([data-theme="light"]) .mf-paste,:root:not([data-theme="light"]) .mf-place,:root:not([data-theme="light"]) .mf-me{background:#1B3D2D;color:#FAF6EE;box-shadow:2px 3px 0 rgba(0,0,0,.3),inset 0 0 0 1px rgba(231,203,126,.3)}
  :root:not([data-theme="light"]) .mf-place small{color:#C9D6CD}
  :root:not([data-theme="light"]) .mf-me{color:#E7CB7E}
  :root:not([data-theme="light"]) .mf-msg.bad{color:#F2A08F}
}
:root[data-theme="dark"] .mf-tag{background:#245240;color:#FAF6EE;box-shadow:2px 3px 0 rgba(0,0,0,.3),inset 0 0 0 1px rgba(231,203,126,.3)}
:root[data-theme="dark"] .mf-tag::before{background:#12281E}
:root[data-theme="dark"] .mf-tag svg{color:#E7CB7E}
:root[data-theme="dark"] .mf-tag input::placeholder{color:rgba(250,246,238,.6)}
:root[data-theme="dark"] .mf-tag:focus-within{box-shadow:2px 3px 0 rgba(0,0,0,.3),inset 0 0 0 2px #E7CB7E}
:root[data-theme="dark"] .mf-paste,:root[data-theme="dark"] .mf-place,:root[data-theme="dark"] .mf-me{background:#1B3D2D;color:#FAF6EE;box-shadow:2px 3px 0 rgba(0,0,0,.3),inset 0 0 0 1px rgba(231,203,126,.3)}
:root[data-theme="dark"] .mf-place small{color:#C9D6CD}
:root[data-theme="dark"] .mf-me{color:#E7CB7E}
:root[data-theme="dark"] .mf-msg.bad{color:#F2A08F}

/* --- vector map (MapLibre + OpenFreeMap, Dec 2026): colours come from the style in app.js (MAPPAL); these dress the chrome --- */
.mapframe .mapbox.maplibregl-map{position:relative;overflow:hidden;font:inherit}
.mapframe .maplibregl-marker{z-index:460}
.mapframe .maplibregl-canvas{outline:none}
.mapframe .maplibregl-ctrl-top-left .maplibregl-ctrl{margin:12px 0 0 12px}
.mapframe .maplibregl-ctrl-group{border-radius:2px;box-shadow:none;background:none;filter:drop-shadow(2px 3px 0 rgba(31,42,36,.18)) drop-shadow(4px 6px 6px rgba(31,42,36,.18))}
.mapframe .maplibregl-ctrl-group button{width:40px;height:40px;background-color:#FAF6EE;border-radius:0}
.mapframe .maplibregl-ctrl-group button+button{border-top:1px dashed rgba(15,74,48,.3)}
.mapframe .maplibregl-ctrl-group button:first-child{border-radius:2px 2px 0 0}
.mapframe .maplibregl-ctrl-group button:last-child{border-radius:0 0 2px 2px}
.mapframe .maplibregl-ctrl-group button:hover,.mapframe .maplibregl-ctrl-group button:focus-visible{background-color:#F1DC9A}
.mapframe .maplibregl-ctrl-attrib{background:rgba(250,246,238,.92);color:#4E5852;font-size:11px}
.mapframe .maplibregl-ctrl-attrib a{color:#0F4A30}
.mapframe .maplibregl-ctrl-attrib.maplibregl-compact{min-height:24px}
.mapframe .maplibregl-ctrl-bottom-right{right:0;bottom:0}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) .mapframe .maplibregl-ctrl-group button{background-color:#1B3D2D}
  :root:not([data-theme="light"]) .mapframe .maplibregl-ctrl-group button .maplibregl-ctrl-icon{filter:invert(1) sepia(.4)}
  :root:not([data-theme="light"]) .mapframe .maplibregl-ctrl-attrib{background:rgba(18,40,30,.9);color:#C9D6CD}
  :root:not([data-theme="light"]) .mapframe .maplibregl-ctrl-attrib a{color:#E7CB7E}
  :root:not([data-theme="light"]) .mapframe .maplibregl-ctrl-attrib-button{filter:invert(1)}
}
:root[data-theme="dark"] .mapframe .maplibregl-ctrl-group button{background-color:#1B3D2D}
:root[data-theme="dark"] .mapframe .maplibregl-ctrl-group button .maplibregl-ctrl-icon{filter:invert(1) sepia(.4)}
:root[data-theme="dark"] .mapframe .maplibregl-ctrl-attrib{background:rgba(18,40,30,.9);color:#C9D6CD}
:root[data-theme="dark"] .mapframe .maplibregl-ctrl-attrib a{color:#E7CB7E}
:root[data-theme="dark"] .mapframe .maplibregl-ctrl-attrib-button{filter:invert(1)}
