.hero-chart {
  margin: 0;
  padding: 24px 24px 16px;
  background: #fff;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.hero-chart__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 20px;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-ink);
}

.hero-chart__title .icon { color: var(--color-primary); }

.hero-chart__subtitle {
  flex-basis: 100%;
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 400;
  color: var(--color-muted);
}

.hero-chart__plot {
  position: relative;
  height: 220px;
  margin-left: 22px;
}

.hero-chart__grid {
  position: absolute;
  inset: 0 0 24px;
}

.hero-chart__gridline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: #eeece9;
}

.hero-chart__tick {
  position: absolute;
  left: -22px;
  top: -9px;
  width: 16px;
  font-size: .72rem;
  color: var(--color-muted);
  text-align: right;
}

.hero-chart__bars {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 2px;
}

.hero-chart__col {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 24px;
  outline: none;
  cursor: default;
}

.hero-chart__col.is-current .hero-chart__bar { background: var(--color-primary-700); }

.hero-chart__col:hover .hero-chart__bar,
.hero-chart__col:focus-visible .hero-chart__bar { background: var(--color-primary); }

.hero-chart__col:hover .hero-chart__tooltip,
.hero-chart__col:focus-visible .hero-chart__tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* keep the outer tooltips inside the card */
.hero-chart__col:first-child .hero-chart__tooltip {
  left: 0;
  transform: translate(0, 4px);
}

.hero-chart__col:last-child .hero-chart__tooltip {
  left: auto;
  right: 0;
  transform: translate(0, 4px);
}

.hero-chart__col:first-child:hover .hero-chart__tooltip,
.hero-chart__col:last-child:hover .hero-chart__tooltip { transform: translate(0, 0); }

.hero-chart__bar {
  width: min(60%, 18px);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--color-primary-400);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .7s var(--ease), background-color .2s;
}

/* bars grow once revealed; without JS / in the editor they are simply there */
.hero-chart[data-revealed] .hero-chart__bar,
html:not(.reveal-on) .hero-chart__bar { transform: scaleY(1); }

.hero-chart__label {
  position: absolute;
  bottom: 0;
  font-size: .72rem;
  color: var(--color-muted);
}

.hero-chart__tooltip {
  position: absolute;
  bottom: calc(100% - 8px);
  left: 50%;
  z-index: 2;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--color-ink);
  color: #fff;
  font-size: .8rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity .15s, transform .15s;
}

.hero-chart__tooltip strong { color: #fff; }

@media (max-width: 639.98px) {
  .hero-chart { padding: 18px 14px 12px; }

  /* every second year label on narrow screens */
  .hero-chart__col:nth-child(even) .hero-chart__label { visibility: hidden; }
}
