/**
 * Product tour / guided onboarding (post-questionnaire + navbar replay).
 * Root: #wm-product-onboarding-root
 */

#wm-product-onboarding-root {
  --wm-po-z-bf: 200099;
  --wm-po-z-dim: 200100;
  --wm-po-z-hit: 200101;
  --wm-po-z-ring: 200102;
  --wm-po-z-ui: 200110;
  --wm-po-glass: rgba(12, 18, 42, 0.92);
  --wm-po-glow: rgba(120, 175, 255, 0.45);
  --wm-po-text: #e8f0ff;
  --wm-po-muted: #9eb5d8;
  /* Must never participate in document flow — only paint above the app */
  position: fixed !important;
  inset: 0 !important;
  /* Avoid 100vw: with a vertical scrollbar it overflows and shifts flex layouts horizontally */
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
  overflow: visible;
  isolation: isolate;
  z-index: var(--wm-po-z-dim);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.26s ease;
}

#wm-product-onboarding-root.wm-po-visible {
  opacity: 1;
  pointer-events: none;
}

/* Inter-step: hide spotlight + blur strips so the app shows through (see wmPoApplyNextSpotlightLayout) */
#wm-product-onboarding-root.wm-po-visible.wm-po-chrome-transition-out {
  opacity: 0 !important;
  pointer-events: none !important;
}

#wm-product-onboarding-root.wm-po-visible.wm-po-chrome-transition-out
  .wm-po-hit-path {
  pointer-events: none !important;
}

#wm-product-onboarding-root.wm-po-blocking {
  pointer-events: none;
}

/*
 * Mobile revealed navbar (.navbar-wrapper) uses z-index ~999998 (chat-box.css).
 * While the product tour is active, paint the tour root, blur strips, and callouts above it.
 */
body.wm-product-onboarding-active #wm-product-onboarding-root {
  --wm-po-z-bf: 1000099;
  --wm-po-z-dim: 1000100;
  --wm-po-z-hit: 1000101;
  --wm-po-z-ring: 1000102;
  --wm-po-z-ui: 1000110;
  z-index: 1000100;
}

body.wm-product-onboarding-active #wm-po-bf-layer {
  --wm-po-z-bf: 1000099;
  z-index: 1000099;
}

body.wm-product-onboarding-active #wm-po-input-blocker {
  z-index: 1000115;
}

/* Blur strips live here (sibling of #wm-product-onboarding-root) so they never affect root layout/stacking quirks */
#wm-po-bf-layer {
  --wm-po-z-bf: 200099;
  position: fixed !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
  pointer-events: none !important;
  z-index: 200099;
  isolation: isolate;
  opacity: 1;
  transition: opacity 0.26s ease;
}

#wm-po-bf-layer.wm-po-chrome-transition-out {
  opacity: 0 !important;
}

/* Legacy: strips used to live inside the onboarding root — keep inert if present */
#wm-product-onboarding-root .wm-po-shield--bf-top,
#wm-product-onboarding-root .wm-po-shield--bf-bottom,
#wm-product-onboarding-root .wm-po-shield--bf-left,
#wm-product-onboarding-root .wm-po-shield--bf-right {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/*
 * Spotlight: no backdrop-filter on a masked full-screen layer (hole stays blurred in WebKit).
 * Four edge strips provide tint + blur outside the bbox; .wm-po-shield--dim is hidden in spotlight mode.
 */
/*
 * Spotlight uses ONLY these four strips (tint + blur). A full-viewport layer with mask-image
 * feathered into the “hole” and made the interior look muddy; strips leave a hard-clear rectangle.
 */
