/* The guided tour: a bar docked under the workspace. It takes its own strip of
   the window and the workspace gives that height up, so the bar never covers a
   control. Closed, it is a slim strip that keeps the way back to the story and
   one pill to open the tour again. Every colour and size is the workspace's. */

body[data-tour="open"] { --tour-h: 46px; }
body[data-tour="closed"] { --tour-h: 30px; }
body[data-tour] .app { height: calc(100vh - var(--tour-h)); height: calc(100dvh - var(--tour-h)); }

.tour {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 5; /* under every dialog and scrim of the workspace */
  height: var(--tour-h);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0 var(--s-3);
  background: var(--bg-rail);
  border-top: 1px solid var(--line-strong);
  font: var(--text-sm) / var(--lh-ui) var(--font-ui);
  color: var(--text-2);
}

.tour a,
.tour button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: var(--control-h);
  padding: 0 9px;
  border-radius: var(--r-md);
  color: var(--text-2);
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.tour a:hover,
.tour button:hover { background: var(--surface-2); color: var(--text); }

.tour-beats { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; flex: none; }
.tour-beat b { font-weight: var(--w-regular); color: var(--text-3); font-variant-numeric: tabular-nums; }
.tour-beat b::after { content: " ·"; }
.tour-beat[aria-current="step"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.tour-beat[aria-current="step"] b { color: var(--accent); }

/* The line of help wraps onto a second line before it is ever cut. */
.tour-hint {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 var(--s-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-read);
  font-size: var(--text-sm);
  line-height: 1.3;
}
/* Wide, each pill already names its beat. */
.tour-hint b { display: none; }

.tour .tour-next { background: var(--solid); color: var(--text-on-solid); padding: 0 12px; }
.tour .tour-next:hover { background: var(--solid-hover); color: var(--text-on-solid); }
.tour .tour-open { box-shadow: inset 0 0 0 1px var(--line-strong); height: 22px; font-size: var(--text-xs); }

/* Closed: the story link, a gap, the pill. */
.tour[data-state="closed"] > :not(.tour-story):not(.tour-open) { display: none; }
.tour[data-state="closed"] .tour-story { height: 22px; font-size: var(--text-xs); }
.tour[data-state="closed"] .tour-open { margin-left: auto; }
.tour[data-state="open"] .tour-open { display: none; }

/* A narrow window: the names leave the pills, and the line of help takes a
   second row under them, with the name of its beat in front. */
@media (max-width: 1239px) {
  body[data-tour="open"] { --tour-h: 78px; }
  .tour[data-state="open"] { flex-wrap: wrap; align-content: center; row-gap: 2px; padding-top: 4px; padding-bottom: 4px; }
  .tour[data-state="open"] .tour-beats { margin-right: auto; }
  .tour[data-state="open"] .tour-hint { order: 9; flex: 0 0 100%; margin: 0 2px; }
}
@media (max-width: 719px) {
  body[data-tour="open"] { --tour-h: 96px; }
  .tour { padding-bottom: env(safe-area-inset-bottom); }
  .tour[data-state="open"] { gap: 2px; padding-left: var(--s-2); padding-right: var(--s-2); }
  .tour-beat span { display: none; }
  .tour-beat b::after { content: none; }
  .tour-beat { min-width: 30px; justify-content: center; }
  .tour-close span { display: none; }
  .tour-hint b { display: inline; }
}

/* The Scoreboard prints the command an agent posts with. The demo has no command line, so the hint is left out. */
.mem-cli-hint { display: none; }

@media (prefers-reduced-motion: reduce) {
  .tour a, .tour button { transition: none; }
}
