:root {
  --ink: #1a1f1c;
  --muted: #4a524c;
  --paper: #f7f5f0;
  --card: #ffffff;
  --line: #d4d0c6;
  --accent: #1f5c45;
  --accent-soft: #e6f0eb;
  --warn: #7a4a12;
  --warn-soft: #f5ead8;
  --fact: #1e3a5f;
  --fact-soft: #e8eef5;
  --opinion: #5c3d6e;
  --opinion-soft: #f0e8f4;
}

* { box-sizing: border-box; }

html { font-size: 18px; }

body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

header.site {
  border-bottom: 1px solid var(--line);
  background: var(--card);
  margin-bottom: 1.75rem;
}

header.site .wrap {
  padding-top: 1rem;
  padding-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
}

header.site .brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
}

nav a {
  margin-right: 1rem;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
}
nav a:hover, nav a[aria-current="page"] {
  color: var(--accent);
  text-decoration: underline;
}

h1 {
  font-size: 1.85rem;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.015em;
}

h3 {
  font-size: 1.05rem;
  margin: 1.4rem 0 0.5rem;
}

p, li { color: var(--ink); }
.lede { font-size: 1.08rem; color: var(--muted); margin-top: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  margin: 1.25rem 0;
}

.card.lead {
  border-left: 4px solid var(--warn);
  background: var(--warn-soft);
}

.card.study {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
}

.big-number {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0.25rem 0;
}

.big-number span {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.tag.fact { background: var(--fact-soft); color: var(--fact); }
.tag.opinion { background: var(--opinion-soft); color: var(--opinion); }
.tag.counter { background: var(--warn-soft); color: var(--warn); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0.75rem 0 1rem;
  background: var(--card);
}

th, td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.55rem;
  text-align: left;
}

th { background: #eeebe3; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.sources {
  font-size: 0.88rem;
  color: var(--muted);
}

.sources code {
  font-size: 0.82em;
  background: #ece8df;
  padding: 0.05em 0.3em;
  border-radius: 3px;
}

footer.site {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}

.home-list {
  list-style: none;
  padding: 0;
}

.home-list li {
  margin: 0.75rem 0;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.home-list a.title {
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--ink);
}
.home-list a.title:hover { color: var(--accent); }
.home-list p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.95rem; }

@media (max-width: 560px) {
  html { font-size: 17px; }
  .big-number { font-size: 1.65rem; }
}

/* Section scaffolding */
.slot-note {
  font-size: 0.88rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  background: #faf8f3;
}

.biz-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}
.biz-list .card { margin: 0.85rem 0; }
.biz-list h2 {
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
}

.parcel-search label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.parcel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.parcel-row input {
  flex: 1 1 12rem;
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.parcel-row button {
  font: inherit;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.parcel-row button:hover { filter: brightness(1.05); }

.parcel-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}
.parcel-card { margin: 0.65rem 0; }
.parcel-owner { font-weight: 700; margin: 0 0 0.2rem; }
.parcel-addr { margin: 0 0 0.25rem; }
.parcel-meta { margin: 0; }

@media (max-width: 560px) {
  nav a { margin-right: 0.65rem; font-size: 0.88rem; }
}

/* Tax sale / multi-layer map */
.wrap.wide {
  max-width: 72rem;
}

.map-disclaimer p { margin: 0; }

.map-layout {
  display: block;
  margin: 1.25rem 0;
}

.map-sidebar {
  margin: 0;
}

.map-sidebar-title {
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
}

.map-sidebar-title + .map-legend,
.layer-toggles + .map-sidebar-title {
  margin-top: 1.25rem;
}

.layer-toggles,
.map-legend {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
}

.layer-toggles li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  margin: 0.4rem 0;
}

.layer-toggles label {
  cursor: pointer;
  color: var(--ink);
}

.layer-count { font-size: 0.82rem; }

.map-legend li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.4rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.swatch {
  flex: 0 0 1.15rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 3px;
  margin-top: 0.15rem;
  box-sizing: border-box;
}

.swatch.high {
  background: rgba(31, 92, 69, 0.35);
  border: 2px solid #1f5c45;
}

 .swatch.medium {
  background: rgba(196, 122, 42, 0.35);
  border: 2px dashed #7a4a12;
}

