/* Better Streets Pōneke. Brand tokens follow the Welly Climate Nerd theme
   (kmcd42/wcn-theme: wcn.css + the current live site). Swap them here to re-skin. */
:root {
  --pink: #c23578;           /* WCN accent: CTAs, tags, active states */
  --pink-deep: #8b1a4a;
  --pink-glow: rgba(194, 53, 120, 0.35);
  --blue: #0066ff;           /* hero-gradient corner blue */
  --charcoal: #221f20;       /* WCN dark background */
  --charcoal-deep: #161314;  /* WCN dark card */
  --orange: #f29a38;         /* illustration highlight */

  --bg: #f9f5f0;             /* WCN cream */
  --card: #ffffff;
  --field: #f9f5f0;
  --ink: #0f0e0e;
  --ink-soft: #7a7070;
  --line: rgba(0, 0, 0, 0.09);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --radius: 18px;
  --font-heading: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --glass: rgba(255, 255, 255, 0.88);
  --pill-shadow: 0 4px 18px rgba(0, 0, 0, 0.14);
  --map-bg: #e4e0dc;
  /* Space the floating nav takes at the top of the screen. */
  --topbar-h: calc(70px + env(safe-area-inset-top, 0px));
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--charcoal);
    --card: var(--charcoal);
    --field: var(--charcoal-deep);
    --ink: #f0ece9;
    --ink-soft: #a39a97;
    --line: rgba(255, 255, 255, 0.09);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --glass: rgba(34, 31, 32, 0.86);
    --pill-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
    --map-bg: #1b1b1b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-heading); }
a { color: var(--pink); }
[hidden] { display: none !important; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }

/* ---- Floating nav: pills over the map (like wellyclimatenerd.net) ------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 46px;
  padding: 5px 16px 5px 5px; border-radius: 999px;
  background: var(--glass); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); box-shadow: var(--pill-shadow);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
}
.logo {
  display: block; flex: none; width: 36px; height: 36px; border-radius: 10px;
  box-shadow: 0 2px 10px var(--pink-glow);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong {
  font-family: var(--font-heading); font-weight: 800; font-size: 1rem;
  letter-spacing: -0.02em; white-space: nowrap;
}
.brand-text small { font-size: 0.7rem; color: var(--ink-soft); white-space: nowrap; margin-top: 1px; }
.topnav { display: flex; gap: 8px; }
.topnav .btn { min-height: 46px; }
.topnav .btn.ghost {
  background: var(--glass); color: var(--ink); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--pill-shadow);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
}
.topnav .btn.ghost:hover { background: var(--card); }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; font-family: var(--font-body); font-weight: 700; text-decoration: none; white-space: nowrap;
}
.btn:focus-visible, .chip:focus-visible, .pick:focus-visible, .vote-btn:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.btn.primary { background: var(--pink); color: #fff; box-shadow: 0 4px 18px var(--pink-glow); }
.btn.primary:hover { background: #d03e85; }
.btn.solid { background: var(--ink); color: var(--bg); }
.btn.solid:hover { opacity: 0.88; }
.btn.ghost { background: transparent; border-color: rgba(240, 236, 233, 0.28); color: inherit; border-radius: 12px; }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.06); }
.panel .btn.ghost, .modal .btn.ghost { border-color: var(--line); border-radius: 999px; }
.btn.ghost-light { background: rgba(255,255,255,0.16); color: #fff; border-color: rgba(255,255,255,0.4); }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink-soft); text-decoration: underline; cursor: pointer; font-size: 0.85rem; }

/* ---- Layout ------------------------------------------------------------- */
.layout { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; z-index: 0; background: var(--map-bg); }
.leaflet-container { font-family: var(--font-body); }
.leaflet-bar a, .leaflet-control-layers { background: var(--card); color: var(--ink); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--field); color: var(--ink); }
.leaflet-container .leaflet-control-attribution { background: var(--glass); color: var(--ink-soft); }

.placing-banner {
  position: absolute; z-index: 700; top: var(--topbar-h); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 18px; border-radius: 999px;
  background: var(--pink); color: #fff; box-shadow: 0 6px 24px var(--pink-glow); font-weight: 700;
  max-width: calc(100% - 32px);
}
body.placing #map { cursor: crosshair; }

/* Phones: a fixed pin in the middle of the map, with its tip on the centre point. */
.centre-pin {
  position: absolute; z-index: 650; left: 50%; top: 50%; width: 40px; height: 40px;
  transform: translate(-50%, calc(-100% - 2px)); pointer-events: none;
}
.centre-pin .pin { width: 40px; height: 40px; animation: none; }
.drop-bar {
  position: absolute; z-index: 700; left: 0; right: 0; bottom: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--card); color: var(--ink); border-radius: var(--radius) var(--radius) 0 0;
  border-top: 1px solid var(--line); box-shadow: var(--shadow);
}
.drop-bar p { margin: 0 0 12px; font-weight: 700; text-align: center; line-height: 1.35; }
.drop-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.drop-actions .btn { min-height: 48px; }
.drop-bar .btn.ghost { border-color: var(--line); border-radius: 999px; }