.wm-po-shield--bf-top,
.wm-po-shield--bf-bottom,
.wm-po-shield--bf-left,
.wm-po-shield--bf-right {
  position: fixed !important;
  float: none !important;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 0;
  background: rgba(8, 12, 29, 0.38);
  backdrop-filter: blur(4px) saturate(160%);
  -webkit-backdrop-filter: blur(4px) saturate(160%);
  border: none;
  border-radius: 0;
  z-index: var(--wm-po-z-bf);
  /* Blocking is handled by .wm-po-hit-path so strips can animate without stealing clicks */
  pointer-events: none;
  display: none;
  transition:
    top 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Full-screen dim for welcome / non-spotlight only (see .wm-po-shield--dim-fullscreen) */
.wm-po-shield--dim {
  position: fixed !important;
  inset: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  background: rgba(8, 12, 29, 0.42);
  border: none;
  border-radius: 0;
  z-index: var(--wm-po-z-dim);
  pointer-events: none;
}

/* Full-screen overlay (welcome, etc.): single layer with blur like .lab-modal-backdrop */
.wm-po-shield--dim.wm-po-shield--dim-fullscreen {
  background: rgba(8, 12, 29, 0.38);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 0.5px solid rgb(63 81 157 / 68%);
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

/* Pointer hit target: evenodd donut; inner hole is axis-aligned (matches unblurred bbox; ring is rounded visually) */
.wm-po-hit-svg {
  position: fixed !important;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--wm-po-z-hit);
  pointer-events: none;
}

.wm-po-hit-path {
  pointer-events: auto;
}

/* Border + glow only (dim comes from .wm-po-shield--dim mask — no 9999px spread) */
.wm-po-spotlight-ring {
  position: fixed !important;
  z-index: var(--wm-po-z-ring);
  pointer-events: none;
  border-radius: 14px;
  box-sizing: border-box;
  border: 2px solid rgba(130, 185, 255, 0.55);
  box-shadow: 0 0 28px rgba(100, 160, 255, 0.35);
  background: transparent;
  transition:
    top 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    left 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease;
}

.wm-po-spotlight-ring.wm-po-pulse {
  animation: wm-po-ring-pulse 2.4s ease-in-out infinite;
}

@keyframes wm-po-ring-pulse {
  0%,
  100% {
    border-color: rgba(130, 185, 255, 0.45);
    box-shadow: 0 0 22px rgba(100, 160, 255, 0.28);
  }
  50% {
    border-color: rgba(160, 210, 255, 0.75);
    box-shadow: 0 0 36px rgba(120, 190, 255, 0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wm-po-spotlight-ring.wm-po-pulse {
    animation: none;
  }

  #wm-product-onboarding-root {
    transition: none;
  }

  #wm-po-bf-layer {
    transition: none;
  }

  .wm-po-shield--bf-top,
  .wm-po-shield--bf-bottom,
  .wm-po-shield--bf-left,
  .wm-po-shield--bf-right,
  .wm-po-spotlight-ring {
    transition: none;
  }

  #wm-po-input-blocker {
    cursor: default;
  }
}

/*
 * Raise targets above the BF strips / hit layer. Do not set position here:
 * .ai-sidebar-container is position:absolute; forcing relative breaks layout (sidebar shifts).
 */
.wm-po-target-highlight {
  z-index: 200108 !important;
}

/* Center card */
.wm-po-card-wrap {
  position: fixed;
  inset: 0;
  z-index: var(--wm-po-z-ui);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vh, 40px);
  pointer-events: none;
}

.wm-po-card-wrap > * {
  pointer-events: auto;
}

.wm-po-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wm-po-card__logo-wrap {
  margin: 0 auto 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.wm-po-card__logo {
  display: block;
  width: auto;
  height: auto;
  max-width: min(200px, 52vw);
  max-height: 52px;
  object-fit: contain;
}

.wm-po-card {
  width: min(440px, 100%);
  max-height: min(78vh, 640px);
  overflow: auto;
  padding: 2rem 2rem 1.75rem;
  border-radius: 20px;
  background: linear-gradient(
    155deg,
    rgba(22, 32, 68, 0.97) 0%,
    rgba(10, 14, 36, 0.98) 100%
  );
  border: 1px solid rgba(120, 170, 255, 0.22);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 80px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(80, 140, 255, 0.12);
  text-align: center;
  color: var(--wm-po-text);
  font-family:
    "Montserrat",
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  animation: wm-po-card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes wm-po-card-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.wm-po-card__headline {
  margin: 0 0 0.85rem;
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  background: linear-gradient(
    to bottom,
    #ffffff 0%,
    #c5d9ff 38%,
    #6b8bd4 58%,
    #ffffff 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.wm-po-card__body {
  margin: 0 0 1.5rem;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--wm-po-muted);
  font-weight: 500;
}

.wm-po-card__body-plain {
  margin: 0;
}

.wm-po-card__body--multiline,
.wm-po-card__body-plain.wm-po-card__body--multiline {
  white-space: pre-line;
}

.wm-po-card__body--with-inline-help {
  text-align: center;
}

.wm-po-card__navbar-help-inline.wm-navbar-help-tour {
  display: inline-flex;
  vertical-align: middle;
  margin: 0 0.2em;
  flex-shrink: 0;
  cursor: default;
  pointer-events: none;
}

.wm-po-card__body--steps .wm-po-rich-para {
  margin: 0 0 0.75rem;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  font-weight: inherit;
}

.wm-po-card__body--steps .wm-po-rich-para:last-of-type {
  margin-bottom: 0.65rem;
}

/* Numbered steps (callout + center card): digit in a circle */
.wm-po-numbered-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
}

.wm-po-numbered-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
  line-height: 1.45;
}

