/* Avanzamento dell'analisi: passi, cronometro, stato compatto. */

.progress {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: end;
}
.progress-title {
  margin: 0 0 2.5rem;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.4rem, 5vw, 4.25rem); line-height: 1; letter-spacing: -.01em;
  word-break: break-word;
}
.progress-title .city { color: var(--on-dark-mute); font-style: italic; }

/* Passi */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; max-width: 40rem; }
.step {
  display: grid; grid-template-columns: 2rem 1fr auto; gap: 1rem; align-items: center;
  padding: .85rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  color: var(--on-dark-mute);
  font-size: clamp(1.02rem, 1.5vw, 1.2rem); font-weight: 300;
  transition: color .8s var(--ease-soft);
}
.step:last-child { border-bottom: 0; }
.step[data-state="running"], .step[data-state="done"] { color: var(--white); }
.step[data-state="error"] { color: var(--on-dark-mute); }
.step-time { font-size: .9rem; color: var(--on-dark-mute); font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .8s var(--ease-soft); }
.step[data-state="done"] .step-time, .step[data-state="error"] .step-time { opacity: 1; }

.step-icon { position: relative; width: 1.5rem; height: 1.5rem; }
.step-icon::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  transition: background .6s var(--ease-soft), border-color .6s var(--ease-soft), transform .6s var(--ease);
}
.step-icon svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: var(--black); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.step-icon .check { stroke-dasharray: 14; stroke-dashoffset: 14; transition: stroke-dashoffset .6s var(--ease) .15s; }
.step-icon .cross { stroke: var(--on-dark-mute); opacity: 0; }

.step[data-state="running"] .step-icon::before {
  border-color: rgba(212, 162, 81, .25);
  border-top-color: var(--gold);
  animation: spin 1.1s linear infinite;
}
.step[data-state="done"] .step-icon::before { background: var(--gold); border-color: var(--gold); transform: scale(1); }
.step[data-state="done"] .check { stroke-dashoffset: 0; }
.step[data-state="error"] .cross { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cronometro */
.timer { text-align: right; line-height: 1; padding-bottom: .4rem; }
.timer-value {
  font-family: var(--sans); font-weight: 200; font-variant-numeric: tabular-nums;
  font-size: clamp(4.5rem, 11vw, 9.5rem); letter-spacing: -.04em; color: var(--white);
}
.timer-unit { font-weight: 200; font-size: clamp(1.8rem, 3.5vw, 3rem); color: var(--gold); margin-left: .3rem; }
.timer-label { display: block; margin-top: 1rem; font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; color: var(--on-dark-mute); }
.progress.is-done .timer-value { color: var(--gold-light); transition: color 1s var(--ease-soft); }

/* Errore */
body[data-state="error"] .timer { display: none; }
.progress-error { margin-top: 1rem; max-width: 40rem; }
.progress-error-text { margin: 0 0 1.75rem; font-size: 1.2rem; font-weight: 300; color: var(--white); }
.progress-error-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* Stato compatto (in basso, quando l'avanzamento è fuori vista) */
.status-pill {
  position: fixed; left: 50%; bottom: max(1.25rem, env(safe-area-inset-bottom)); z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 1.25rem .8rem 1rem;
  background: rgba(11, 11, 13, .92); color: var(--white);
  border: 1px solid rgba(212, 162, 81, .28); border-radius: 999px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: .92rem; white-space: nowrap;
  opacity: 0; transform: translate(-50%, 1rem); pointer-events: none;
  transition: opacity .7s var(--ease-soft), transform .9s var(--ease);
}
.status-pill.is-visible { opacity: 1; transform: translate(-50%, 0); }
.pill-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--gold); animation: pulse 1.6s var(--ease-soft) infinite; }
.status-pill.is-done .pill-dot { animation: none; }
.pill-time { color: var(--gold-light); font-variant-numeric: tabular-nums; }
@keyframes pulse { 50% { opacity: .3; } }

@media (max-width: 760px) {
  .progress { grid-template-columns: 1fr; gap: 1.5rem; }
  .timer { order: -1; text-align: left; padding: 0; }
  .timer-label { margin-top: .6rem; }
  .progress-title { margin-bottom: 1.5rem; }
  .status-pill { font-size: .85rem; max-width: calc(100vw - 2rem); }
  .pill-text { overflow: hidden; text-overflow: ellipsis; }
}
