/* Interactive guided demo. Styled with Mellio's mellio-visual tokens (--mv-*)
   so the guidance chrome reads as part of the app — single blue accent, serif
   titles, mono labels, ink ramp, hairlines — not a generic product tour. */

body.mellio-demo-mode {
  --demo-ink: var(--mv-ink);
  --demo-ink-70: var(--mv-ink-70);
  --demo-muted: var(--mv-ink-40);
  --demo-rule: var(--mv-ink-12);
  --demo-accent: var(--mv-blue);
  --demo-accent-soft: var(--mv-blue-soft);
  --demo-panel: rgba(255, 255, 255, 0.97);
}

/* ---- spotlight: focus the live UI, ring it in the accent ---- */
.demo-guide-spotlight {
  position: fixed;
  z-index: 8900;
  pointer-events: none;
  border: 2px solid var(--mv-paper);
  border-radius: var(--mv-r-btn);
  box-shadow:
    0 0 0 9999px rgba(27, 30, 36, 0.44),
    0 18px 56px rgba(27, 30, 36, 0.20),
    inset 0 0 0 1px var(--mv-blue-mid);
  transition:
    left 220ms var(--mv-ease), top 220ms var(--mv-ease),
    width 220ms var(--mv-ease), height 220ms var(--mv-ease),
    border-radius 220ms var(--mv-ease), opacity 140ms var(--mv-ease);
}

/* ---- popover: a Mellio panel ---- */
.demo-guide-popover {
  position: fixed;
  z-index: 8910;
  width: min(384px, calc(100vw - 32px));
  color: var(--demo-ink);
  background: var(--demo-panel);
  border: 1px solid var(--mv-ink-12);
  border-radius: var(--mv-r-panel);
  box-shadow: 0 1px 2px rgba(20, 24, 33, 0.05), 0 18px 48px rgba(20, 24, 33, 0.15);
  backdrop-filter: blur(14px);
  overflow: hidden;
  transition: left 220ms var(--mv-ease), top 220ms var(--mv-ease), opacity 140ms var(--mv-ease);
}

.demo-guide-spotlight.is-transitioning,
.demo-guide-popover.is-transitioning { opacity: 0; pointer-events: none; }

body.help-drawer-open .demo-guide-spotlight,
body.help-drawer-open .demo-guide-popover { opacity: 0; pointer-events: none; }

.demo-guide-body { padding: 17px 18px 14px; }

/* mono caps system-label, like the app's rails/eyebrows */
.demo-guide-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
  font: 600 10px/1 var(--mv-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mv-ink-40);
}

.demo-guide-step-count { color: var(--mv-blue); white-space: nowrap; }

/* serif title, like a result-card heading */
.demo-guide-title {
  margin: 0 0 7px;
  font: 600 19px/1.2 var(--mv-serif);
  letter-spacing: -0.01em;
  color: var(--mv-ink);
}

.demo-guide-copy {
  margin: 0;
  font: 400 13.5px/1.58 var(--mv-sans);
  color: var(--mv-ink-70);
}

.demo-guide-copy strong { font-weight: 600; color: var(--mv-ink); }
.demo-guide-copy em { font-style: italic; }

.demo-guide-copy code {
  font: 500 12px/1.4 var(--mv-mono);
  background: var(--mv-blue-soft);
  border: 1px solid color-mix(in srgb, var(--mv-blue) 16%, transparent);
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--mv-blue);
}

.demo-guide-keytip {
  font-family: var(--mv-serif);
  font-style: italic;
  font-size: 12.5px;
  color: var(--mv-ink-40);
}

.demo-guide-keytip kbd {
  font: 500 11px/1 var(--mv-mono);
  font-style: normal;
  background: var(--mv-ink-05, rgba(27, 30, 36, 0.05));
  border: 1px solid var(--mv-ink-12);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--mv-ink-70);
}

/* ---- tools row: sample note + section jump + restart ---- */
.demo-guide-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--mv-ink-08);
}

.demo-guide-sample-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--mv-ink-40);
  font: 600 11px/1 var(--mv-sans);
  white-space: nowrap;
}

.demo-guide-sample-note::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mv-blue);
  box-shadow: 0 0 0 3px var(--mv-blue-soft);
}

.demo-guide-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--mv-ink-40);
  font: 600 11px/1 var(--mv-sans);
  white-space: nowrap;
}

.demo-guide-jump select,
.demo-guide-tool-btn {
  height: 28px;
  border: 1px solid var(--mv-ink-12);
  border-radius: var(--mv-r-btn);
  background: var(--mv-paper);
  color: var(--mv-ink-70);
  font: 600 11.5px/1 var(--mv-sans);
  box-shadow: 0 1px 2px rgba(20, 24, 33, 0.04);
  cursor: pointer;
  transition: color 0.15s var(--mv-ease), box-shadow 0.15s var(--mv-ease), transform 0.12s var(--mv-ease);
}

