/* tutorial.css — all tour chrome. Nothing here touches the app's own layout.
   base.css owns:  --z-panel:10;  --z-modal:900;  --z-tour:1000;   */

:root {
  --tour-dim: rgba(6, 7, 10, .72);
  --tour-ring: var(--accent-2);
}

/* Root: fixed, so nothing in the document flow can be pushed by the tour. */
.tour-root {
  position: fixed;
  inset: 0;
  z-index: var(--z-tour);
  pointer-events: none;              /* only the pieces that opt in take clicks */
}

/* ---- hit-test layer: four transparent rects leaving a real hole ---------- */
.tour-block {
  position: fixed;
  pointer-events: auto;              /* eats clicks on the rest of the app */
  background: transparent;
  cursor: default;
}

/* ---- the spotlight: one element whose box-shadow IS the dim layer -------- */
.tour-spot {
  position: fixed;
  top: 0; left: 0; width: 0; height: 0;
  pointer-events: none;              /* the target underneath stays clickable */
  border-radius: var(--radius);
  box-shadow:
    0 0 0 200vmax var(--tour-dim),           /* the dim, painted outward */
    0 0 0 1px var(--tour-ring) inset,        /* crisp edge on the cutout */
    0 0 0 3px rgba(51, 209, 160, .28);       /* soft halo */
  transition:
    top .18s cubic-bezier(.2, .8, .2, 1),
    left .18s cubic-bezier(.2, .8, .2, 1),
    width .18s cubic-bezier(.2, .8, .2, 1),
    height .18s cubic-bezier(.2, .8, .2, 1),
    opacity .15s linear;
}

/* While chasing a scroll or resize the ring must track the target 1:1.
   A transition here would make the spotlight lag visibly behind the element. */
.tour-root.is-tracking .tour-spot { transition: none; }

/* No target (a "what's new" step): dim everything, no cutout. */
.tour-root.is-modal .tour-spot {
  opacity: 1;
  width: 0; height: 0;
  left: 50%; top: 50%;
  box-shadow: 0 0 0 200vmax var(--tour-dim);
}

/* ---- the tooltip card ---------------------------------------------------- */
.tour-tip {
  position: fixed;
  top: 0; left: 0;                              /* moved with transform only */
  width: min(360px, calc(100vw - 24px));
  box-sizing: border-box;
  pointer-events: auto;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
  transform: translate3d(-9999px, -9999px, 0);  /* off-screen until first placed */
  transition: transform .18s cubic-bezier(.2, .8, .2, 1);
  font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.tour-root.is-tracking .tour-tip { transition: none; }
.tour-tip:focus { outline: none; }
.tour-tip:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.tour-tip__chapter {
  font: 11px/1 var(--font);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 6px;
}
.tour-tip__title { font-size: 16px; margin: 0 0 6px; font-weight: 650; }
.tour-tip__body { margin: 0 0 12px; color: var(--text); }
.tour-tip__body code { font-family: var(--font); color: var(--warn); }

.tour-tip__nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tour-tip__count { font: 12px/1 var(--font); color: var(--muted); }
.tour-tip__buttons { display: flex; gap: 6px; margin-left: auto; }

.tour-tip__dots { display: flex; gap: 5px; align-items: center; }
.tour-dot {
  width: 8px; height: 8px; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--edge);
  cursor: pointer;
}
.tour-dot.is-done { background: var(--muted); }
.tour-dot.is-current { background: var(--accent-2); transform: scale(1.35); }
.tour-dot:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Above 14 steps the dots stop being readable; use a bar instead. */
.tour-tip__dots--bar {
  flex: 1 1 60px;
  height: 4px;
  background: var(--edge);
  border-radius: 2px;
  overflow: hidden;
}
.tour-bar { display: block; height: 100%; background: var(--accent-2); }

/* ---- the arrow: a rotated square borrowing two of the card's borders ----- */
.tour-tip__arrow {
  position: absolute;
  width: 12px; height: 12px;
  background: var(--panel-2);
  border: 1px solid var(--edge);
  transform: rotate(45deg);
}
.tour-tip[data-side="bottom"] .tour-tip__arrow {
  top: -7px; margin-left: -6px; border-right: 0; border-bottom: 0;
}
.tour-tip[data-side="top"] .tour-tip__arrow {
  bottom: -7px; margin-left: -6px; border-left: 0; border-top: 0;
}
.tour-tip[data-side="right"] .tour-tip__arrow {
  left: -7px; margin-top: -6px; border-right: 0; border-top: 0;
}
.tour-tip[data-side="left"] .tour-tip__arrow {
  right: -7px; margin-top: -6px; border-left: 0; border-bottom: 0;
}
.tour-tip[data-side="corner"] .tour-tip__arrow,
.tour-tip[data-side="center"] .tour-tip__arrow { display: none; }

/* Clicking the dim area does nothing useful — say so with one small shake. */
.tour-tip.is-nudging { animation: tour-nudge .22s ease-in-out; }
@keyframes tour-nudge {
  0%, 100% { margin-left: 0; }
  25% { margin-left: -4px; }
  75% { margin-left: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .tour-spot, .tour-tip { transition: none !important; }
  .tour-tip.is-nudging { animation: none !important; }
  .tour-dot.is-current { transform: none; }
}
