:root {
  --carta: #f5f3ee;          /* the warm white of the page */
  --inchiostro: #16161a;     /* the ink of the curve and the text */
  --grigio: #a3a19b;         /* the grey of the frame, the arms and the small text */
  --tenue: rgba(22, 22, 26, 0.07); /* the faint lines of the graph */
  --accento: #ff4d1a;        /* the one accent: the diamond, the square, the curve at the end */
  --g: 300px;                /* the side of the graph, set by the script */
}

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

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

.corsa {
  position: relative;
  height: 380vh;
}

.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* the piece: a small header, the graph, the value in code */
.pezzo {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(8px, 2vh, 16px);
}

.testa {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: clamp(11px, min(1.4vw, 2.2vh), 14px);
  font-variation-settings: 'wght' 520, 'wdth' 100;
  letter-spacing: 0.01em;
  user-select: none;
}
.testa__etichetta { color: var(--inchiostro); }
.testa__nome {
  display: inline-block;
  color: var(--grigio);
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: 0.92em;
  overflow: hidden;
}
.testa__nome > span { display: inline-block; }

.grafico {
  display: block;
  overflow: visible;
  touch-action: pan-y;
}

.grafico__bordo { fill: none; stroke: var(--tenue); stroke-width: 1; }
.grafico__tacca { stroke: var(--grigio); stroke-width: 1; stroke-linecap: round; }
.grafico__lineare { fill: none; stroke: var(--grigio); stroke-opacity: 0.45; stroke-width: 1; stroke-dasharray: 2 4; }
.grafico__testina { stroke: var(--inchiostro); stroke-opacity: 0.16; stroke-width: 1; }
.grafico__guida { stroke: var(--accento); stroke-opacity: 0.45; stroke-width: 1; stroke-dasharray: 2 3; }
.grafico__braccio { stroke: var(--grigio); stroke-width: 1; }
.grafico__curva { fill: none; stroke: var(--inchiostro); stroke-width: 2; stroke-linecap: round; }
.grafico__capo { fill: var(--inchiostro); }
.grafico__binario { stroke: var(--tenue); stroke-width: 1; stroke: rgba(22, 22, 26, 0.14); }
.grafico__oggetto { fill: var(--accento); }
.grafico__rombo { fill: var(--accento); }
.grafico__pomo { fill: var(--carta); stroke: var(--inchiostro); stroke-width: 1.25; }
/* a wider, invisible patch so the handle is easy to grab with a finger */
.grafico__presa { fill: transparent; }
.grafico__maniglia { cursor: grab; }
.grafico__maniglia.preso { cursor: grabbing; }

.codice {
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: clamp(10px, min(1.35vw, 2.1vh), 13px);
  font-weight: 420;
  color: var(--inchiostro);
  white-space: nowrap;
  user-select: none;
}
.codice__fn { color: var(--grigio); }

.scendi {
  position: absolute;
  bottom: clamp(12px, 3.6vh, 30px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--grigio);
  font-variation-settings: 'wght' 500, 'wdth' 100;
}

@media (prefers-reduced-motion: reduce) {
  .corsa { height: 100vh; }
}
