/* =========================================================================
   Nest.IQ — Hub guided tour
   A lightweight, brand-consistent spotlight + tooltip tour for the hub. A
   backdrop dims the page, a "spotlight" ring highlights the anchored section,
   and a quiet-luxury tooltip explains each step with prev / next / skip and a
   progress indicator. Theme-aware via shared tokens; reduced-motion-safe.
   Scoped under .niq-tour*. Zero dependencies.
   ========================================================================= */

/* Backdrop — four panels around the spotlight rect would be heavy; instead we
   use one fixed scrim with a transparent "hole" punched via box-shadow on the
   highlight ring. The scrim itself is click-catching (advance / dismiss-safe). */
.niq-tour-backdrop {
  position: fixed;
  inset: 0;
  z-index: 990;
  background: color-mix(in oklab, #0c0a07 58%, transparent);
  opacity: 0;
  transition: opacity 0.3s var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
  pointer-events: none;
}
.niq-tour-backdrop[data-show='true'] {
  opacity: 1;
  pointer-events: auto;
}

/* The spotlight ring — positioned over the target; the huge spread box-shadow
   paints the dimmed area, leaving the target itself bright. */
.niq-tour-spot {
  position: fixed;
  z-index: 991;
  border-radius: var(--r, 14px);
  pointer-events: none;
  box-shadow: 0 0 0 9999px color-mix(in oklab, #0c0a07 60%, transparent),
    0 0 0 2px color-mix(in oklab, var(--gold, #c9a24b) 75%, transparent),
    0 18px 60px -12px rgba(0, 0, 0, 0.6);
  transition: top 0.42s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    left 0.42s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    width 0.42s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    height 0.42s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity 0.3s ease;
  opacity: 0;
}
.niq-tour-spot[data-show='true'] {
  opacity: 1;
}
/* Centered intro/outro step (no anchor) — hide the ring, keep the scrim. */
.niq-tour-spot[data-centered='true'] {
  box-shadow: 0 0 0 9999px color-mix(in oklab, #0c0a07 64%, transparent);
}

/* Tooltip / step card. */
.niq-tour-pop {
  position: fixed;
  z-index: 992;
  width: min(360px, calc(100vw - 2rem));
  background: var(--paper, #fdfbf6);
  color: var(--ink, #14181c);
  border: 1px solid color-mix(in oklab, var(--ink, #14181c) 14%, transparent);
  border-radius: var(--r-lg, 20px);
  box-shadow: var(--shadow-l, 0 36px 70px -20px rgba(0, 0, 0, 0.4));
  padding: 1.25rem 1.3rem 1.1rem;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: top 0.42s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    left 0.42s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity 0.3s ease, transform 0.3s ease;
}
.niq-tour-pop[data-show='true'] {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.niq-tour-pop__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.niq-tour-pop__step {
  font-family: var(--font-mono, monospace);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--clay, #c8552e);
}
.niq-tour-pop__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -0.3rem -0.4rem -0.3rem 0;
  border: 0;
  background: transparent;
  color: var(--ink-muted, #6e747b);
  border-radius: var(--r-pill, 999px);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.niq-tour-pop__close:hover {
  color: var(--ink, #14181c);
  background: color-mix(in oklab, var(--ink, #14181c) 6%, transparent);
}
.niq-tour-pop__close svg {
  width: 16px;
  height: 16px;
  display: block;
}
.niq-tour-pop__title {
  font-family: var(--font-display, 'Fraunces', Georgia, serif);
  font-size: 1.3rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink, #14181c);
  margin: 0 0 0.35rem;
}
.niq-tour-pop__body {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-soft, #3c434a);
  margin: 0;
}

/* Progress dots. */
.niq-tour-pop__dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  margin: 0.95rem 0 0.85rem;
}
.niq-tour-pop__dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill, 999px);
  background: color-mix(in oklab, var(--ink, #14181c) 16%, transparent);
  transition: background 0.25s ease, transform 0.25s ease;
}
.niq-tour-pop__dot[data-active='true'] {
  background: var(--clay, #c8552e);
  transform: scale(1.25);
}
.niq-tour-pop__dot[data-done='true'] {
  background: color-mix(in oklab, var(--clay, #c8552e) 55%, transparent);
}

/* Action row. */
.niq-tour-pop__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.niq-tour-pop__skip {
  margin-right: auto;
  border: 0;
  background: transparent;
  padding: 0.4rem 0;
  font-family: var(--font-mono, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted, #6e747b);
  cursor: pointer;
  transition: color 0.2s ease;
}
.niq-tour-pop__skip:hover {
  color: var(--ink, #14181c);
}
.niq-tour-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.6em 1.05em;
  border-radius: var(--r-pill, 999px);
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1;
  transition: background 0.22s ease, border-color 0.22s ease, color 0.22s ease,
    transform 0.22s ease;
}
.niq-tour-btn:active {
  transform: translateY(1px);
}
.niq-tour-btn--ghost {
  background: transparent;
  color: var(--ink, #14181c);
  border-color: color-mix(in oklab, var(--ink, #14181c) 25%, transparent);
}
.niq-tour-btn--ghost:hover {
  border-color: var(--ink, #14181c);
  background: color-mix(in oklab, var(--ink, #14181c) 5%, transparent);
}
.niq-tour-btn--primary {
  background: var(--clay, #c8552e);
  color: #fdf4ee;
  border-color: var(--clay, #c8552e);
}
.niq-tour-btn--primary:hover {
  background: var(--clay-deep, #a23e1f);
  border-color: var(--clay-deep, #a23e1f);
  transform: translateY(-1px);
}
.niq-tour-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* The little caret pointing from the tooltip toward the target. */
.niq-tour-pop__arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--paper, #fdfbf6);
  border: 1px solid color-mix(in oklab, var(--ink, #14181c) 14%, transparent);
  transform: rotate(45deg);
  display: none;
}
.niq-tour-pop[data-placement='top'] .niq-tour-pop__arrow,
.niq-tour-pop[data-placement='bottom'] .niq-tour-pop__arrow {
  display: block;
  left: var(--arrow-x, 50%);
  margin-left: -6px;
}
.niq-tour-pop[data-placement='bottom'] .niq-tour-pop__arrow {
  top: -7px;
  border-right: 0;
  border-bottom: 0;
}
.niq-tour-pop[data-placement='top'] .niq-tour-pop__arrow {
  bottom: -7px;
  border-left: 0;
  border-top: 0;
}

/* Header "Take the tour" trigger — sits beside the theme toggle. Matches the
   pill language of the page; flips correctly in dark via tokens. */
.niq-tour-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-family: var(--font-mono, monospace);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 0.95em;
  height: 40px;
  border-radius: var(--r-pill, 999px);
  background: var(--paper, #fdfbf6);
  color: var(--ink, #14181c);
  border: var(--hair, 1px solid rgba(20, 24, 28, 0.12));
  box-shadow: var(--shadow-s, 0 1px 2px rgba(20, 24, 28, 0.05));
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.22s ease, border-color 0.22s ease, transform 0.22s ease,
    background 0.22s ease;
}
.niq-tour-trigger:hover {
  color: var(--clay, #c8552e);
  border-color: var(--clay, #c8552e);
  transform: translateY(-1px);
}
.niq-tour-trigger svg {
  width: 15px;
  height: 15px;
  display: block;
}
/* Compact: on small screens show only the icon to save the header row. */
.niq-tour-trigger__label {
  display: inline;
}
@media (max-width: 560px) {
  .niq-tour-trigger {
    padding: 0;
    width: 40px;
    justify-content: center;
  }
  .niq-tour-trigger__label {
    display: none;
  }
}

.niq-tour-backdrop :focus-visible,
.niq-tour-pop :focus-visible {
  outline: 2px solid var(--clay, #c8552e);
  outline-offset: 3px;
}

html.niq-tour-lock,
html.niq-tour-lock body {
  overflow: hidden;
}

@media print {
  .niq-tour-backdrop,
  .niq-tour-spot,
  .niq-tour-pop,
  .niq-tour-trigger {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .niq-tour-backdrop,
  .niq-tour-spot,
  .niq-tour-pop {
    transition-duration: 0.001ms !important;
  }
}
