/* ============================================================
   LEARNAI — QUIZ FUNNEL
   Interactive lead-gen quiz · Steps · Options · Results · Bot
   ============================================================ */

/* ------------------------------------------------------------ 
   PROGRESS BAR
   ------------------------------------------------------------ */

.quiz-progress {
  position: sticky;
  top: 64px;
  z-index: 90;
  height: 4px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
}

.quiz-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--emerald-700), var(--emerald-500));
  border-radius: 0 var(--r-pill) var(--r-pill) 0;
  transition: width var(--dur-slow) var(--ease-out);
}

/* ------------------------------------------------------------ 
   QUIZ CONTAINER
   ------------------------------------------------------------ */

.quiz {
  position: relative;
  min-height: calc(100vh - 64px);
  overflow: hidden;
}

.quiz__viewport {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 68px);
}

/* ------------------------------------------------------------ 
   STEP (each screen)
   ------------------------------------------------------------ */

.quiz-step {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-8) var(--gutter);
  opacity: 0;
  transform: translateX(60px);
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease-out),
              transform var(--dur-med) var(--ease-out);
}

.quiz-step.is-active {
  position: relative;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.quiz-step.is-exit {
  opacity: 0;
  transform: translateX(-60px);
}

.quiz-step__inner {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-8);
}

/* ------------------------------------------------------------ 
   STEP 0 — WELCOME
   ------------------------------------------------------------ */

.quiz-welcome {
  text-align: center;
}

.quiz-welcome__icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--s-6);
  border-radius: 50%;
  background: linear-gradient(140deg, var(--emerald-900), var(--emerald-700));
  display: grid;
  place-items: center;
  color: var(--on-dark);
  box-shadow: 0 0 0 8px rgba(16,185,129,.12), 0 0 0 16px rgba(16,185,129,.06);
  animation: welcome-pulse 3s var(--ease-out) infinite;
}

@keyframes welcome-pulse {
  0%, 100% { box-shadow: 0 0 0 8px rgba(16,185,129,.12), 0 0 0 16px rgba(16,185,129,.06); }
  50% { box-shadow: 0 0 0 12px rgba(16,185,129,.10), 0 0 0 24px rgba(16,185,129,.03); }
}

.quiz-welcome__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  background: var(--emerald-50);
  border: 1px solid #A7F3D0;
  border-radius: var(--r-pill);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--emerald-700);
  margin-bottom: var(--s-5);
}

.quiz-welcome h1 {
  font-size: var(--text-display-md);
  max-width: 18ch;
  margin-bottom: var(--s-4);
}

.quiz-welcome__sub {
  font-size: var(--text-lg);
  color: var(--ink-soft);
  max-width: 44ch;
  line-height: 1.6;
}

.quiz-welcome__meta {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  margin-top: var(--s-2);
}

.quiz-welcome__meta span {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--text-sm);
  color: var(--muted);
}

.quiz-welcome__meta svg {
  color: var(--emerald-600);
  flex-shrink: 0;
}

/* ------------------------------------------------------------ 
   QUESTION AREA
   ------------------------------------------------------------ */

.quiz-question {
  text-align: center;
  width: 100%;
}

.quiz-question__step-label {
  display: inline-block;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--emerald-700);
  margin-bottom: var(--s-3);
}

.quiz-question__text {
  font-size: var(--text-display-sm);
  max-width: 22ch;
  margin-inline: auto;
  line-height: 1.2;
}

/* ------------------------------------------------------------ 
   OPTION CARDS (grid of choices)
   ------------------------------------------------------------ */

.quiz-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
  width: 100%;
}

.quiz-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-6) var(--s-4);
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.quiz-option:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.quiz-option:active {
  transform: translateY(0);
}

.quiz-option.is-selected {
  border-color: var(--emerald-700);
  background: var(--emerald-50);
  box-shadow: 0 0 0 3px rgba(4,120,87,.12), var(--shadow-sm);
  transform: translateY(-2px);
}

.quiz-option__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

.quiz-option.is-selected .quiz-option__icon {
  background: var(--emerald-700);
  border-color: var(--emerald-700);
  color: var(--on-dark);
}

.quiz-option__label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--ink);
  line-height: 1.2;
}

.quiz-option__desc {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.4;
}

.quiz-option__check {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--emerald-700);
  display: grid;
  place-items: center;
  color: var(--on-dark);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity var(--dur-fast) var(--ease-snap),
              transform var(--dur-fast) var(--ease-snap);
}

.quiz-option.is-selected .quiz-option__check {
  opacity: 1;
  transform: scale(1);
}

/* Two-column variant for 2 options */
.quiz-options--2 {
  grid-template-columns: repeat(2, 1fr);
  max-width: 540px;
  margin-inline: auto;
}

/* Three-column variant for 6 options (wider) */
.quiz-options--wide {
  grid-template-columns: repeat(3, 1fr);
  max-width: 800px;
  margin-inline: auto;
}