.swatch.pin {
  border-radius: 50%;
  border: 2px solid #1a1f1c;
  background: #1e3a5f;
}

.swatch.pin-mls { background: #1e3a5f; }
.swatch.pin-fb { background: #5c3d6e; }
.swatch.pin-cl { background: #b45309; }

.legend-hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
}

.map-popup {
  font-size: 0.92rem;
  line-height: 1.35;
  max-width: 16rem;
}

.map-popup .parcel-owner {
  font-weight: 700;
  font-size: 1rem;
}

.map-popup a {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  background: #1f5c45;
  color: #fff !important;
  text-decoration: none;
}

.leaflet-popup-content-wrapper {
  border-radius: 10px;
}

.leaflet-container a.leaflet-popup-close-button {
  width: 1.5rem;
  height: 1.5rem;
  font-size: 1.25rem;
  padding: 0.2rem;
}

.map-frame {
  min-height: 28rem;
  min-height: max(28rem, 50vh);
  border: 1px solid var(--line);
  border-radius: 10px;
  /* avoid clipping the Leaflet panes on tiny screens */
  overflow: visible;
  background: var(--card);
  width: 100%;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.6rem;
  position: relative;
  z-index: 20;
}

.map-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  border: 1px solid #1f5c45;
  background: #fff;
  color: #1f5c45;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  pointer-events: auto;
}

.map-tool-btn:hover,
.map-tool-btn:focus-visible {
  background: #eef3ee;
}

.map-tool-btn[aria-pressed="true"],
.map-tool-btn[aria-expanded="true"] {
  background: #1f5c45;
  color: #fff;
}

.map-tool-btn:disabled {
  cursor: wait;
  opacity: 0.7;
}

.map-tool-btn.is-locating {
  color: #7a4a12;
  border-color: #7a4a12;
}

.map-tool-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.map-locate-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  margin: 0 0 0.6rem;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  border: 3px solid #7a4a12;
  background: #fff2cc;
  color: #3a2408;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  z-index: 30;
}

.map-locate-hint[hidden] {
  display: none !important;
}

.map-locate-hint-text {
  flex: 1 1 auto;
}

.map-locate-retry-btn {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: 2px solid #7a4a12;
  background: #7a4a12;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.map-locate-retry-btn:hover,
.map-locate-retry-btn:focus-visible {
  background: #5f3a0d;
}

.map-locate-retry-btn[hidden] {
  display: none !important;
}

.map-fs-banner {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: #1f5c45;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.3;
}

.map-fs-banner[hidden] {
  display: none !important;
}

#map {
  width: 100%;
  height: 28rem;
  min-height: 28rem;
  min-height: max(28rem, 50vh);
  display: block;
}

.map-status-banner {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.35;
}

.map-popup .parcel-owner { margin-top: 0; }

/* Explicit full-screen mode, toggled by the "Full screen" toolbar button.
   Applies at any viewport width — no longer tied to a media query. */
body.map-user-fs {
  overflow: hidden;
}
body.map-user-fs header.site,
body.map-user-fs footer.site,
body.map-user-fs main.wrap.wide > h1,
body.map-user-fs main.wrap.wide > .lede,
body.map-user-fs main.wrap.wide > .map-disclaimer,
body.map-user-fs main.wrap.wide > p.sources {
  display: none;
}
body.map-user-fs main.wrap.wide {
  max-width: none;
  padding: 0;
  margin: 0;
}
body.map-user-fs .map-layout {
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  position: fixed;
  inset: 0;
  /* Fallback chain: 100% (of fixed inset, i.e. viewport) -> 100vh ->
     100dvh/100svh. Jelly Max WebView may lack dvh/svh support, so keep the
     earlier declarations as a working fallback. */
  height: 100%;
  height: 100vh;
  height: 100dvh;
  height: 100svh;
  z-index: 10;
}
body.map-user-fs .map-main {
  order: 2;
  width: 100%;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
body.map-user-fs .map-toolbar {
  margin: 0;
  padding: 0.5rem 0.75rem;
  flex: 0 0 auto;
  /* Distinct toolbar bar so it's unmistakable that full-screen is active
     even on devices where the layout/height fixes don't fully land. */
  background: #eef3ee;
  border-bottom: 1px solid #1f5c45;
  box-shadow: inset 0 3px 0 #1f5c45;
}
body.map-user-fs .map-status-banner {
  margin: 0;
  padding: 0.4rem 0.75rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
body.map-user-fs .map-frame {
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  min-height: 85vh;
  border-radius: 0;
  border: 0;
}
body.map-user-fs #map {
  width: 100%;
  height: 100%;
  min-height: 85vh;
}
/* Sidebar must not affect fullscreen layout (and cannot receive stray
   pointer events) unless it's actually open. */
body.map-user-fs #map-sidebar:not(.is-open) {
  display: none !important;
}

