/* ============================================================
   Hamilton is Home — Map locator (map.css)
   Shared by homepage and projects page.
   ============================================================ */

/* ── Locator layout: sidebar + map ── */
.map-locator {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(68,57,76,.12);
  border: 1.5px solid rgba(68,57,76,.08);
  height: 600px;
}

/* ── Sidebar ── */
.map-sidebar {
  background: var(--white);
  display: flex;
  flex-direction: column;
  border-right: 1.5px solid rgba(68,57,76,.08);
  overflow: hidden;
}
.map-sidebar-head {
  padding: 1rem 1rem .75rem;
  border-bottom: 1.5px solid rgba(68,57,76,.06);
  flex-shrink: 0;
}

/* Search input */
.map-search-wrap {
  position: relative;
  margin-bottom: .65rem;
}
.map-search-wrap svg {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  stroke: var(--muted);
  pointer-events: none;
}
.map-search {
  width: 100%;
  padding: .55rem .75rem .55rem 2.2rem;
  font-family: var(--font-body);
  font-size: .83rem;
  color: var(--plum);
  background: var(--cream);
  border: 1.5px solid rgba(68,57,76,.12);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}
.map-search:focus { border-color: var(--teal); }
.map-search::placeholder { color: var(--muted); }

/* Filter pills inside sidebar */
.map-filters {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}
.map-filter-btn {
  font-family: var(--font-head);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: .3rem .8rem;
  border-radius: 50px;
  border: 1.5px solid rgba(68,57,76,.18);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  background: transparent;
  color: var(--plum);
  white-space: nowrap;
}
.map-filter-btn:hover { border-color: var(--plum); }
.map-filter-btn.active { background: var(--plum); color: var(--white); border-color: var(--plum); }
.map-filter-btn[data-filter="Development"].active { background: var(--teal); border-color: var(--teal); color: var(--plum); }
.map-filter-btn[data-filter="Complete"].active { background: var(--merigold); border-color: var(--merigold); color: var(--plum); }

/* Project list */
.map-list {
  flex: 1;
  overflow-y: auto;
  padding: .35rem 0;
  scroll-behavior: smooth;
}
.map-list::-webkit-scrollbar { width: 4px; }
.map-list::-webkit-scrollbar-track { background: transparent; }
.map-list::-webkit-scrollbar-thumb { background: rgba(68,57,76,.15); border-radius: 4px; }

.map-list-item {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .7rem 1rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .12s, border-color .12s;
  border-bottom: 1px solid rgba(68,57,76,.05);
}
.map-list-item:hover { background: rgba(68,57,76,.03); border-left-color: rgba(68,57,76,.15); }
.map-list-item.active { background: rgba(116,193,169,.08); border-left-color: var(--teal); }
.map-list-item.active.phase-comp { background: rgba(234,156,54,.07); border-left-color: var(--merigold); }

.map-list-dot {
  width: 9px;
  height: 9px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  flex-shrink: 0;
  margin-top: 4px;
  border: 1.5px solid rgba(255,255,255,.8);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.map-list-dot-dev  { background: #74C1A9; }
.map-list-dot-comp { background: #EA9C36; }

.map-list-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.map-list-addr {
  font-family: var(--font-head);
  font-size: .82rem;
  font-weight: 700;
  color: var(--plum);
  line-height: 1.25;
  margin-bottom: .2rem;
  word-break: break-word;
}
.map-list-org {
  font-family: var(--font-body);
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-word;
}
.map-list-units {
  font-family: var(--font-head);
  font-size: .68rem;
  font-weight: 700;
  color: var(--teal-dk);
  flex-shrink: 0;
  margin-top: 3px;
}

.map-list-empty {
  padding: 2rem 1rem;
  text-align: center;
  font-family: var(--font-body);
  font-size: .82rem;
  color: var(--muted);
  display: none;
}

.map-sidebar-foot {
  padding: .6rem 1rem;
  border-top: 1.5px solid rgba(68,57,76,.06);
  font-family: var(--font-body);
  font-size: .72rem;
  color: var(--muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.map-sidebar-foot strong { color: var(--plum); font-family: var(--font-head); }

/* ── Map panel ── */
.map-panel { position: relative; overflow: hidden; }
#project-map { width: 100%; height: 100%; display: block; }

/* ── Leaflet overrides ── */
.leaflet-container { font-family: var(--font-body) !important; }
.leaflet-control-attribution {
  font-family: var(--font-body) !important;
  font-size: .68rem !important;
  background: rgba(253,249,244,.85) !important;
  backdrop-filter: blur(4px);
  border-radius: 6px 0 0 0 !important;
}
.leaflet-control-zoom a {
  font-family: var(--font-head) !important;
  color: var(--plum) !important;
  background: var(--white) !important;
  border-color: rgba(68,57,76,.15) !important;
}
.leaflet-control-zoom a:hover { background: var(--cream) !important; color: var(--plum) !important; }

/* ── Custom pin marker ── */
.map-pin {
  width: 14px;
  height: 14px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2.5px solid rgba(255,255,255,.9);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  transition: transform .15s, box-shadow .15s;
}
.map-pin.map-pin-active { transform: rotate(-45deg) scale(1.5); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.map-pin-dev  { background: #74C1A9; }
.map-pin-comp { background: #EA9C36; }

/* ── Popup ── */
.leaflet-popup-content-wrapper {
  border-radius: 10px !important;
  padding: 0 !important;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(68,57,76,.18) !important;
  border: 1.5px solid rgba(68,57,76,.08) !important;
}
.leaflet-popup-content { margin: 0 !important; width: 220px !important; }
.leaflet-popup-tip-container { display: none; }
.leaflet-popup-close-button {
  color: var(--white) !important;
  font-size: 18px !important;
  padding: 6px 8px !important;
  top: 2px !important; right: 2px !important;
  z-index: 10;
}
.popup-head { background: var(--plum); padding: .85rem 1rem; position: relative; }
.popup-phase {
  display: inline-block;
  font-family: var(--font-body);
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: .15rem .45rem;
  border-radius: 4px;
  margin-bottom: .4rem;
}
.popup-phase-dev  { background: rgba(116,193,169,.25); color: #a8e0d0; }
.popup-phase-comp { background: rgba(234,156,54,.25);  color: #f0bf7a; }
.popup-addr {
  font-family: var(--font-head);
  font-size: .92rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
  margin: 0;
}
.popup-body { background: var(--white); padding: .75rem 1rem; }
.popup-org {
  font-family: var(--font-body);
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: .5rem;
  line-height: 1.4;
}
.popup-meta { display: flex; gap: .5rem; flex-wrap: wrap; }
.popup-chip {
  font-family: var(--font-body);
  font-size: .68rem;
  font-weight: 600;
  padding: .18rem .5rem;
  border-radius: 4px;
  background: rgba(68,57,76,.07);
  color: var(--plum);
}

/* ── Legend ── */
.map-legend {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.map-legend-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-body);
  font-size: .78rem;
  color: var(--muted);
}
.map-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.map-legend-dot-dev  { background: #74C1A9; }
.map-legend-dot-comp { background: #EA9C36; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .map-locator {
    grid-template-columns: 1fr;
    grid-template-rows: auto 380px;
    height: auto;
  }
  .map-sidebar {
    border-right: none;
    border-bottom: 1.5px solid rgba(68,57,76,.08);
    max-height: 300px;
  }
  .map-panel { height: 380px; }
}
@media (max-width: 540px) {
  .map-locator { grid-template-rows: auto 300px; }
  .map-panel { height: 300px; }
}
