:root {
  --fondo: #f4f1ea;      /* warm white paper */
  --inchiostro: #1b1a17; /* the serif letters at rest */
  --accento: #d9542b;    /* the one accent: the sans letters and the marks that count down */
  --riga: #cfc9bd;       /* the thin baseline rule */
  --nota: #9a948a;       /* the small line of text */
}

* { 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;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 5vh, 44px);
  padding: 0 16px;
  touch-action: pan-y;
}

/* the baseline (--base) is where the thin rule runs, measured from the bottom of the letter windows */
/* the word is always set at the same size: the letter windows are measured in em */
.parola {
  position: relative;
  display: flex;
  font-size: clamp(40px, min(16vw, 20vh), 164px);
  font-weight: 400;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  --base: 0.27em;
}

/* one letter: GSAP writes its width (--w, in em) so the neighbours slide when a face is wider or narrower */
.cella {
  position: relative;
  display: block;
  width: calc(var(--w, 0.6) * 1em);
  height: 1.32em;
}

/* the window: what rolls out of it is hidden; tall enough for the descender of the g */
.finestra {
  position: absolute;
  left: -0.12em;
  right: -0.12em;
  top: 0;
  bottom: 0;
  overflow: hidden;
}

/* the two faces of the letter: GSAP moves these (xPercent, yPercent), nothing else does */
.faccia {
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  line-height: 1.32em;
  white-space: pre;
  will-change: transform;
}

.graziata {
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-variation-settings: 'opsz' 144, 'wght' var(--sw, 380), 'SOFT' 0, 'WONK' 0;
  color: var(--inchiostro);
}

.bastone {
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  font-variation-settings: 'wght' var(--bw, 540), 'wdth' var(--bx, 86);
  color: var(--accento);
  top: 0.004em; /* a hair lower: this lines the Mona Sans baseline up with the Fraunces one */
}

/* the short accent mark under a changed letter: its length is the moment left before the letter rolls back */
.tempo {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: calc(var(--base, 0.27em) - 0.075em);
  height: 2px;
  border-radius: 2px;
  background: var(--accento);
  transform: scaleX(0);
  will-change: transform;
}

.riga {
  position: absolute;
  left: -0.08em;
  right: -0.08em;
  bottom: var(--base, 0.27em);
  height: 1px;
  background: var(--riga);
  pointer-events: none;
}

.nota {
  font-size: clamp(10px, min(2.6vw, 2.4vh), 13px);
  color: var(--nota);
  letter-spacing: 0.02em;
}
