:root {
  --fondo: #f2f2f2;
  --carta: #ffffff;
  --inchiostro: #121214;
  --grigio: #8b8b93;
  --grigio-chiaro: #b9b9c0;
  --linea: rgba(18, 18, 20, 0.08);
  --linea-forte: rgba(18, 18, 20, 0.14);
  --fine-settimana: rgba(18, 18, 20, 0.025);
  --accento: #4f46e5;
  --barra: #eef0ff;
  --barra-bordo: rgba(79, 70, 229, 0.22);
  --barra-testo: #3730a3;
  --ritardo: #e5484d;
  --puntuale: #16a34a;
  --riga: clamp(30px, 7.4vh, 46px);
  --etichette: clamp(78px, 22%, 132px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 16px;
}

/* the card of the project tool */
.card {
  position: relative;
  width: min(100%, 760px);
  background: var(--carta);
  border: 1px solid var(--linea);
  border-radius: clamp(14px, 2.6vh, 20px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 22px 48px -26px rgba(20, 20, 40, 0.28);
  padding: clamp(12px, 2.6vh, 20px) clamp(12px, 2.4vw, 20px);
  user-select: none;
  -webkit-user-select: none;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: clamp(8px, 1.8vh, 14px);
}
.head__left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  width: clamp(26px, 5vh, 32px); height: clamp(26px, 5vh, 32px);
  flex: none;
  border-radius: 9px;
  background: var(--accento);
  display: grid; place-items: center;
}
.logo svg { width: 58%; height: 58%; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.head__app { font-size: clamp(10px, 1.7vh, 12px); color: var(--grigio); font-weight: 500; line-height: 1.2; }
.head__title { font-size: clamp(13px, 2.4vh, 16px); font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; white-space: nowrap; }

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #f4f4f6;
  border: 1px solid var(--linea);
  font-size: clamp(10px, 1.7vh, 12px);
  color: var(--grigio);
  font-weight: 550;
}
.seg span { padding: 3px 10px; border-radius: 999px; }
.seg .seg__on { background: #fff; color: var(--inchiostro); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* the chart: a column of labels on the left, the weeks on the right */
.chart { position: relative; }

.axis {
  position: relative;
  height: clamp(20px, 3.8vh, 26px);
  margin-left: var(--etichette);
  border-bottom: 1px solid var(--linea);
}
.axis span {
  position: absolute;
  top: 0;
  font-size: clamp(9px, 1.6vh, 11px);
  font-weight: 550;
  color: var(--grigio);
  white-space: nowrap;
  padding-left: 4px;
}

.body { position: relative; }

.grid {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--etichette); right: 0;
  pointer-events: none;
}
.grid i { position: absolute; top: 0; bottom: 0; }
.grid .w { width: 0; border-left: 1px solid var(--linea); }
.grid .we { background: var(--fine-settimana); }

.today {
  position: absolute;
  top: 0; bottom: 0;
  width: 0;
  border-left: 1px solid var(--accento);
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}
.today span {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  transform: translateX(-50%);
  font-size: clamp(8.5px, 1.5vh, 10px);
  font-weight: 650;
  color: #fff;
  background: var(--accento);
  border-radius: 999px;
  padding: 1px 6px;
  white-space: nowrap;
}

.links {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 2;
}
.links path { fill: none; stroke: var(--grigio-chiaro); stroke-width: 1.25; stroke-linejoin: round; stroke-linecap: round; }
.links path.head { fill: var(--grigio-chiaro); stroke: none; }
.links path.hot { stroke: var(--accento); }
.links path.head.hot { fill: var(--accento); }

.rows { list-style: none; position: relative; z-index: 3; }
.row {
  position: relative;
  height: var(--riga);
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(18, 18, 20, 0.045);
}
.row:last-child { border-bottom: 0; }

.row__name {
  width: var(--etichette);
  flex: none;
  padding-right: 8px;
  font-size: clamp(10px, min(1.85vh, 2.9vw), 13px);
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row__name small { display: block; font-size: 0.8em; font-weight: 450; color: var(--grigio); margin-top: 1px; }

.track { position: relative; flex: 1; height: 100%; }

/* where the task was in the starting plan */
.was {
  position: absolute;
  top: 50%;
  height: calc(var(--riga) * 0.62);
  margin-top: calc(var(--riga) * -0.31);
  border-radius: 8px;
  border: 1px dashed rgba(79, 70, 229, 0.38);
  opacity: 0;
  pointer-events: none;
}

/* a task bar: GSAP moves .bar, the CSS draws .bar__skin */
.bar {
  position: absolute;
  top: 50%;
  left: 0;
  height: calc(var(--riga) * 0.62);
  margin-top: calc(var(--riga) * -0.31);
  cursor: grab;
  touch-action: none;
  will-change: transform;
}
.bar.is-held { cursor: grabbing; z-index: 4; }
.bar__skin {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: var(--barra);
  border: 1px solid var(--barra-bordo);
  box-shadow: 0 1px 1px rgba(30, 30, 80, 0.04);
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 4px 0 6px;
  color: var(--barra-testo);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.bar__fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(79, 70, 229, 0.12);
  pointer-events: none;
}
.bar__grip {
  position: relative;
  flex: none;
  width: 4px; height: 44%;
  border-left: 1px solid currentColor;
  border-right: 1px solid currentColor;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.bar__days {
  position: relative;
  font-size: clamp(9px, 1.55vh, 11px);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}
.bar__who {
  position: relative;
  flex: none;
  width: calc(var(--riga) * 0.42);
  height: calc(var(--riga) * 0.42);
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--barra-bordo);
  display: grid; place-items: center;
  font-size: clamp(7px, 1.2vh, 9px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--barra-testo);
}
.bar.is-held .bar__skin { box-shadow: 0 10px 22px -10px rgba(40, 30, 140, 0.45), 0 2px 4px rgba(40, 30, 140, 0.12); border-color: var(--accento); }
.bar.is-held .bar__grip, .bar.is-hover .bar__grip { opacity: 0.6; }
.bar.is-hover .bar__skin { box-shadow: 0 6px 14px -8px rgba(40, 30, 140, 0.35); }
.bar.is-pushed .bar__skin { border-color: rgba(79, 70, 229, 0.6); }

/* the launch row is the milestone: a darker bar */
.bar.is-launch .bar__skin { background: var(--accento); border-color: var(--accento); color: #fff; }
.bar.is-launch .bar__who { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.bar.is-launch .bar__fill { background: rgba(255, 255, 255, 0.14); }

@media (hover: hover) {
  .bar:hover .bar__grip { opacity: 0.6; }
}

.foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(20px, 3.6vh, 26px);
  padding-top: clamp(8px, 1.8vh, 14px);
  border-top: 1px solid var(--linea);
}
.foot__label { display: flex; align-items: center; gap: 6px; font-size: clamp(11px, 1.9vh, 13px); color: var(--grigio); font-weight: 550; }
.foot__label svg { width: 15px; height: 15px; fill: none; stroke: var(--grigio); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.foot__date {
  position: relative;
  display: inline-flex;
  font-size: clamp(14px, 2.6vh, 18px);
  font-weight: 650;
  letter-spacing: -0.01em;
  height: 1.25em;
  line-height: 1.25em;
  overflow: hidden;
  white-space: pre;
}
.foot__date .c { display: inline-block; position: relative; }
.chip {
  margin-left: auto;
  font-size: clamp(10px, 1.7vh, 12px);
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
  color: var(--puntuale);
  background: rgba(22, 163, 74, 0.09);
  border: 1px solid rgba(22, 163, 74, 0.2);
}
.chip.is-late { color: var(--ritardo); background: rgba(229, 72, 77, 0.08); border-color: rgba(229, 72, 77, 0.22); }

/* the date tooltip above the bar being dragged */
.tip {
  position: absolute;
  left: 0; top: 0;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
}
.tip span {
  display: block;
  transform: translate(-50%, -100%);
  font-size: clamp(10px, 1.7vh, 12px);
  font-weight: 600;
  color: #fff;
  background: var(--inchiostro);
  padding: 4px 8px;
  border-radius: 7px;
  white-space: nowrap;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.4);
}

.ghost {
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px;
  fill: #111; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  opacity: 0;
  z-index: 7;
}

@media (max-width: 420px) {
  .seg { display: none; }
  .row__name small { display: none; }
}
