/* The app screen that breaks into layers. Colours in :root (the Playground palette). */
:root {
  --fondo: #f4f4f5;
  --inchiostro: #0b0b0f;
  --secondario: #71717a;
  --tenue: #a1a1aa;
  --linea: #e4e4e7;
  --carta: #ffffff;
  --accento: #4f46e5;
  /* the screen: measured on the width and on the height, so it stays inside a short phone box too */
  --w: min(62vw, 88vh, 600px);
  --h: calc(var(--w) * 0.62);
  --u: calc(var(--w) / 100);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--fondo); }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.corsa { position: relative; height: 320vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-items: center;
  padding: min(6vh, 40px) 16px min(4vh, 28px);
}

.testa { text-align: center; }
.testa__nota {
  font-size: clamp(10px, min(1.6vw, 2.4vh), 13px);
  letter-spacing: 0.02em;
  color: var(--secondario);
  margin-bottom: 0.5em;
}
.testa__titolo {
  font-size: clamp(18px, min(4.2vw, 6vh), 44px);
  font-weight: 620;
  font-stretch: 112%;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.testa__titolo span { color: var(--secondario); font-weight: 520; }

.scena {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  perspective: calc(var(--w) * 2.6);
  perspective-origin: 50% 40%;
}
.pila {
  position: relative;
  width: var(--w);
  height: var(--h);
  transform-style: preserve-3d;
}

/* ---------- the layers ---------- */
.strato {
  position: absolute;
  inset: 0;
  outline-offset: 0;
  border-radius: calc(var(--u) * 2.4);
  transform-style: preserve-3d;
}
.strato--fondo {
  background: var(--carta);
  box-shadow: 0 0 0 1px rgba(15, 15, 30, 0.06), 0 calc(var(--u) * 2) calc(var(--u) * 6) rgba(15, 15, 30, 0.08);
  overflow: visible;
}
.fondo__griglia {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    linear-gradient(rgba(79, 70, 229, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 70, 229, 0.08) 1px, transparent 1px);
  background-size: calc(var(--w) / 12) calc(var(--w) / 12);
  opacity: 0;
}
.fondo__luce {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.9) 48%, transparent 66%), radial-gradient(120% 90% at 85% 0%, rgba(79, 70, 229, 0.07), transparent 60%);
  background-size: 260% 100%, 100% 100%;
  background-position: 120% 0, 0 0;
  mix-blend-mode: normal;
  pointer-events: none;
}

/* the layout: guides that only show when the layers come apart */
.schema {
  position: absolute;
  border: 1px dashed rgba(79, 70, 229, 0.55);
  background: rgba(79, 70, 229, 0.045);
  border-radius: calc(var(--u) * 1.2);
}
.schema--lato { left: 2.5%; top: 4%; width: 17%; height: 92%; }
.schema--testa { left: 22%; top: 4%; width: 75.5%; height: 10%; }
.schema--a { left: 22%; top: 19%; width: 23.8%; height: 22%; }
.schema--b { left: 47.85%; top: 19%; width: 23.8%; height: 22%; }
.schema--c { left: 73.7%; top: 19%; width: 23.8%; height: 22%; }
.schema--grafico { left: 22%; top: 46%; width: 75.5%; height: 50%; }

