/* Hipkartan — Scandinavian editorial over a full-bleed map.
   Ground: deep fir green ink on warm paper panels. One working accent per category. */
:root {
  --ink: #172a1e;
  --paper: #faf6ee;
  --paper-2: #f1ead9;
  --line: #d9d0bb;
  --mute: #6b6a5c;
  --coffee: #7a4a21;
  --bakery: #d98f26;
  --veggie: #2e7d3f;
  --wine: #8e2f48;
  --secondhand: #2f6f8e;
  --stay: #4a4463;
  --fdisplay: "Fraunces", Georgia, serif;
  --fbody: "Karla", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--fbody); color: var(--ink); background: var(--paper); }
#map { position: fixed; inset: 0; background: #e8e4da; }

/* ── header panel ── */
.panel {
  position: fixed; top: 14px; left: 14px; z-index: 1000;
  width: min(400px, calc(100vw - 28px));
  background: var(--paper);
  border: 1.5px solid var(--ink);
  box-shadow: 5px 5px 0 rgba(23, 42, 30, .9);
  padding: 16px 18px 14px;
}
.masthead h1 {
  font-family: var(--fdisplay);
  font-weight: 900; font-size: 30px; letter-spacing: -.01em; line-height: 1;
}
.masthead .sub { font-size: 12.5px; color: var(--mute); margin-top: 5px; letter-spacing: .02em; }
.controls { margin-top: 12px; }
#q {
  width: 100%; font: 500 15px var(--fbody); color: var(--ink);
  background: #fff; border: 1.5px solid var(--ink); border-radius: 0;
  padding: 10px 12px; min-height: 44px;
  touch-action: manipulation;
}
#q:focus { outline: 3px solid var(--bakery); outline-offset: 1px; }
#q::placeholder { color: var(--mute); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font: 700 12.5px var(--fbody); letter-spacing: .02em;
  border: 1.5px solid var(--ink); background: #fff; color: var(--ink);
  padding: 8px 11px; min-height: 38px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
  touch-action: manipulation;
}
.chip .swatch { width: 11px; height: 11px; border: 1.5px solid var(--ink); background: var(--c, var(--ink)); }
.chip .n { color: var(--mute); font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chip[aria-pressed="true"] .n { color: var(--paper-2); }
.chip:focus-visible { outline: 3px solid var(--bakery); outline-offset: 1px; }

.status:empty { display: none; }

/* ── leaflet skin ── */
.leaflet-container { font-family: var(--fbody); }
.leaflet-popup-content-wrapper {
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 0;
  box-shadow: 4px 4px 0 rgba(23, 42, 30, .85);
}
.leaflet-popup-tip { background: var(--ink); }
.leaflet-popup-content { margin: 14px 16px; line-height: 1.45; }
.pop h3 { font-family: var(--fdisplay); font-weight: 700; font-size: 17px; line-height: 1.15; margin-bottom: 2px; }
.pop .cat {
  display: inline-block; font: 700 10.5px var(--fbody); letter-spacing: .09em; text-transform: uppercase;
  color: #fff; background: var(--c, var(--ink)); padding: 2px 7px; margin: 3px 0 6px;
}
.pop .meta { font-size: 13px; color: var(--mute); margin-bottom: 6px; }
.pop .meta b { color: var(--ink); }
.pop .why { font-size: 13.5px; margin-bottom: 9px; max-width: 250px; }
.pop .links { display: flex; gap: 12px; flex-wrap: wrap; }
.pop .links a {
  font: 700 12.5px var(--fbody); color: var(--ink);
  text-decoration: none; border-bottom: 2px solid var(--bakery);
  padding: 3px 0; min-height: 24px;
}
.pop .links a:hover, .pop .links a:focus-visible { background: var(--bakery); }
.leaflet-control-zoom a {
  border-radius: 0 !important; color: var(--ink) !important;
  border: 1px solid var(--ink) !important; background: var(--paper) !important;
  width: 36px !important; height: 36px !important; line-height: 34px !important;
}
.leaflet-control-attribution { font-size: 10px; background: rgba(250, 246, 238, .85) !important; }

@media (max-width: 560px) {
  .panel { top: 10px; left: 10px; width: calc(100vw - 20px); padding: 12px 14px 12px; }
  .masthead h1 { font-size: 24px; }
  /* the running count is noise on a phone, but locate messages are not */
  .status { display: none; }
  .status.speak { display: block; bottom: 10px; left: 10px; right: 10px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* favourites */
.pop { position: relative; }
.pop .favbtn {
  position: absolute; top: -4px; right: -4px;
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--paper-2); border: 1.5px solid var(--ink); cursor: pointer;
  touch-action: manipulation;
}
.pop .favbtn.on { background: #fdf3d5; }
.pop .favbtn:focus-visible { outline: 3px solid var(--bakery); outline-offset: 1px; }
.pop h3 { padding-right: 36px; }

/* collapse */
.masthead { position: relative; }
.collapse {
  position: absolute; top: -2px; right: -4px;
  width: 34px; height: 34px;
  font: 700 20px/1 var(--fbody); color: var(--ink);
  background: var(--paper-2); border: 1.5px solid var(--ink); cursor: pointer;
  touch-action: manipulation;
}
.collapse:hover { background: var(--ink); color: var(--paper); }
.collapse:focus-visible { outline: 3px solid var(--bakery); outline-offset: 1px; }
body.collapsed .controls, body.collapsed .pop .hidebtn.on { background: #f6dfe4; }
.pop .hidebtn:focus-visible { outline: 3px solid var(--bakery); outline-offset: 1px; }
.pop h3 { padding-right: 72px; }

/* ── search results + locate ───────────────────────────────────────────
   The search field does two jobs: it filters the places already on the
   map, and it geocodes anything else against Nominatim. The two are kept
   as separate labelled groups so it is always clear which is which. */
.searchrow { display: flex; gap: 8px; align-items: flex-start; }
.searchwrap { position: relative; flex: 1; }

.locate {
  flex: none; width: 44px; height: 44px;
  display: grid; place-items: center;
  color: var(--ink); background: var(--paper-2);
  border: 1.5px solid var(--ink); cursor: pointer;
  touch-action: manipulation;
  transition: background .15s ease, color .15s ease;
}
.locate:hover { background: var(--ink); color: var(--paper); }
.locate:focus-visible { outline: 3px solid var(--bakery); outline-offset: 1px; }
.locate[aria-busy="true"] { background: var(--bakery); color: var(--ink); cursor: progress; }
.locate[aria-busy="true"] svg { animation: locatespin 1.1s linear infinite; transform-origin: 50% 50%; }
@keyframes locatespin { to { transform: rotate(360deg); } }

.sresults {
  position: absolute; z-index: 1200; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 292px; overflow-y: auto; list-style: none;
  background: var(--paper); border: 1.5px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(23, 42, 30, .85);
}
.sresults[hidden] { display: none; }
.sresults .grouphead {
  font: 700 10.5px var(--fbody); letter-spacing: .09em; text-transform: uppercase;
  color: var(--mute); padding: 8px 12px 4px; border-top: 1px solid var(--line);
}
.sresults .grouphead:first-child { border-top: none; }
.sresults li[role="option"] {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; min-height: 44px; cursor: pointer;
  font-size: 14px; line-height: 1.3; border-top: 1px solid var(--line);
}
.sresults .grouphead + li[role="option"] { border-top: none; }
.sresults li[role="option"] .swatch {
  width: 10px; height: 10px; flex: none;
  border: 1.5px solid var(--ink); background: var(--c, var(--ink));
}
.sresults li[role="option"] .lab { flex: 1; min-width: 0; }
.sresults li[role="option"] .lab b { font-weight: 700; }
.sresults li[role="option"] .lab span {
  display: block; font-size: 12px; color: var(--mute);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sresults li[role="option"][aria-selected="true"],
.sresults li[role="option"]:hover { background: var(--paper-2); }
.sresults li[role="option"][aria-selected="true"] { box-shadow: inset 3px 0 0 var(--bakery); }
.sresults .note { padding: 9px 12px; font-size: 12.5px; color: var(--mute); }

/* the pin dropped for a geocoded address, distinct from a curated place */
.addrpin {
  width: 17px; height: 17px; border: 2.5px solid var(--ink);
  background: var(--bakery); box-shadow: 2px 2px 0 rgba(23, 42, 30, .6);
}
.mepin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 3px solid var(--paper); background: var(--wine);
  box-shadow: 0 0 0 1.5px var(--ink);
}
@media (max-width: 560px) {
  .sresults { max-height: 44dvh; }
}

/* ── shared points ─────────────────────────────────────────────────────
   Stays are located to their town, so several land on one coordinate.
   One counted marker stands in for them; nothing is hidden underneath. */
.stack {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font: 700 12px var(--fbody); color: var(--paper);
  background: var(--c, var(--ink));
  border: 1.5px solid var(--ink);
  box-shadow: 2px 2px 0 rgba(23, 42, 30, .55);
  cursor: pointer;
}
.stack.fav { border-color: #c99700; border-width: 2.5px; }
.stackpop .stacklist { list-style: none; margin-top: 4px; }
.stackpop .stacklist li {
  display: flex; gap: 8px; align-items: baseline;
  padding: 6px 0; border-top: 1px solid var(--line);
  font-size: 13.5px; line-height: 1.35;
}
.stackpop .stacklist li:first-child { border-top: none; }
.stackpop .stacklist .swatch {
  width: 9px; height: 9px; flex: none;
  border: 1.5px solid var(--ink); background: var(--c, var(--ink));
}
.stackpop .stacklist .lab { flex: 1; min-width: 0; }
.stackpop .stacklist .lab span { display: block; font-size: 12px; color: var(--mute); }
.stackpop .stacklist a {
  color: var(--ink); text-decoration: none;
  border-bottom: 2px solid var(--bakery); padding-bottom: 1px;
}
.stackpop .stacklist a:hover, .stackpop .stacklist a:focus-visible { background: var(--bakery); }
.stackpop h3 { padding-right: 0; }
