/* sign & flyer map demo. the real tool's palette and type (anton, dm sans, dm mono), self-hosted. */
@font-face {
  font-family: "Anton";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/demos/signmap/fonts/anton-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/demos/signmap/fonts/dm-sans-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/demos/signmap/fonts/dm-mono-latin-500-normal.woff2") format("woff2");
}

:root {
  --sky: #b0e1e5;
  --teal: #3fafba;
  --teal-dark: #2d8f99;
  --teal-ink: #1f6f78;
  --sand: #ffecb9;
  --sand-dark: #f5d97a;
  --coral: #ffbda3;
  --coral-dark: #e58a6a;
  --dark: #1a2e35;
  --mid: #4a6670;
  --muted: #8aacb2;
  --border: #ddeef0;
  --bg: #f7fafa;
  --green: #2f9e44;
  --danger: #b42318;
  --display: "Anton", "Bebas Neue", Impact, system-ui, sans-serif;
  --sans: "DM Sans", -apple-system, system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --shadow-card: 0 4px 18px rgba(26, 46, 53, 0.1);
  --shadow-small: 0 1px 4px rgba(26, 46, 53, 0.12);
  --shadow-pop: 0 4px 20px rgba(26, 46, 53, 0.16);
  --r-btn: 6px;
  --r-card: 10px;
  --r-panel: 14px;
  --r-pill: 999px;
  --panel-w: 344px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--dark);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.frame { position: relative; height: 100%; }

#map { position: absolute; inset: 0; background: #eef3f3; }
.leaflet-container { font-family: var(--sans); }
/* osm's standard style, quieted toward the light basemap the real tool uses, so the pins carry the color */
.leaflet-tile-pane { filter: grayscale(0.82) brightness(1.07) contrast(0.88); }
.leaflet-control-attribution { font-size: 9.5px; }
.leaflet-control-attribution a { color: var(--teal-ink); }
.leaflet-bar a { color: var(--dark); }

/* ---------- demo label ---------- */
.demo-tag {
  position: absolute;
  z-index: 1100;
  top: 14px;
  left: calc(var(--panel-w) + 32px);
  right: 14px;
  margin: 0 auto;
  width: max-content;
  max-width: calc(100% - var(--panel-w) - 46px);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 7px 7px 13px;
  background: var(--dark);
  color: #fff;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-pop);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.demo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); flex: none; box-shadow: 0 0 0 3px rgba(255, 189, 163, 0.25); }
.demo-text { white-space: nowrap; }
.demo-why {
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  border-radius: var(--r-pill);
  padding: 3px 10px;
  cursor: pointer;
}
.demo-why:hover, .demo-why[aria-expanded="true"] { background: var(--coral); color: var(--dark); }
.demo-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 28px));
  background: #fff;
  color: var(--dark);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  padding: 4px 16px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0;
}