.wm-po-numbered-steps li:last-child {
  margin-bottom: 0;
}

.wm-po-step-marker {
  flex-shrink: 0;
  width: 1.42rem;
  height: 1.42rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  color: #e8f0ff;
  background: rgba(100, 155, 255, 0.22);
  border: 1px solid rgba(130, 185, 255, 0.45);
  box-sizing: border-box;
  margin-top: 0.14em;
}

.wm-po-step-text {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.wm-po-callout__body--steps .wm-po-rich-para {
  margin: 0 0 0.55rem;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.wm-po-callout__body--steps .wm-po-rich-para:first-child {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--wm-po-text);
  margin-bottom: 0.4rem;
}

.wm-po-callout__body--steps .wm-po-rich-para:last-of-type {
  margin-bottom: 0.5rem;
}

/* Venture Blueprint pillar row: match :hover while onboarding waitClick is active */
.vb-pillar-item.wm-po-vb-pillar-sim-hover {
  transform: translateY(-1px);
  filter: drop-shadow(0 0 10px rgba(19, 109, 244, 0.25));
  background-color: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

[data-wm-theme="light"] .vb-pillar-item.wm-po-vb-pillar-sim-hover {
  background-color: rgba(37, 99, 235, 0.06) !important;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12) !important;
}

[data-wm-theme="light"] .wm-po-step-marker {
  color: #1a3a66;
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.3);
}

.wm-po-card__actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: center;
}

.wm-po-card__actions--row {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
}

/* CTAs use shared .lab-button.primary / .lab-button.secondary (chat-box.css) */
.wm-po-cta {
  width: fit-content !important;
  max-width: 100%;
}

.wm-po-card__actions .wm-po-cta,
.wm-po-callout__actions .wm-po-cta {
  width: fit-content !important;
}

/* Anchored tooltip / callout */
.wm-po-callout {
  position: fixed;
  z-index: var(--wm-po-z-ui);
  width: min(320px, calc(100vw - 32px));
  padding: 1rem 1.1rem 1rem;
  border-radius: 14px;
  background: var(--wm-po-glass);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(130, 180, 255, 0.28);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 32px rgba(80, 140, 255, 0.1);
  color: var(--wm-po-text);
  font-family:
    "Montserrat",
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    top 0.16s ease,
    left 0.16s ease;
}

.wm-po-callout.wm-po-callout--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Viewport-centered modal-style callout (does not track page scroll) */
.wm-po-callout.wm-po-callout--fixed-center {
  max-width: min(340px, calc(100vw - 24px));
  transform: translate(-50%, calc(-50% + 6px));
}

.wm-po-callout.wm-po-callout--fixed-center.wm-po-callout--visible {
  transform: translate(-50%, -50%);
}

.wm-po-callout__title {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.wm-po-callout__body {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--wm-po-muted);
  font-weight: 500;
}

.wm-po-callout__body--multiline {
  white-space: pre-line;
}

.wm-po-callout__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.wm-po-callout__actions .wm-po-callout__skip,
.wm-po-card__actions .wm-po-callout__skip {
  margin-right: auto;
  padding: 0.2rem 0.35rem;
  border: none;
  background: transparent;
  color: rgba(200, 215, 245, 0.55);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.wm-po-callout__actions .wm-po-callout__skip:hover,
.wm-po-card__actions .wm-po-callout__skip:hover {
  color: rgba(230, 240, 255, 0.92);
  background: rgba(255, 255, 255, 0.06);
}

.wm-po-callout__actions .wm-po-callout__skip:focus-visible,
.wm-po-card__actions .wm-po-callout__skip:focus-visible {
  outline: 2px solid rgba(140, 190, 255, 0.85);
  outline-offset: 2px;
}

[data-wm-theme="light"] .wm-po-callout__actions .wm-po-callout__skip,
[data-wm-theme="light"] .wm-po-card__actions .wm-po-callout__skip {
  color: rgba(70, 82, 118, 0.55);
}

[data-wm-theme="light"] .wm-po-callout__actions .wm-po-callout__skip:hover,
[data-wm-theme="light"] .wm-po-card__actions .wm-po-callout__skip:hover {
  color: rgba(28, 36, 62, 0.92);
  background: rgba(0, 0, 0, 0.05);
}

.wm-po-callout__actions .wm-po-cta.lab-button.primary {
  padding: 0.55rem 1.1rem;
  font-size: 0.8rem;
}

.wm-po-callout__actions .wm-po-cta.lab-button.secondary {
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
}

/* Invalid click during Next-only callout: brief orange ring on Next, then fade */
@keyframes wm-po-next-hint {
  0%,
  65% {
    box-shadow:
      0 0 0 2px rgba(255, 130, 60, 0.95),
      0 0 22px rgba(255, 130, 60, 0.4);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 130, 60, 0);
  }
}

