/* The customers table with columns to choose: the customers of an invented SaaS, Orbitly, in a soft grey shell with a
   white card inside. The chips above the table show or hide a column: the widths live in one CSS variable (--cols)
   that the script writes at every frame, so the header and every row share the same grid while it moves. */
:root {
  --page: #ffffff;          /* the page */
  --shell: #f4f4f6;         /* the outer shell */
  --card: #ffffff;          /* the table card */
  --ink: #16161a;           /* the words */
  --muted: #6f6f7a;         /* the small words */
  --faint: #a5a5ae;         /* the header labels */
  --line: rgba(22, 22, 26, 0.07); /* the hairlines */
  --accent: #5b5bf0;        /* the chips, the light of a new column */
  --accent-soft: #efeffe;   /* the chip that is on */
  --mint: #1f9d74;          /* the health meter */
  --cols: minmax(0, 1fr) 92px 84px 0px 96px 0px;
}

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

html, body { height: 100%; overflow: hidden; }

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

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

.wrap { width: min(640px, 100%); }

.shell {
  position: relative;
  background: var(--shell);
  border-radius: 22px;
  padding: 5px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 1px rgba(22, 22, 26, 0.05),
    0 2px 4px -2px rgba(22, 22, 26, 0.06),
    0 24px 60px -28px rgba(30, 30, 60, 0.28);
}

.shell__head { display: flex; align-items: center; gap: 10px; padding: clamp(6px, 1.6vh, 10px) 10px clamp(7px, 1.8vh, 11px) 9px; }
.shell__mark {
  width: 28px; height: 28px; flex: none; padding: 5px; border-radius: 9px;
  background: linear-gradient(160deg, #2a2a33, #111116);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
  fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round;
}
.shell__text { min-width: 0; }
.shell__title { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.shell__crumb { color: var(--faint); font-weight: 480; }
.shell__sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.count { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; display: flex; align-items: baseline; }
.count__roll { display: inline-block; color: var(--ink); font-weight: 620; min-width: 0.62em; text-align: right; margin-right: 0.3em; }

.card {
  position: relative;
  background: var(--card);
  border-radius: 17px;
  box-shadow:
    0 0 0 1px rgba(22, 22, 26, 0.06),
    0 1px 2px rgba(22, 22, 26, 0.05),
    0 8px 20px -12px rgba(22, 22, 26, 0.14);
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 1), transparent);
}

/* ---------- the chips ---------- */
.chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: clamp(8px, 2vh, 12px) 12px clamp(8px, 2vh, 12px);
  border-bottom: 1px solid var(--line);
}
.chip {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px 0 7px;
  border: 0; border-radius: 9px;
  font: inherit; font-size: 12px; font-weight: 540; font-variation-settings: "wdth" 100;
  color: var(--muted);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(22, 22, 26, 0.09), 0 1px 1px rgba(22, 22, 26, 0.04);
  cursor: pointer;
  transition: color 0.25s, background-color 0.25s, box-shadow 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.chip__box {
  width: 15px; height: 15px; flex: none; border-radius: 5px;
  box-shadow: inset 0 0 0 1.25px rgba(22, 22, 26, 0.22);
  display: grid; place-items: center;
  transition: background-color 0.25s, box-shadow 0.25s;
}
.chip__box svg { width: 11px; height: 11px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chip[aria-pressed="true"] {
  color: var(--ink);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent), 0 1px 2px color-mix(in srgb, var(--accent) 18%, transparent);
}
.chip[aria-pressed="true"] .chip__box {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 2px color-mix(in srgb, var(--accent) 45%, transparent);
}
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  .chip:hover { color: var(--ink); box-shadow: 0 0 0 1px rgba(22, 22, 26, 0.16), 0 2px 4px -1px rgba(22, 22, 26, 0.08); }
  .chip[aria-pressed="true"]:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 2px 5px -1px color-mix(in srgb, var(--accent) 25%, transparent); }
}
.chip.is-hover { color: var(--ink); }
.chip__short { display: none; }

/* ---------- the table ---------- */
.table { position: relative; padding: 4px 6px 6px; }

.thead, .row {
  display: grid;
  grid-template-columns: var(--cols);
  align-items: center;
  padding: 0 8px;
}
.thead { height: clamp(26px, 6vh, 32px); font-size: 11px; font-weight: 560; color: var(--faint); letter-spacing: 0.01em; }

