:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #68736d;
  --line: #dce5dd;
  --paper: #fbfcf8;
  --panel: #ffffff;
  --field: #f5f8f4;
  --primary: #1f6b45;
  --primary-dark: #174f35;
  --accent: #d8a441;
  --sky: #9ecbd0;
  --rose: #d9715f;
  --shadow: 0 18px 50px rgb(21 44 29 / 12%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgb(220 229 221 / 74%);
  background: rgb(251 252 248 / 90%);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
}

.main-nav {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

.main-nav a {
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.main-nav a:hover {
  background: var(--field);
  color: var(--ink);
}

.ghost-button {
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--panel);
  color: var(--primary-dark);
  font-weight: 800;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
  gap: clamp(28px, 6vw, 80px);
  align-items: end;
  padding: clamp(42px, 8vw, 96px) clamp(18px, 5vw, 72px) 26px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.45rem, 7vw, 5.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 7px;
  font-size: 1.08rem;
}

.lede {
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.22rem);
  line-height: 1.6;
}

.search-panel,
.filters,
.map-card,
.modal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.search-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgb(31 107 69 / 12%);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented legend {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.segmented label {
  display: flex;
  justify-content: center;
  min-height: 40px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
  color: var(--muted);
}

.segmented input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented label:has(input:checked) {
  border-color: var(--primary);
  background: #e5f0e9;
  color: var(--primary-dark);
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  font-weight: 900;
}

.primary-button {
  background: var(--primary);
  color: #fff;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--primary-dark);
}

.insights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 clamp(18px, 5vw, 72px) 26px;
}

.insights article {
  display: grid;
  gap: 4px;
  min-height: 96px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #eef5ef;
}

.insights strong {
  font-size: 1.9rem;
  line-height: 1;
}

.insights span {
  color: var(--muted);
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  padding: 12px clamp(18px, 5vw, 72px) 46px;
  align-items: start;
}

.filters {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 18px;
  padding: 18px;
}

.section-heading {
  padding-bottom: 4px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.checkbox-row input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--primary);
}

.results {
  min-width: 0;
  grid-column: 2;
}

.results-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 14px;
}

.result-list {
  display: grid;
  gap: 12px;
}

.status-message {
  min-height: 44px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #eef5ef;
  color: var(--muted);
  font-weight: 800;
}

.status-message.is-error {
  border-color: rgb(217 113 95 / 42%);
  background: #fff1ee;
  color: #8b3527;
}

.status-message.is-warning {
  border-color: rgb(216 164 65 / 45%);
  background: #fff7e2;
  color: #6f4d12;
}

.load-more-button {
  justify-self: center;
  margin-top: 14px;
}

.activity-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.activity-card {
  display: grid;
  gap: 16px;
  cursor: pointer;
}

.activity-card.has-map-position:focus-visible {
  outline: 3px solid rgb(216 164 65 / 44%);
  outline-offset: 3px;
}

.activity-card.is-selected {
  border-color: rgb(31 107 69 / 55%);
  box-shadow: 0 12px 34px rgb(31 107 69 / 12%);
}

.activity-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
}

.activity-main p,
.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.activity-meta,
.activity-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.activity-meta span,
.activity-footer span,
.activity-footer a {
  border-radius: 999px;
  background: var(--field);
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.activity-footer a {
  background: #e5f0e9;
  color: var(--primary-dark);
}

.activity-footer .over-budget {
  background: #fff1d5;
  color: #6f4d12;
}

.activity-meta .verified {
  background: #e5f0e9;
  color: var(--primary-dark);
}

.activity-meta .community {
  background: #fff1d5;
  color: #6f4d12;
}

.price-lockup {
  display: grid;
  justify-items: end;
  align-content: start;
  min-width: 90px;
}

.price-lockup strong,
.price-lockup a {
  color: var(--primary-dark);
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 900;
}

.price-lockup span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.map-card {
  grid-column: 2;
  overflow: hidden;
  min-height: 520px;
}

.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 900;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--primary-dark);
  font-weight: 900;
}

.map-canvas {
  position: relative;
  height: 390px;
  min-height: 390px;
  overflow: hidden;
  background: #edf2ef;
}

/* Minimal Leaflet layout fallback for local preview when CDN CSS is blocked. */
.leaflet-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  outline: 0;
}

