/* The plan comparison that fills in on scroll. Colours in :root (the Playground palette): one violet light for the
   recommended plan, everything else neutral. The panel is drawn at a fixed size (660 wide, 380 when the stage is
   narrow) and scaled to fit the stage: the scale goes on .cornice, GSAP moves the cells inside. */
:root {
  --fondo: #07080b;          /* the page */
  --fondo-alto: #11131a;     /* the soft lift of the page behind the panel */
  --pannello: #0f1116;       /* the panel */
  --pannello-basso: #0b0c10; /* the bottom of the panel's gradient */
  --inchiostro: #f3f4f6;     /* the words */
  --tenue: #8a8f9b;          /* the small words */
  --spento: #4a4e58;         /* the "not included" marks */
  --linea: rgba(255, 255, 255, 0.07); /* thin rules */
  --luce: #9b8cff;           /* the light of the recommended plan */
  --luce-chiara: #d6d0ff;    /* the brightest part of that light */
  --verde: #7fe3b4;          /* the saving */
}

* { 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;
}

.prezzi { position: relative; height: 420vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 3vh, 40px) clamp(10px, 4vw, 48px);
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(110% 80% at 50% 40%, var(--fondo-alto), var(--fondo) 64%);
}

/* the violet light behind the recommended column */
.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) 55%, transparent), color-mix(in srgb, var(--luce) 18%, transparent) 55%, transparent);
  filter: blur(40px);
  opacity: 0.3;
}
.grana {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.06;
  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");
}

.spazio { position: relative; flex: none; }
.cornice { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

/* ------------------------------------------------------------------ the panel */
.pannello {
  --pad: 28px;
  --colF: 196px;
  --rh: 40px;
  --mx: 70%;
  --my: 0%;
  position: relative;
  width: 660px;
  padding: var(--pad);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--pannello), var(--pannello-basso));
  border: 1px solid rgba(255, 255, 255, 0.075);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 1px 1px rgba(0, 0, 0, 0.5),
    0 12px 24px -8px rgba(0, 0, 0, 0.6),
    0 40px 80px -20px rgba(0, 0, 0, 0.7);
}
/* a soft light on the surface that follows the pointer */
.pannello__luce {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(360px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.045), transparent 60%);
}
.pannello.stretta { --pad: 16px; --colF: 112px; --rh: 34px; width: 380px; border-radius: 18px; }

/* the head: brand, title, the billing switch */
.capo { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; position: relative; }
.capo__marchio { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--tenue); margin-bottom: 8px; }
.capo__marchio svg { width: 14px; height: 14px; fill: none; stroke: var(--luce); stroke-width: 1.8; stroke-linecap: round; }
.capo__titolo { font-size: 26px; font-weight: 640; font-stretch: 106%; letter-spacing: -0.025em; line-height: 1.05; }
.capo__riga { margin-top: 6px; font-size: 13px; color: var(--tenue); line-height: 1.4; }
.stretta .capo { margin-bottom: 20px; gap: 10px; }
.stretta .capo__marchio { font-size: 11px; margin-bottom: 5px; }
.stretta .capo__titolo { font-size: 19px; }
.stretta .capo__riga { display: none; }

.interruttore {
  --x0: 4px; --w0: 70px; --x1: 78px; --w1: 90px;
  --t: 0;                    /* 0 monthly, 1 yearly (moved by the script) */
  --stira: 0;                /* how much the knob stretches while it runs */
  position: relative;
  flex: none;
  display: flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}
.interruttore__pomo {
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: calc(var(--w0) + (var(--w1) - var(--w0)) * var(--t) + var(--stira) * 14px);
  transform: translateX(calc(var(--x0) + (var(--x1) - var(--x0)) * var(--t) - var(--stira) * 7px));
  border-radius: 999px;
  background: linear-gradient(180deg, #2a2d36, #1d1f26);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 2px 6px rgba(0, 0, 0, 0.5);
}
.interruttore__voce {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 560;
  white-space: nowrap;
  color: var(--tenue);
}
.interruttore__voce.su { color: var(--inchiostro); }
.sconto {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 640;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--verde);
  background: color-mix(in srgb, var(--verde) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--verde) 24%, transparent);
}
.stretta .interruttore__voce { padding: 6px 9px; font-size: 11px; gap: 4px; }
.stretta .sconto { font-size: 9.5px; padding: 1px 5px; }

/* ------------------------------------------------------------------ the table */
.tavola {
  position: relative;
  display: grid;
  grid-template-columns: var(--colF) repeat(3, 1fr);
  grid-template-rows: auto repeat(6, var(--rh)) auto;
}
.cella {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #c9ccd3;
  text-align: center;
}
.cella--nome { justify-content: flex-start; text-align: left; color: var(--tenue); font-weight: 480; }
.cella--scelta { color: var(--inchiostro); font-weight: 560; }
.stretta .cella { font-size: 11.5px; }
.filo {
  grid-column: 1 / -1;
  align-self: start;
  height: 1px;
  background: var(--linea);
  transform-origin: 0 50%;
  z-index: 1;
}