.cell { min-width: 0; overflow: hidden; white-space: nowrap; }
.cell__in { display: inline-flex; align-items: center; gap: 8px; padding-right: 12px; transform-origin: 0 50%; }

.row {
  position: relative;
  height: clamp(30px, 7.2vh, 42px);
  border-radius: 10px;
  font-size: 13px;
  transition: transform 0.35s cubic-bezier(0.2, 1.4, 0.4, 1), box-shadow 0.35s, background-color 0.25s;
}
.row + .row::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: 0; height: 1px; background: var(--line);
  transition: opacity 0.2s;
}
.row.is-hover {
  transform: translateY(-1px);
  background: #fff;
  box-shadow: 0 0 0 1px rgba(22, 22, 26, 0.05), 0 6px 16px -8px rgba(22, 22, 26, 0.22), 0 1px 2px rgba(22, 22, 26, 0.05);
  z-index: 2;
}
.row.is-hover::before, .row.is-hover + .row::before { opacity: 0; }
@media (hover: hover) {
  .row:hover {
    transform: translateY(-1px);
    background: #fff;
    box-shadow: 0 0 0 1px rgba(22, 22, 26, 0.05), 0 6px 16px -8px rgba(22, 22, 26, 0.22), 0 1px 2px rgba(22, 22, 26, 0.05);
    z-index: 2;
  }
  .row:hover::before, .row:hover + .row::before { opacity: 0; }
}

.who__pic {
  width: 22px; height: 22px; flex: none; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 9.5px; font-weight: 700; color: #fff; letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(22, 22, 26, 0.18);
}
.who__name { font-weight: 560; overflow: hidden; text-overflow: ellipsis; }
.cell--who .cell__in { max-width: 100%; }

.plan { font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 6px; }
.plan--enterprise { color: #4b3fc9; background: #efedff; box-shadow: inset 0 0 0 1px rgba(75, 63, 201, 0.12); }
.plan--pro { color: #2563c9; background: #eaf2ff; box-shadow: inset 0 0 0 1px rgba(37, 99, 201, 0.12); }
.plan--starter { color: #62626c; background: #f2f2f4; box-shadow: inset 0 0 0 1px rgba(22, 22, 26, 0.06); }

.num { font-weight: 540; font-variant-numeric: proportional-nums; }
.soft { color: var(--muted); }

.meter { width: 38px; height: 5px; border-radius: 3px; background: #ececef; overflow: hidden; flex: none; }
.meter i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, color-mix(in srgb, var(--mint) 70%, #fff), var(--mint)); }
.meter--low i { background: linear-gradient(90deg, #f3c27a, #e08b2c); }

/* the light of a column that has just opened: a soft band from the header down, with a 1px line on top */
.glow {
  position: absolute; top: 4px; bottom: 6px; left: 0; width: 0;
  border-radius: 10px; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 11%, transparent), color-mix(in srgb, var(--accent) 3%, transparent) 70%, transparent);
}
.glow::before {
  content: ""; position: absolute; left: 8px; right: 8px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

/* ---------- the drawn pointer of the autopilot ---------- */
.ghost {
  position: absolute; left: 0; top: 0; width: 22px; height: 22px; z-index: 10;
  pointer-events: none; opacity: 0;
  fill: #16161a; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
}

@media (max-width: 480px) {
  .stage { padding: 6px; }
  .shell { border-radius: 18px; padding: 3px; }
  .chips { flex-wrap: nowrap; }
  .chip__long { display: none; }
  .chip__short, .chip:not(:has(.chip__short)) .chip__long { display: inline; }
  .card { border-radius: 14px; }
  .chips { gap: 4px; padding-left: 7px; padding-right: 7px; }
  .chip { height: 25px; padding: 0 7px 0 5px; font-size: 11px; gap: 4px; }
  .chip__box { width: 13px; height: 13px; border-radius: 4px; }
  .table { padding: 2px 3px 4px; }
  .thead, .row { padding: 0 6px; }
  .row { font-size: 11.5px; }
  .cell__in { gap: 6px; padding-right: 6px; }
  .who__pic { width: 19px; height: 19px; font-size: 8.5px; border-radius: 6px; }
  .plan { font-size: 10px; padding: 2px 5px; letter-spacing: -0.01em; }
  .meter { width: 26px; }
  .shell__sub { display: none; }
}
