@font-face {
    font-display: auto;
    font-family: "PolySans";
    font-style: normal;
    font-weight: 700;
    src: url("https://grist.org/wp-content/themes/grist/dist/fonts/PolySansUS-Median..woff2") format("woff2"),
        url("https://grist.org/wp-content/themes/grist/dist/fonts/PolySansUS-Median..woff") format("woff");
}

@font-face {
    font-display: auto;
    font-family: "Basis Grotesque Pro";
    font-style: normal;
    font-weight: 500;
    src: url("https://grist.org/wp-content/themes/grist/dist/fonts/basis-grotesque-regular-pro..woff2") format("woff2"),
        url("https://grist.org/wp-content/themes/grist/dist/fonts/basis-grotesque-regular-pro..woff") format("woff");
}

@font-face {
    font-display: auto;
    font-family: "Basis Grotesque Pro";
    font-style: normal;
    font-weight: 700;
    src: url("https://grist.org/wp-content/themes/grist/dist/fonts/basis-grotesque-bold-pro..woff2") format("woff2"),
        url("https://grist.org/wp-content/themes/grist/dist/fonts/basis-grotesque-bold-pro..woff") format("woff");
}

@font-face {
    font-display: auto;
    font-family: "Basis Grotesque Pro";
    font-style: italic;
    font-weight: 700;
    src: url("https://grist.org/wp-content/themes/grist/dist/fonts/basis-grotesque-bold-italic-pro..woff2") format("woff2"),
        url("https://grist.org/wp-content/themes/grist/dist/fonts/basis-grotesque-bold-italic-pro..woff") format("woff");
}

:root {
  --color-primary: #3c3830;
  --color-tertiary: #ccc;
  --color-background: #F0F0F0;
  --typography-primary: "PolySans", sans-serif;
  --typography-secondary: "Basis Grotesque Pro", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--color-background); color: var(--color-primary); font-family: var(--typography-secondary); font-weight: 500; overflow: hidden; }

.dc-map { max-width: 900px; margin: 0 auto; padding: 4px 20px 12px; display: flex; flex-direction: column; height: 100vh; }

.dc-map h2 {
  font-family: var(--typography-primary);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.2;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.dc-map .subtitle {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-primary);
  opacity: .7;
  margin-bottom: 16px;
  max-width: 600px;
}

.dc-map__container {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--color-tertiary);
}

#map { width: 100%; height: 100%; background: var(--color-background); }

.leaflet-control-attribution {
  font-family: var(--typography-secondary) !important;
  font-size: 9px !important;
  background: rgba(255,255,255,.85) !important;
  color: var(--color-primary) !important;
  opacity: .5;
}
.leaflet-control-attribution a { color: var(--color-primary) !important; }

.leaflet-tooltip.tip {
  background: rgba(255,255,255,0.97) !important;
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  padding: 12px !important;
  font-family: var(--typography-secondary) !important;
  color: var(--color-primary) !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important;
  min-width: 220px !important;
  max-width: 320px !important;
  width: max-content !important;
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

.tip .n {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--color-primary);
}

.tip .d {
  color: var(--color-primary);
  opacity: .65;
  font-size: 11.5px;
}

.tip .phase {
  display: inline-block;
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  margin-top: 4px;
}

.tip .phase.proposed { background: rgba(172,0,232,.1); color: #AC00E8; }
.tip .phase.delayed { background: rgba(247,153,69,.12); color: #d07a20; }
.tip .phase.withdrawn { background: rgba(245,81,91,.1); color: #F5515B; }
.tip .phase.construction { background: rgba(172,0,232,.1); color: #AC00E8; }

.tip .detail {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #eee;
  font-size: 11px;
  line-height: 1.5;
  color: var(--color-primary);
  opacity: .75;
}

.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before { border-color: transparent !important; }

.leaflet-popup-content-wrapper.tip {
  background: rgba(255,255,255,0.97);
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.leaflet-popup-content-wrapper.tip .leaflet-popup-content {
  margin: 12px;
  font-family: var(--typography-secondary);
  color: var(--color-primary);
  font-size: 12px;
  line-height: 1.5;
  min-width: 200px;
  max-width: 280px;
}
.leaflet-popup-tip-container { display: none; }
.leaflet-popup-pane { z-index: 801 !important; }
.leaflet-popup-close-button { color: var(--color-primary) !important; font-size: 18px !important; padding: 6px 8px 0 0 !important; }

.dc-map__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 10px 0;
}

.dc-map__reset {
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--color-tertiary);
  border-radius: 4px;
  backdrop-filter: blur(4px);
  padding: 6px 12px;
  font-family: var(--typography-secondary);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-primary);
  cursor: pointer;
}
.dc-map__reset:hover { background: #fff; }

.dc-map__legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-primary);
}

.dc-map__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dc-map__legend-dot.sq {
  border-radius: 2px;
}

.dc-map__source {
  margin-top: 8px;
  font-size: 12px;
  font-style: italic;
  color: var(--color-primary);
  line-height: 1.5;
}

@media (max-width: 600px) {
  .dc-map { padding: 4px 12px 8px; }
  .dc-map h2 { font-size: 22px; }
  .dc-map__container { min-height: 0; }
  .dc-map__legend { gap: 2px 12px; padding: 8px 0; font-size: 11px; }
  .leaflet-tooltip.tip { min-width: 180px !important; max-width: 260px !important; }
}