:root {
  --fg: #1c1f23; --muted: #5d6670; --bg: #fbfaf7; --card: #fff; --line: #e3e0d8;
  --accent: #1f5f4a; --accent-2: #e8f1ed; --warn: #8a5a00; --warn-bg: #fff4dc;
  --bad: #8b2a2a; --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg); background: var(--bg); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

header.site { border-bottom: 1px solid var(--line); background: var(--card); }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 14px 16px; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--accent); text-decoration: none; }
.tag { color: var(--muted); font-size: .9rem; }

main { padding-top: 24px; padding-bottom: 40px; }
#search { display: flex; gap: 8px; }
#search input { flex: 1; min-width: 0; font-size: 1.05rem; padding: 12px 14px;
  border: 1px solid #c9c5ba; border-radius: var(--radius); background: #fff; }
#search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#search button { font-size: 1rem; padding: 0 18px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #fff; cursor: pointer; }
.hint { color: var(--muted); font-size: .9rem; margin: 8px 2px 0; }
.disclaimer { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius);
  padding: 8px 12px; font-size: .88rem; margin: 14px 0; }

#status { margin: 12px 2px; color: var(--muted); }
#status.empty { color: var(--fg); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; }

.results { list-style: none; padding: 0; margin: 0; }
.results li { margin: 0 0 8px; }
.results button { width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px; cursor: pointer; font: inherit; color: inherit; }
.results button:hover, .results button:focus { border-color: var(--accent); outline: none; }
.results .addr { font-weight: 600; }
.results .sub { color: var(--muted); font-size: .88rem; }

