/* The workout that replays on scroll with the light of the zone. Colours in :root (the Playground palette): the three
   zone colours are the light of the piece, everything else is neutral. The phone is drawn at 300 x 620 and scaled to
   fit the stage (the scale goes on .cornice, GSAP moves .telefono inside it). */
:root {
  --fondo: #08090b;          /* the page */
  --fondo-alto: #121419;     /* the soft lift of the page behind the phone */
  --guscio: #16171c;         /* the phone's body */
  --schermo: #0b0c0f;        /* the screen */
  --pannello: #15171c;       /* the small panels on the screen */
  --inchiostro: #f2f3f5;     /* the words */
  --tenue: #8b8f99;          /* the small words */
  --linea: rgba(255, 255, 255, 0.07); /* thin rules */
  --facile: #3dd6c3;         /* zone 1, easy */
  --ritmo: #f4b740;          /* zone 2, tempo */
  --soglia: #ff5b4f;         /* zone 3, threshold */
  --luce: #3dd6c3;           /* the light of the zone you are in (moved by the script) */
  --forza: 0.6;              /* how strong that light is (moved by the script) */
}

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

.corsa { position: relative; height: 420vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 6vw, 96px);
  padding: clamp(12px, 4vh, 44px) clamp(16px, 5vw, 64px);
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(120% 90% at 70% 50%, var(--fondo-alto), var(--fondo) 62%);
}

