/* "Show me how" walkthroughs: a ring around the real button and a small box beside it with
   one sentence. Both are popovers (top layer), so they sit above the page and dialogs. The
   owner tour handles clicks so only the controls for its current step respond.
   Big buttons and plain type for people using this on a phone in a van. */

:root {
  --walkthrough-ring: var(--canary-deep);
  --walkthrough-dim: rgb(19 28 51 / 0.45);
  --walkthrough-box: var(--paper);
  --walkthrough-edge: var(--night);
  --walkthrough-shadow: 0 16px 40px -10px rgb(19 28 51 / 0.45), 0 2px 8px rgb(19 28 51 / 0.18);
}

/* The ring: a see-through hole in a dimmed page. leave the highlighted control clickable. */
.walkthrough-ring {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 0;
  border: 3px solid var(--walkthrough-ring);
  border-radius: var(--radius);
  background: transparent;
  box-shadow: 0 0 0 100vmax var(--walkthrough-dim);
  pointer-events: none;
  overflow: visible;
}

.walkthrough-pop {
  position: fixed;
  inset: auto;
  top: 0;
  left: 0;
  width: min(340px, calc(100vw - 24px));
  margin: 0;
  padding: 16px;
  border: 2px solid var(--walkthrough-edge);
  border-radius: var(--radius);
  background: var(--walkthrough-box);
  color: var(--ink);
  box-shadow: var(--walkthrough-shadow);
  font-size: 16px;
  line-height: 1.45;
  overflow-y: auto;
}

.walkthrough-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.walkthrough-title {
  font-size: 15px;
  color: var(--ink-2);
}

/* Focus lands on the heading so screen readers start there; it isn't something to press. */
.walkthrough-title:focus,
.walkthrough-title:focus-visible {
  outline: none;
}

.walkthrough-count {
  margin: 0;
  flex: none;
  font-size: 13px;
  color: var(--ink-3);
}

.walkthrough-text {
  margin: 0 0 14px;
  font-size: 17px;
  color: var(--ink);
}

.walkthrough-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.walkthrough-actions .btn {
  min-height: 44px;
  padding: 8px 16px;
  font-size: 15px;
}

.walkthrough-actions .walkthrough-exit {
  margin-right: auto;
}

/* No button to point at on this screen: in the middle, no ring. */
.walkthrough-pop.is-centered {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* The step is on another screen: a small note in the corner with Take me there. */
.walkthrough-pop.is-chip {
  top: auto;
  left: auto;
  right: 16px;
  bottom: 16px;
  width: auto;
  max-width: calc(100vw - 32px);
  padding: 10px 12px;
}

.walkthrough-pop.is-chip .walkthrough-head {
  margin-bottom: 8px;
}

/* Phone width: a sheet along the bottom (or top, when the button is down there). */
.walkthrough-pop.is-sheet {
  top: auto;
  left: 0;
  right: 0;
  bottom: auto;
  width: 100%;
  border-width: 2px 0 0;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: calc(12px + max(env(safe-area-inset-top), env(safe-area-inset-bottom))) 16px;
}

.walkthrough-pop.is-sheet.is-sheet-top {
  border-width: 0 0 2px;
  border-radius: 0 0 var(--radius) var(--radius);
}

@media (max-width: 639.98px) {
  .walkthrough-pop.is-chip {
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }

  .walkthrough-pop.is-chip .walkthrough-actions .btn,
  .walkthrough-pop.is-sheet .walkthrough-actions .btn {
    flex: 1 1 auto;
  }

  .walkthrough-pop .walkthrough-actions .walkthrough-exit {
    flex: none;
  }
}

@media print {
  .walkthrough-ring,
  .walkthrough-pop {
    display: none !important;
  }
}

/* Hank's "Walk me through this screen": one wide button under the panel's heading. */
.hank-walkthrough-form {
  margin: 0;
}

.hank-walkthrough {
  width: 100%;
  min-height: 44px;
  justify-content: center;
}
