/* Generic pattern app tour — spotlight + coach card */

.app-tour-root {
  position: fixed;
  inset: 0;
  z-index: 12000;
  isolation: isolate;
  pointer-events: none;
}

.app-tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 29, 61, 0.45);
  pointer-events: auto;
}

.app-tour-spotlight {
  position: fixed;
  z-index: 1;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(8, 29, 61, 0.5);
  outline: 2px solid #1b9aaa;
  outline-offset: 0;
  pointer-events: none;
  transition:
    top 0.18s ease,
    left 0.18s ease,
    width 0.18s ease,
    height 0.18s ease;
}

.app-tour-card {
  position: fixed;
  /* Well above spotlight + any highlighted page chrome so Next/Skip stay clickable. */
  z-index: 20;
  max-width: 340px;
  padding: 1rem 1.05rem 0.9rem;
  border-radius: 14px;
  background: #fff;
  color: #0c295a;
  box-shadow: 0 12px 36px rgba(8, 29, 61, 0.28);
  font-family: Lexend, system-ui, sans-serif;
  pointer-events: auto;
}

.app-tour-card--centered {
  top: 50%;
  left: 50%;
  width: min(340px, calc(100vw - 24px));
  transform: translate(-50%, -50%);
}

.app-tour-card--enter {
  animation: app-tour-card-enter 0.2s ease-out;
}

.app-tour-card--centered.app-tour-card--enter {
  animation: app-tour-card-enter-centered 0.2s ease-out;
}

.app-tour-card--enter .app-tour-card__icon {
  animation: app-tour-icon-pop 0.28s ease-out;
}

@keyframes app-tour-card-enter {
  from {
    opacity: 0.55;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes app-tour-card-enter-centered {
  from {
    opacity: 0.55;
    transform: translate(-50%, calc(-50% + 6px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes app-tour-icon-pop {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-tour-card--enter,
  .app-tour-card--centered.app-tour-card--enter,
  .app-tour-card--enter .app-tour-card__icon {
    animation: none;
  }

  .app-tour-spotlight {
    transition: none;
  }
}

.app-tour-card__meta {
  margin: 0 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1b9aaa;
}

.app-tour-card__icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 0 0.55rem;
  border-radius: 0.65rem;
  background: #eaffeb;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.app-tour-card__icon img {
  width: 1.65rem;
  height: 1.65rem;
  object-fit: contain;
  display: block;
}

.app-tour-card__visual {
  width: 100%;
  height: 4.5rem;
  margin: 0 0 0.7rem;
  border-radius: 0.65rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 80% 20%, rgba(27, 154, 170, 0.18), transparent 55%),
    linear-gradient(135deg, #eaffeb 0%, #e8f4f6 100%);
}

.app-tour-card__visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.app-tour-card__title {
  margin: 0 0 0.4rem;
  font-family: Comfortaa, Lexend, system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  color: #081d3d;
}

.app-tour-card__body {
  margin: 0 0 0.95rem;
  font-size: 0.92rem;
  font-weight: 300;
  line-height: 1.45;
  color: #4a5f7a;
}

.app-tour-card__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.app-tour-card__btn {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 0.45rem;
  border: none;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
}

.app-tour-card__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.app-tour-card__btn--ghost {
  background: transparent;
  color: #4a5f7a;
  margin-right: auto;
}

.app-tour-card__btn--secondary {
  background: #e8eef4;
  color: #0c295a;
}

.app-tour-card__btn--primary {
  background: #0c295a;
  color: #fff;
}

.app-tour-card__btn--primary:hover {
  background: #1b9aaa;
}

.app-tour-target {
  /* Do NOT raise z-index here — large lists (Part 1 rows) would cover the coach card. */
  scroll-margin: 5rem;
}

/*
 * Extra ring only on compact targets. Large regions rely on the spotlight hole alone.
 * Keep z-index below .app-tour-root (12000) so the coach card stays on top.
 */
#hs-app-nav-fab.app-tour-target,
#hs-app-nav-progress.app-tour-target,
.hs-app-nav-menu__item.app-tour-target,
.pattern-section-card.app-tour-target,
.pattern-details.app-tour-target,
.row-ask-question-btn.app-tour-target,
[data-tour="row-help"].app-tour-target {
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 3px #1b9aaa, 0 0 0 6px rgba(27, 154, 170, 0.35);
  border-radius: 10px;
}

body.app-tour-active.hs-app-nav-progress-open .app-tour-root {
  z-index: 2147483000;
}

/* Native <dialog> is top-layer; raise tour above it when menu is open */
body.app-tour-active.hs-app-nav-menu-open .app-tour-root {
  z-index: 2147483000;
}

body.app-tour-active.hs-app-nav-menu-open .hs-app-nav-menu {
  z-index: 2147482900;
}