/* the light the phone throws on the page: the colour of the zone, behind everything */
.alone {
  position: absolute;
  z-index: -1;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--luce) 70%, transparent), color-mix(in srgb, var(--luce) 26%, transparent) 50%, transparent);
  filter: blur(36px);
  opacity: calc(0.35 + var(--forza) * 0.65);
}
.grana {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* the words at the side */
.testo { width: clamp(220px, 30vw, 380px); flex: none; }
.testo__nota { font-size: clamp(11px, 1.5vh, 13px); font-weight: 600; letter-spacing: 0.01em; color: var(--inchiostro); margin-bottom: clamp(8px, 1.6vh, 14px); }
.testo__nota span { color: var(--tenue); font-weight: 480; margin-left: 6px; }
.testo__titolo {
  font-size: clamp(24px, min(4vw, 6vh), 52px);
  font-weight: 640;
  font-stretch: 108%;
  letter-spacing: -0.03em;
  line-height: 1.02;
}
.testo__riga { margin-top: clamp(10px, 2vh, 18px); font-size: clamp(13px, 1.9vh, 16px); line-height: 1.45; color: var(--tenue); max-width: 30em; }

/* the zone scale: three segments and a caret that walks with the heart rate */
.scala { margin-top: clamp(16px, 3.4vh, 32px); max-width: 300px; }
.scala__barra { position: relative; display: flex; gap: 3px; height: 4px; }
.scala__seg { display: block; height: 100%; border-radius: 2px; opacity: 0.35; transition: opacity 0.4s; }
.scala__seg--facile { flex: 39; background: var(--facile); }
.scala__seg--ritmo { flex: 20; background: var(--ritmo); }
.scala__seg--soglia { flex: 21; background: var(--soglia); }
.scala__seg.acceso { opacity: 1; }
.scala__segno { position: absolute; left: 0; top: -11px; width: 10px; height: 7px; margin-left: -5px; fill: var(--inchiostro); }
.scala__nomi { display: flex; margin-top: 8px; font-size: 11px; color: var(--tenue); }
.scala__nomi span:nth-child(1) { flex: 39; }
.scala__nomi span:nth-child(2) { flex: 20; }
.scala__nomi span:nth-child(3) { flex: 21; }

/* the phone, drawn at 300 x 620 */
.spazio { position: relative; flex: none; width: 300px; height: 620px; }
.cornice { position: absolute; left: 0; top: 0; width: 300px; height: 620px; transform-origin: 0 0; }
.telefono {
  position: absolute;
  inset: 0;
  border-radius: 50px;
  background: linear-gradient(160deg, #24262d, var(--guscio) 30%, #101115 70%, #1d1f25);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 2px 3px rgba(0, 0, 0, 0.5),
    0 30px 60px -20px rgba(0, 0, 0, 0.8);
  will-change: transform;
}
/* the rim: a 1px edge that catches the zone light on one side and white light on the other */
.telefono__bordo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(200deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.04) 28%, transparent 55%, color-mix(in srgb, var(--luce) calc(var(--forza) * 90%), transparent) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}
.schermo {
  position: absolute;
  inset: 9px;
  border-radius: 42px;
  overflow: hidden;
  background: var(--schermo);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  font-size: 12px;
}
.isola { position: absolute; left: 50%; top: 10px; width: 84px; height: 24px; margin-left: -42px; border-radius: 14px; background: #000; z-index: 4; }
.stato { position: absolute; left: 0; right: 0; top: 13px; display: flex; justify-content: space-between; padding: 0 26px 0 30px; font-size: 12px; font-weight: 600; }
.stato__icone { display: flex; gap: 5px; align-items: center; }
.stato__icone svg { height: 10px; fill: currentColor; stroke: currentColor; }
.stato__icone svg:first-child { width: 15px; stroke: none; }
.stato__icone svg:last-child { width: 22px; stroke-linecap: round; }

.tenue { color: var(--tenue); font-size: 10.5px; }
.testa { position: absolute; left: 18px; right: 18px; top: 54px; display: flex; justify-content: space-between; align-items: center; }
.testa__titolo { font-size: 16px; font-weight: 640; letter-spacing: -0.01em; margin-bottom: 2px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 11px 0 9px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 560;
}
.chip svg { width: 11px; height: 11px; overflow: visible; }
.chip__play { fill: currentColor; }
.chip__ok { fill: none; stroke: var(--facile); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }

.battito { position: absolute; left: 18px; right: 18px; top: 104px; }
.etichetta { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 560; color: var(--tenue); text-transform: uppercase; letter-spacing: 0.06em; }
.cuore { width: 13px; height: 12px; fill: var(--luce); transform-origin: 50% 60%; }
.battito__riga { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.cifre { display: inline-flex; font-size: 62px; font-weight: 600; font-stretch: 112%; letter-spacing: -0.04em; line-height: 1; height: 1em; overflow: hidden; font-variant-numeric: tabular-nums; }
.cifra { display: block; height: 1em; overflow: hidden; }
.cifra__col { display: flex; flex-direction: column; will-change: transform; }
.cifra__col b { display: block; height: 1em; font-weight: inherit; text-align: center; }
.cifra.via { width: 0; }
.battito__unita { font-size: 13px; color: var(--tenue); font-weight: 500; }
.zona { margin-top: 8px; height: 24px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 12px; background: color-mix(in srgb, var(--luce) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--luce) 30%, transparent); overflow: hidden; }
.zona__nome { display: block; font-size: 11px; font-weight: 600; color: var(--luce); white-space: nowrap; }
.zona__nome em { font-style: normal; font-weight: 480; opacity: 0.8; margin-left: 4px; }

.grafico { position: absolute; left: 10px; right: 10px; top: 236px; height: 150px; }
.grafico__svg { display: block; width: 100%; height: 128px; overflow: visible; }
.grafico__fasce rect { fill: rgba(255, 255, 255, 0.025); }
.grafico__fasce path { stroke: var(--linea); stroke-dasharray: 2 3; fill: none; }
.grafico__spenta { fill: none; stroke: rgba(255, 255, 255, 0.13); stroke-width: 1.4; stroke-linejoin: round; }
.grafico__accesa { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cursore__filo { stroke: rgba(255, 255, 255, 0.5); stroke-width: 1; vector-effect: non-scaling-stroke; }
.cursore__anello { fill: var(--schermo); stroke: var(--inchiostro); stroke-width: 1.6; }
.suggerimento {
  position: absolute;
  left: 0;
  top: -6px;
  padding: 3px 7px;
  border-radius: 7px;
  background: rgba(30, 32, 38, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 6px 14px -6px rgba(0, 0, 0, 0.8);
  font-size: 9.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  will-change: left;
}
.grafico__asse { display: flex; justify-content: space-between; margin-top: 6px; padding: 0 2px; font-size: 9px; }

.dati { position: absolute; left: 18px; right: 18px; top: 404px; display: grid; grid-template-columns: 1fr 1fr 0.8fr; gap: 8px; padding-top: 12px; border-top: 1px solid var(--linea); }
.dati__val { margin-top: 3px; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dati__val small { font-size: 10px; color: var(--tenue); font-weight: 500; }

.zone { position: absolute; left: 18px; right: 18px; top: 474px; padding: 12px 12px 11px; border-radius: 16px; background: var(--pannello); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05); }
.zone__barra { display: flex; gap: 2px; height: 6px; margin: 9px 0 8px; border-radius: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.05); }
.zone__barra i { display: block; height: 100%; width: 0; border-radius: 2px; }
.zone__barra i:nth-child(1) { background: var(--facile); }
.zone__barra i:nth-child(2) { background: var(--ritmo); }
.zone__barra i:nth-child(3) { background: var(--soglia); }
.zone__nomi { display: flex; justify-content: space-between; font-size: 10px; color: var(--tenue); }
.zone__nome b { font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 2px; }
.zone__nome--facile b { color: var(--facile); }
.zone__nome--ritmo b { color: var(--ritmo); }
.zone__nome--soglia b { color: var(--soglia); }

/* the summary card that rises over the screen when the run is saved */
.riepilogo {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 22px;
  padding: 16px 16px 15px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(40, 42, 50, 0.86), rgba(24, 25, 30, 0.92));
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 -18px 40px -12px rgba(0, 0, 0, 0.7);
  visibility: hidden;
  z-index: 5;
}
.riepilogo__testa { display: flex; gap: 11px; align-items: center; }
.riepilogo__spunta { width: 30px; height: 30px; flex: none; }
.riepilogo__spunta circle { fill: color-mix(in srgb, var(--facile) 16%, transparent); stroke: color-mix(in srgb, var(--facile) 50%, transparent); stroke-width: 1; }
.riepilogo__spunta path { fill: none; stroke: var(--facile); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.riepilogo__titolo { font-size: 15px; font-weight: 640; margin-bottom: 1px; }
.riepilogo__numeri { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--linea); font-size: 10px; color: var(--tenue); }
.riepilogo__numeri b { display: block; font-size: 17px; color: var(--inchiostro); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-bottom: 1px; }

/* the glass: a soft sheen across the screen, moved by the scroll and the pointer */
.riflesso {
  position: absolute;
  inset: -40% -60%;
  z-index: 6;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.055) 46%, rgba(255, 255, 255, 0.015) 52%, transparent 60%);
  will-change: transform;
}
.casa { position: absolute; left: 50%; bottom: 8px; width: 104px; height: 4px; margin-left: -52px; border-radius: 2px; background: rgba(255, 255, 255, 0.55); z-index: 7; }

@media (max-width: 720px) {
  .palco { flex-direction: column; gap: clamp(8px, 2.4vh, 20px); }
  .testo { width: 100%; text-align: center; }
  .testo__nota { margin-bottom: 4px; }
  .testo__titolo { font-size: clamp(17px, min(5.4vw, 4.2vh), 28px); }
  .testo__riga, .scala { display: none; }
}
@media (max-width: 720px) and (min-height: 700px) {
  .testo__riga { display: block; font-size: 13px; max-width: 26em; margin-inline: auto; }
}
