/* VioVerse Mockup -- Wait-UX interstitial overlay
   Two surfaces, one component:
   - Window A (mode='window-a'): rotating multi-card sequence, time-based
     progress bar with asymptotic curve, no Continue, auto-dismiss on apiPreview
     resolve.
   - Pre-terminal-question (mode='pre-terminal'): single card, promise-anchored
     progress bar, grayed Continue until promise resolves and bar reaches 100%.
   Both layer ON TOP OF the underlying screen (scanning or questions); they do
   not replace it. */

.wait-interstitial {
  position: fixed;
  /* AG-5: scrim starts below the nav so the wordmark stays vivid.
     The coral frame and sidebar are handled by the body.app-framed
     override below. */
  top: var(--shell-nav-h, 60px);
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 500;
  background: var(--backdrop-scrim);
  opacity: 0;
  transition: opacity 0.25s ease-out;
}

/* AG-5 framed state: scrim also clears the sidebar and L-frame. */
body.app-framed .wait-interstitial {
  left: var(--shell-sidebar-w, 63px);
  top: calc(var(--shell-top-gap, 10px) + var(--shell-nav-h, 60px));
}

.wait-interstitial.visible {
  display: flex;
  opacity: 1;
}

.wait-interstitial-card {
  position: relative;
  background: var(--bone-0);
  border-radius: var(--radius);
  padding: 28px 32px 24px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(30, 42, 53, 0.08);
  font-family: 'Plus Jakarta Sans', Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; /* FS-D5: normalized to match .home */
  color: var(--text);
  transform: translateY(8px);
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.wait-interstitial.visible .wait-interstitial-card {
  transform: translateY(0);
}

/* Progress dots row at top of card. One tappable dot per card. Three discrete
   states reflect card position in the sequence:
   - default        upcoming card (light gray pill)
   - .done          already-visited card (filled coral, slightly faded)
   - .current       this card (filled coral, slightly larger)
   Dots are buttons so tap targets are large and accessible. */
.wait-interstitial-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  min-height: 12px;
  align-items: center;
}

.wait-interstitial-dot {
  flex: 0 0 28px;
  height: 6px;
  border-radius: 999px;
  background: rgba(30, 42, 53, 0.14);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s, height 0.18s, flex-basis 0.18s;
  font: inherit;
  color: inherit;
}

.wait-interstitial-dot:hover {
  background: rgba(30, 42, 53, 0.24);
}

.wait-interstitial-dot.done {
  background: rgba(242, 100, 25, 0.55);
}

.wait-interstitial-dot.current {
  background: var(--coral);
  flex: 0 0 36px;
  height: 8px;
}

.wait-interstitial-dot:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}

/* Eyebrow: small uppercase phase label. */
.wait-interstitial-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 10px;
}

/* Headline: Plus Jakarta Sans 700 per vioverse-mockup.md typography hierarchy. */
.wait-interstitial-headline {
  font-family: 'Plus Jakarta Sans', Inter, system-ui, sans-serif;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 18px;
  color: var(--text);
}

.wait-interstitial-headline em {
  font-style: normal;
  color: var(--coral);
}

/* Visual area: implementing session's design pass fills this. Reserved
   slot keeps card height stable across copy variations. */
.wait-interstitial-visual {
  margin: 6px 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
}

.wait-interstitial-visual svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.wait-interstitial-subcopy {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  opacity: 0.78;
  margin: 0 0 22px;
}

.wait-interstitial-subcopy strong {
  color: var(--text);
  opacity: 1;
  font-weight: 600;
}

/* Progress bar. Pill-rounded per the project's existing confidence-bar
   convention. Fill animates via JS (asymptotic curve in window-a mode,
   promise-anchored in pre-terminal mode). */
.wait-interstitial-bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(30, 42, 53, 0.10);
  overflow: hidden;
  margin-bottom: 18px;
}

.wait-interstitial-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--coral);
  border-radius: inherit;
  transition: width 0.25s ease-out;
}

/* Actions row: Back on the left, primary (Next or Continue) on the right.
   Window-a mode shows Back from Card 2 onward and Continue only on the
   final card; intermediate cards show "Next ›" via label swap (the same
   .wait-interstitial-continue button is used for both Next and Continue).
   Pre-terminal mode keeps Back hidden and uses Continue exclusively.

   Design-family aligned with .q-back / .q-next in questions.css (pill shape,
   ink/bone color tokens, transparent-Back-with-filled-primary pattern).
   Specific geometry values (padding, font-size, hover effect, focus +
   disabled states) are intentionally tuned per-context and do NOT need to
   match questions.css numerically. See the 7-impl-F .q-* vs
   .wait-interstitial-* comparison report (BACKLOG-archive.md entry,
   2026-05-18) for the full divergence inventory if reconciliation is ever
   revisited. */
.wait-interstitial-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

/* When Back is hidden the primary button right-aligns naturally because
   space-between pushes it to the right edge of the row. */
.wait-interstitial-back {
  font-family: inherit;
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(30, 42, 53, 0.18);
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.wait-interstitial-back:hover {
  border-color: var(--ink-0);
  background: rgba(30, 42, 53, 0.04);
}

.wait-interstitial-back:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.wait-interstitial-continue {
  font-family: inherit;
  background: var(--ink-0);
  color: var(--bone-0);
  border: 1px solid var(--ink-0);
  border-radius: 999px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  margin-left: auto;
  min-width: 150px;
  text-align: center;
}

.wait-interstitial-continue:disabled,
.wait-interstitial-continue[aria-disabled="true"] {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.wait-interstitial-continue:not(:disabled):hover {
  transform: translateY(-1px);
}

/* Mode-specific: pre-terminal hides the multi-card dots row (single card). */
.wait-interstitial[data-mode="pre-terminal"] .wait-interstitial-dots {
  display: none;
}

/* Mode-specific: upload is pure feedback -- no Continue/Back affordance and no
   dots. It auto-dismisses when the bureau-confirm modal is ready, so there is
   nothing for the user to click. */
.wait-interstitial[data-mode="upload"] .wait-interstitial-actions {
  display: none;
}
.wait-interstitial[data-mode="upload"] .wait-interstitial-dots {
  display: none;
}

/* AG-5: sidebar stays vivid but non-interactive while the interstitial
   is visible. Without this, the sidebar is clickable (scrim no longer
   covers it) and navigating mid-scan orphans the async upload pipeline. */
body:has(.wait-interstitial.visible) .sidebar {
  pointer-events: none;
}

/* AG-5 mobile: sidebar is a bottom tab bar, no L-frame to protect.
   Clear the desktop sidebar offset; nav offset stays from base rule. */
@media (max-width: 768px) {
  body.app-framed .wait-interstitial {
    left: 0;
    top: var(--shell-nav-h, 60px);
  }
}

/* prefers-reduced-motion: skip card slide-in, snap fade only. */
@media (prefers-reduced-motion: reduce) {
  .wait-interstitial,
  .wait-interstitial-card,
  .wait-interstitial-bar-fill,
  .wait-interstitial-dot-fill {
    transition: none;
  }
  .wait-interstitial-card {
    transform: none;
  }
}