/* ---- Panel: right drawer on desktop, bottom sheet on mobile -------------- */
.panel {
  position: absolute; z-index: 800; top: var(--topbar-h); right: 12px; bottom: 12px;
  width: min(430px, calc(100% - 24px));
  background: var(--card); color: var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
}
.panel-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 38px; height: 38px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.panel-body { overflow-y: auto; padding: 22px 22px 30px; -webkit-overflow-scrolling: touch; }
.panel h2 { margin: 10px 44px 8px 0; font-size: 1.6rem; font-weight: 800; line-height: 1.12; letter-spacing: -0.025em; }
.panel h3 {
  margin: 24px 0 8px; font-family: var(--font-body); font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-soft);
}
.panel p { line-height: 1.6; }

@media (max-width: 720px) {
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 72%; border-radius: var(--radius) var(--radius) 0 0; border-width: 1px 0 0; }
  /* A strip at the top holds the close button, so content never scrolls under it. */
  .panel { padding-top: 54px; }
  .panel-body { padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
  .panel h2 { margin-right: 0; }
  .brand-text small, #btn-about { display: none; }
  .topbar { padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px)); }
  .topnav { gap: 6px; }
  .btn { padding: 0 14px; }
}
/* Phones: the logo alone, like the WCN site's floating nav. */
@media (max-width: 480px) {
  .brand { padding: 0; background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .brand-text { display: none; }
  .brand .logo { width: 46px; height: 46px; border-radius: 12px; box-shadow: 0 4px 18px var(--pink-glow); }
}

/* ---- Tags, badges, chips (WCN pill style) ------------------------------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em;
  color: #fff; background: var(--c, var(--pink));
  box-shadow: 0 3px 14px color-mix(in srgb, var(--c, var(--pink)) 35%, transparent);
}
.lead {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;
  border: 1.5px solid var(--line); color: var(--ink-soft);
}
.lead-community { border-color: color-mix(in srgb, var(--pink) 45%, transparent); color: var(--pink); background: color-mix(in srgb, var(--pink) 8%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1.5px solid var(--c, var(--line)); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 6px 13px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); color: #fff; }
.chip-community { --c: var(--pink); }
.sort .chip[aria-pressed="true"] { color: var(--bg); }

/* ---- Intervention picker ------------------------------------------------ */
.pick-group { margin-bottom: 14px; }
.pick-group h4 { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; font-size: 0.95rem; font-weight: 800; letter-spacing: -0.01em; }
.pick-group h4::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 6px; }
.pick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--field);
  cursor: pointer; font-size: 0.85rem; font-weight: 700; line-height: 1.2; min-height: 66px;
}
.pick .pick-icon { font-size: 1.1rem; }
.pick .pick-lead { font-size: 0.68rem; font-weight: 600; color: var(--pink); margin-top: auto; }
.pick[aria-pressed="true"] { border-color: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); background: var(--card); }
/* Phones: icon beside the label, so the cards stay short and even. */
@media (max-width: 720px) {
  .pick { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 8px; min-height: 50px; padding: 10px 12px; }
  .pick .pick-lead { grid-column: 2; margin-top: 0; }
}
.pick-summary { margin: 12px 0 0; padding: 12px 14px; border-left: 4px solid var(--c, var(--pink)); background: var(--field); border-radius: 0 12px 12px 0; font-size: 0.9rem; }
.pick-summary p { margin: 0 0 8px; line-height: 1.5; }

