/* ═══════════════════════════════════════════════════════════
   Brae Hair Care — Quiz Funnel Styles
   Palette extracted from braehaircare.co.uk:
     white + warm cream (#EDE8DC) + dusty rose (#D4C3BA) + near-black (#1A1714)
   Mobile-first (375px baseline).
   ═══════════════════════════════════════════════════════════ */

[x-cloak] { display: none !important; }

/* ─── Brand palette ─── */
:root {
  --brae-white:    #FFFFFF;
  --brae-smoke:    #F5F3F1;           /* subtle card bg, hover tint */
  --brae-cream:    #EDE8DC;           /* warm section bg */
  --brae-rose:     #D4C3BA;           /* product/image card bg */
  --brae-text:     #1A1714;           /* near-black */
  --brae-muted:    rgba(26,23,20,0.48);
  --brae-border:   rgba(26,23,20,0.10);
  --brae-border-strong: rgba(26,23,20,0.22);
}

/* ─── Base ─── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--brae-text);
  background: var(--brae-white);
}

/* ─── Typography helpers ─── */
.font-display {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.font-display-bold {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.font-ui {
  font-family: 'Inter', system-ui, sans-serif;
}

/* ─── Progress bar ─── */
.progress-track {
  height: 3px;
  background: rgba(26,23,20,0.10);
  border-radius: 9999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--brae-text);
  transition: width 500ms cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 9999px;
}

/* ─── Quiz answer cards ─── */
.quiz-card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  background: var(--brae-white);
  border: 1.5px solid var(--brae-border);
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  min-height: 72px;
}
.quiz-card:hover {
  transform: translateY(-1px);
  border-color: var(--brae-border-strong);
  box-shadow: 0 4px 20px -4px rgba(26,23,20,0.08);
}
.quiz-card.selected {
  border-color: var(--brae-text);
  box-shadow: 0 0 0 2px rgba(26,23,20,0.10);
  background: var(--brae-smoke);
}
.quiz-card.selected::after {
  content: '✓';
  position: absolute; top: 0.5rem; right: 0.5rem;
  width: 1.5rem; height: 1.5rem;
  background: var(--brae-text); color: white;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  animation: pop 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

/* ─── Image card (quiz option with photo) ─── */
.quiz-img-card {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  aspect-ratio: 4/5;
  background: var(--brae-rose);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 220ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.quiz-img-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px -6px rgba(26,23,20,0.14); }
.quiz-img-card.selected { border-color: var(--brae-text); }
.quiz-img-card img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.quiz-img-card .img-placeholder {
  width: 100%; height: 100%;
  background: var(--brae-rose);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
}
.quiz-img-card .card-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 0.75rem 0.625rem 0.625rem;
  background: linear-gradient(0deg, rgba(26,23,20,0.72) 0%, rgba(26,23,20,0) 100%);
  color: white;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.3;
}
.quiz-img-card .card-hint {
  font-size: 0.6875rem;
  font-weight: 400;
  opacity: 0.8;
  display: block;
  margin-top: 0.1rem;
}
.quiz-img-card.selected::after {
  content: '✓';
  position: absolute; top: 0.5rem; right: 0.5rem;
  width: 1.5rem; height: 1.5rem;
  background: white; color: var(--brae-text);
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  font-family: 'Inter', sans-serif;
  animation: pop 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Colour swatch circle (hair colour Q) ─── */
.colour-swatch {
  width: 2.25rem; height: 2.25rem;
  border-radius: 9999px;
  border: 2.5px solid rgba(255,255,255,0.55);
  box-shadow: 0 2px 8px rgba(26,23,20,0.18);
  flex-shrink: 0;
}

/* ─── Trust strip (per-question brand signal) ─── */
.quiz-trust-strip {
  display: flex; align-items: center; justify-content: center; gap: 0.375rem;
  margin-top: 1.125rem; padding: 0.5rem 0.875rem;
  background: var(--brae-smoke); border-radius: 0.5rem;
  font-family: 'Inter', sans-serif; font-size: 0.6875rem; font-weight: 500;
  color: var(--brae-text); opacity: 0.5; letter-spacing: 0.01em;
  text-align: center; line-height: 1.4; flex-wrap: wrap;
}
.quiz-trust-strip .dot { opacity: 0.35; margin: 0 0.125rem; }

/* ─── Diagnosis metric bars ─── */
@keyframes metric-grow {
  from { width: 0%; }
  to   { width: var(--w, 50%); }
}
.diag-metric-bar {
  animation: metric-grow 0.85s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  animation-delay: calc(var(--delay, 0) * 0.1s + 0.15s);
  width: 0%;
}

/* ─── Diagnosis tags ─── */
.diag-tag {
  font-family: 'Inter', sans-serif; font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.03em; padding: 0.3rem 0.75rem;
  border: 1.5px solid; border-radius: 9999px;
  white-space: nowrap;
}

/* ─── Icon grid cards (Q3–Q7) ─── */
.quiz-icon-card {
  position: relative;
  background: var(--brae-white);
  border: 1.5px solid var(--brae-border);
  border-radius: 0.875rem;
  padding: 1.25rem 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  min-height: 128px;
  transition: all 220ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
}
.quiz-icon-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px -6px rgba(26,23,20,0.12); }
.quiz-icon-card.selected { border-color: var(--brae-text); background: var(--brae-smoke); }
.quiz-icon-card .icon-wrap { width: 2.5rem; height: 2.5rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.quiz-icon-card .icon-wrap svg { width: 100%; height: 100%; }
.quiz-icon-card .icon-dot { width: 0.3rem; height: 0.3rem; border-radius: 9999px; flex-shrink: 0; }
.quiz-icon-card .icon-label { font-family: 'Inter', sans-serif; font-weight: 600; font-size: 0.8125rem; color: var(--brae-text); line-height: 1.3; }
.quiz-icon-card .icon-hint { font-family: 'Inter', sans-serif; font-weight: 400; font-size: 0.6875rem; color: var(--brae-muted); line-height: 1.35; margin-top: 0.1rem; }
.quiz-icon-card.selected::after {
  content: '✓';
  position: absolute; top: 0.45rem; right: 0.45rem;
  width: 1.25rem; height: 1.25rem;
  background: var(--brae-text); color: white;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 700; font-family: 'Inter', sans-serif;
  animation: pop 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Primary CTA button ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9375rem 2rem;
  border-radius: 0.625rem;
  background: var(--brae-text);
  color: white;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  transition: all 220ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 4px 24px -6px rgba(26,23,20,0.30);
  min-height: 54px;
  white-space: nowrap;
  cursor: pointer;
  border: none;
}
.btn-primary:hover { background: #2E2924; transform: translateY(-1px); box-shadow: 0 8px 32px -8px rgba(26,23,20,0.35); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:focus-visible { outline: 2px solid var(--brae-text); outline-offset: 3px; border-radius: 0.625rem; }
.btn-primary:disabled { opacity: 0.50; cursor: wait; transform: none; }

/* ─── Secondary / outline button ─── */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--brae-text);
  border: 1.5px solid var(--brae-border-strong);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: all 200ms ease;
  min-height: 48px;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--brae-smoke); border-color: var(--brae-text); }

