/* La scala dei dati in diagonale. Colori in :root (la palette del Playground). */
:root {
  --carta: #fffcf8;
  --inchiostro: #12110e;
  --secondario: #6f6a60;
  --tenue: #b9b3a6;
  --filo: #e0ded5;
  --tessera: #fbf8f2;
  --accento: #e7e72b;
  --terra: #337c83;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--carta); }
body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* the paper grain, very faint */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.38 0 0 0 0 0.3 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the opening */
.apertura {
  min-height: min(86vh, 760px);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: clamp(10px, 2.4vh, 22px);
  padding: clamp(28px, 8vh, 90px) 20px clamp(24px, 6vh, 60px);
}
.occhiello {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-size: clamp(10.5px, min(1.2vw, 1.8vh), 13px);
  font-weight: 560;
  letter-spacing: 0.01em;
  color: var(--secondario);
}
.occhiello span {
  padding: 0.35em 0.8em;
  border-radius: 99px;
  background: var(--accento);
  color: var(--inchiostro);
}
.titolo {
  font-family: 'Newsreader Variable', Georgia, serif;
  font-weight: 400;
  font-size: clamp(30px, min(7vw, 9.5vh), 92px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  max-width: 11em;
  text-wrap: balance;
}
.sotto {
  font-family: 'Newsreader Variable', Georgia, serif;
  font-size: clamp(14px, min(1.8vw, 2.5vh), 20px);
  line-height: 1.35;
  color: var(--secondario);
  max-width: 26em;
  text-wrap: balance;
}
.scendi {
  width: clamp(30px, 5vh, 40px);
  height: clamp(30px, 5vh, 40px);
  border-radius: 50%;
  border: 1px solid var(--filo);
  display: grid;
  place-items: center;
  margin-top: clamp(4px, 2vh, 18px);
}
.scendi svg { width: 42%; height: 42%; fill: none; stroke: var(--inchiostro); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* the masked words of the titles */
.parola { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.parola > span { display: inline-block; will-change: transform; }

/* the staircase ride */
.corsa { position: relative; height: 420vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}
@supports (height: 100lvh) {
  .palco { height: 100lvh; }
}

.testa {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: clamp(14px, 4.5vh, 44px) clamp(16px, 4vw, 56px) clamp(10px, 2.5vh, 24px);
  position: relative;
  z-index: 3;
  background: linear-gradient(var(--carta) 62%, rgba(255, 252, 248, 0));
}
.testa__titolo {
  font-family: 'Newsreader Variable', Georgia, serif;
  font-weight: 400;
  font-size: clamp(19px, min(3.2vw, 4.6vh), 40px);
  letter-spacing: -0.02em;
  line-height: 1;
}
.testa__nota {
  font-size: clamp(10.5px, min(1.15vw, 1.7vh), 13px);
  font-weight: 560;
  color: var(--secondario);
  white-space: nowrap;
}

.campo { position: relative; }
.fila {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

/* one data tile: a square card */
.tessera {
  --t: 300px;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--t);
  height: var(--t);
  will-change: transform, clip-path;
}
.tessera__carta {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--t) * 0.035);
  background: var(--tessera);
  border: 1px solid var(--filo);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 2px rgba(40, 32, 18, 0.05),
    0 calc(var(--t) * 0.03) calc(var(--t) * 0.08) rgba(40, 32, 18, 0.07),
    0 calc(var(--t) * 0.1) calc(var(--t) * 0.22) rgba(40, 32, 18, 0.06);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: calc(var(--t) * 0.065);
  overflow: hidden;
}
/* a soft light that moves on the card as it crosses the screen */
.tessera__luce {
  position: absolute;
  inset: -30%;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0));
  opacity: 0.6;
  will-change: transform;
}
.tessera__testa {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: calc(var(--t) * 0.038);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tessera__tema { display: inline-flex; align-items: center; gap: 0.55em; }
.tessera__segno {
  width: 0.85em;
  height: 0.85em;
  border-radius: 0.2em;
  background: var(--inchiostro);
  display: inline-block;
}
.tessera__fonte { color: var(--tenue); font-weight: 500; }
.tessera__grafico {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: calc(var(--t) * 0.03) 0;
}
.tessera__grafico svg { width: 100%; height: 100%; max-height: 100%; overflow: visible; }
.tessera__dato { position: relative; }
.cifra-riga {
  display: flex;
  align-items: baseline;
  font-weight: 640;
  font-stretch: 104%;
  font-size: calc(var(--t) * 0.17);
  letter-spacing: -0.04em;
  line-height: 0.95;
  white-space: nowrap;
}
.cifra-riga .car { display: inline-block; }
.cifra-riga .unita { font-weight: 520; font-size: 0.5em; letter-spacing: -0.01em; margin-left: 0.18em; }
.frase {
  margin-top: calc(var(--t) * 0.025);
  font-family: 'Newsreader Variable', Georgia, serif;
  font-size: calc(var(--t) * 0.052);
  line-height: 1.22;
  color: var(--secondario);
  max-width: 19em;
}
.frase em { font-style: italic; color: var(--inchiostro); }

/* chart parts */
.g-filo { stroke: var(--filo); stroke-width: 1; fill: none; }
.g-tenue { fill: var(--filo); }
.g-ink { fill: var(--inchiostro); }
.g-acc { fill: var(--accento); }
.g-linea { stroke: var(--inchiostro); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.g-testo { font-family: 'Mona Sans Variable', system-ui, sans-serif; font-size: 8.5px; font-weight: 560; fill: var(--secondario); }
.g-testo--ink { fill: var(--inchiostro); font-weight: 640; }

/* the rail of the findings */
.binario {
  position: relative;
  z-index: 3;
  justify-self: center;
  display: flex;
  gap: 2px;
  padding: 4px;
  margin-bottom: clamp(12px, 4vh, 40px);
  border-radius: 99px;
  background: rgba(255, 252, 248, 0.82);
  border: 1px solid var(--filo);
  box-shadow: 0 6px 20px rgba(40, 32, 18, 0.07);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.binario__pillola {
  position: absolute;
  top: 4px;
  left: 0;
  height: calc(100% - 8px);
  width: 40px;
  border-radius: 99px;
  background: var(--inchiostro);
  will-change: transform, width;
}
.binario__voce {
  position: relative;
  border: 0;
  background: none;
  font: inherit;
  font-size: clamp(10px, min(2.7vw, 1.7vh), 13px);
  font-weight: 560;
  color: var(--secondario);
  padding: 0.62em 0.95em;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-grid;
  place-items: center;
  transition: color 0.3s;
}
.binario__voce[aria-current="true"] { color: var(--carta); }
.binario__voce:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: 2px; }
@media (hover: hover) {
  .binario__voce:not([aria-current="true"]):hover { color: var(--inchiostro); }
}

.piede {
  padding: clamp(40px, 12vh, 120px) 20px clamp(30px, 8vh, 80px);
  text-align: center;
  font-size: clamp(11px, 1.6vh, 13px);
  color: var(--secondario);
}

/* reduced motion: no ride, the tiles stand in a column, already complete */
.ridotto .corsa { height: auto; }
.ridotto .palco { position: relative; height: auto; overflow: visible; grid-template-rows: auto auto; }
.ridotto .campo { padding: 24px 16px 40px; }
.ridotto .fila { position: relative; display: grid; justify-items: center; gap: 28px; }
.ridotto .tessera { position: relative; }
.ridotto .binario { display: none; }
