.scroller {
  max-block-size: 10rem;
  overflow: auto;
  padding: 0.75rem 1rem;
  background: white;
  color: black;
  border: 1px solid silver;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 1;
  block-size: 0.35rem;
  margin-block-end: 0.75rem;
  background: tomato;
  transform-origin: left;
  scale: 0 1;
}

.scroller h1 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

@supports (animation-timeline: scroll()) {
  .bar {
    animation: grow linear both;
    animation-timeline: scroll(nearest);
  }
}

@keyframes grow {
  to {
    scale: 1 1;
  }
}