/* Page coordinates (CSS px): margins 30. Tab strip 30..102, rule 102..108, stage 126..510. */
.kp {
  width: 540px;
  height: 540px;
  box-sizing: border-box;
  padding: 30px;
  background: #1c2cf2;
  color: #fff;
  font-family: "Big Shoulders Display Variable", sans-serif;
}

.kp * { box-sizing: border-box; }

.kp-list {
  position: relative;
  display: flex;
  height: 78px;
  border-bottom: 6px solid #fff;
}

.kp-tab {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 52px;
  font-weight: 300;
  line-height: 1;
  outline: none;
  transition: font-weight 300ms cubic-bezier(0.3, 0.7, 0.3, 1);
}

.kp-tab:nth-child(1) { width: 92px; }
.kp-tab:nth-child(2) { width: 130px; }
.kp-tab:nth-child(3) { width: 152px; }
.kp-tab:nth-child(4) { width: 106px; }

.kp-hover { font-weight: 600; }
.kp-tab[data-selected] { font-weight: 900; }
.kp-tab:focus-visible { box-shadow: inset 0 -8px 0 #fff; }

/* The block carries its own copy of the words in the ground colour, pinned to the strip, so it wipes across them. */
.kp-ind {
  position: absolute;
  top: 0;
  left: var(--active-tab-left);
  width: var(--active-tab-width);
  height: 72px;
  overflow: hidden;
  background: #d8ff3a;
  pointer-events: none;
}

.kp-over {
  position: absolute;
  top: 0;
  left: calc(var(--active-tab-left) * -1);
  display: flex;
  width: 480px;
}

.kp-ind,
.kp-over {
  transition-property: left, width;
  transition-duration: 380ms;
  transition-timing-function: cubic-bezier(0.3, 0.75, 0.2, 1);
}

.kp-over .kp-tab { color: #1c2cf2; }

.kp-stage {
  display: grid;
  grid-template-columns: 480px;
  height: 384px;
  margin-top: 18px;
}

.kp-panel {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 384px;
  outline: none;
  transform-origin: 50% 100%;
  transition: transform 380ms cubic-bezier(0.3, 0.75, 0.2, 1), opacity 140ms linear 160ms;
}

.kp-panel[hidden] { display: none; }

.kp-panel[data-starting-style] { transform: scaleY(0); }

.kp-panel[data-ending-style] {
  opacity: 0;
  transform: scaleY(0);
  transform-origin: 50% 0;
}

/* The viewBox is the count's ink box, so the digits fill 480 x 296 edge to edge; the comma hangs below. */
.kp-count {
  display: block;
  width: 480px;
  height: 296px;
  overflow: visible;
  fill: #fff;
  font-size: 1000px;
  font-weight: 900;
}

/* line-height = (ascent - descent) x size puts the baseline on the bottom margin; descenders hang below it */
.kp-foot {
  display: flex;
  justify-content: space-between;
  height: 40px;
  margin: 0 -3px 0 -2px;
  font-size: 52px;
  font-weight: 300;
  line-height: 40.1px;
}

.kp-foot span:last-child { color: #d8ff3a; }
