:root {
  --fondo: #f4f4f5;
  --carta: #ffffff;
  --inchiostro: #121214;
  --grigio: #84848c;
  --grigio-chiaro: #b4b4bb;
  --linea: rgba(18, 18, 20, 0.08);
  --ramo: #cfd0d6;
  --accento: #4f46e5;
  --accento-tenue: rgba(79, 70, 229, 0.1);
  --design: linear-gradient(135deg, #f5d0fe, #c4b5fd);
  --engineering: linear-gradient(135deg, #bae6fd, #a5b4fc);
  --growth: linear-gradient(135deg, #bbf7d0, #99f6e4);
  --capo: linear-gradient(135deg, #fde68a, #fdba74);
}

* { 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 {
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* the card is laid out in design units and scaled with zoom (sharp text, no blur) */
.card {
  position: relative;
  background: var(--carta);
  border: 1px solid var(--linea);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(18, 18, 20, 0.04), 0 18px 48px -18px rgba(18, 18, 20, 0.18);
  padding: 14px 14px 16px;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 12px;
  border-bottom: 1px solid var(--linea);
  margin-bottom: 16px;
}

.head__left { display: flex; align-items: center; gap: 9px; }

.logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--inchiostro);
  display: grid;
  place-items: center;
}

.logo svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.head__app { font-size: 10.5px; color: var(--grigio); line-height: 1.2; }
.head__title { font-size: 14px; font-weight: 640; letter-spacing: -0.01em; line-height: 1.2; }

.head__path {
  flex: 1;
  min-width: 0;
  margin: 0 10px;
  text-align: right;
  font-size: 10.5px;
  color: var(--accento);
  font-weight: 560;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  visibility: hidden;
}

.head__count {
  font-size: 11px;
  color: var(--grigio);
  border: 1px solid var(--linea);
  border-radius: 999px;
  padding: 4px 10px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.head__count .roll { color: var(--inchiostro); font-weight: 620; }

.roll { display: inline-flex; overflow: hidden; height: 1.25em; line-height: 1.25em; }
.roll > span { display: inline-block; }

.chart { position: relative; }

.links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.links path {
  fill: none;
  stroke: var(--ramo);
  stroke-width: 1.3;
  stroke-linecap: butt;
  stroke-linejoin: round;
  transition: stroke 0.25s, opacity 0.25s;
}

.links path.is-lit { stroke: var(--accento); stroke-width: 1.6; }
.links.is-focus path:not(.is-lit) { opacity: 0.35; }

.people { position: absolute; inset: 0; }

.person {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  background: var(--carta);
  border: 1px solid var(--linea);
  border-radius: 11px;
  box-shadow: 0 1px 2px rgba(18, 18, 20, 0.04), 0 6px 16px -10px rgba(18, 18, 20, 0.18);
  transition: border-color 0.28s, box-shadow 0.28s;
  cursor: default;
}

/* the inner skin carries hover lift so GSAP can own the outer transform */
.person.is-lit {
  border-color: rgba(79, 70, 229, 0.45);
  box-shadow: 0 0 0 3px var(--accento-tenue), 0 10px 22px -12px rgba(79, 70, 229, 0.45);
}

.person > .avatar, .person > .who { transition: opacity 0.28s; }
.chart.is-focus .person:not(.is-lit) { box-shadow: 0 1px 2px rgba(18, 18, 20, 0.02); border-color: rgba(18, 18, 20, 0.05); }
.chart.is-focus .person:not(.is-lit) > .avatar, .chart.is-focus .person:not(.is-lit) > .who { opacity: 0.42; }

.avatar {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 8.5px;
  font-weight: 680;
  letter-spacing: 0.02em;
  color: rgba(18, 18, 20, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.person--root .avatar { width: 28px; height: 28px; font-size: 10px; }

.who { min-width: 0; }
.who__name { font-size: 11px; font-weight: 600; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.who__role { font-size: 9.5px; color: var(--grigio); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.person--root .who__name { font-size: 12.5px; }
.person--root .who__role { font-size: 10px; }

/* the fold toggle on a team lead: the count of people and a chevron */
.fold {
  position: absolute;
  top: -8px;
  right: 8px;
  height: 18px;
  min-width: 30px;
  padding: 0 5px 0 6px;
  border-radius: 999px;
  border: 1px solid var(--linea);
  background: var(--carta);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font: inherit;
  font-size: 9.5px;
  font-weight: 620;
  color: var(--inchiostro);
  box-shadow: 0 2px 6px -2px rgba(18, 18, 20, 0.16);
  cursor: pointer;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.fold svg { width: 9px; height: 9px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fold .plus { display: inline-block; width: 0; overflow: hidden; transition: width 0.25s; }
.fold.is-closed { background: var(--inchiostro); color: #fff; border-color: var(--inchiostro); }
.fold.is-closed .plus { width: 0.6em; }

.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

.pointer svg { width: 100%; height: 100%; fill: var(--inchiostro); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2)); }

@media (hover: hover) {
  .fold:hover { border-color: rgba(18, 18, 20, 0.2); }
}

/* the narrow layout (phones): no avatar on the people, shorter roles on the leads, tighter cards */
.card.is-narrow .person { padding: 0 6px; gap: 5px; }
.card.is-narrow .person--member .avatar { display: none; }
.card.is-narrow .person--lead .avatar { width: 18px; height: 18px; font-size: 7.5px; }
.card.is-narrow .head__path { font-size: 9.5px; margin: 0 6px; }

/* the people slide under their lead when a team folds, never over it */
.person--member { z-index: 1; }
.person--lead, .person--root { z-index: 2; }
