/* Glass slabs that settle into a stack on scroll. Colours in :root (the Playground palette). */
:root {
  --fondo: #0b0b0d;
  --testo: #f2f1ee;
  --tenue: #8d8b88;
  --vetro: 255, 255, 255;
  --accento: #8fd6ff;
  --luce: 255, 248, 236;
}

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

.corsa { position: relative; height: 500vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  max-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(4px, 1.4vh, 14px);
  padding: clamp(12px, 3vh, 30px) clamp(14px, 3vw, 40px);
  overflow: hidden;
}

.testa { display: flex; justify-content: space-between; align-items: center; font-size: clamp(11px, 1.8vh, 14px); position: relative; z-index: 3; }
.marchio { display: flex; align-items: center; gap: 7px; font-weight: 640; font-stretch: 110%; letter-spacing: -.01em; }
.marchio svg { width: 1.5em; height: 1.5em; fill: none; stroke: var(--accento); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.testa__lato { color: var(--tenue); }

/* the stage */
.scena { position: relative; min-height: 0; }

/* the beam: a soft column of light falling from the top onto the pile */
.fascio {
  position: absolute;
  left: 50%;
  top: -40%;
  width: var(--fw, 120px);
  height: 95%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(var(--luce), 0) 0%, rgba(var(--luce), .05) 45%, rgba(var(--luce), .13) 100%);
  filter: blur(14px);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

/* the view angle lives on .pila in CSS; the pointer turns .giro inside it with GSAP */
.inclina { position: absolute; inset: 0; perspective: 1400px; z-index: 1; }
.pila {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: rotateX(57deg) rotateZ(-16deg);
}
.giro { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }

/* the soft shadow on the ground, darker as the pile grows */
.ombra-terra {
  position: absolute;
  left: calc(var(--w, 300px) * -.6);
  top: calc(var(--h, 190px) * -.6);
  width: calc(var(--w, 300px) * 1.2);
  height: calc(var(--h, 190px) * 1.2);
  border-radius: 40%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .85), rgba(0, 0, 0, 0));
  opacity: 0;
}

/* where the pile will stand: a thin outline on the ground, gone once the first slab lands */
.orma {
  position: absolute;
  left: calc(var(--w, 300px) / -2);
  top: calc(var(--h, 190px) / -2);
  width: var(--w, 300px);
  height: var(--h, 190px);
  border-radius: calc(var(--w, 300px) * .06);
  border: 1px solid rgba(var(--vetro), .12);
  background: radial-gradient(40% 50% at 50% 50%, rgba(var(--luce), .06), rgba(var(--luce), 0) 70%);
  opacity: 0;
}

/* a slab: GSAP moves it (z, y, opacity); its children carry the look */
.lastra {
  --li: 0;      /* how much of the beam falls on it */
  --lx: .5;     /* where the beam crosses it, across its width */
  --spento: 0;  /* how much its content has faded under the next slab */
  --tinta: 255, 255, 255;
  position: absolute;
  left: calc(var(--w, 300px) / -2);
  top: calc(var(--h, 190px) / -2);
  width: var(--w, 300px);
  height: var(--h, 190px);
  transform-style: preserve-3d;
}
.lastra__spessore {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--w, 300px) * .06);
  transform: translateZ(calc(var(--w, 300px) * -.022));
  background: linear-gradient(135deg, rgba(var(--tinta), .22), rgba(var(--tinta), .06));
  border: 1px solid rgba(var(--tinta), .16);
}
.lastra__vetro {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--w, 300px) * .06);
  overflow: hidden;
  background:
    linear-gradient(150deg, rgba(var(--vetro), .13) 0%, rgba(var(--vetro), .04) 42%, rgba(var(--tinta), .07) 100%),
    rgba(16, 16, 20, .84);
  border: 1px solid rgba(var(--vetro), .16);
  box-shadow: inset 0 1px 0 rgba(var(--vetro), .22), inset 0 0 0 1px rgba(var(--tinta), calc(var(--li) * .35));
}
/* where the beam crosses the slab: an oval of light tinted by the slab, a little brighter edge on the near side */
.lastra__luce {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(28% 34% at calc(20% + var(--lx) * 60%) 52%, rgba(var(--tinta), calc(var(--li) * .55)), rgba(var(--tinta), 0) 70%),
    radial-gradient(60% 50% at calc(20% + var(--lx) * 60%) 50%, rgba(var(--luce), calc(var(--li) * .12)), rgba(var(--luce), 0) 70%);
  mix-blend-mode: screen;
  pointer-events: none;
}
.lastra__dentro {
  position: absolute;
  inset: 0;
  padding: calc(var(--w, 300px) * .055) calc(var(--w, 300px) * .06);
  display: flex;
  flex-direction: column;
  gap: calc(var(--w, 300px) * .03);
  font-size: calc(var(--w, 300px) * .043);
  opacity: calc(1 - var(--spento));
}