.wm-po-callout__actions .wm-po-cta.wm-po-next-hint {
  animation: wm-po-next-hint 2.2s ease forwards;
}

@media (prefers-reduced-motion: reduce) {
  .wm-po-callout__actions .wm-po-cta.wm-po-next-hint {
    animation-duration: 0.45s;
  }
}

/* Artifacts deep tour: block minimize until step-complete card (see product-onboarding.js) */
body.wm-po-artifacts-onboarding-nomin #artifacts-modal-minimize {
  pointer-events: none !important;
  opacity: 0.38;
  cursor: not-allowed !important;
}

/*
 * Points onboarding: top nav is normally hover-revealed; overlay blocks that, so pin the bar in view.
 * Scoped class avoids relying on body.wm-navbar-revealed mobile full-screen rules.
 */
body.wm-po-navbar-tour-pinned .navbar-wrapper {
  transform: translateY(0) !important;
  opacity: 1 !important;
}

body.wm-po-navbar-tour-pinned .nav-reveal-chip {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Navbar help (? ) button */
.wm-navbar-help-tour {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(230, 238, 255, 0.88);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.wm-navbar-help-tour:hover {
  background: rgba(120, 170, 255, 0.12);
  border-color: rgba(130, 185, 255, 0.35);
  color: #fff;
}

.wm-navbar-help-tour:focus-visible {
  outline: 2px solid rgba(140, 190, 255, 0.85);
  outline-offset: 2px;
}

[data-wm-theme="light"] .wm-po-shield--dim {
  background: var(--wm-artifact-backdrop);
  border-color: var(--wm-artifact-border);
}

[data-wm-theme="light"] .wm-po-shield--bf-top,
[data-wm-theme="light"] .wm-po-shield--bf-bottom,
[data-wm-theme="light"] .wm-po-shield--bf-left,
[data-wm-theme="light"] .wm-po-shield--bf-right {
  background: var(--wm-artifact-backdrop);
}

@media (max-width: 768px) {
  .wm-po-callout {
    max-height: min(72dvh, 520px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  }

  .wm-po-card {
    padding: 1.5rem 1.25rem 1.35rem;
  }

  .wm-navbar-help-tour {
    width: 32px;
    height: 32px;
    margin-left: 0px;
    font-size: 0.9rem;
  }
}

/* Root uses pointer-events:none but .wm-po-hit-path uses auto — without this, an invisible root can still block the app after the tour ends */
#wm-product-onboarding-root:not(.wm-po-visible) .wm-po-hit-path {
  pointer-events: none !important;
}

/* Full-viewport shield during inter-step fades / bridge to center cards (see wmPoBeginInputBlock). Above app + onboarding root, below nothing interactive. */
#wm-po-input-blocker {
  position: fixed !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
  z-index: 200115;
  pointer-events: none;
  visibility: hidden;
  background: transparent;
  cursor: wait;
}

#wm-po-input-blocker.wm-po-input-blocker--active {
  pointer-events: auto !important;
  visibility: visible;
}

/* Venture confirmation during product tour: only Create (.venture-confirm-btn) receives clicks. */
#new-venture-modal.wm-po-nv-allow-create-only
  .new-venture-view[data-view="confirmation"]
  .new-venture-confirmation-container
  * {
  pointer-events: none !important;
}

#new-venture-modal.wm-po-nv-allow-create-only
  .new-venture-view[data-view="confirmation"]
  .new-venture-confirmation-container
  .venture-confirm-btn,
#new-venture-modal.wm-po-nv-allow-create-only
  .new-venture-view[data-view="confirmation"]
  .new-venture-confirmation-container
  .venture-confirm-btn
  * {
  pointer-events: auto !important;
}
