
.map-legend-container {
    display: flex;
    flex-direction: column;
    border: none;
    gap: 0 10px;
  }

.map-legend-image {
  width: 100%;          /* Or any percentage/fluid unit */
  height: auto;         /* Crucial: prevents stretching */
  aspect-ratio: 25 / 16; /* Matches your image's ratio */
  object-fit: cover;    /* Ensures the image fills the box without distortion */
}

  .map-legend {
    display: flex;
    flex: 1;
    font-weight: 500;
    flex-direction: column;
    min-height: 0;
    border-radius: 8px;
    background: #295252;
  }

 .map-legend-image-container {
    width: 100%;
    height: auto;
    overflow: hidden;
  }

/* 1. Define the container context */
.responsive-list {
  margin: 20px;
  container-type: inline-size;
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2cqw; /* Gap scales with container width */
}

.list-item {
  display: flex;
  align-items: center;
  gap: 3cqw;
  width: 100%;
}

/* 2. Make image scale based on a percentage of the container */
.list-item img {
  width: 15cqw; /* Image always takes up 25% of container width */
  max-width: 20px; /* Optional: cap the size so it doesn't get huge */
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

/* 3. Make font scale based on container width */
.list-item .legend-item-content {
  flex: 1;
  min-width: 0;
  /* Font grows fluidly: base size (0.85rem) + a percentage of container width (1cqw) */
  font-size: clamp(12px, 0.85rem + 1cqw, 24px);
  line-height: 1.4;
  word-wrap: break-word;
  color: white;
}

  @media (min-width: 1170px) {
    .map-legend-container {
      flex-direction: row;
      align-items: stretch;
    }

    .map-legend-image-container {
        flex: 0 0 calc(66% - 0.66rem);
        height: auto;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    .map-legend {
      flex: 1;
      margin-left: 10px;
      height: auto;
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
  }