.touch-hint {
  position: absolute;
  z-index: 1050;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(26, 46, 53, 0.86);
  color: #fff;
  padding: 9px 14px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.touch-hint.on { opacity: 1; }

/* ---------- panel ---------- */
.panel {
  position: absolute;
  z-index: 1000;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: var(--panel-w);
  background: #fff;
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  font-size: 13px;
  overflow: hidden;
}
.panel-head { padding: 14px 18px 12px; border-bottom: 1px solid var(--border); }
.head-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--mid);
  background: var(--sand);
  padding: 2px 9px;
  border-radius: var(--r-pill);
}
.back { font-size: 12px; font-weight: 600; color: var(--teal-ink); text-decoration: none; white-space: nowrap; }
.back:hover { color: var(--dark); text-decoration: underline; text-underline-offset: 2px; }
.title {
  margin: 9px 0 0;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.meta-row { display: flex; align-items: center; gap: 6px 12px; margin-top: 9px; flex-wrap: wrap; }
.sync { font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.12em; color: var(--mid); display: inline-flex; align-items: center; gap: 6px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.stats { font-size: 12px; color: var(--mid); }
.stats b { color: var(--dark); font-weight: 650; }

.lab {
  margin: 0;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--mid);
}

/* ---------- buttons ---------- */
.btn {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--dark);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  padding: 7px 11px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--bg); border-color: var(--muted); }
.btn.primary { background: var(--teal-ink); color: #fff; border-color: var(--teal-ink); }
.btn.primary:hover { background: #185a62; }
.btn.danger { color: var(--danger); border-color: #fbcaca; }
.btn.danger:hover, .btn.danger.armed { background: #fff1f1; border-color: #f08585; }
.btn:disabled { opacity: 0.55; cursor: default; }
select.btn {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%234a6670' fill='none' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--teal-ink);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--dark); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- drop a pin ---------- */
.drop { padding: 14px 16px; background: var(--bg); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.seg { display: flex; border: 1px solid var(--border); border-radius: var(--r-btn); overflow: hidden; background: #fff; }
.seg button {
  flex: 1;
  font-size: 13px;
  font-weight: 650;
  padding: 8px 6px;
  border: none;
  background: transparent;
  color: var(--mid);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--dark); color: #fff; }
.seg button[aria-pressed="true"] .swatch { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6); }
.seg.sm { flex: none; }
.seg.sm button { font-size: 12px; padding: 5px 11px; font-weight: 600; flex: none; white-space: nowrap; }
.search-row { display: flex; gap: 6px; }
.search-row input {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  padding: 9px 10px;
  background: #fff;
}
.search-row input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 2px rgba(63, 175, 186, 0.2); }
.search-row .btn { padding: 8px 15px; font-size: 13px; }
.results {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-small);
  max-height: 250px;
  overflow-y: auto;
}
.result { padding: 9px 12px; cursor: pointer; font-size: 12.5px; line-height: 1.35; border-bottom: 1px solid var(--border); }
.result:last-child { border-bottom: none; }
.result:hover, .result.active { background: var(--bg); }
.result-name { font-weight: 650; }
.result-meta { font-size: 11px; color: var(--mid); margin-top: 2px; }
.result-tag {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--coral);
  vertical-align: 1px;
  font-weight: 500;
}
.results-empty { padding: 10px 12px; font-size: 12px; color: var(--mid); line-height: 1.45; }
.drop-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; }
.privacy { font-size: 11.5px; color: var(--mid); line-height: 1.4; }

/* ---------- filters ---------- */
.filters { padding: 10px 16px 11px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 9px; }
.toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px 8px 4px 8px;
}
.chip:has(input:not(:checked)) { color: var(--muted); }
.chip:has(input:not(:checked)) .swatch { opacity: 0.4; }
.chip input { accent-color: var(--teal-dark); margin: 0; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); flex: none; }
.swatch.flyer { background: var(--teal); }
.swatch.lawn { background: var(--coral-dark); }
.badge { background: var(--border); color: var(--mid); font-family: var(--mono); font-size: 10px; padding: 1px 7px; border-radius: var(--r-pill); }
.status-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.showing { font-family: var(--mono); font-size: 10.5px; color: var(--mid); white-space: nowrap; }
.showing b { color: var(--dark); font-weight: 500; }

