/* ---------- States: empty, loading, locked, waiting, not available, error ----------
   One recipe for every state: what happened, why, and the one next step.
   Unlayered and scoped under .pitch-site like the rest of the stage. */

.pitch-site .stage-state {
  align-items: flex-start;
  background: var(--ps-paper-raised);
  border: 2px solid var(--ps-ink);
  border-radius: 8px;
  color: var(--ps-ink);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 34rem;
  padding: 14px 16px;
  text-align: start;
}

.pitch-site .stage-state__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0;
}

.pitch-site .stage-state__body {
  color: var(--ps-ink-soft);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  max-width: 60ch;
  text-wrap: pretty;
}

.pitch-site .stage-state__summary,
.pitch-site .stage-state__ref {
  color: var(--ps-ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  margin: 0;
}

.pitch-site .stage-state__actions {
  margin-block-start: 4px;
}

.pitch-site .stage-state__glyph {
  display: block;
  height: 54px;
  width: 54px;
}

.pitch-site .stage-state__glyph svg {
  display: block;
  height: 100%;
  width: 100%;
}

.pitch-site .stage-state--empty {
  align-items: center;
  background: transparent;
  border: 2px dashed rgba(14, 17, 17, 0.3);
  justify-content: center;
  max-width: none;
  padding: 32px 20px;
  text-align: center;
}

.pitch-site .stage-state--waiting {
  background: var(--ps-paper);
}

.pitch-site .stage-state--error {
  border-color: var(--ps-red);
}

/* ---------- Locked: the lock card, and a preview that keeps names readable ---------- */

.pitch-site .locked-section__card.stage-state {
  align-items: flex-start;
  text-align: start;
}

.pitch-site .locked-section--preview .locked-section__overlay {
  justify-content: flex-start;
}

.pitch-site .locked-section--preview .locked-section__card.stage-state {
  max-width: none;
  width: 100%;
}

.pitch-site .stage-lock-offers {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  list-style: none;
  margin: 0;
  max-width: 30rem;
  padding: 0;
  width: 100%;
}

.pitch-site .stage-lock-offer {
  border: 1px solid rgba(14, 17, 17, 0.14);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 2px;
  padding: 8px;
}

.pitch-site .stage-lock-offer--cheapest {
  background: color-mix(in srgb, var(--ps-yellow) 35%, var(--ps-paper-raised));
  border: 2px solid var(--ps-ink);
}

.pitch-site .stage-lock-offer__name {
  font-size: 13px;
}

.pitch-site .stage-lock-offer__price {
  font-family: var(--font-mono);
}

/* ---------- Locked value: the hatched stand-in for a number ---------- */

.pitch-site .stage-locked-value {
  background: repeating-linear-gradient(45deg, var(--ps-cream-soft) 0 4px, var(--ps-paper-shade) 4px 8px);
  border-radius: 3px;
  display: inline-block;
  height: 11px;
  vertical-align: middle;
  width: 52px;
}

/* ---------- Loading: skeleton rows under a thin yellow line ---------- */

.pitch-site .stage-skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pitch-site .stage-skeleton__row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 24px minmax(0, 1fr) 60px;
  height: 30px;
}

.pitch-site .stage-skeleton__bar {
  background: var(--ps-paper-shade);
  border-radius: 3px;
  height: 12px;
}

.pitch-site .stage-skeleton__row:nth-child(3n) .stage-skeleton__bar--text {
  width: 62%;
}

.pitch-site .stage-skeleton__row:nth-child(3n + 1) .stage-skeleton__bar--text {
  width: 80%;
}

.pitch-site .stage-skeleton__row:nth-child(3n + 2) .stage-skeleton__bar--text {
  width: 70%;
}

.pitch-site .stage-progress {
  animation: stage-progress 1.2s ease-in-out infinite;
  background: var(--ps-yellow);
  border-radius: 2px;
  display: block;
  height: 3px;
  transform-origin: left center;
}

/* ---------- Switching view: the old view fades and the yellow line runs ---------- */

.pitch-site--app .stage__main:has(> #stage_view[busy])::before {
  animation: stage-progress 1.2s ease-in-out 0.15s infinite both;
  background: var(--ps-yellow);
  content: "";
  height: 3px;
  inset: 0 0 auto;
  position: absolute;
  transform-origin: left center;
  z-index: 2;
}

.pitch-site--app .stage:has(#stage_view[busy]) .stage__pitch-svg > :not([class^="stage-pitch__"]) {
  opacity: 0.35;
  transition: opacity 0.15s ease 0.15s;
}

@keyframes stage-progress {
  0% {
    opacity: 1;
    transform: scaleX(0);
  }

  70% {
    opacity: 1;
    transform: scaleX(0.85);
  }

  100% {
    opacity: 0;
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pitch-site .stage-progress,
  .pitch-site--app .stage__main:has(> #stage_view[busy])::before {
    animation: none;
    transform: scaleX(0.6);
  }
}
