html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1a1a1a;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  padding: 0.75rem 1rem;
  background: #2b2b2b;
  color: #fff;
  display: flex;
  align-items: baseline;
  column-gap: 1rem;
  row-gap: 0.15rem;
  flex-wrap: wrap;
}

header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

header p {
  margin: 0;
  font-size: 0.85rem;
  color: #c8c8c8;
}

header #list-toggle {
  margin-left: auto;
  background: #3d3d3d;
  color: #fff;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  header #list-toggle {
    margin-top: 0.35rem;
  }
}

header #list-toggle:hover {
  background: #4a4a4a;
}

header #list-toggle[aria-expanded="true"] {
  background: #2057a8;
  border-color: #2057a8;
}

#layout {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

#map {
  flex: 1;
  min-height: 60vh;
}

#sidebar {
  width: 320px;
  border-left: 1px solid #d9d9d9;
  background: #fafafa;
  overflow-y: auto;
  transition: width 0.2s ease, transform 0.2s ease;
}

#sidebar.hidden {
  width: 0;
  border-left: none;
  overflow: hidden;
}

#sidebar-scrim {
  display: none;
}

#project-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.project-item {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #e6e6e6;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border-left: 3px solid transparent;
  border-top: none;
  border-right: none;
  font: inherit;
  color: inherit;
}

.project-item:hover {
  background: #eef3fa;
}

.project-item.selected {
  background: #e2ecf9;
  border-left-color: #2057a8;
}

.project-item-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 0 0.15rem;
}

.project-item-address {
  font-size: 0.78rem;
  color: #555;
  margin: 0 0 0.2rem;
}

.project-item-meta {
  font-size: 0.72rem;
  color: #777;
  margin: 0;
}

@media (max-width: 720px) {
  #sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(85vw, 360px);
    z-index: 1000;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.18);
    transform: translateX(0);
  }

  #sidebar.hidden {
    width: min(85vw, 360px);
    border-left: 1px solid #d9d9d9;
    transform: translateX(100%);
    overflow: hidden;
  }

  #sidebar-scrim {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
  }

  #sidebar-scrim[hidden] {
    display: none;
  }
}

footer {
  padding: 0.5rem 1rem;
  background: #f1f1f1;
  font-size: 0.8rem;
  color: #555;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

footer a {
  color: #2057a8;
}

.leaflet-popup-content p {
  margin: 0 0 0.2rem;
}

.leaflet-popup-content p:last-child {
  margin-bottom: 0;
}

.popup-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.15rem;
}

.popup-address {
  font-size: 0.8rem;
  color: #555;
  margin: 0 0 0.25rem;
}

.popup-summary {
  font-size: 0.85rem;
  margin: 0 0 0.45rem;
}

.popup-meta {
  font-size: 0.75rem;
  color: #777;
  margin: 0;
}

.popup-sources {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  list-style: disc;
}

.popup-sources li {
  font-size: 0.75rem;
}

.popup-sources a {
  font-size: 0.75rem;
}

.popup-combined-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: #2057a8;
  margin: 0 0 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.popup-subproject {
  padding: 0.55rem 0;
  border-top: 1px solid #e2e2e2;
}

.popup-subproject:first-of-type {
  border-top: none;
  padding-top: 0;
}

.popup-subproject:last-of-type {
  padding-bottom: 0;
}

.leaflet-popup-content {
  margin: 8px 12px;
  line-height: 1.25;
}

.popup-combined .leaflet-popup-content {
  max-height: 50vh;
  overflow-y: auto;
}
