.page--map {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.map-header {
  margin-bottom: 1.5rem;
}

.map-header h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  color: #2c2c2c;
  margin-bottom: 0.5rem;
}

.map-header__description {
  color: #5a5a5a;
  font-size: 1.1rem;
  max-width: 680px;
}

.map-container {
  display: grid;
  grid-template-columns: 1fr 220px;
  grid-template-rows: auto auto;
  gap: 1rem 1.5rem;
  align-items: start;
}

.map {
  height: 600px;
  border-radius: 6px;
  border: 1px solid #e0ddd8;
  grid-column: 1;
}

.map-timeline {
  grid-column: 1;
  background: #faf9f7;
  border: 1px solid #e0ddd8;
  border-radius: 6px;
  padding: 0.75rem 1rem;
}


.map-timeline__controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.map-timeline__play {
  width: 32px;
  height: 32px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.map-timeline__play:hover {
  background: #f0eeeb;
}

.map-timeline__slider {
  flex: 1;
  height: 6px;
  cursor: pointer;
  accent-color: #4a7c59;
}

.map-timeline__label {
  font-size: 0.85rem;
  color: #2c2c2c;
  font-weight: 600;
  min-width: 90px;
  text-align: right;
  flex-shrink: 0;
}

.map-timeline__range {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #888;
  margin-top: 0.25rem;
  padding: 0 40px 0 40px;
}

.map-legend {
  grid-column: 2;
  grid-row: 1 / 3;
  background: #faf9f7;
  border: 1px solid #e0ddd8;
  border-radius: 6px;
  padding: 1rem;
}

.map-legend__title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #2c2c2c;
  margin: 0 0 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e0ddd8;
}

.map-legend__title:first-child {
  padding-top: 0;
  border-top: none;
}

.map-legend__filters {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.map-legend__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #2c2c2c;
  cursor: pointer;
}

.map-legend__item input {
  margin: 0;
}

/* Legend swatches — shapes match map markers */
.map-legend__item--violence::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: #a63d40; flex-shrink: 0;
}
.map-legend__item--post::before {
  content: "";
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid #4a7c59;
  flex-shrink: 0;
}
.map-legend__item--policy::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: transparent; border: 2.5px solid #5b6abf;
  flex-shrink: 0; box-sizing: border-box;
}
.map-legend__item--settlement::before {
  content: ""; width: 10px; height: 10px; border-radius: 0;
  background: #b58536; flex-shrink: 0;
}
.map-legend__item--battle::before {
  content: "\2605"; font-size: 12px; color: #6b4c9a;
  line-height: 1; flex-shrink: 0; width: 10px; text-align: center;
}
.map-legend__item--mining::before {
  content: ""; width: 8px; height: 8px;
  background: #c97b2a; flex-shrink: 0;
  transform: rotate(45deg);
}
.map-legend__item--trail::before {
  content: ""; width: 16px; height: 0;
  border-top: 2px dashed #8B6914;
  flex-shrink: 0;
}
.map-legend__item--trail-california::before {
  content: ""; width: 16px; height: 0;
  border-top: 2px dashed #8B6914;
  flex-shrink: 0;
}
.map-legend__item--trail-oregon::before {
  content: ""; width: 16px; height: 0;
  border-top: 2px dashed #2E6B3E;
  flex-shrink: 0;
}
.map-legend__item--trail-overland::before {
  content: ""; width: 16px; height: 0;
  border-top: 2px dashed #5B4A8A;
  flex-shrink: 0;
}
.map-legend__item--trail-butterfield::before {
  content: ""; width: 16px; height: 0;
  border-top: 2px dashed #9B4F2B;
  flex-shrink: 0;
}
.map-legend__item--trail-mormon::before {
  content: ""; width: 16px; height: 0;
  border-top: 2px dashed #2B6A9B;
  flex-shrink: 0;
}
.map-legend__item--trail-spanish::before {
  content: ""; width: 16px; height: 0;
  border-top: 2px dashed #8B4513;
  flex-shrink: 0;
}
.map-legend__item--trail-santafe::before {
  content: ""; width: 16px; height: 0;
  border-top: 2px dashed #B5651D;
  flex-shrink: 0;
}
.map-legend__item--trail-elcamino::before {
  content: ""; width: 16px; height: 0;
  border-top: 2px dashed #6B8E23;
  flex-shrink: 0;
}

.map-popup__title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  margin: 0 0 0.25rem;
  color: #2c2c2c;
}

.map-popup__desc {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #3a3a3a;
  margin: 0;
}

.map-marker-svg {
  background: transparent !important;
  border: none !important;
  transition: opacity 0.3s ease;
}

.map-marker-svg svg {
  transition: transform 0.3s ease;
}

.map-reference-label {
  font-size: 0.7rem;
  color: #888;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .map-container {
    grid-template-columns: 1fr;
  }

  .map {
    height: 400px;
    grid-column: 1;
  }

  .map-legend {
    grid-column: 1;
    grid-row: auto;
  }

  .map-legend__filters {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .map-timeline {
    grid-column: 1;
  }

  .map-timeline__play {
    width: 44px;
    height: 44px;
  }

  .map-timeline__range {
    padding: 0 36px 0 50px;
  }

  .map-timeline__label {
    min-width: 70px;
    font-size: 0.8rem;
  }

  .map-header h1 {
    font-size: 1.5rem;
  }

  .map-header__description {
    font-size: 0.95rem;
  }

  .page--map {
    padding: 1.5rem 1rem;
  }

  .leaflet-popup-content {
    max-width: 220px;
  }
}
