/* Spring down the stairs: a cream toy shop page with pastel shelves, a dark floor, a rainbow spring and an orange
   toy crane. */
:root {
  --page: #fff6e9;          /* the page behind everything */
  --ink: #26213d;           /* the words */
  --shelf-a: #ffd6c4;       /* the rows: first colour */
  --shelf-b: #ffe8a3;       /* the rows: second colour */
  --shelf-c: #c9eedb;       /* the rows: third colour */
  --shelf-d: #d6e0ff;       /* the rows: fourth colour */
  --floor: #26213d;         /* the floor at the bottom */
  --floor-ink: #fff6e9;     /* the words on the floor */
  --coil-1: #ff4f81;        /* the spring: first colour of the rainbow */
  --coil-2: #ffab2e;        /* the spring: second colour */
  --coil-3: #2fc79c;        /* the spring: third colour */
  --coil-4: #3f7bff;        /* the spring: fourth colour */
  --coil-5: #9b57ff;        /* the spring: last colour */
  --sheen: #f1e6ff;         /* the pearly sheen on the tilted coils */
  --crane: #ff6a3d;         /* the toy crane's claw */
  --cable: #26213d;         /* the crane's cable */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Fredoka Variable', 'Fredoka', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  background: var(--page);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.catch {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.catch:focus-visible {
  outline: 3px solid var(--coil-4);
  outline-offset: -6px;
}

/* ---- the rows: placed by the script, one under the other, each a little wider ---- */
.stairs {
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8em;
  padding: 0 0.9em;
  border-radius: 0 0.5em 0 0;
  background: var(--shelf-a);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.65), inset -3px 0 0 rgba(38, 33, 61, 0.07);
  white-space: nowrap;
  visibility: hidden;
  pointer-events: none;
}

.step:nth-child(4n + 2) {
  background: var(--shelf-b);
}

.step:nth-child(4n + 3) {
  background: var(--shelf-c);
}

.step:nth-child(4n + 4) {
  background: var(--shelf-d);
}

.step[data-on] {
  visibility: visible;
  pointer-events: auto;
}

.step__name {
  display: inline-block;
  font-weight: 560;
  letter-spacing: -0.01em;
  transform-origin: 30% 100%;
}

.step--brand .step__name {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.step__note {
  font-size: 0.72em;
  font-weight: 500;
  opacity: 0.62;
}

.step__note[hidden] {
  display: none;
}

.floor {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  padding: 0 1.1em;
  border-radius: 0.5em 0.5em 0 0;
  background: var(--floor);
  color: var(--floor-ink);
  white-space: nowrap;
  visibility: hidden;
}

.floor[data-on] {
  visibility: visible;
}

.floor__text {
  font-weight: 560;
  letter-spacing: 0.01em;
}

.spring {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hint {
  position: absolute;
  z-index: 3;
  margin: 0;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink);
  opacity: 0.6;
  pointer-events: none;
  white-space: nowrap;
}

/* the hover: the row's name springs like a coil */
@media (hover: hover) {
  .step:hover .step__name {
    animation: boing 0.7s cubic-bezier(0.3, 0, 0.2, 1);
  }
}

@keyframes boing {
  0% { transform: scale(1, 1); }
  18% { transform: scale(1.06, 0.78); }
  40% { transform: scale(0.96, 1.14); }
  62% { transform: scale(1.02, 0.95); }
  80% { transform: scale(0.995, 1.02); }
  100% { transform: scale(1, 1); }
}

@media (prefers-reduced-motion: reduce) {
  @media (hover: hover) {
    .step:hover .step__name {
      animation: none;
    }
  }
}
