body {
  margin: 0;
  font-family: sans-serif;
}

#intro {
  padding: 3rem 2rem 1rem;
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

#scrolly {
  position: relative;
}

#vis {
  position: sticky;
  top: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

#vis svg {
  width: 100%;
  height: 100%;
  display: block;
}

#text {
  position: relative;
  z-index: 10;
  margin-top: -100vh; /* pulls over sticky map */
  width: 100vw;
  pointer-events: none; /* so tooltips still work on map */
}

.step {
  width: 30vw;
  margin-left: auto;
  margin-right: 5vw;
  min-height: 30vh;      
  margin-bottom: 90vh;    /* vertical spacing between steps */
  pointer-events: auto;
}

.step-text {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  border-radius: 8px;
  padding: 1rem 1.5rem;
}

.step.first {
    margin-bottom: 50vh;
}

.step.last {
    margin-bottom: 0;
}

#tooltip {
  background: white;
  border: 1px solid #ccc;
  padding: 6px 8px;
  font-size: 12px;
  display: none;
  pointer-events: none;
  z-index: 1000;
}

#legend-scale {
  width: 20px;
  height: 200px;
}

#legend {
  position: fixed;
  bottom: 20px;
  left: 50px;
  z-index: 20;
  padding: 10px;
  font-family: sans-serif;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
}

.legend-title {
  font-weight: bold;
  margin-bottom: 6px;
  text-align: center;
}

.legend-container {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
}

#legend-scale {
  flex-shrink: 0;
}

.legend-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 180px;
}

.legend-label {
  height: 1px; /* baseline alignment */
  transform: translateY(0.4em); /* fine-tune vertical centering */
}

#filter-controls {
  position: fixed;
  bottom: 20px;
  left: 150px; /* shift it right so it doesn’t sit on the edge */
  z-index: 30;
  padding: 10px;
  display: none;
  flex-direction: column; /* stack vertically */
  gap: 8px;
  pointer-events: auto;
}

#filter-controls button {
  background: #eee;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}

#filter-controls button.active {
  background: #333;
  color: white;
}

#attribution {
  margin: 10px;
  font-size: small;
}

@media (max-width: 768px) {
#legend {
  left: 10px;
}
#filter-controls {
  left: 80px; /* shift it right so it doesn’t sit on the edge */
}

.step {
    width: 70vw;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
  }
  .step-text {
      background: rgba(255, 255, 255, 0.5);

  }
  #attribution {
    font-size: x-small;
  }
}

