/* The AI agent card with steps that check off, on black, in the style of the light effects of AI apps. */
:root {
  --fondo: #000000;              /* the page */
  --card: #0c0c0e;               /* the card */
  --bordo: rgba(255, 255, 255, 0.08);
  --superficie: rgba(255, 255, 255, 0.035); /* the request box */
  --testo: #fafafa;              /* titles, the request, the numbers */
  --secondo: #a1a1aa;            /* finished steps, the summary */
  --terzo: #71717a;              /* times, labels */
  --barra: rgba(255, 255, 255, 0.2); /* the bars that are not the main one */
  --accento: #8fa2ff;            /* the beam, the checks, the main bar */
}

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

html, body { height: 100%; }

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

/* the card grows downwards while it works: the script sets the top padding so that, finished, it sits in the middle */
.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: 14px;
  overflow: hidden;
}

/* ---------- the card ---------- */
.agent {
  --row: clamp(27px, 4.4vh, 32px);
  position: relative;
  width: min(408px, 100%);
  padding: clamp(14px, 2.6vh, 18px) 16px clamp(14px, 2.6vh, 17px);
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--bordo);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 24px 60px -30px rgba(0, 0, 0, 0.9);
  isolation: isolate;
}

/* the faint light in the corner while it works */
.agent__wash {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(90% 60% at 0% 0%, color-mix(in srgb, var(--accento) 13%, transparent), transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

/* the beam along the border */
.beam {
  position: absolute;
  left: -1px; top: -1px;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
}
.beam path { fill: none; stroke-linecap: round; }
.beam__ring { stroke: var(--accento); stroke-width: 1; opacity: 0; }
.beam__glow { stroke: var(--accento); stroke-width: 7; opacity: 0.55; filter: url(#beam-soft); }
.beam__tail { stroke: var(--accento); stroke-width: 1.2; opacity: 0.35; }
.beam__body { stroke: var(--accento); stroke-width: 1.5; opacity: 0.9; }
.beam__head { stroke: #ffffff; stroke-width: 1.8; }

/* ---------- the head ---------- */
.agent__head { display: flex; align-items: center; gap: 10px; }

.agent__mark {
  flex: none;
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.agent__mark svg { width: 18px; height: 18px; overflow: visible; fill: none; stroke: var(--testo); stroke-width: 1.7; stroke-linecap: round; }

.agent__who { flex: 1; min-width: 0; }
.agent__name { font-size: 14px; line-height: 18px; font-weight: 620; letter-spacing: -0.01em; }
.agent__sub {
  display: flex; align-items: center;
  margin-top: 1px;
  font-size: 12px; line-height: 16px;
  color: var(--terzo);
  white-space: nowrap;
}
.agent__sep { margin: 0 5px; opacity: 0.7; }
.agent__state {
  position: relative;
  display: block;
  height: 16px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.agent__state > span { display: block; white-space: pre; }

/* Stop, then Run again */
.act {
  flex: none;
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px;
  padding: 0 12px 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #e4e4e7;
  font: inherit; font-size: 12.5px; font-weight: 560;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.act.is-hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.16); }
@media (hover: hover) { .act:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.16); } }
.act:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
.act__ico { width: 15px; height: 15px; display: grid; place-items: center; flex: none; }
.act__ico svg { width: 15px; height: 15px; overflow: visible; }
.act__stop { fill: currentColor; }
.act__again { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.act__label { position: relative; display: block; height: 18px; line-height: 18px; overflow: hidden; white-space: nowrap; }
.act__label span { display: block; white-space: pre; }

/* ---------- the request ---------- */
.ask {
  display: flex; align-items: center; gap: 9px;
  margin-top: clamp(11px, 2vh, 14px);
  padding: 0 12px;
  height: clamp(36px, 5.4vh, 40px);
  border-radius: 11px;
  background: var(--superficie);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.ask__ico { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--terzo); stroke-width: 1.5; stroke-linecap: round; }
.ask__text { font-size: 13.5px; font-weight: 520; color: #ececef; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- the steps ---------- */
.steps {
  list-style: none;
  margin-top: clamp(6px, 1.2vh, 8px);
  padding-left: 2px;
}
.step { position: relative; height: 0; overflow: visible; }
.step__row {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: var(--row);
  opacity: 0;
}
/* the thin line that joins the icons, drawn when the next step arrives */
.step__line {
  position: absolute;
  left: 7.5px;
  top: calc(var(--row) * -0.5 + 9px);
  height: calc(var(--row) - 18px);
  width: 1px;
  background: rgba(255, 255, 255, 0.12);
  transform-origin: 50% 0;
  transform: scaleY(0);
}
.step__ico { position: relative; width: 16px; height: 16px; flex: none; }
.step__ico svg { width: 16px; height: 16px; overflow: visible; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.s-track { stroke: rgba(255, 255, 255, 0.14); stroke-width: 1.5; }
.s-arc { stroke: rgba(255, 255, 255, 0.92); stroke-width: 1.5; stroke-dasharray: 26 100; }
.s-ring { stroke: var(--accento); stroke-width: 1.5; stroke-dasharray: 100 102; stroke-dashoffset: 101; }
.s-check { stroke: var(--accento); stroke-width: 1.7; stroke-dasharray: 100 102; stroke-dashoffset: 101; }
.s-x { stroke: var(--terzo); stroke-width: 1.5; stroke-dasharray: 100 102; stroke-dashoffset: 101; }

.step__text {
  flex: 1; min-width: 0;
  font-size: 13px; line-height: 18px; font-weight: 500;
  color: var(--secondo);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* the light that runs across the letters while the step runs */
.step__text.is-run {
  background-image: linear-gradient(90deg, #6b6b74 0%, #6b6b74 38%, #ffffff 50%, #6b6b74 62%, #6b6b74 100%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.step__text.is-stop { color: var(--terzo); }
.step__time {
  position: relative;
  height: 18px; line-height: 18px;
  overflow: hidden;
  font-size: 12px; font-weight: 500;
  color: var(--terzo);
  font-variant-numeric: tabular-nums;
}
.step__time span { display: block; }

/* ---------- the result ---------- */
.result { height: 0; overflow: hidden; }
/* only padding here, no margin: the script measures this box to open the result to its height */
.result__in { position: relative; padding-top: calc(clamp(6px, 1.2vh, 8px) + clamp(10px, 1.8vh, 13px)); }
.result__rule {
  position: absolute; left: 0; right: 0; top: clamp(6px, 1.2vh, 8px);
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.result__body { display: flex; align-items: flex-end; gap: 14px; }
.result__text { flex: 1; min-width: 0; font-size: 13px; line-height: 19px; color: var(--secondo); padding-bottom: 14px; }
.result__text p { white-space: normal; }
.result__text b { color: var(--testo); font-weight: 600; }
.result__text .wd { display: inline-block; white-space: pre; }

/* the small bar chart: one column per plan, the bar for this quarter and a thin mark for the last one */
.chart {
  --bars: clamp(34px, 7vh, 46px);
  flex: none;
  position: relative;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 17px 0 16px;
}
.chart__base {
  position: absolute; left: -2px; right: -2px; bottom: 15px;
  height: 1px; background: rgba(255, 255, 255, 0.14);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.col { position: relative; width: 30px; display: flex; justify-content: center; }
.col__track { position: relative; width: 16px; height: var(--bars); }
/* the bar grows in height and its value rides on its top */
.col__bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 0;
  border-radius: 4px 4px 1.5px 1.5px;
  background: var(--barra);
}
.col__val {
  position: absolute; left: -12px; right: -12px; bottom: 0;
  margin-bottom: 4px;
  text-align: center;
  font-size: 10.5px; line-height: 13px; font-weight: 560;
  color: #d4d4d8;
  font-variant-numeric: tabular-nums;
  opacity: 0;
}
.col.is-top .col__bar {
  --shine: 120%;
  background:
    linear-gradient(0deg, transparent calc(var(--shine) - 22%), rgba(255, 255, 255, 0.55) var(--shine), transparent calc(var(--shine) + 22%)),
    linear-gradient(180deg, color-mix(in srgb, var(--accento) 82%, #fff), var(--accento));
  box-shadow: 0 0 14px -2px color-mix(in srgb, var(--accento) 55%, transparent);
}
.col__lab {
  position: absolute; left: 50%; bottom: -16px;
  translate: -50% 0;
  font-size: 10px; line-height: 13px;
  font-variation-settings: "wdth" 88;
  color: var(--terzo);
  white-space: nowrap;
}

.frame { position: absolute; left: 0; top: 0; width: 0; height: 0; visibility: hidden; pointer-events: none; }

/* ---------- the drawn pointer of the autopilot ---------- */
.ghost {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  fill: #fafafa; stroke: #000; stroke-width: 1.3; stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

@media (max-width: 380px) {
  .agent { padding-left: 14px; padding-right: 14px; }
  .result__text { font-size: 12.5px; line-height: 18px; }
  .ask__text { font-size: 13px; }
  .chart { gap: 6px; }
  .col { width: 28px; }
}
