/* A street's elevation profile (js/common/AccessScoreElevationProfile.js), shared by the AccessScore tool's street
   popup and the Street Grade API docs' preview: each stretch of the line and the ground under it in its slope
   class's color (set per element from the grade-ramp tokens), and a legend of toggles beneath. */
.elevation-profile {
  margin: 0;
  font: var(--text-caption-regular);
  font-variant-numeric: tabular-nums;
  color: var(--color-neutral-700);
}

/* A fixed aspect, not a stretched one: the chart carries its own labels, which a non-uniform scale would distort. */
.elevation-profile__chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.elevation-profile__chart:focus-visible {
  outline: 2px solid var(--color-link-200);
  outline-offset: 2px;
  border-radius: var(--border-radius-sm);
}

.elevation-profile__ground {
  fill-opacity: 0.3;
  stroke: none;
}

/* The gentlest class's blue is under 3:1 against the white popup (WCAG 1.4.11), so the colored line rides on a darker
   casing a half stroke wider each side, which carries the shape's contrast whatever the class colors are. */
.elevation-profile__casing {
  fill: none;
  stroke: var(--color-neutral-700);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.elevation-profile__stroke {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
}

.elevation-profile__ground,
.elevation-profile__stroke {
  transition: opacity 120ms;
}

/* A highlighted class keeps its color; every other stretch fades back, while the casing keeps the line's shape. */
.elevation-profile--filtered [data-class]:not(.elevation-profile__mark--on, .elevation-profile__class) {
  opacity: 0.15;
}

.elevation-profile__axis {
  stroke: var(--color-neutral-300);
  stroke-width: 1;
}

.elevation-profile__cursor {
  stroke: var(--color-neutral-800);
  stroke-width: 1;
  stroke-dasharray: 3 2;
}

.elevation-profile__bracket {
  fill: none;
  stroke: var(--color-neutral-900);
  stroke-width: 1.5;
}

.elevation-profile__extreme {
  fill: var(--color-neutral-900);
}

/* Sizes in the chart's own viewBox units, not the page's: the SVG scales as a whole to the popup's width, so a
   --ui-scale token would be applied twice. */
.elevation-profile__end,
.elevation-profile__tick,
.elevation-profile__callout {
  font-family: var(--font-primary);
  font-size: 11px;
}

.elevation-profile__end {
  fill: var(--color-neutral-900);
  font-weight: 700;
}

.elevation-profile__tick {
  fill: var(--color-neutral-700);
}

.elevation-profile__callout {
  fill: var(--color-neutral-900);
  font-size: 12px;
  font-weight: 800;
}

.elevation-profile__legend-title {
  margin: var(--space-xs) 0 0;
  font: var(--text-caption-semibold);
  color: var(--color-neutral-900);
}

/* One grid for every row, so the swatches, names, bars and lengths line up down the legend. */
.elevation-profile__legend {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 2px var(--space-xs);
  margin: var(--space-xxs) 0 0;
  padding: 0;
  list-style: none;
}

.elevation-profile__legend li {
  display: contents;
}

.elevation-profile__class {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
  margin: 0 calc(-4px * var(--ui-scale, 1));
  padding: 2px calc(4px * var(--ui-scale, 1));
  border: 0;
  border-radius: var(--border-radius-sm);
  background: none;
  font: var(--text-caption-regular);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.elevation-profile__class:hover,
.elevation-profile__class--at {
  background: var(--color-neutral-100);
}

.elevation-profile__class:focus-visible {
  outline: 2px solid var(--color-link-200);
  outline-offset: 1px;
}

.elevation-profile__class[aria-pressed="true"] {
  background: var(--color-neutral-200);
  box-shadow: inset 0 0 0 1px var(--color-neutral-800);
  color: var(--color-neutral-900);
}

.elevation-profile__swatch {
  width: calc(12px * var(--ui-scale, 1));
  height: calc(12px * var(--ui-scale, 1));
  border-radius: var(--border-radius-sm);
}

.elevation-profile__share {
  height: calc(6px * var(--ui-scale, 1));
  overflow: hidden;
  border-radius: var(--border-radius-sm);
  background: var(--color-neutral-200);
}

.elevation-profile__share-fill {
  display: block;
  height: 100%;
  border-radius: var(--border-radius-sm);
}

.elevation-profile__length {
  font-weight: 700;
  color: var(--color-neutral-900);
  text-align: right;
}

.elevation-profile__readout {
  min-height: calc(18px * var(--ui-scale, 1));
  margin: var(--space-xxs) 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .elevation-profile__ground,
  .elevation-profile__stroke {
    transition: none;
  }
}
