/* Three words pushed across three frictions: one push, three lines, one accent. */
:root {
  --fondo: #f4f1ea;      /* warm white paper */
  --inchiostro: #1b1a17; /* the words */
  --linea: #cfc9bd;      /* the hairlines of the tracks */
  --grana: #ddd7cb;      /* the fine grain under wood and felt */
  --accento: #e2452b;    /* the one accent: the push, the trail of the friction, the stop mark */
  --dato: #8f897e;       /* the small numbers */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.scena {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(18px, 6vw, 60px);
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* the bench: three tracks stacked, as wide as the box allows and never taller than it */
.banco {
  position: relative;
  width: min(100%, 640px);
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 7.5vh, 64px);
  padding-left: 14px;
  font-size: clamp(26px, min(8vw, 9.5vh), 66px);
}

.pista {
  position: relative;
  height: 1.05em;
}

/* the hairline the word slides on */
.pista-linea {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--linea);
}

/* the grain: rough surfaces get fine ticks under the line, denser where it grips more */
.pista-grana {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 4px;
  opacity: 0.9;
}

/* the end of the track: a short upright tick */
.pista-fine {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 9px;
  background: var(--linea);
}

/* the trail the friction leaves behind the word, drawn on the line */
.pista-scia {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  border-radius: 1px;
  background: var(--accento);
  transform-origin: 0 50%;
}

/* where the word stopped */
.pista-segno {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1.5px;
  height: 10px;
  margin-left: -0.75px;
  background: var(--accento);
  transform-origin: 50% 100%;
  transform: scaleY(0);
}

/* the coefficient at the end of the line */
.pista-mu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  font-size: 11px;
  letter-spacing: 0.04em;
  font-variation-settings: 'wght' 460, 'wdth' 100;
  font-variant-numeric: tabular-nums;
  color: var(--dato);
  white-space: nowrap;
}

/* the word: the script moves it (x), its child leans (skew), each letter changes width */
.parola {
  position: absolute;
  left: 0;
  bottom: 0.05em;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  will-change: transform;
}

.parola:active { cursor: grabbing; }

.parola-dentro {
  display: inline-block;
  transform-origin: 50% 100%;
  white-space: nowrap;
  will-change: transform;
}

.lettera {
  display: inline-block;
  font-variation-settings: 'wght' 640, 'wdth' 100;
  letter-spacing: -0.01em;
}

/* the distance, read live under the word */
.parola-metri {
  position: absolute;
  left: 0;
  top: calc(100% + 0.32em);
  font-size: 11px;
  letter-spacing: 0.04em;
  font-variation-settings: 'wght' 460, 'wdth' 100;
  font-variant-numeric: tabular-nums;
  color: var(--dato);
  white-space: nowrap;
}

/* the push: one bar as tall as the three tracks, just left of the words */
.spinta {
  position: absolute;
  left: 0;
  top: -0.1em;
  bottom: -0.05em;
  width: 3px;
  pointer-events: none;
  will-change: transform;
}

.spinta-tratto {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: var(--accento);
  transform-origin: 50% 50%;
}

.nota {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(12px, 4.5vh, 40px);
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.02em;
  font-variation-settings: 'wght' 420;
  color: var(--dato);
  opacity: 0;
}