.etichetta { display: flex; align-items: center; gap: .45em; font-size: .86em; font-weight: 600; color: rgba(var(--tinta), .95); letter-spacing: .01em; }
.etichetta svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }

/* write */
.campo {
  display: flex;
  align-items: center;
  min-height: 2.6em;
  padding: 0 .8em;
  border-radius: .7em;
  background: rgba(var(--vetro), .06);
  border: 1px solid rgba(var(--vetro), .14);
  font-size: 1.12em;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}
.campo__cursore { width: 1.5px; height: 1.1em; margin-left: 2px; background: var(--accento); border-radius: 1px; }
.campo__piede { display: flex; justify-content: space-between; align-items: center; color: var(--tenue); font-size: .82em; }
.tasto { padding: .15em .55em; border-radius: .4em; border: 1px solid rgba(var(--vetro), .16); color: var(--testo); }

/* automate */
.regola { display: flex; justify-content: space-between; align-items: center; gap: .8em; padding: .55em .7em; border-radius: .7em; background: rgba(var(--vetro), .05); border: 1px solid rgba(var(--vetro), .1); }
.regola span:first-child { display: flex; flex-direction: column; gap: .1em; }
.regola b { font-weight: 560; }
.regola i { font-style: normal; color: var(--tenue); font-size: .82em; }
.regola.spenta { opacity: .55; }
.leva { position: relative; flex: none; width: 2.3em; height: 1.35em; border-radius: 1em; background: rgba(var(--vetro), .16); }
.leva i { position: absolute; left: .15em; top: .15em; width: 1.05em; height: 1.05em; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.leva.acceso { background: rgba(166, 140, 255, .9); }
.leva.acceso i { left: auto; right: .15em; }

/* measure */
.dato { display: flex; align-items: baseline; gap: .5em; }
.dato__cifra { font-size: 2.2em; font-weight: 640; font-stretch: 112%; letter-spacing: -.02em; line-height: 1; }
.dato__nota { color: var(--tenue); font-size: .86em; }
.grafico { width: 100%; flex: 1; min-height: 0; overflow: visible; }
.grafico__linea { fill: none; stroke: rgb(255, 190, 120); stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.grafico__area { fill: rgba(255, 190, 120, .14); }

/* share */
.link { display: flex; align-items: center; justify-content: space-between; gap: .6em; padding: .4em .4em .4em .8em; border-radius: .8em; background: rgba(var(--vetro), .06); border: 1px solid rgba(var(--vetro), .14); }
.link__indirizzo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.link__copia { flex: none; height: 2em; padding: 0 .9em; border-radius: .6em; background: var(--testo); color: #111; font-weight: 600; overflow: hidden; display: inline-flex; }
.link__rullo { display: flex; flex-direction: column; }
.link__rullo span { height: 2em; display: flex; align-items: center; gap: .3em; }
.link__rullo svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.persone { display: flex; align-items: center; }
.faccia { width: 1.9em; height: 1.9em; margin-right: -.45em; border-radius: 50%; display: grid; place-items: center; font-size: .72em; font-weight: 640; color: #111; background: var(--c); border: 2px solid #17171b; }
.persone__nota { margin-left: 1em; color: var(--tenue); font-size: .82em; }

/* the caption below rolls like a drum */
.didascalia { display: flex; justify-content: center; font-size: clamp(12px, 2.1vh, 16px); position: relative; z-index: 3; }
.didascalia__rullo { display: block; height: 1.5em; overflow: hidden; }
.didascalia__righe { display: flex; flex-direction: column; text-align: center; }
.didascalia__righe span { height: 1.5em; line-height: 1.5em; color: var(--tenue); white-space: nowrap; }
.didascalia__righe b { color: var(--testo); font-weight: 600; }
