/* The dashboard that assembles piece by piece on scroll. Colours in :root (the Playground palette). */
:root {
  --fondo: #fafafa;
  --finestra: #ffffff;
  --pannello: #f6f6f7;
  --inchiostro: #0b0b0f;
  --secondario: #71717a;
  --bordo: rgba(10, 10, 20, 0.08);
  --accento: #4f46e5;
  --accento-tenue: #eef0ff;
  --verde: #15803d;
  --verde-tenue: #e9f7ee;
  --rosso: #b42318;
}

* { 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: 420vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3.5vw, 48px);
  padding: clamp(12px, 4vh, 40px) clamp(14px, 4vw, 48px);
  overflow: hidden;
}

/* the three lines at the side */
.frasi { width: clamp(180px, 24vw, 300px); flex: none; }
.frasi__nota { font-size: clamp(11px, 1.5vh, 13px); font-weight: 560; color: var(--accento); margin-bottom: 10px; }
.frasi__pila { position: relative; height: 3.4em; font-size: clamp(18px, min(2.4vw, 3.6vh), 30px); }
.frase {
  position: absolute;
  inset: 0 0 auto 0;
  font-weight: 620;
  font-stretch: 104%;
  letter-spacing: -0.02em;
  line-height: 1.1;
  opacity: 0;
}

/* the window, drawn at 960 x 600 and scaled to fit (the scale goes on .cornice, GSAP moves what is inside) */
.spazio { position: relative; flex: none; width: 640px; height: 400px; }
.cornice { position: absolute; left: 0; top: 0; width: 960px; height: 600px; transform-origin: 0 0; }
.finestra {
  position: absolute;
  inset: 0;
  background: var(--finestra);
  border: 1px solid var(--bordo);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(10, 10, 20, 0.04), 0 30px 60px -30px rgba(10, 10, 20, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.finestra__barra {
  height: 38px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--bordo);
  background: #fcfcfd;
}
.finestra__indirizzo { font-size: 11px; color: var(--secondario); background: var(--pannello); padding: 4px 14px; border-radius: 99px; }
.finestra__corpo { flex: 1; display: flex; min-height: 0; }

.pezzo { will-change: transform; }
.pezzo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(79, 70, 229, calc(0.13 * var(--forza, 1))) 50%, transparent 70%);
  transform: translateX(var(--lampo, -120%));
}

/* sidebar */
.lato {
  position: relative;
  width: 186px;
  flex: none;
  background: var(--pannello);
  border-right: 1px solid var(--bordo);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}
.lato__marchio { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; padding: 0 6px; }
.lato__marchio svg { width: 20px; height: 20px; fill: var(--inchiostro); }
.lato__voci { display: flex; flex-direction: column; gap: 2px; }
.voce { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 9px; font-size: 13px; color: var(--secondario); }
.voce svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.voce--attiva { background: var(--finestra); color: var(--inchiostro); font-weight: 560; box-shadow: 0 1px 2px rgba(10, 10, 20, 0.06); }
.lato__piano { margin-top: auto; background: var(--finestra); border: 1px solid var(--bordo); border-radius: 12px; padding: 12px; font-size: 12px; display: flex; flex-direction: column; gap: 8px; }
.lato__barra { height: 4px; border-radius: 4px; background: var(--pannello); overflow: hidden; }
.lato__barra i { display: block; height: 100%; width: 84%; background: var(--accento); border-radius: 4px; }

.principale { flex: 1; min-width: 0; padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.tenue { color: var(--secondario); }
.piccolo { font-size: 11.5px; }

.testata { position: relative; display: flex; align-items: center; justify-content: space-between; border-radius: 10px; }
.testata h3 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.testata__destra { display: flex; align-items: center; gap: 10px; }
.cerca { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--secondario); border: 1px solid var(--bordo); border-radius: 9px; padding: 7px 12px; width: 200px; }
.cerca svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.persona { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: linear-gradient(135deg, #e0e7ff, #fde2e4); }

.numeri { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.numero { position: relative; border: 1px solid var(--bordo); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; background: var(--finestra); overflow: hidden; }
.numero__cifra { font-size: 24px; font-weight: 640; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.numero__var { font-size: 11.5px; font-weight: 560; }
.su { color: var(--verde); }
.giu { color: var(--verde); }

.sotto { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; }
.grafico, .tabella { position: relative; border: 1px solid var(--bordo); border-radius: 12px; padding: 14px; background: var(--finestra); overflow: hidden; display: flex; flex-direction: column; gap: 10px; }
.grafico__testa, .tabella__testa { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; font-weight: 600; }
.grafico__svg { width: 100%; flex: 1; min-height: 0; }
.grafico__righe { stroke: var(--bordo); stroke-width: 1; fill: none; }
.grafico__linea { fill: none; stroke: var(--accento); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; }

.righe { display: flex; flex-direction: column; }
.riga {
  display: grid;
  grid-template-columns: 52px 1fr 70px 64px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 9px 8px;
  border-top: 1px solid var(--bordo);
  border-radius: 8px;
}
.riga:first-child { border-top: 0; }
.riga span:first-child { color: var(--secondario); font-variant-numeric: tabular-nums; }
.cifre { text-align: right; font-variant-numeric: tabular-nums; font-weight: 560; }
.stato { justify-self: end; font-size: 11px; font-weight: 560; padding: 3px 8px; border-radius: 99px; background: var(--pannello); color: var(--secondario); }
.stato--ok { background: var(--verde-tenue); color: var(--verde); }
.stato--via { background: var(--accento-tenue); color: var(--accento); }
.riga--scelta { background: var(--accento-tenue); }

.puntatore { position: absolute; left: 0; top: 0; width: 22px; height: 22px; opacity: 0; pointer-events: none; z-index: 5; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25)); }
.puntatore path { fill: var(--inchiostro); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; }

.piede { height: 40vh; display: grid; place-items: center; text-align: center; color: var(--secondario); font-size: clamp(13px, 2vh, 15px); padding: 0 20px; }

/* narrow screens: the lines go above the window */
@media (max-width: 720px) {
  .palco { flex-direction: column; gap: clamp(8px, 2vh, 18px); }
  .frasi { width: 100%; text-align: center; }
  .frasi__nota { margin-bottom: 4px; }
  .frasi__pila { height: 2.4em; font-size: clamp(14px, min(4.4vw, 3.4vh), 20px); }
}
