/* The product tour in /app (src/tour.ts) and on /demo: the ring and the step
   card, the one offer card on the Sites list and the app-only touches. Here,
   not in site-marketing.css, because app pages do not load the marketing
   stylesheets. Tokens only, so both themes match. */

/* ---------------- the ring and the step card ---------------- */

:root {
  --tour-dim: color-mix(in srgb, #1d1b17 12%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --tour-dim: color-mix(in srgb, #000 38%, transparent);
  }
}

:root[data-theme='dark'] {
  --tour-dim: color-mix(in srgb, #000 38%, transparent);
}

.tour-ring {
  position: absolute;
  z-index: 80;
  border: 2px solid var(--accent);
  border-radius: 16px;
  /* A light dim around the part, never over it: what is inside looks as it does without the tour. */
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 9999px var(--tour-dim);
  pointer-events: none;
  transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease;
}

.tour-card {
  position: absolute;
  z-index: 81;
  width: min(360px, calc(100vw - 32px));
  padding: 18px 20px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-sheet);
  outline: none;
  animation: tour-in 0.25s ease;
}

.tour-card:focus {
  outline: none;
}

/* /demo: a close button in the corner, clear of the title. */
.tour-card.has-close {
  padding-right: 48px;
}

.tour-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--text-dim);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.tour-close:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.tour-close:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.tour-card.is-center {
  position: fixed;
  width: min(460px, calc(100vw - 32px));
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.tour-card.is-sheet {
  position: fixed;
  top: auto;
  right: 12px;
  bottom: 12px;
  left: 12px;
  width: auto;
}

.tour-ring.no-motion,
.tour-card.no-motion {
  transition: none;
  animation: none;
}

@keyframes tour-in {
  from { opacity: 0; transform: translateY(6px); }
}

.tour-card.is-center {
  animation: none;
}

.tour-count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.tour-title {
  margin: 6px 0 6px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.2;
}

.tour-text {
  font-size: 14.5px;
  color: var(--text-dim);
}

.tour-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.tour-actions .btn-quiet {
  margin-right: auto;
}


/* ---------------- the "Take the tour" card on /app ---------------- */

.tour-offer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px 14px 18px;
}

.tour-offer-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-lg);
  color: var(--accent);
  background: var(--accent-soft);
}

.tour-offer-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.tour-offer-copy .card-title {
  font-size: var(--fs-15);
}

.tour-offer-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
}

.tour-offer-actions form {
  margin: 0;
}

@media (max-width: 720px) {
  /* The close button stays in the top corner; Start goes full width below. */
  .tour-offer {
    position: relative;
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 16px;
  }
  .tour-offer-copy {
    flex-basis: calc(100% - 52px - 44px);
  }
  .tour-offer-actions {
    width: 100%;
  }
  .tour-offer-actions > .btn {
    flex: 1 1 auto;
  }
  .tour-offer-actions form {
    position: absolute;
    top: 6px;
    right: 6px;
  }
}

/* ---------------- the step card inside the app ---------------- */

/* App UI stays sans (docs/style.md): the step title matches the card titles. */
.app .tour-title {
  font-family: inherit;
  font-weight: 650;
  font-size: var(--fs-18);
  letter-spacing: -0.01em;
}

/* On a phone the card is a sheet over the bottom of the screen: clear of the
   home indicator, with full-size tap targets. */
@media (max-width: 720px) {
  .app .tour-card.is-sheet {
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .app .tour-actions .btn {
    min-height: 44px;
  }
}