/* ------------------------------------------------------------ 
   NAV BUTTONS (back / next)
   ------------------------------------------------------------ */

.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 720px;
  margin-top: var(--s-4);
}

.quiz-nav__back {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}

.quiz-nav__back:hover { color: var(--ink); }

.quiz-nav__next {
  pointer-events: none;
  opacity: 0.4;
  transform: translateY(2px);
  transition: opacity var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

.quiz-nav__next.is-ready {
  pointer-events: auto;
  opacity: 1;
  transform: none;
}

/* ------------------------------------------------------------ 
   RESULTS PAGE
   ------------------------------------------------------------ */

.quiz-results {
  text-align: center;
}

/* ---- Bot Character ---- */

.bot {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto var(--s-6);
}

.bot__body {
  position: relative;
  width: 100%;
  height: 100%;
  animation: bot-bounce 2s var(--ease-out) infinite;
}

@keyframes bot-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.bot__head {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  border-radius: var(--r-lg);
  background: linear-gradient(140deg, var(--emerald-900), var(--emerald-700));
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.bot__eyes {
  display: flex;
  gap: 12px;
}

.bot__eye {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--emerald-100);
  position: relative;
}

.bot__eye::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--on-dark);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: bot-look 4s ease-in-out infinite;
}

@keyframes bot-look {
  0%, 100% { transform: translate(-50%, -50%); }
  25% { transform: translate(-20%, -50%); }
  75% { transform: translate(-80%, -50%); }
}

.bot__mouth {
  width: 20px;
  height: 10px;
  border-radius: 0 0 10px 10px;
  background: var(--emerald-500);
}

.bot__arm {
  position: absolute;
  bottom: 10px;
  width: 28px;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--emerald-800);
}

.bot__arm--left {
  left: 4px;
  transform-origin: right center;
  animation: clap-left 1s var(--ease-out) infinite;
}

.bot__arm--right {
  right: 4px;
  transform-origin: left center;
  animation: clap-right 1s var(--ease-out) infinite;
}

@keyframes clap-left {
  0%, 100% { transform: rotate(10deg); }
  50% { transform: rotate(-30deg); }
}

@keyframes clap-right {
  0%, 100% { transform: rotate(-10deg); }
  50% { transform: rotate(30deg); }
}

.bot__sparkles {
  position: absolute;
  inset: -20px;
  pointer-events: none;
}

.bot__sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold-500);
  animation: sparkle-pop 2s var(--ease-out) infinite;
}

.bot__sparkle:nth-child(1) { top: 0; left: 20%; animation-delay: 0s; }
.bot__sparkle:nth-child(2) { top: 10%; right: 10%; animation-delay: 0.3s; }
.bot__sparkle:nth-child(3) { bottom: 20%; left: 5%; animation-delay: 0.6s; }
.bot__sparkle:nth-child(4) { top: 5%; left: 50%; animation-delay: 0.9s; }
.bot__sparkle:nth-child(5) { bottom: 10%; right: 5%; animation-delay: 1.2s; }

@keyframes sparkle-pop {
  0%, 100% { opacity: 0; transform: scale(0); }
  50% { opacity: 1; transform: scale(1); }
}

/* ---- Results Content ---- */

.quiz-results__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  background: var(--gold-50);
  border: 1px solid #FCD34D;
  border-radius: var(--r-pill);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-700);
  margin-bottom: var(--s-4);
}

.quiz-results__title {
  font-size: var(--text-display-md);
  max-width: 20ch;
  margin: 0 auto var(--s-4);
}

.quiz-results__sub {
  font-size: var(--text-lg);
  color: var(--ink-soft);
  max-width: 52ch;
  margin: 0 auto var(--s-8);
  line-height: 1.6;
}

/* ---- Summary pill ---- */

.quiz-summary {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2);
  margin-bottom: var(--s-8);
}

.quiz-summary__pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-2) var(--s-3);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-soft);
}

.quiz-summary__pill svg {
  color: var(--emerald-600);
}

/* ---- Recommended Course Cards ---- */

.quiz-results__heading {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s-5);
}

.quiz-recs {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.quiz-rec {
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-align: left;
  transition: box-shadow var(--dur-med) var(--ease-out),
              transform var(--dur-med) var(--ease-out),
              border-color var(--dur-med) var(--ease-out);
}

.quiz-rec:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.quiz-rec__mockup {
  width: 100px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.quiz-rec__mockup-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.quiz-rec__mockup-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-2xs);
  color: rgba(255,255,255,.9);
  text-align: center;
  line-height: 1.3;
  padding: var(--s-2);
}

.quiz-rec__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-5);
  min-width: 0;
}

.quiz-rec__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}

.quiz-rec__title {
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

.quiz-rec__reason {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.5;
}

.quiz-rec__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: auto;
  padding-top: var(--s-3);
}

.quiz-rec__price {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.quiz-rec__price .now {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--ink);
}

.quiz-rec__price .was {
  font-size: var(--text-2xs);
  color: var(--faint);
  text-decoration: line-through;
}