/* ---------- list ---------- */
.list { flex: 1; overflow-y: auto; min-height: 60px; }
.sec-head {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--mid);
  background: var(--bg);
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
}
.sec-head .badge { margin-left: auto; }
.caret { font-size: 9px; transition: transform 0.18s; }
.sec.collapsed .caret { transform: rotate(-90deg); }
.sec.collapsed .items { display: none; }
.items { padding: 4px 0; margin: 0; list-style: none; border-bottom: 1px solid var(--border); }
.item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 16px 7px 13px; cursor: pointer; border-left: 3px solid transparent; }
.item:hover, .item:focus-visible { background: var(--bg); border-left-color: var(--teal); outline: none; }
.item-name { font-weight: 550; font-size: 13px; line-height: 1.3; overflow-wrap: anywhere; }
.item-name.empty { color: var(--muted); font-weight: 400; font-style: italic; }
.item-meta { font-size: 11.5px; color: var(--mid); line-height: 1.3; margin-top: 2px; }
.pill { display: inline-block; font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: 0.1em; padding: 1px 6px; border-radius: var(--r-pill); margin-right: 5px; }
.pill.flyer-up { background: var(--green); color: #fff; }
.pill.sign-up { background: var(--sand-dark); color: var(--dark); }
.pill.todo { background: var(--border); color: var(--mid); }
.more { display: block; width: calc(100% - 32px); margin: 6px 16px 8px; padding: 9px 12px; border: 1px dashed var(--muted); border-radius: var(--r-btn); background: #fff; color: var(--teal-ink); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.more:hover { background: var(--bg); }
.empty-row { padding: 12px 16px; font-size: 12px; color: var(--mid); font-style: italic; }

/* ---------- footer ---------- */
.panel-foot { border-top: 1px solid var(--border); padding: 10px 16px 12px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.foot-row { display: flex; gap: 6px; align-items: center; }
.foot-row.small { justify-content: flex-start; }
.spacer { flex: 1; }
.credits { margin: 0; font-size: 10.5px; line-height: 1.45; color: var(--mid); }

/* ---------- crosshair mode ---------- */
.ch-ring { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; z-index: 900; display: none; }
.ch-ring.on { display: block; }
.ring { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--dark); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 2px 8px rgba(0, 0, 0, 0.25); background: rgba(255, 255, 255, 0.15); position: relative; }
.ring::before, .ring::after { content: ""; position: absolute; background: var(--dark); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9); }
.ring::before { top: 50%; left: -19px; transform: translateY(-50%); width: 60px; height: 2px; }
.ring::after { left: 50%; top: -19px; transform: translateX(-50%); width: 2px; height: 60px; }
.ch-cta { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 1000; display: none; gap: 8px; background: rgba(255, 255, 255, 0.96); padding: 9px 10px; border-radius: var(--r-pill); box-shadow: var(--shadow-pop); }
.ch-cta.on { display: flex; }
.ch-cta .btn { padding: 10px 18px; font-size: 14px; white-space: nowrap; border-radius: var(--r-pill); }
.ch-hint { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 1000; background: var(--dark); color: #fff; padding: 8px 14px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 550; display: none; box-shadow: var(--shadow-pop); pointer-events: none; white-space: nowrap; }
.ch-hint.on { display: block; }

/* ---------- markers ---------- */
.pin { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); background: var(--teal); position: relative; }
.pin.flyer { background: var(--teal); }
.pin.lawn { background: var(--coral-dark); }
/* placed: flyer goes green, sign goes sand, plus a check so the state doesn't ride on color alone */
.pin.flyer.placed { background: var(--green); }
.pin.lawn.placed { background: var(--sand-dark); }
.pin.placed::before { content: ""; position: absolute; left: 6px; top: 2.5px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pin.lawn.placed::before { border-color: var(--dark); }
.pin.has-notes::after { content: ""; position: absolute; top: -4px; right: -4px; width: 8px; height: 8px; background: var(--dark); border: 1.5px solid #fff; border-radius: 50%; }
.pin.is-new { animation: pin-pop 0.9s ease-out 2; }
@keyframes pin-pop {
  0% { box-shadow: 0 0 0 0 rgba(26, 46, 53, 0.45), 0 1px 4px rgba(0, 0, 0, 0.35); }
  100% { box-shadow: 0 0 0 16px rgba(26, 46, 53, 0), 0 1px 4px rgba(0, 0, 0, 0.35); }
}

/* ---------- popups ---------- */
.leaflet-popup-content-wrapper { border-radius: var(--r-card); }
.leaflet-popup-content { margin: 13px 15px; min-width: 228px; font-size: 13px; }
.leaflet-container a.leaflet-popup-close-button { width: 28px; height: 28px; font-size: 20px; line-height: 26px; color: var(--mid); }
.pop-title { font-family: var(--display); font-size: 19px; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.1; padding-right: 18px; }
.pop-meta { font-size: 12px; color: var(--mid); margin-top: 3px; }
/* the one-time "here's what was found" line. shown right after an address drop, never saved, gone on the next open. */
.pop-found { margin-top: 8px; font-size: 11.5px; line-height: 1.4; background: var(--sand); border-radius: var(--r-btn); padding: 6px 8px; }
.pop-found span { color: var(--mid); }
.pop-label { font-family: var(--mono); font-size: 9.5px; font-weight: 500; letter-spacing: 0.14em; color: var(--mid); display: block; margin-top: 10px; }
.pop-notes { width: 100%; margin-top: 4px; font-size: 13px; border: 1px solid var(--border); border-radius: var(--r-btn); padding: 7px 8px; resize: vertical; min-height: 60px; }
.pop-notes:focus, .pop-select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 2px rgba(63, 175, 186, 0.2); }
.pop-select { width: 100%; font-size: 12.5px; border: 1px solid var(--border); border-radius: var(--r-btn); padding: 5px 8px; margin-top: 4px; background: #fff; }
.pop-hint { font-size: 11px; color: var(--mid); margin-top: 8px; }
.pop-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.pop-saved { font-family: var(--mono); font-size: 10px; color: var(--teal-ink); opacity: 0; transition: opacity 0.2s; }
.pop-saved.on { opacity: 1; }
.placed-toggle {
  width: 100%;
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 650;
  border: 2px solid var(--border);
  border-radius: var(--r-btn);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.placed-toggle:hover { border-color: var(--muted); }
.placed-toggle.placed-flyer { background: var(--green); border-color: var(--green); color: #fff; }
.placed-toggle.placed-sign { background: var(--sand-dark); border-color: var(--sand-dark); }
.check { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; position: relative; }
.placed-flyer .check, .placed-sign .check { background: #fff; border-color: #fff; }
.placed-flyer .check::after, .placed-sign .check::after { content: ""; position: absolute; left: 3px; top: 0; width: 4px; height: 8px; border: solid var(--green); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.placed-sign .check::after { border-color: #c9a63a; }

/* ---------- import modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(26, 46, 53, 0.45); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: var(--r-panel); width: 440px; max-width: 100%; box-shadow: var(--shadow-pop); overflow: hidden; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: 22px; text-transform: uppercase; line-height: 1; }
.modal-body { padding: 6px 20px; font-size: 13px; line-height: 1.5; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-btn);
  font-size: 13px;
  font-weight: 550;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  z-index: 3000;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast.on { opacity: 1; }

/* ---------- narrow: map on top, panel below, the page scrolls ---------- */
/* the floating panel would cover a phone screen, so it becomes a block under the map. one finger scrolls
   the page so the panel stays reachable; two fingers move the map (see signmap.js). */
@media (max-width: 900px) {
  html, body { height: auto; overflow-x: hidden; overflow-y: auto; }
  .frame { height: auto; display: flex; flex-direction: column; }
  #map { position: relative; inset: auto; width: 100%; height: 62vh; min-height: 300px; max-height: 560px; }
  .panel { position: relative; top: auto; left: auto; bottom: auto; width: 100%; border-radius: 0; box-shadow: none; border-top: 1px solid var(--border); }
  .list { overflow: visible; }
  .demo-tag { left: 10px; right: 10px; top: 10px; max-width: calc(100% - 20px); padding: 6px 6px 6px 11px; font-size: 10.5px; gap: 7px; }
  .demo-pop { right: 0; }
  .ch-hint { top: 52px; }
  .ch-cta { bottom: 14px; }
  .ch-cta .btn { padding: 11px 18px; font-size: 15px; }
  .panel-head { padding: 12px 16px 10px; }
  .title { font-size: 25px; }
  .search-row input { font-size: 16px; } /* 16px or more stops ios zooming on focus */
  .leaflet-popup-content { min-width: 210px; }
  .seg button, .seg.sm button { min-height: 40px; }
  .chip { padding: 7px 10px; }
  .item { padding-top: 9px; padding-bottom: 9px; }
}
/* short windows (and the embed on the piece page): the whole panel scrolls, so the list isn't squeezed to one row */
@media (min-width: 901px) and (max-height: 780px) {
  .panel { overflow-y: auto; overscroll-behavior: contain; }
  .list { flex: none; overflow: visible; }
}
@media (max-width: 360px) {
  .demo-text { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .pin.is-new { animation: none; }
  .caret, .toast, .touch-hint, .pop-saved { transition: none; }
}
