/* First-run welcome tour. */

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 8, 13, 0.62);
  backdrop-filter: blur(3px);
  animation: tourFade 160ms ease-out;
}
@keyframes tourFade { from { opacity: 0; } to { opacity: 1; } }

.tour-modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 26px 28px 20px;
  border-radius: 16px;
  background: var(--bg-elev, #14171f);
  border: 1px solid var(--line-2, rgba(255, 255, 255, 0.12));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  color: var(--fg, #eef0f4);
  animation: tourRise 180ms ease-out;
}
@keyframes tourRise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.tour-skip {
  position: absolute;
  top: 14px; right: 16px;
  border: 0;
  background: transparent;
  color: var(--fg-mute, #9aa3b2);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.tour-skip:hover { color: var(--fg, #eef0f4); background: rgba(255, 255, 255, 0.06); }

/* The illustration takes its colour from the accent, so it stays on-brand
   without shipping five separate images. */
.tour-art {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 132px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.07);
  color: var(--accent, #6366f1);
}
.tour-art svg { width: 100%; max-width: 260px; height: auto; overflow: visible; }

/* Each step's art is re-inserted on render, so these replay per step rather
   than only on first open. --d staggers the pieces so the picture assembles
   itself instead of appearing all at once. */
.tour-art .tp {
  opacity: 0;
  transform: translateY(6px);
  transform-box: fill-box;
  transform-origin: center;
  animation: tourPop 380ms cubic-bezier(.2, .7, .3, 1) forwards;
  animation-delay: var(--d, 0ms);
}
/* Ends at the element's own design opacity, carried in --o. Animating to a
   flat 1 overrode the transparency the illustration is built from and turned
   every layer into one solid block. */
@keyframes tourPop {
  from { opacity: 0; transform: translateY(6px) scale(.96); }
  to   { opacity: var(--o, 1); transform: none; }
}

/* Connector lines draw themselves rather than fading in — the point of the
   threads step is the connection, so it should be seen being made. */
.tour-art .tdraw {
  opacity: var(--o, 1);
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
  animation: tourDraw 620ms ease-out forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes tourDraw { to { stroke-dashoffset: 0; } }

/* The "someone is here" dot, which is the whole idea of the presence step. */
.tour-art .tpulse {
  animation: tourPulse 2.4s ease-in-out infinite;
  animation-delay: var(--d2, 0ms);
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes tourPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .55; transform: scale(.82); }
}

.tour-title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.tour-body {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg-mute, #9aa3b2);
}

.tour-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.tour-dots { display: flex; gap: 6px; }
.tour-dot {
  width: 7px; height: 7px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line-2, rgba(255, 255, 255, 0.18));
  cursor: pointer;
  transition: background 140ms, width 140ms;
}
.tour-dot.active { width: 18px; background: var(--accent, #6366f1); }

.tour-actions { display: flex; align-items: center; gap: 8px; }
.tour-cta {
  font-size: 12.5px;
  color: var(--accent, #6366f1);
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 6px;
}
.tour-cta:hover { text-decoration: underline; }
.tour-cta[hidden] { display: none; }
.tour-back[hidden] { display: none; }

/* The buttons reuse .ds-btn where it exists; these are the fallbacks so the
   tour is not dependent on a stylesheet that may not be on every page. */
.tour-actions button {
  font: inherit;
  font-size: 13px;
  min-height: 34px;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}
.tour-actions .tour-back {
  background: transparent;
  color: var(--fg-mute, #9aa3b2);
  border-color: var(--line-2, rgba(255, 255, 255, 0.12));
}
.tour-actions .tour-back:hover { color: var(--fg, #eef0f4); }
.tour-actions .tour-next {
  background: var(--accent, #6366f1);
  color: #fff;
  font-weight: 600;
}
.tour-actions .tour-next:hover { filter: brightness(1.08); }

@media (max-width: 520px) {
  .tour-modal { padding: 22px 18px 18px; }
  .tour-art { height: 108px; }
  .tour-foot { flex-direction: column; align-items: stretch; gap: 14px; }
  .tour-dots { justify-content: center; }
  .tour-actions { justify-content: stretch; gap: 10px; }

  /* Touch targets. The shared .ds-btn.sm sizing wins on specificity and left
     these at 27px tall — comfortably under the 44px a finger needs. Fills the
     width too, so the primary action is where a thumb already is. */
  .tour-actions button,
  .tour-actions .tour-cta {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 14px;
  }
  .tour-actions .tour-next { flex: 1; }
  .tour-actions .tour-back { flex: 0 0 auto; }
  .tour-actions .tour-cta { order: -1; flex-basis: 100%; }

  /* The dots double as navigation, so they need room to be tapped as well. */
  .tour-dot { width: 9px; height: 9px; }
  .tour-dot.active { width: 22px; }
  .tour-dots { gap: 10px; padding: 6px 0; }

  .tour-skip {
    top: 8px; right: 8px;
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tour-overlay, .tour-modal { animation: none; }
  /* Show the finished picture rather than animating to it. */
  .tour-art .tp { opacity: var(--o, 1); transform: none; animation: none; }
  .tour-art .tdraw { opacity: var(--o, 1); stroke-dashoffset: 0; animation: none; }
  .tour-art .tpulse { animation: none; }
}
