/* The order tracking with the mark that stops at every step on scroll. Colours in :root (the Playground palette): one
   accent, the green of the line, the ring and the lit steps; everything else is warm neutral. The card is drawn at
   340 px wide and scaled to fit the stage (the scale goes on .cornice, GSAP never touches it). */
:root {
  --fondo: #ecebe7;          /* the page */
  --fondo-alto: #f6f5f2;     /* the soft light on the page behind the card */
  --carta: #ffffff;          /* the card */
  --inchiostro: #17181b;     /* the words */
  --tenue: #8a8780;          /* the small words */
  --spento: #bdb9b0;         /* the steps not reached yet */
  --linea: #e6e3dd;          /* thin rules and the empty line */
  --nodo: #f4f2ee;           /* an empty step */
  --accento: #157a57;        /* the line, the ring, the lit steps */
  --accento-tenue: #e3f1eb;  /* the soft green behind the status */
  --tela: #d9cdb8;           /* the oat linen of the item */
}

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

.viaggio { position: relative; height: 520vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(90% 70% at 50% 42%, var(--fondo-alto), var(--fondo) 70%);
}
@supports (height: 100lvh) { .palco { height: 100lvh; } }
.grana {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  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 card, drawn at 340 px and scaled by the script */
.cornice { position: relative; width: 340px; flex: none; transform-origin: 50% 50%; }
.carta {
  position: relative;
  width: 340px;
  padding: 20px 22px 14px;
  border-radius: 22px;
  background: var(--carta);
  box-shadow:
    0 0 0 1px rgba(23, 24, 27, 0.06),
    0 1px 1px rgba(23, 24, 27, 0.04),
    0 6px 14px -6px rgba(23, 24, 27, 0.08),
    0 26px 48px -18px rgba(23, 24, 27, 0.16),
    0 60px 90px -40px rgba(21, 122, 87, 0.14);
  overflow: hidden;
}
.carta__luce {
  position: absolute;
  inset: 0 0 auto;
  height: 140px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(21, 122, 87, 0.05), transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* the shop and the status */
.testa { position: relative; display: flex; align-items: center; justify-content: space-between; height: 26px; }
.marchio { display: flex; align-items: center; gap: 7px; }
.marchio__segno { width: 17px; height: 17px; fill: none; stroke: var(--inchiostro); stroke-width: 2.2; stroke-linecap: round; }
.marchio__nome { font-size: 14px; font-weight: 660; font-stretch: 112%; letter-spacing: -0.01em; }
.stato {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--nodo);
  color: var(--tenue);
  font-size: 11.5px;
  font-weight: 560;
  font-stretch: 104%;
  box-shadow: inset 0 0 0 1px var(--linea);
}
.stato.acceso { background: var(--accento-tenue); color: var(--accento); box-shadow: inset 0 0 0 1px rgba(21, 122, 87, 0.14); }
.stato { transition: background-color 0.5s, color 0.5s, box-shadow 0.5s; }
.stato__parola { display: inline-block; white-space: nowrap; }

/* the estimate */
.stima { position: relative; margin-top: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--linea); }
.stima__etichetta { font-size: 12px; color: var(--tenue); font-weight: 480; }
.stima__etichetta span, .stima__nota span { display: inline-block; }
.stima__valore { display: flex; align-items: center; gap: 8px; margin-top: 3px; height: 40px; }
.stima__fessura { display: block; overflow: hidden; height: 40px; padding-right: 2px; }
.stima__testo {
  display: block;
  font-size: 33px;
  line-height: 40px;
  font-weight: 640;
  font-stretch: 106%;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stima__spunta { width: 24px; height: 24px; flex: none; fill: none; stroke: var(--accento); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.stima__nota { margin-top: 2px; font-size: 12.5px; color: var(--tenue); }
.articolo { display: flex; align-items: center; gap: 9px; margin-top: 12px; font-size: 12px; }
.articolo__tela {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  flex: none;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(90, 70, 40, 0.10) 0 1px, transparent 1px 3px),
    linear-gradient(150deg, #e6dcc9, var(--tela));
  box-shadow: inset 0 0 0 1px rgba(23, 24, 27, 0.06), 0 1px 2px rgba(23, 24, 27, 0.08);
}
.articolo__nome { font-weight: 540; }
.articolo__ordine { margin-left: auto; color: var(--tenue); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }

/* the steps */
.tappe { position: relative; list-style: none; margin-top: 8px; }
.binario { position: absolute; left: 0; top: 0; bottom: 0; width: 36px; pointer-events: none; }
.binario__svg { position: absolute; inset: 0; width: 36px; height: 100%; overflow: visible; }
.binario__base { fill: none; stroke: var(--linea); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 0.5 5; }
.binario__pieno { fill: none; stroke: var(--accento); stroke-width: 2; stroke-linecap: round; }
.scia {
  position: absolute;
  left: 17px;
  top: 0;
  width: 2px;
  height: 40px;
  border-radius: 2px;
  transform-origin: 50% 100%;
  background: linear-gradient(180deg, rgba(21, 122, 87, 0), rgba(21, 122, 87, 0.5));
  opacity: 0;
  z-index: 3;
}
.segno { position: absolute; left: 0; top: 0; width: 36px; height: 36px; margin-top: -18px; z-index: 4; }
.segno__anello {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accento);
  background: rgba(255, 255, 255, 0.0);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.9), 0 4px 10px -2px rgba(21, 122, 87, 0.28);
}
.segno__pacco {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 3px;
  background: var(--accento);
  box-shadow: 0 1px 2px rgba(21, 122, 87, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  opacity: 0;
}
.segno__pacco i { position: absolute; left: 50%; top: 0; bottom: 0; width: 1.5px; margin-left: -0.75px; background: rgba(255, 255, 255, 0.55); }

.tappa {
  isolation: isolate;
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr;
  column-gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 0 6px 0 0;
  border-radius: 14px;
}
.tappa::after {
  content: '';
  position: absolute;
  inset: 3px -8px 3px 44px;
  border-radius: 12px;
  background: var(--nodo);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s;
}
.tappa__nodo {
  position: relative;
  z-index: 2;
  width: 30px;
  height: 30px;
  margin-left: 3px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--nodo);
  box-shadow: inset 0 0 0 1px var(--linea);
}
.tappa__nodo::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(120% 100% at 30% 20%, #23946c, var(--accento) 60%);
  box-shadow: 0 2px 6px -1px rgba(21, 122, 87, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transform: scale(var(--pieno, 0));
  opacity: var(--pieno, 0);
}
.tappa__nodo svg {
  position: relative;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tappa__nodo path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.tappa__testo { display: block; min-width: 0; }
.tappa__riga { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tappa__nome { font-size: 14px; font-weight: 560; letter-spacing: -0.01em; color: var(--spento); white-space: nowrap; transition: color 0.45s; }
.tappa.accesa .tappa__nome { color: var(--inchiostro); }
.tappa__ora { font-size: 11.5px; color: var(--tenue); font-variant-numeric: tabular-nums; white-space: nowrap; opacity: 0; }
.tappa__dettaglio { display: block; margin-top: 2px; font-size: 12px; line-height: 1.35; color: var(--tenue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; }

@media (hover: hover) {
  .tappa.accesa:hover::after { opacity: 1; }
  .tappa.accesa:hover .tappa__nodo svg { transform: translateY(-1px) scale(1.06); }
  .tappa__nodo svg { transition: transform 0.35s cubic-bezier(0.2, 1.6, 0.4, 1); }
}
