/* ==========================================================================
   WS Theme — quiz-nudge.css
   Small dismissible pill (bottom-left) pointing to the quiz on the homepage,
   shop and category archives (template-parts/components/quiz-nudge.php,
   assets/js/quiz-nudge.js). Sits below drawers, mobile nav (200) and the
   add-to-cart toast (500, bottom-right), so it never covers them.
   ========================================================================== */

.quiz-nudge {
  position: fixed;
  bottom: max(var(--spacing-lg), env(safe-area-inset-bottom));
  left: max(var(--spacing-lg), env(safe-area-inset-left));
  z-index: 150;
  display: flex;
  align-items: center;
  max-width: min(24rem, calc(100vw - 2 * var(--spacing-md)));
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px var(--color-shadow);
  opacity: 0;
  visibility: hidden;
  /* Taps pass through while it fades out, not only once hidden. */
  pointer-events: none;
  transform: translateY(0.75rem);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0s linear 0.25s;
}

/* Without JS it never appears (display: flex above would beat the UA rule). */
.quiz-nudge[hidden] {
  display: none;
}

.quiz-nudge.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0s;
}

.quiz-nudge__link {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: var(--spacing-sm);
  min-height: 44px;
  padding: var(--spacing-sm) 0 var(--spacing-sm) var(--spacing-sm);
  color: var(--color-text);
  font-size: 0.875rem;
  line-height: 1.3;
  text-decoration: none;
}

.quiz-nudge__icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  color: var(--color-accent-text);
  font-weight: 700;
  background-color: var(--color-accent-tint);
  border-radius: 50%;
}

.quiz-nudge__lead {
  color: var(--color-text-muted);
}

.quiz-nudge__action {
  font-weight: 600;
  white-space: nowrap;
}

.quiz-nudge__link:hover .quiz-nudge__action,
.quiz-nudge__link:focus-visible .quiz-nudge__action {
  color: var(--color-accent-text);
}

.quiz-nudge__close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  line-height: 1;
  background: none;
  border: 0;
  cursor: pointer;
}

.quiz-nudge__close:hover,
.quiz-nudge__close:focus-visible {
  color: var(--color-text);
}

@media (max-width: 767px) {
  .quiz-nudge {
    bottom: max(var(--spacing-md), env(safe-area-inset-bottom));
    left: var(--spacing-md);
  }
}

/* Narrow phones: the action alone keeps the pill on one line. */
@media (max-width: 400px) {
  .quiz-nudge__lead {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-nudge,
  .quiz-nudge.is-visible {
    transform: none;
    transition: none;
  }
}