.demo-guide-jump select { max-width: 116px; padding: 0 26px 0 9px; }
.demo-guide-tool-btn { padding: 0 11px; white-space: nowrap; }

.demo-guide-jump select:hover,
.demo-guide-tool-btn:hover {
  color: var(--mv-ink);
  box-shadow: 0 3px 10px -3px rgba(27, 30, 36, 0.2), inset 0 0 0 1px var(--mv-ink-12);
  transform: translateY(-1px);
}

.demo-guide-jump select:focus-visible,
.demo-guide-tool-btn:focus-visible {
  outline: 2px solid var(--mv-blue-mid);
  outline-offset: 2px;
}

/* ---- footer ---- */
.demo-guide-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px 15px;
  border-top: 1px solid var(--mv-ink-08);
}

.demo-guide-foot .spacer { flex: 1; }

.demo-guide-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 33px;
  padding: 0 13px;
  border: 1px solid var(--mv-ink-12);
  border-radius: var(--mv-r-btn);
  background: var(--mv-paper);
  color: var(--mv-ink-70);
  font: 600 12px/1 var(--mv-sans);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(20, 24, 33, 0.04);
  transition: color 0.15s var(--mv-ease), background 0.15s var(--mv-ease), box-shadow 0.2s var(--mv-ease), transform 0.12s var(--mv-ease);
}

.demo-guide-btn:hover {
  color: var(--mv-ink);
  box-shadow: 0 4px 12px -4px rgba(27, 30, 36, 0.22), inset 0 0 0 1px var(--mv-ink-12);
  transform: translateY(-1px);
}

/* ink-filled primary — Mellio's CTA convention (--handoff-action: ink) */
.demo-guide-btn.primary {
  border-color: var(--mv-ink);
  background: var(--mv-ink);
  color: #fff;
}

.demo-guide-btn.primary:hover {
  background: #2a2f37;
  box-shadow: 0 6px 16px -6px rgba(27, 30, 36, 0.4);
}

.demo-guide-btn.linkish {
  min-height: 30px;
  padding: 0 6px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--mv-ink-40);
}

.demo-guide-btn.linkish:hover {
  background: transparent;
  color: var(--mv-ink-70);
  transform: none;
  box-shadow: none;
}

.demo-guide-btn:focus-visible {
  outline: 2px solid var(--mv-blue-mid);
  outline-offset: 2px;
}

.demo-guide-btn[disabled] { opacity: 0.4; cursor: default; }

/* ---- pulse on the spotlit target ---- */
.demo-guide-target-pulse { animation: demoGuidePulse 1500ms var(--mv-ease) infinite; }

@keyframes demoGuidePulse {
  0%, 100% { filter: none; }
  50% { filter: drop-shadow(0 0 12px rgba(45, 74, 110, 0.30)); }
}

/* ---- in-app trick decorations → accent ---- */
body.mellio-demo-mode.demo-guide-cell-tools-on .paper-cell.demo-guide-cell-affordance {
  box-shadow: inset 0 0 0 2px var(--mv-blue-mid);
  background: var(--mv-blue-soft);
}

body.mellio-demo-mode.demo-guide-cell-tools-on .paper-cell.demo-guide-cell-affordance .cell-drag-grip {
  opacity: 1;
  pointer-events: auto;
  background: rgba(45, 74, 110, 0.18);
  border-color: var(--mv-blue-mid);
}

body.mellio-demo-mode .paper-row-handle-hover.demo-guide-edge-affordance,
body.mellio-demo-mode .paper-col-handle-hover.demo-guide-edge-affordance {
  background: var(--mv-paper);
  box-shadow: 0 0 0 1px var(--mv-blue-mid), 0 6px 16px rgba(27, 30, 36, 0.16);
}

@media (max-width: 760px) {
  .demo-guide-popover {
    left: 12px !important;
    right: 12px;
    top: auto !important;
    bottom: 12px;
    width: auto;
    max-height: calc(100vh - 24px);
    overflow: auto;
  }
  .demo-guide-jump { margin-left: 0; }
  .demo-guide-tools { align-items: stretch; }
  .demo-guide-sample-note { width: 100%; }
  .demo-guide-jump,
  .demo-guide-tool-btn { flex: 1 1 auto; }
  .demo-guide-jump select { flex: 1; max-width: none; }
  .demo-guide-tool-btn { min-width: 84px; margin-left: 0; }
  .demo-guide-foot { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-guide-spotlight,
  .demo-guide-popover { transition: none; }
  .demo-guide-target-pulse { animation: none; }
}