#detail { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-top: 8px; }
#detail h1 { font-size: 1.35rem; margin: 0 0 4px; }
#detail h2 { font-size: 1.05rem; margin: 26px 0 10px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
#detail h3 { font-size: .95rem; margin: 18px 0 8px; color: var(--accent); }
#detail .m { color: var(--muted); font-size: .9rem; }
.back { background: none; border: 0; color: var(--accent); padding: 0; cursor: pointer; font: inherit; margin-bottom: 10px; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

.doc { border-top: 1px solid var(--line); padding: 10px 0; }
.doc:first-of-type { border-top: 0; }
.doc .t { font-weight: 600; }
.doc .m { color: var(--muted); font-size: .88rem; }

.clause { border-left: 3px solid var(--accent); background: var(--accent-2); padding: 8px 12px;
  margin: 0 0 10px; border-radius: 0 6px 6px 0; }
.clause blockquote { margin: 0 0 6px; font-family: Georgia, "Times New Roman", serif; }
.clause .m { color: var(--muted); font-size: .85rem; }
.clause.superseded { border-left-color: #b9b4a8; background: #f3f2ee; }
.clause.superseded blockquote { text-decoration: line-through; color: var(--muted); }
details.old > summary { cursor: pointer; color: var(--muted); font-size: .88rem; margin: 0 0 8px; }

.badge { display: inline-block; font-size: .75rem; padding: 1px 7px; border-radius: 99px;
  margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.badge.unreviewed { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d9a6; }
.badge.law { background: #fbe9e9; color: var(--bad); border: 1px solid #efc9c9; }
.badge.old { background: #eceae4; color: var(--muted); }

table.cov { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.cov th, table.cov td { text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.cov th { color: var(--muted); font-weight: 500; }
.none { color: var(--muted); font-style: italic; }

footer.site { color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); padding: 16px 0 28px; }

@media (max-width: 560px) {
  dl.facts { grid-template-columns: 1fr; gap: 0; }
  dl.facts dd { margin-bottom: 6px; }
  table.cov thead { display: none; }
  table.cov tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.cov td { display: block; border: 0; padding: 0; }
}

.beta { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-2); border: 1px solid #c4dbd1; border-radius: 999px; padding: 1px 8px; }
header.site .links { margin-left: auto; display: flex; gap: 14px; font-size: .9rem; }
header.site .links a, footer.site a { color: var(--accent); }
.page h1 { margin: 8px 0 6px; } .page h2 { margin: 26px 0 6px; font-size: 1.15rem; }
.page code { background: var(--accent-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }

/* ---- /map ------------------------------------------------------------------------------------------ */
body.mapbody { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.mapbody header.site .wrap { max-width: none; padding: 10px 16px; }
.mapbody header.site .links a[aria-current] { font-weight: 700; text-decoration: none; }
.mapnote { margin: 0; padding: 5px 16px; font-size: .8rem; background: var(--warn-bg); color: var(--warn);
  border-bottom: 1px solid #f0d9a6; }
#mapwrap { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: #e9e6df; }
#mapsearch-box { position: absolute; z-index: 1000; top: 10px; left: 56px; width: min(380px, calc(100% - 70px)); }
#mapsearch { display: flex; gap: 6px; }
#mapsearch input { flex: 1; min-width: 0; font-size: 16px; padding: 9px 12px; border: 1px solid #c9c5ba;
  border-radius: var(--radius); background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
#mapsearch button { font-size: 1rem; padding: 0 14px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #fff; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
#mapstatus:not(:empty) { margin-top: 6px; background: var(--card); border-radius: 8px; padding: 6px 10px;
  font-size: .88rem; color: var(--muted); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
#mapresults { margin-top: 6px; max-height: 45vh; overflow: auto; }
#mapresults li { margin-bottom: 4px; }
#mapresults button { padding: 7px 10px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

#panel { position: absolute; z-index: 1001; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100%;
  background: var(--card); border-left: 1px solid var(--line); box-shadow: -2px 0 10px rgba(0,0,0,.12);
  overflow: auto; padding: 16px 18px 28px; -webkit-overflow-scrolling: touch; }
#panel h1 { font-size: 1.2rem; margin: 0 0 4px; }
#panel h2 { font-size: 1rem; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
#panel h3 { font-size: .92rem; margin: 14px 0 6px; color: var(--accent); }
#panel .m { color: var(--muted); font-size: .88rem; }
#panel .close { position: sticky; z-index: 2; float: right; top: 0; margin: -6px -8px 0 8px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: #f1efe9; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--fg); }
#panel dl.facts { grid-template-columns: 1fr; gap: 0; }
#panel dl.facts dd { margin-bottom: 6px; }
#panel table.cov thead { display: none; }
#panel table.cov tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
#panel table.cov td { display: block; border: 0; padding: 0; }
a.btn { display: inline-block; background: var(--accent); color: #fff; text-decoration: none; padding: 7px 14px;
  border-radius: var(--radius); font-size: .92rem; }
.badge.st-covered { background: #dff1e8; color: #1f6b47; }
.badge.st-partial { background: var(--warn-bg); color: var(--warn); }
.badge.st-none { background: #eceae4; color: var(--muted); }
.badge.st-acreage { background: #f2ecdc; color: #6f5d2f; }
#panel .badge { margin-left: 0; font-size: .82rem; padding: 2px 10px; }

.maphint { background: rgba(255,255,255,.94); border-radius: 8px; padding: 6px 10px; font-size: .85rem;
  color: var(--fg); box-shadow: 0 1px 4px rgba(0,0,0,.2); max-width: 240px; }
.maphint[hidden] { display: none; }
.legend { background: rgba(255,255,255,.95); border-radius: 8px; padding: 6px 10px; font-size: .8rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.2); max-width: 260px; }
.legend summary { cursor: pointer; font-weight: 600; }
.legend .lh { font-weight: 600; margin-top: 6px; color: var(--muted); }
.legend ul { list-style: none; margin: 2px 0 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.legend .sw { display: inline-block; width: 14px; height: 10px; border: 2px solid; border-radius: 2px; opacity: .75; flex: none; }
.legend .sw.p { width: 10px; height: 10px; }
.tdr-tt { font: 13px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; width: max-content; max-width: 260px; white-space: normal; }
.tdr-tt .m { color: var(--muted); }

@media (max-width: 699px) {
  .mapbody header.site .tag { display: none; }
  .mapbody header.site .wrap { padding: 8px 12px; }
  #mapsearch-box { left: 52px; right: 10px; width: auto; }
  /* details as a bottom sheet: the map stays visible above it */
  #panel { top: auto; left: 0; width: 100%; max-height: 58%; border-left: 0; border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0; box-shadow: 0 -3px 12px rgba(0,0,0,.18); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  body.panel-open .leaflet-bottom.leaflet-left { display: none; }
  .mapbody .leaflet-top.leaflet-right { top: 50px; }
  .maphint { max-width: 200px; font-size: .8rem; }
  .mapbody header.site .links { gap: 10px; }
  .mapbody .brand { font-size: 1.05rem; }
  .mapnote { font-size: .74rem; padding: 4px 12px; }
  .mapnote .long { display: none; }
}

/* ---- server-rendered pages (/neighborhoods, /n/<slug>, /p/<id>) ------------------------------------------- */
header.site .links a[aria-current] { font-weight: 700; text-decoration: none; }
.crumbs { font-size: .85rem; color: var(--muted); margin: 0 0 6px; }
.crumbs a { color: var(--accent); }
.seo .lead { font-size: 1.05rem; margin: 6px 0 10px; }
.seo .note { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.seo .m { color: var(--muted); font-size: .9rem; }
.seo h3 { font-size: 1rem; margin: 18px 0 8px; color: var(--accent); }
.seo .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.seo .actions a:not(.btn) { color: var(--accent); }
form.lookup { margin: 14px 0; }
form.lookup label { display: block; font-weight: 600; margin: 0 0 6px; }
form.lookup .row { display: flex; gap: 8px; }
form.lookup input { flex: 1; min-width: 0; font-size: 1rem; padding: 10px 12px; border: 1px solid #c9c5ba;
  border-radius: var(--radius); background: #fff; }
form.lookup input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
form.lookup button { font-size: 1rem; padding: 0 16px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #fff; cursor: pointer; }
ul.rules { list-style: none; padding: 0; margin: 0; }
ul.rules li { border-left: 3px solid var(--accent); background: var(--accent-2); padding: 8px 12px;
  margin: 0 0 10px; border-radius: 0 6px 6px 0; }
ul.rules blockquote { margin: 4px 0 6px; font-family: Georgia, "Times New Roman", serif; }
ul.hoods { list-style: none; padding: 0; margin: 0; columns: 2 260px; column-gap: 28px; }
ul.hoods li { break-inside: avoid; padding: 3px 0; }
ul.hoods a { color: var(--accent); font-weight: 600; }
.prop h2 { font-size: 1.1rem; margin: 26px 0 10px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.prop h1 { font-size: 1.4rem; margin: 4px 0; }
.nbhd { margin: 6px 0; }
.nbhd a { color: var(--accent); }
