/* PLOT demo app — phone-first, one screen, map underneath everything. */
:root {
  --ink: #1b2a41;
  --paper: #ffffff;
  --accent: #e4572e;
  --muted: #6b7280;
  --shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 16px/1.4 system-ui, -apple-system, sans-serif; color: var(--ink); background: #ddd; }
#map { position: fixed; inset: 0; }

.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--ink); color: var(--paper);
}
.bar-status { flex: 1; font-size: 14px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-btn {
  border: 0; border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 600;
  background: var(--accent); color: var(--paper); cursor: pointer;
}
.bar-btn[disabled] { opacity: .5; cursor: default; }
.bar-btn.on { background: var(--paper); color: var(--ink); }

.nearest {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 1000;
  top: calc(64px + env(safe-area-inset-top));
  background: rgba(27, 42, 65, .85); color: var(--paper);
  padding: 6px 14px; border-radius: 999px; font-size: 13px;
}

.card {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001;
  background: var(--paper); border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
  max-height: 70vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom);
  animation: rise .25s ease-out;
}
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
.card-close {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.card-photo { height: 220px; background: #cbd5e1 center/cover no-repeat; border-radius: 18px 18px 0 0; position: relative; }
.card-photo .staged { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 6px; }
.card-body { padding: 14px 16px 18px; }
.card-title { margin: 0 0 4px; font-size: 20px; }
.card-sub { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.card-stats { margin: 0 0 10px; font-weight: 600; }
.card-desc { margin: 0; font-size: 15px; color: #374151; }

/* "You are here" dot */
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 2px #2563eb55; }

/* ---- v0.2 controls: search, filters, locate, HUD, approach banner ---- */
.bar { gap: 8px; }
.search { flex: 1; min-width: 0; }
.search input {
  width: 100%; border: 0; border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 15px;
  background: rgba(255,255,255,.12); color: var(--paper); outline: none;
}
.search input::placeholder { color: rgba(255,255,255,.6); }
.search input:focus { background: var(--paper); color: var(--ink); }
.icon-btn {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; font-size: 20px; cursor: pointer;
  background: rgba(255,255,255,.12); color: var(--paper);
}
.icon-btn.active { background: var(--paper); color: var(--ink); }
.bar-btn { flex: none; padding: 10px 16px; }
.bar-btn.on { background: #16a34a; color: #fff; }

.status {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 1000;
  top: calc(62px + env(safe-area-inset-top));
  background: rgba(27, 42, 65, .85); color: var(--paper);
  padding: 5px 12px; border-radius: 999px; font-size: 13px; max-width: 92vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.locate {
  position: fixed; right: 14px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 1000;
  width: 48px; height: 48px; border: 0; border-radius: 50%; font-size: 24px; cursor: pointer;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
}
.locate.busy { opacity: .6; }

.panel {
  position: fixed; left: 10px; right: 10px; z-index: 1002;
  top: calc(62px + env(safe-area-inset-top));
  background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px;
}
.panel-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.panel-row:empty { display: none; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; padding: 6px 10px; border-radius: 999px; background: #f1f5f9; cursor: pointer; }
.toggle input { accent-color: var(--accent); }
.chip { border: 1px solid #cbd5e1; background: #fff; border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.panel-text { width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 15px; }
.panel-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 13px; color: var(--muted); }
.link { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }

.hud {
  position: fixed; left: 10px; right: 72px; z-index: 1000;
  bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 6px;
}
.hud-line { background: rgba(27, 42, 65, .9); color: var(--paper); padding: 8px 12px; border-radius: 12px; font-size: 14px; }
.hud-line.ahead { background: #1d4ed8; font-weight: 600; }

.approach {
  position: fixed; left: 10px; right: 10px; z-index: 1001;
  top: calc(96px + env(safe-area-inset-top));
  background: var(--accent); color: #fff; padding: 10px 14px; border-radius: 12px; font-weight: 600;
  box-shadow: var(--shadow); animation: rise .2s ease-out;
}

/* Hidden-by-filter markers: Leaflet has no hide; we remove from the map instead. */
.leaflet-marker-icon.dim { opacity: .35; }

/* The `hidden` attribute loses to any display: rule (flex, grid) — make it win. */
[hidden] { display: none !important; }

/* ---- v0.2 layers panel ---- */
.panel { max-height: 70vh; overflow-y: auto; }
.panel-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.new-toggle { align-self: flex-start; }
.group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 0 4px; }
.layer-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-radius: 8px; cursor: pointer; }
.layer-row:hover { background: #f8fafc; }
.layer-row input { accent-color: var(--ink); }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.15); }
.layer-name { flex: 1; font-size: 15px; }
.layer-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-layer { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.card-links { margin: 10px 0 0; display: flex; gap: 14px; flex-wrap: wrap; }
.card-links a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* ---- v0.2 drawer (replaces the dropdown panel) + icon pins ---- */
.panel { display: none; } /* old dropdown rules retired */
.backdrop { position: fixed; inset: 0; z-index: 1001; background: rgba(0,0,0,.35); }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 1002;
  width: min(340px, 86vw); background: var(--paper); box-shadow: var(--shadow);
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto; transform: translateX(-100%); transition: transform .22s ease-out;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 18px; }
.drawer-close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f1f5f9; font-size: 22px; line-height: 1; cursor: pointer; }
.dot { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.layer-row { padding: 8px 4px; }

.pin { background: none; border: 0; }
.pin-bubble {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; line-height: 1; font-size: 15px;
  background: var(--c); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
/* the little tail that makes it a pin: a rotated square under the circle */
.pin-bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; width: 10px; height: 10px;
  background: var(--c); transform: translateX(-50%) rotate(45deg); z-index: -1; border-right: 2px solid #fff; border-bottom: 2px solid #fff;
}
.pin-new .pin-bubble { box-shadow: 0 0 0 3px #facc15, 0 2px 6px rgba(0,0,0,.35); }