/* ─── Loading spinner ─── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 2.5rem; height: 2.5rem;
  border: 2.5px solid rgba(26,23,20,0.12);
  border-top-color: var(--brae-text);
  border-radius: 9999px;
  animation: spin 0.8s linear infinite;
}

/* ─── Loading dots ─── */
@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.35; }
  40%           { transform: scale(1.0); opacity: 1; }
}
.loading-dot {
  width: 0.5rem; height: 0.5rem;
  border-radius: 9999px;
  background: var(--brae-text);
  animation: dot-bounce 1.4s ease-in-out infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

/* ─── Quiz screen slide-in ─── */
.quiz-screen { animation: slide-in 360ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
@keyframes slide-in {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Fade-up reveal ─── */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-up   { animation: fade-in-up 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both; }
.animate-fade-up-delay-1 { animation-delay: 80ms; }
.animate-fade-up-delay-2 { animation-delay: 160ms; }
.animate-fade-up-delay-3 { animation-delay: 240ms; }
.animate-fade-up-delay-4 { animation-delay: 320ms; }
.animate-fade-up-delay-5 { animation-delay: 400ms; }

/* ─── Scroll reveal ─── */
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ─── Form inputs ─── */
.form-input {
  width: 100%;
  height: 3.25rem;
  padding: 0 1rem;
  border-radius: 0.625rem;
  background: var(--brae-white);
  border: 1.5px solid var(--brae-border-strong);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: var(--brae-text);
  transition: border-color 180ms ease;
  -webkit-appearance: none;
}
.form-input:focus {
  outline: none;
  border-color: var(--brae-text);
  box-shadow: 0 0 0 3px rgba(26,23,20,0.07);
}
.form-input::placeholder { color: rgba(26,23,20,0.30); }

/* ─── Product card (result page) ─── */
.product-card {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  background: var(--brae-white);
  border: 1.5px solid var(--brae-border);
  border-radius: 1rem;
  padding: 0.875rem;
  transition: all 200ms ease;
}
.product-card.customizable:hover { border-color: var(--brae-border-strong); }
.product-card.customizable.checked { border-color: var(--brae-text); background: var(--brae-smoke); }

.product-img {
  width: 76px; height: 76px;
  border-radius: 0.75rem;
  object-fit: cover;
  background: var(--brae-rose);
  flex-shrink: 0;
}
.product-img-placeholder {
  width: 76px; height: 76px;
  border-radius: 0.75rem;
  background: var(--brae-rose);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.625rem;
}

/* ─── Role badges ─── */
.role-badge {
  display: inline-block;
  padding: 0.175rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.625rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.role-cleanser    { background: #EAF0F5; color: #3A6070; }
.role-conditioner { background: #F2EDE8; color: #7A5D48; }
.role-treatment   { background: #F2EDE8; color: #7A5D48; }
.role-finisher    { background: #EBF0F2; color: #4A6070; }
.role-protector   { background: #EBF2EB; color: #467046; }
.role-boost       { background: #F5F0EB; color: #7A6248; }

/* ─── Sticky bottom CTA (result page mobile) ─── */
.sticky-cta {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 0.875rem 1rem env(safe-area-inset-bottom, 0.875rem);
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(26,23,20,0.08);
  z-index: 40;
  box-shadow: 0 -6px 24px -6px rgba(26,23,20,0.07);
}

/* ─── Sell slide marquee ticker ─── */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee-track {
  animation: marquee 30s linear infinite;
  display: flex;
  width: max-content;
  gap: 2.5rem;
}
.ticker-item {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  letter-spacing: 0.06em;
  white-space: nowrap;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--brae-muted);
}

/* ─── Thin divider ─── */
.brae-divider {
  height: 1px;
  background: var(--brae-border);
  border: none;
  margin: 0;
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Focus accessibility ─── */
*:focus:not(:focus-visible) { outline: none; }
*:focus-visible { outline: 2px solid var(--brae-text); outline-offset: 2px; border-radius: 4px; }