/* ---- Forms -------------------------------------------------------------- */
label.field { display: block; margin: 14px 0 4px; font-weight: 700; font-size: 0.92rem; }
.field-hint { font-size: 0.82rem; color: var(--ink-soft); margin: 0 0 8px; line-height: 1.45; }
input[type="text"], input[type="password"], input[type="email"], textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--field); line-height: 1.45;
}
input:focus, textarea:focus { outline: none; border-color: var(--pink); }
textarea { min-height: 110px; resize: vertical; }
.counter { text-align: right; font-size: 0.75rem; color: var(--ink-soft); margin-top: 3px; font-variant-numeric: tabular-nums; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.notice { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: var(--field); border: 1px solid var(--line); font-size: 0.9rem; }
.notice.error { border-color: #d6402f; color: #d6402f; background: transparent; }
.notice.ok { border-color: var(--pink); }

/* ---- Suggestion detail ---------------------------------------------------- */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 44px 4px 0; }
.place { font-size: 0.9rem; color: var(--ink-soft); margin: 0 0 12px; }
.reason { white-space: pre-wrap; }
.vote-row { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; }
.vote-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border-radius: 999px; border: 2px solid var(--pink); background: transparent; color: var(--ink);
  font-weight: 700; cursor: pointer;
}
.vote-btn[aria-pressed="true"] { background: var(--pink); color: #fff; box-shadow: 0 4px 18px var(--pink-glow); }
.vote-btn .count { font-variant-numeric: tabular-nums; font-weight: 800; }
.vote-btn[disabled] { opacity: 0.55; cursor: default; }
/* Safety card */
.impact-card { margin: 22px 0 4px; padding: 16px; border-radius: var(--radius); background: var(--field); border: 1px solid var(--line); }
.impact-card h3 { margin: 0 0 6px; }
.impact-card p { margin: 0 0 6px; }
.done-tag { background: var(--pink); color: #fff; }

/* Opt-in form */
.optin { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.optin > p { margin: 0 0 10px; font-weight: 600; }
.optin > p.small { font-weight: 400; }
.optin-email { margin-top: 10px; }

/* ---- Browse list ---------------------------------------------------------- */
.list { list-style: none; margin: 12px 0 0; padding: 0; }
.list li button {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; width: 100%;
  padding: 11px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer;
}
.list li button:hover { background: var(--field); }
.list .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--pink); font-size: 0.9rem; }
.list .t { font-family: var(--font-heading); font-weight: 800; letter-spacing: -0.01em; line-height: 1.25; }
.list .s { font-size: 0.78rem; color: var(--ink-soft); }
.list .v { font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sort { display: flex; gap: 6px; margin-top: 10px; }

/* ---- Map markers ---------------------------------------------------------- */
/* White pins with a pink outline in both themes, so every emoji reads clearly. */
.pin {
  position: relative; display: grid; place-items: center; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  background: #fff; border: 2.5px solid var(--pink); box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}
.pin span { transform: rotate(45deg); font-size: 16px; line-height: 1; color: var(--charcoal); font-weight: 800; font-family: var(--font-heading); }
.pin-done {
  position: absolute; top: -7px; right: -7px; transform: rotate(45deg);
  display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  background: var(--pink); color: #fff; border: 2px solid #fff; font-size: 10px; line-height: 1;
}
.pin.draft span { color: #fff; }
.pin.draft { background: var(--pink); border-color: #fff; box-shadow: 0 0 0 6px var(--pink-glow), 0 3px 8px rgba(0,0,0,0.35); animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { margin-top: -6px; } }
@media (prefers-reduced-motion: reduce) { .pin.draft { animation: none; } }
.cluster {
  display: grid; place-items: center; border-radius: 50%;
  background: var(--charcoal); color: #fff; border: 3px solid var(--pink);
  box-shadow: 0 4px 16px var(--pink-glow);
  font-family: var(--font-heading); font-weight: 800; font-size: 0.9rem;
}

/* ---- Modal & toast ---------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; background: rgba(22, 19, 20, 0.6); padding: 16px; }
.modal-card { background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 24px; max-width: 380px; width: 100%; box-shadow: var(--shadow); }
.modal-card h2 { margin-top: 0; font-weight: 800; letter-spacing: -0.02em; }
#turnstile-slot { min-height: 70px; margin: 12px 0; }
.toast {
  position: fixed; z-index: 2100; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--charcoal); color: #f0ece9; padding: 11px 18px; border-radius: 999px;
  border: 1px solid rgba(194, 53, 120, 0.5); box-shadow: var(--shadow); width: max-content; max-width: calc(100% - 32px); font-size: 0.92rem;
}
/* On phones, keep messages clear of the Drop pin bar. */
@media (max-width: 720px) { body.placing .toast { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); } }

/* ---- Credit ------------------------------------------------------------- */
.made-by {
  position: fixed; z-index: 500; left: 60px; bottom: 10px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border-radius: 999px;
  background: var(--charcoal); color: #f0ece9; text-decoration: none;
  font-size: 0.75rem; font-weight: 600; box-shadow: var(--shadow);
}
.made-by .logo { width: 22px; height: 22px; border-radius: 6px; box-shadow: none; }
.made-by:hover { color: #fff; background: var(--pink-deep); }
@media (max-width: 720px) { .made-by { display: none; } }

/* ---- About -------------------------------------------------------------- */
.about ul, .about ol { padding-left: 1.2rem; line-height: 1.6; }
.about .steps li { margin-bottom: 4px; }
.legend { display: grid; gap: 7px; margin: 8px 0; }
.legend div { display: flex; align-items: center; gap: 9px; font-size: 0.9rem; }
.legend i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