/* the components: boxes and controls, without words */
.pezzo {
  position: absolute;
  background: var(--carta);
  border: 1px solid var(--linea);
  border-radius: calc(var(--u) * 1.4);
  box-shadow: 0 calc(var(--u) * 0.3) calc(var(--u) * 1) rgba(15, 15, 30, 0.05);
}
.pezzo--lato {
  left: 2.5%; top: 4%; width: 17%; height: 92%;
  background: #fafafa;
  padding: 26% 10% 0;
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 1.2);
}
.pezzo--lato i {
  display: block;
  height: calc(var(--u) * 4.4);
  border-radius: calc(var(--u) * 1);
}
.pezzo--lato i.acceso { background: rgba(79, 70, 229, 0.1); }
.pezzo--cerca { left: 22%; top: 4.5%; width: 38%; height: 9%; border-radius: 999px; background: #fafafa; }
.pezzo--bottone { left: 81%; top: 4.5%; width: 16.5%; height: 9%; border-radius: 999px; background: var(--inchiostro); border-color: var(--inchiostro); }
.pezzo--a { left: 22%; top: 19%; width: 23.8%; height: 22%; }
.pezzo--b { left: 47.85%; top: 19%; width: 23.8%; height: 22%; }
.pezzo--c { left: 73.7%; top: 19%; width: 23.8%; height: 22%; }
.pezzo--grafico { left: 22%; top: 46%; width: 75.5%; height: 50%; }

/* the content: words, numbers, the line */
.strato--testi { color: var(--inchiostro); font-size: calc(var(--u) * 2.2); }
.strato--testi > span { position: absolute; white-space: nowrap; line-height: 1; }
.marchio {
  left: 5%; top: 8%;
  display: flex; align-items: center; gap: calc(var(--u) * 0.8);
  font-weight: 650; font-size: calc(var(--u) * 2.5); letter-spacing: -0.01em;
}
.marchio svg { width: calc(var(--u) * 2.6); height: calc(var(--u) * 2.6); fill: none; stroke: var(--accento); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.marchio svg circle { fill: var(--accento); stroke: none; }
.voce { left: 6.6%; color: var(--secondario); font-size: calc(var(--u) * 1.9); }
.voce--a { top: 23.6%; color: var(--accento); font-weight: 600; }
.voce--b { top: 33.4%; }
.voce--c { top: 43.2%; }
.voce--d { top: 53%; }
.cerca { left: 25%; top: 7.6%; color: var(--tenue); font-size: calc(var(--u) * 1.9); }
.bottone { left: 83.6%; top: 7.6%; color: #fff; font-weight: 600; font-size: calc(var(--u) * 1.8); }
.dato { display: flex; flex-direction: column; gap: calc(var(--u) * 1.3); top: 23.4%; }
.dato em { font-style: normal; color: var(--secondario); font-size: calc(var(--u) * 1.8); }
.dato b { font-weight: 640; font-size: calc(var(--u) * 3.6); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dato--a { left: 24.4%; }
.dato--b { left: 50.25%; }
.dato--c { left: 76.1%; }
.grafico-titolo { left: 24.4%; top: 50.5%; font-weight: 600; font-size: calc(var(--u) * 1.9); }
.linea { position: absolute; left: 24.4%; top: 58%; width: 70.6%; height: 34%; overflow: visible; }
.linea__area { fill: rgba(79, 70, 229, 0.08); stroke: none; }
.linea__tratto { fill: none; stroke: var(--accento); stroke-width: 1.6; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0; }
.linea__punto { fill: var(--carta); stroke: var(--accento); stroke-width: 1.4; vector-effect: non-scaling-stroke; }

/* ---------- the labels: flat, over the scene, each tied by a thin line to the right edge of its layer ---------- */
.ancora { position: absolute; left: 100%; top: 50%; width: 1px; height: 1px; pointer-events: none; }
.etichette { position: absolute; inset: 0; pointer-events: none; }
.etichetta { position: absolute; left: 0; top: 0; }
.etichetta__corpo {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  transform: translateY(-50%);
  opacity: 0;
  white-space: nowrap;
}
.etichetta__filo {
  grid-row: 1 / span 2;
  position: relative;
  display: block;
  width: 40px;
  height: 1px;
  background: var(--tenue);
  transform-origin: 0 50%;
}
.etichetta b { font-weight: 600; font-size: clamp(9px, calc(var(--u) * 2.3), 15px); letter-spacing: -0.005em; line-height: 1.1; }
.etichetta em { grid-column: 2; font-style: normal; color: var(--secondario); font-size: clamp(8px, calc(var(--u) * 1.8), 12px); line-height: 1.2; }

/* ---------- the dashed lines along the depth, from the corners of the bottom layer ---------- */
.filo {
  position: absolute;
  width: 0;
  height: 100px;
  border-left: 1px dashed rgba(79, 70, 229, 0.5);
  transform-origin: 0 0;
  opacity: 0;
}
.filo--a { left: 0; top: 0; }
.filo--b { left: 100%; top: 0; }
.filo--c { left: 100%; top: 100%; }
.filo--d { left: 0; top: 100%; }

.piede {
  font-size: clamp(10px, min(1.5vw, 2.2vh), 12px);
  color: var(--tenue);
  letter-spacing: 0.01em;
}

/* on a narrow screen the labels sit a little closer */
@media (max-width: 640px), (max-aspect-ratio: 4/5) {
  :root { --w: min(60vw, 66vh, 420px); }
  .etichetta em { display: none; }
}