/* Jelly Max / very small phones */
@media (max-width: 400px) {
  .wrap.wide {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .map-layout {
    margin: 0.75rem 0;
  }
  .map-status-banner {
    font-size: 0.88rem;
  }
  .map-legend li {
    font-size: 0.84rem;
    gap: 0.65rem;
    margin: 0.55rem 0;
  }
  .swatch {
    flex-basis: 1.35rem;
    width: 1.35rem;
    height: 1.35rem;
  }
  .layer-toggles label {
    font-size: 0.95rem;
    line-height: 1.35;
  }
  .layer-toggles input {
    width: 1.1rem;
    height: 1.1rem;
  }
}


.swatch.pin-new {
  background: #c9a227;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #c9a227;
}

.map-frame {
  position: relative;
}

.map-gesture-lock {
  position: absolute;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(250, 248, 243, 0.55);
  border-radius: 10px;
  text-align: center;
  pointer-events: auto;
}

.map-gesture-lock[hidden] {
  display: none !important;
}

.map-unlock-btn {
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 1px solid #1f5c45;
  background: #1f5c45;
  color: #fff;
  cursor: pointer;
}

.map-lock-hint {
  margin: 0;
  max-width: 16rem;
}

.map-feature-panel {
  margin: 0.75rem 0 0;
  padding: 0.85rem 1rem;
}

.map-feature-panel[hidden] {
  display: none !important;
}

.map-feature-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.map-feature-panel-head .map-sidebar-title {
  margin: 0;
}

.map-panel-close {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
}

.map-feature-body .map-popup {
  max-width: none;
}

.map-feature-body .badge-new {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #c9a227;
  color: #1a1f1c;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
}

/* Desktop: keep panel available but compact under map optional */
@media (min-width: 721px) {
  .map-gesture-lock {
    display: none !important;
  }
  .map-feature-panel {
    display: none !important;
  }
}

@media (max-width: 720px) {
  /* Prefer full-screen detail view — hide Leaflet popups */
  .leaflet-popup-pane {
    display: none !important;
  }
  .map-feature-panel {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 3000;
    margin: 0;
    padding: 0.85rem 1rem 1.25rem;
    border-radius: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .map-feature-panel[hidden] {
    display: none !important;
  }
  .map-panel-close {
    min-width: 44px;
    min-height: 44px;
    font-size: 1rem;
  }

  /* Map is hidden while the full-screen detail view is showing */
  body.map-detail-open .map-frame,
  body.map-detail-open .map-status-banner,
  body.map-detail-open .map-toolbar {
    display: none !important;
  }

  /* Gesture lock is unnecessary once the map is full-screen */
  .map-gesture-lock {
    display: none !important;
  }
}

/* Layers sidebar: a single overlay sheet used at every viewport width so the
   toolbar's "Layers" button always visibly does something, above the map. */
.map-sidebar {
  position: fixed;
  inset: 0;
  z-index: 3000;
  margin: 0;
  max-width: none;
  border-radius: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  visibility: hidden;
  pointer-events: auto;
}
.map-sidebar.is-open {
  transform: translateY(0);
  visibility: visible;
}
.map-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.map-sidebar-head .map-sidebar-title {
  margin: 0;
}
.map-sidebar-close {
  min-width: 44px;
  min-height: 44px;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
}
.map-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2900;
  background: rgba(20, 24, 21, 0.35);
  pointer-events: auto;
}
.map-sidebar-backdrop[hidden] {
  display: none !important;
}