.leaflet-pane,
.leaflet-map-pane,
.leaflet-tile-pane,
.leaflet-overlay-pane,
.leaflet-shadow-pane,
.leaflet-marker-pane,
.leaflet-tooltip-pane,
.leaflet-popup-pane {
  position: absolute;
  top: 0;
  left: 0;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg,
.leaflet-pane > canvas {
  position: absolute;
  top: 0;
  left: 0;
}

.leaflet-tile {
  user-select: none;
  -webkit-user-drag: none;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-control {
  position: relative;
  z-index: 1000;
  clear: both;
  margin: 10px;
  pointer-events: auto;
}

.leaflet-left .leaflet-control {
  float: left;
}

.leaflet-right .leaflet-control {
  float: right;
}

.leaflet-control-zoom a {
  display: block;
  width: 32px;
  height: 32px;
  background: #fff;
  line-height: 32px;
  text-align: center;
}

.leaflet-control-attribution {
  margin: 0;
  background: rgb(255 255 255 / 78%);
  padding: 2px 6px;
}

.map-canvas .leaflet-container,
.leaflet-container {
  font: inherit;
}

.map-canvas .leaflet-control-attribution {
  font-size: 0.68rem;
}

.map-canvas .leaflet-control-zoom {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgb(23 33 27 / 12%);
}

.map-canvas .leaflet-control-zoom a {
  border: 0;
  color: var(--primary-dark);
  font-weight: 900;
}

.map-loading,
.map-error {
  display: grid;
  min-height: inherit;
  place-items: center;
  padding: 28px;
  text-align: center;
}

.map-error {
  align-content: center;
  gap: 8px;
}

.map-error h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
}

.map-error p {
  max-width: 360px;
  margin: 0 auto;
  color: var(--muted);
}

.activity-marker-shell {
  border: 0;
  background: transparent;
}

.osm-map-marker {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  font: 900 0.8rem/1 Inter, system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 22px rgb(23 33 27 / 24%);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.osm-map-marker.is-selected {
  transform: scale(1.18);
  outline: 4px solid rgb(216 164 65 / 34%);
  box-shadow: 0 12px 30px rgb(23 33 27 / 34%);
}

.osm-map-marker.is-verified {
  background: var(--primary);
}

.osm-map-marker.is-community {
  background: var(--accent);
  color: var(--ink);
}

.map-info {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  min-height: 116px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.map-info span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.map-info h3 {
  margin-bottom: 4px;
}

.map-info p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.35;
}

.map-info a {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  padding: 10px 13px;
  font-size: 0.82rem;
  font-weight: 900;
}

.map-info-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.map-info-actions .secondary-button {
  min-height: 38px;
  padding: 0 14px;
}

.community-page {
  margin: 0 clamp(18px, 5vw, 72px) 56px;
}

.community-header {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #18261f;
  color: #fff;
}

.community-header .eyebrow {
  color: var(--accent);
}

.community-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.submission-modal {
  width: min(540px, calc(100% - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}

.submission-modal::backdrop,
.listing-modal::backdrop {
  background: rgb(23 33 27 / 58%);
}

.modal-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.listing-modal {
  width: min(860px, calc(100% - 28px));
  border: 0;
  padding: 0;
  background: transparent;
}

.listing-modal-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.listing-dialog-body {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
}

.listing-photo {
  position: relative;
  min-height: 320px;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #e5f0e9;
}

.listing-photo img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

.listing-photo figcaption {
  position: absolute;
  right: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  border-radius: 999px;
  background: rgb(23 33 27 / 78%);
  color: #fff;
  padding: 6px 10px;
  font-size: 0.7rem;
  font-weight: 800;
}

.listing-photo-fallback {
  display: grid;
  place-items: center;
  color: var(--primary-dark);
  font-size: 1.4rem;
  font-weight: 900;
}

.listing-detail-copy {
  display: grid;
  gap: 14px;
  align-content: start;
}

.listing-detail-copy h2 {
  font-size: clamp(1.65rem, 3vw, 2.45rem);
}

.listing-detail-copy p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-grid div,
.detail-notes span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  padding: 12px;
}

.detail-grid strong {
  display: block;
  color: var(--ink);
  line-height: 1.25;
}

.detail-grid span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-notes span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.listing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.listing-actions a,
.listing-actions button {
  display: inline-flex;
  align-items: center;
  min-width: 132px;
  justify-content: center;
  text-align: center;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .map-card {
    min-height: 360px;
  }

  .map-canvas {
    height: 300px;
    min-height: 300px;
  }
}

@media (max-width: 820px) {
  .app-header {
    grid-template-columns: 1fr auto;
  }

  .main-nav {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-top: 34px;
  }

  .insights,
  .workspace {
    grid-template-columns: 1fr;
  }

  .filters {
    position: relative;
    top: 0;
  }

  .map-card,
  .results {
    grid-column: 1;
  }

  .results-header,
  .community-header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 540px) {
  .field-grid {
    grid-template-columns: 1fr 1fr;
  }

  .segmented,
  .segmented.compact {
    grid-template-columns: 1fr 1fr;
  }

  .activity-main {
    grid-template-columns: 1fr;
  }

  .price-lockup {
    justify-items: start;
  }

  .map-info {
    align-items: stretch;
    flex-direction: column;
  }

  .map-info-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .map-info a {
    text-align: center;
  }

  .listing-dialog-body,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .listing-photo,
  .listing-photo img {
    min-height: 220px;
  }

  h1 {
    font-size: 2.35rem;
  }
}