/* the marks: a check, and a short line for "not included" */
.segno { width: 18px; height: 18px; }
.segno circle { fill: rgba(255, 255, 255, 0.06); }
.segno path { fill: none; stroke: #e6e7ea; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; }
.cella--scelta .segno circle { fill: color-mix(in srgb, var(--luce) 22%, transparent); }
.cella--scelta .segno path { stroke: var(--luce-chiara); }
.manca { width: 12px; height: 2px; }
.manca path { stroke: var(--spento); stroke-width: 1.4; stroke-linecap: round; }
.stretta .segno { width: 16px; height: 16px; }

/* the heads of the three columns */
.testa {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 6px 18px;
}
.testa__nome { font-size: 13px; font-weight: 600; color: #c9ccd3; }
.testa--scelta .testa__nome { color: var(--luce-chiara); }
.prezzo { display: flex; align-items: baseline; margin-top: 8px; line-height: 1; }
.prezzo__val { display: flex; font-size: 34px; font-weight: 660; font-stretch: 104%; letter-spacing: -0.03em; }
.prezzo__per { margin-left: 3px; font-size: 12px; color: var(--tenue); }
.cifra { display: inline-block; width: 0.6em; height: 1em; overflow: hidden; line-height: 1; text-align: center; }
.cifra__col { display: flex; flex-direction: column; }
.cifra__col b { display: block; height: 1em; font-weight: inherit; }
.testa__sotto { display: grid; margin-top: 8px; font-size: 11.5px; color: var(--tenue); white-space: nowrap; }
.testa__sotto span { grid-area: 1 / 1; }
.testa__sotto .risparmio { color: var(--verde); }
.stretta .testa { padding: 16px 2px 14px; }
.stretta .testa__nome { font-size: 11.5px; }
.stretta .prezzo { margin-top: 6px; }
.stretta .prezzo__val { font-size: 24px; }
.stretta .prezzo__per { font-size: 10px; margin-left: 2px; }
.stretta .testa__sotto { font-size: 9.5px; margin-top: 6px; }

/* the buttons under the columns */
.piede { position: relative; z-index: 1; display: flex; justify-content: center; padding: 16px 8px 4px; }
.btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 132px;
  padding: 10px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #d5d7dd;
  font: inherit;
  font-size: 12.5px;
  font-weight: 560;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: background-color 0.25s, border-color 0.25s;
}
.btn--scelta {
  color: #0d0b1a;
  border-color: transparent;
  background: linear-gradient(180deg, var(--luce-chiara), var(--luce));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 6px 18px -6px color-mix(in srgb, var(--luce) 70%, transparent);
}
.btn__lampo {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 40%;
  transform: translateX(-140%) skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  pointer-events: none;
}
.btn__parola { position: relative; }
@media (hover: hover) {
  .btn:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.16); }
  .btn--scelta:hover { background: linear-gradient(180deg, #e6e2ff, var(--luce)); }
}
.stretta .piede { padding: 12px 3px 2px; }
.stretta .btn { font-size: 10.5px; padding: 8px 4px; }

/* the recommended column: a glass card behind it, with a light that goes round its edge */
.scelta {
  --ang: 0deg;               /* where the beam on the edge is (moved by the script) */
  --brillo: 0;               /* how bright the beam is */
  --vetro: 0.5;              /* how lit the glass is */
  grid-column: 3;
  grid-row: 1 / -1;
  position: relative;
  z-index: 0;
  margin: -8px 0 -10px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--luce) calc(var(--vetro) * 16%), transparent), color-mix(in srgb, var(--luce) calc(var(--vetro) * 4%), transparent) 60%, transparent),
    rgba(255, 255, 255, calc(0.012 + var(--vetro) * 0.02));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, calc(0.04 + var(--vetro) * 0.05)), 0 20px 50px -20px color-mix(in srgb, var(--luce) calc(var(--vetro) * 40%), transparent);
}
.scelta__bordo {
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(from var(--ang), transparent 0 58%, color-mix(in srgb, var(--luce) 60%, transparent) 70%, var(--luce-chiara) 75%, color-mix(in srgb, var(--luce) 60%, transparent) 80%, transparent 92%);
  -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, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: var(--brillo);
}
.scelta__chip {
  position: absolute;
  left: 50%;
  top: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 620;
  white-space: nowrap;
  color: #0d0b1a;
  background: linear-gradient(180deg, var(--luce-chiara), var(--luce));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 4px 14px -4px color-mix(in srgb, var(--luce) 80%, transparent);
  transform: translate(-50%, -50%);
}
.scelta__chip svg { width: 11px; height: 11px; fill: currentColor; }
.stretta .scelta { margin: -6px 0 -8px; border-radius: 13px; }
.stretta .scelta__chip { font-size: 9px; padding: 3px 7px 3px 6px; gap: 3px; }
.stretta .scelta__chip svg { width: 9px; height: 9px; }

/* the light that runs down the recommended column, row by row */
.faro {
  --riempi: 0;               /* how far down it has come (moved by the script) */
  grid-column: 3;
  grid-row: 2 / 8;
  position: relative;
  z-index: 0;
  pointer-events: none;
}
.faro::before {
  content: '';
  position: absolute;
  inset: 0 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--luce) 5%, transparent), color-mix(in srgb, var(--luce) 13%, transparent));
  clip-path: inset(0 0 calc((1 - var(--riempi)) * 100%) 0);
}
.faro__fronte {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--riempi) * 100%);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--luce-chiara) 30%, #fff 50%, var(--luce-chiara) 70%, transparent);
  box-shadow: 0 0 12px 1px color-mix(in srgb, var(--luce) 80%, transparent);
  opacity: 0;
}