/* ---- Social proof ---- */

.quiz-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  margin-top: var(--s-8);
  padding: var(--s-4) var(--s-5);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  width: 100%;
  max-width: 600px;
  margin-inline: auto;
}

.quiz-social__avatars {
  display: flex;
}

.quiz-social__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--text-2xs);
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--bg-alt);
  margin-left: -8px;
}

.quiz-social__avatar:first-child { margin-left: 0; }

.quiz-social__text {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.quiz-social__text strong {
  color: var(--ink);
}

/* ---- Final CTA ---- */

.quiz-final-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-4);
  margin-top: var(--s-8);
  width: 100%;
  max-width: 600px;
  margin-inline: auto;
}

.quiz-final-cta__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
}

.quiz-final-cta .btn {
  min-width: 260px;
}

/* ------------------------------------------------------------ 
   "NOT SURE?" FALLBACK
   ------------------------------------------------------------ */

.quiz-unsure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  width: 100%;
  max-width: 600px;
  margin: var(--s-4) auto;
  padding: var(--s-4) var(--s-5);
  background: var(--bg-alt);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
}

.quiz-unsure__text {
  font-size: var(--text-sm);
  color: var(--muted);
  white-space: nowrap;
}

.quiz-unsure__btn {
  flex-shrink: 0;
}

/* ------------------------------------------------------------ 
   FULL-WIDTH COURSE CTA
   ------------------------------------------------------------ */

.quiz-rec__cta {
  width: 100%;
  margin-top: var(--s-3);
  padding: 0.75em 1.2em;
  font-size: var(--text-sm);
  justify-content: center;
}

/* ---- Restart link ---- */

.quiz-restart {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-6);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}

.quiz-restart:hover { color: var(--emerald-700); }

/* ------------------------------------------------------------ 
   RESPONSIVE
   ------------------------------------------------------------ */

@media (max-width: 768px) {
  .quiz-step {
    padding: var(--s-6) var(--gutter);
    justify-content: flex-start;
    padding-top: var(--s-8);
  }

  .quiz-options {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-3);
  }

  .quiz-options--wide {
    grid-template-columns: repeat(2, 1fr);
  }

  .quiz-option {
    padding: var(--s-4) var(--s-3);
  }

  .quiz-option__icon {
    width: 40px;
    height: 40px;
  }

  .quiz-option__label {
    font-size: var(--text-sm);
  }

  .quiz-option__desc {
    font-size: var(--text-xs);
  }

  .quiz-welcome__meta {
    flex-direction: column;
    gap: var(--s-2);
  }

  .quiz-question__text {
    font-size: var(--text-display-sm);
  }

  .quiz-results__title {
    font-size: var(--text-display-sm);
  }

  .quiz-results__sub {
    font-size: var(--text-md);
  }

  .quiz-rec {
    flex-direction: column;
  }

  .quiz-rec__mockup {
    width: 100%;
    height: 100px;
  }

  .quiz-social {
    flex-direction: column;
    text-align: center;
  }

  .quiz-unsure {
    flex-direction: column;
    text-align: center;
    gap: var(--s-2);
  }
}

@media (max-width: 480px) {
  .quiz-options {
    grid-template-columns: 1fr 1fr;
    gap: var(--s-2);
  }

  .quiz-options--2 {
    grid-template-columns: 1fr;
  }

  .quiz-option {
    padding: var(--s-3);
    gap: var(--s-2);
  }

  .quiz-option__icon {
    width: 36px;
    height: 36px;
  }

  .quiz-option__label {
    font-size: var(--text-sm);
  }

  .quiz-option__desc {
    display: none;
  }

  .quiz-nav {
    flex-direction: column-reverse;
    gap: var(--s-3);
  }

  .quiz-nav .btn {
    width: 100%;
  }

  .quiz-nav__back {
    justify-content: center;
  }

  .quiz-final-cta .btn {
    width: 100%;
    min-width: 0;
  }

  .quiz-summary__pill {
    font-size: var(--text-2xs);
  }

  .bot {
    width: 96px;
    height: 96px;
  }

  .bot__head {
    width: 64px;
    height: 64px;
  }

  .bot__eye {
    width: 10px;
    height: 10px;
  }

  .bot__eye::after {
    width: 4px;
    height: 4px;
  }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .quiz-step,
  .quiz-option,
  .quiz-option__check,
  .quiz-option__icon,
  .quiz-nav__next,
  .quiz-progress__fill,
  .quiz-rec {
    transition: none;
  }

  .quiz-rec__cta {
    transition: none;
  }

  .quiz-step.is-active {
    transform: none;
  }

  .quiz-step.is-exit {
    transform: none;
  }

  .quiz-welcome__icon {
    animation: none;
  }

  .bot__body {
    animation: none;
  }

  .bot__eye::after {
    animation: none;
  }

  .bot__arm--left,
  .bot__arm--right {
    animation: none;
  }

  .bot__sparkle {
    animation: none;
    opacity: 0.7;
  }
}
