/* The features with a phone screen that changes on scroll. Colours in :root (the Playground palette). */
:root {
  --fondo: #fafafa;
  --inchiostro: #0b0b0f;
  --secondario: #71717a;
  --tenue: #a1a1aa;
  --bordo: rgba(10, 10, 20, 0.08);
  --accento: #0f766e;
  --accento-tenue: #ccfbf1;
  --telefono: #111114;
  --schermo: #ffffff;
  --strada: #e9e9ee;
  --acqua: #dbeafe;
}

* { 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: 400vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(20px, 6vw, 88px);
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(14px, 4vh, 40px) clamp(16px, 5vw, 56px);
  overflow: hidden;
}

/* ---------- the texts ---------- */
.testi__nota {
  font-size: 13px;
  font-weight: 560;
  color: var(--accento);
  margin-bottom: clamp(14px, 3vh, 26px);
}
.testi__corpo { position: relative; display: flex; gap: clamp(14px, 2.2vw, 24px); }
.binario {
  position: relative;
  flex: 0 0 2px;
  width: 2px;
  border-radius: 2px;
  background: var(--bordo);
  overflow: hidden;
}
.binario__pieno {
  position: absolute;
  inset: 0;
  background: var(--accento);
  border-radius: 2px;
  transform-origin: 50% 0;
  transform: scaleY(0);
}
.passi { list-style: none; display: flex; flex-direction: column; gap: clamp(14px, 3.4vh, 34px); }
.passo { opacity: 0.32; }
.passo__titolo {
  font-size: clamp(19px, 2.4vw, 28px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 640;
  font-stretch: 104%;
}
.passo__riga {
  margin-top: 6px;
  max-width: 34ch;
  font-size: clamp(13px, 1.25vw, 15px);
  line-height: 1.5;
  color: var(--secondario);
}

/* ---------- the phone ---------- */
.telefono-posto { perspective: 1200px; }
.telefono {
  --alto: min(78vh, 600px);
  position: relative;
  height: var(--alto);
  aspect-ratio: 9 / 19;
  padding: calc(var(--alto) * 0.018);
  border-radius: calc(var(--alto) * 0.105);
  background: linear-gradient(145deg, #2a2a2f, var(--telefono) 38%, #050506);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 2px 4px rgba(10, 10, 20, 0.06),
    0 30px 60px -24px rgba(10, 10, 20, 0.35),
    0 18px 36px -18px rgba(15, 118, 110, 0.18);
  transform-style: preserve-3d;
}
.telefono::after { /* the glass reflection */
  content: '';
  position: absolute;
  inset: calc(var(--alto) * 0.018);
  border-radius: calc(var(--alto) * 0.088);
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 32%);
  pointer-events: none;
  z-index: 5;
}
.telefono__tasto { position: absolute; width: 3px; border-radius: 2px; background: #1c1c20; left: -3px; }
.telefono__tasto--a { top: 22%; height: 7%; }
.telefono__tasto--b { top: 32%; height: 11%; }

.vetro {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--alto) * 0.088);
  overflow: hidden;
  background: var(--schermo);
  font-size: calc(var(--alto) * 0.0225);
}
.barra-stato {
  position: absolute;
  inset: 0 0 auto;
  height: 7.5%;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 9% 0 10%;
  font-size: 0.95em;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.isola { width: 30%; height: 46%; border-radius: 99px; background: #050506; }
.barra-stato__segni { display: flex; align-items: flex-end; gap: 0.18em; height: 0.8em; }
.barra-stato__segni i { width: 0.22em; border-radius: 1px; background: currentColor; }
.barra-stato__segni i:nth-child(1) { height: 40%; }
.barra-stato__segni i:nth-child(2) { height: 70%; }
.barra-stato__segni i:nth-child(3) { height: 100%; }

.schermo {
  position: absolute;
  inset: 0;
  padding: 16% 7% 7%;
  background: var(--schermo);
  will-change: transform, opacity;
}
.sch-nota { font-size: 0.82em; color: var(--secondario); font-weight: 520; }
.sch-titolo { margin-top: 0.15em; font-size: 1.55em; line-height: 1.1; font-weight: 660; letter-spacing: -0.02em; }
.sch-titolo--cifra { font-size: 2.3em; font-variant-numeric: tabular-nums; }
.sch-sotto { margin-top: 0.2em; font-size: 0.82em; color: var(--accento); font-weight: 560; }

/* screen 1 */
.giorni { list-style: none; margin-top: 1.2em; display: flex; flex-direction: column; gap: 0.55em; }
.giorno {
  display: flex;
  align-items: center;
  gap: 0.75em;
  padding: 0.75em 0.8em;
  border-radius: 0.9em;
  background: #f4f4f5;
  border: 1px solid var(--bordo);
}
.giorno__data {
  display: grid;
  place-items: center;
  width: 2.6em;
  height: 2.6em;
  border-radius: 0.7em;
  background: #fff;
  font-size: 0.72em;
  color: var(--secondario);
  line-height: 1;
}
.giorno__data b { font-size: 1.45em; color: var(--inchiostro); font-weight: 660; }
.giorno__testo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15em; }
.giorno__testo b { font-size: 0.95em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.giorno__testo em { font-style: normal; font-size: 0.78em; color: var(--secondario); }
.giorno__ok { width: 1.15em; height: 1.15em; flex: 0 0 auto; }
.giorno__ok path { fill: none; stroke: var(--accento); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }

.giorno--nuovo { justify-content: center; gap: 0.45em; padding: 0.9em; background: transparent; border: 1px dashed rgba(10, 10, 20, 0.16); color: var(--secondario); font-size: 0.86em; font-weight: 560; }
.giorno__piu { width: 1em; height: 1em; }
.giorno__piu path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* screen 2 */
.metro { display: block; height: 0.28em; margin-top: 0.8em; border-radius: 99px; background: #f0f0f2; overflow: hidden; }
.metro i { display: block; width: 77.5%; height: 100%; border-radius: inherit; background: var(--accento); transform: scaleX(0); transform-origin: left center; }
.barre {
  margin-top: 1.4em;
  height: 34%;
  display: flex;
  align-items: flex-end;
  gap: 0.7em;
  padding: 0 0.2em;
}
.barra { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 0.4em; }
.barra i {
  display: block;
  width: 100%;
  height: calc(var(--h) * 82%);
  border-radius: 0.5em 0.5em 0.25em 0.25em;
  background: #e4e4e7;
  transform-origin: 50% 100%;
}
.barra--su i { background: var(--accento); }
.barra em { font-style: normal; font-size: 0.72em; color: var(--tenue); }
.spese { list-style: none; margin-top: 1.2em; border-top: 1px solid var(--bordo); }
.spese li {
  display: flex;
  justify-content: space-between;
  gap: 0.6em;
  padding: 0.7em 0;
  border-bottom: 1px solid var(--bordo);
  font-size: 0.86em;
}
.spese li span { color: var(--secondario); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spese li b { font-weight: 620; font-variant-numeric: tabular-nums; }

/* screen 3 */
.schermo--strada { padding: 0; background: #f4f4f5; }
.mappa { position: absolute; inset: 0; width: 100%; height: 100%; }
.mappa__isolati rect { fill: #ffffff; stroke: rgba(10, 10, 20, 0.05); }
.mappa__fiume { fill: none; stroke: var(--acqua); stroke-width: 14; stroke-linecap: round; }
.mappa__strada-fondo { fill: none; stroke: var(--accento-tenue); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.mappa__strada { fill: none; stroke: var(--accento); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.mappa__spillo path { fill: var(--inchiostro); }
.mappa__spillo rect { fill: #fff; }
.mappa__spillo--fine path { fill: var(--accento); }
.foglio {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 4%;
  padding: 1em 1.1em 1.05em;
  border-radius: 1.2em;
  background: #fff;
  border: 1px solid var(--bordo);
  box-shadow: 0 10px 28px -12px rgba(10, 10, 20, 0.25);
}
.foglio__tempo { font-size: 0.9em; color: var(--secondario); }
.foglio__tempo b { font-size: 1.5em; color: var(--inchiostro); font-weight: 660; margin-right: 0.15em; }
.foglio__via { margin-top: 0.2em; font-size: 0.82em; color: var(--secondario); }
.foglio__tasto {
  display: block;
  margin-top: 0.85em;
  padding: 0.75em;
  border-radius: 99px;
  background: var(--inchiostro);
  color: #fff;
  text-align: center;
  font-size: 0.86em;
  font-weight: 600;
}

/* screen 4 */
.schermo--fatto { display: grid; place-items: center; padding-bottom: 24%; background: var(--accento); color: #fff; }
.fatto { width: 100%; text-align: center; }
.fatto__segno { width: 3.6em; height: 3.6em; display: block; margin: 0 auto 0.9em; }
.fatto__anello { fill: none; stroke: rgba(255, 255, 255, 0.4); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; }
.fatto__spunta { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.fatto__titolo { font-size: 1.7em; font-weight: 660; letter-spacing: -0.02em; }
.fatto__riga { margin-top: 0.3em; font-size: 0.86em; opacity: 0.8; }
.fatto__righe { list-style: none; margin: 1.4em 0.2em 0; text-align: left; border-top: 1px solid rgba(255, 255, 255, 0.2); }
.fatto__righe li { display: flex; justify-content: space-between; padding: 0.7em 0.2em; border-bottom: 1px solid rgba(255, 255, 255, 0.2); font-size: 0.86em; }
.fatto__righe li span { opacity: 0.75; }
.fatto__righe li b { font-weight: 620; }
.fatto__tasto { position: absolute; left: 7%; right: 7%; bottom: 6%; padding: 0.85em 0; border-radius: 99px; background: #fff; color: var(--accento); font-size: 0.9em; font-weight: 640; text-align: center; box-shadow: 0 0.4em 1.2em rgba(0, 40, 35, 0.25); }

/* ---------- narrow screens: the phone on top, one text at a time below ---------- */
@media (max-width: 640px), (max-aspect-ratio: 4/5) {
  .palco {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: center;
    justify-items: center;
    gap: clamp(10px, 2.6vh, 22px);
    padding: clamp(10px, 3vh, 24px) 16px;
  }
  .telefono-posto { order: -1; }
  .telefono { --alto: min(56vh, 440px); }
  .testi { width: 100%; max-width: 420px; text-align: center; }
  .testi__nota { display: none; }
  .testi__corpo { flex-direction: column; align-items: center; gap: clamp(8px, 1.6vh, 14px); }
  .binario { order: 2; flex: 0 0 2px; width: min(160px, 50%); height: 2px; }
  .binario__pieno { transform-origin: 0 50%; transform: scaleX(0); }
  .passi { display: grid; width: 100%; }
  .passo { grid-area: 1 / 1; opacity: 0; }
  .passo__titolo { font-size: clamp(16px, 4.6vw, 22px); }
  .passo__riga { margin: 4px auto 0; font-size: clamp(12px, 3.4vw, 14px); max-width: 30ch; }
}
@media (max-height: 380px) {
  .passo__riga { display: none; }
}
