/* =============================================================================
   Quiz-funnel renderer — Product A LOCKED LOOK.
   LIGHT · warm · photography-led. Big SOLID tap chips (neutral -> accent when
   selected). Thin dot progress spine. Big fluid variable-type question. NO
   dark-glass, NO backdrop-filter/blur (reserved for Product B; INP cost bites on
   cheap ad-traffic Android). One accent = the CLIENT's brand color, on the
   selected-option state + the single primary CTA ONLY.

   All color/space/type come from shared/ui tokens (var(--color-*) etc.) so a
   rebrand is one file. The ONLY per-client color is --funnel-accent, injected
   inline from theme.accent; it falls back to the token accent.
   ============================================================================= */
@import "/vendor/tokens.css";

:root {
  /* per-client accent (injected inline); fall back to the semantic token accent */
  --funnel-accent: var(--color-accent-strong);
  --funnel-accent-ink: var(--color-accent-strong);
  /* hero photo (injected inline when https); the barrier layer keeps text >=4.5:1 */
  --funnel-hero: none;
  /* readable ink chosen for a solid accent CTA (white on our accent passes AA) */
  --funnel-on-accent: var(--color-on-accent);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;               /* no horizontal scroll (WCAG 1.4.10 reflow) */
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  -webkit-text-size-adjust: 100%;
}

/* ── Photography-led backdrop: a real photo behind a LIGHT warm barrier layer.
   No blur — a solid warm scrim carries the contrast, cheaply. ─────────────── */
.funnel-hero-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--color-surface-2);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.82)),
    var(--funnel-hero);
  background-size: cover;
  background-position: center;
  pointer-events: none;
}
/* No hero photo set ⇒ a plain warm wash (no empty-image request). */
:root:not([style*="--funnel-hero"]) .funnel-hero-layer,
.funnel-hero-layer { background-image: linear-gradient(180deg, var(--color-bg), var(--color-surface-2)); }

/* ── Layout: a single centered column, one screen per step ─────────────────── */
.funnel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), var(--space-6)) var(--space-5)
           calc(var(--space-16) + env(safe-area-inset-bottom));
  min-height: 100dvh;
}
.funnel--message { display: flex; align-items: center; justify-content: center; text-align: center; }

/* ── Thin progress spine (dots) ────────────────────────────────────────────── */
.progress-spine {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  padding: var(--space-2) 0 var(--space-6);
}
.progress-spine .dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-line);
  transition: background-color 180ms ease, transform 180ms ease;
}
.progress-spine .dot.on { background: var(--funnel-accent); transform: scale(1.25); }

/* ── One step per screen ───────────────────────────────────────────────────── */
.step { animation: none; }
.step[hidden] { display: none; }

.step-count {
  margin: 0 0 var(--space-2);
  color: var(--color-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Big FLUID variable-type question. */
.q-prompt, .q-prompt-sub, .cap-title {
  font-family: var(--font-display);
  color: var(--color-ink);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-5);
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  overflow-wrap: break-word;   /* never let a long word force horizontal scroll */
  hyphens: auto;
}
.q-prompt-sub, .cap-title { margin-bottom: var(--space-5); }
.q-help { margin: calc(var(--space-4) * -0.5) 0 var(--space-5); color: var(--color-muted); font-size: var(--text-md); }

/* ── Tap chips: big SOLID neutral surfaces -> accent when selected ─────────── */
.options { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.chip { position: relative; display: block; }
.chip-input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0;
}
.chip-face {
  display: flex;
  align-items: center;
  min-height: 56px;            /* > 48px house tap-target floor */
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  color: var(--color-text);
  border: 2px solid var(--color-line);
  border-radius: var(--radius-md);
  font-size: var(--text-lg);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 120ms ease;
}
.chip-face::before {
  content: "";
  flex: 0 0 auto;
  width: 22px; height: 22px;
  margin-right: var(--space-3);
  border: 2px solid var(--color-line);
  border-radius: var(--radius-pill);
  transition: border-color 140ms ease, background-color 140ms ease;
}
.options[data-kind="multi-select"] .chip-face::before { border-radius: 6px; }

/* hover (pointer only) — subtle, neutral */
@media (hover: hover) {
  .chip-face:hover { border-color: var(--color-muted); }
}
/* selected state = the ONE place the client accent appears on options */
.chip-input:checked + .chip-face {
  border-color: var(--funnel-accent);
  background: var(--color-accent-wash);
}
.chip-input:checked + .chip-face::before {
  border-color: var(--funnel-accent);
  background: var(--funnel-accent);
  box-shadow: inset 0 0 0 3px var(--color-surface);
}
/* one-time tap-confirm pulse (<=400ms, reduced-motion-safe) */
.chip-input:checked + .chip-face { animation: tap-confirm 320ms ease; }
@keyframes tap-confirm {
  0% { transform: scale(1); }
  40% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

/* visible keyboard focus that a sticky element never obscures (2.4.11) */
.chip-input:focus-visible + .chip-face,
.cap-field input:focus-visible,
.consent-row input:focus-visible,
.cta:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

/* ── Capture fields ────────────────────────────────────────────────────────── */
.cap-fields { display: flex; flex-direction: column; gap: var(--space-4); margin-bottom: var(--space-5); }
.cap-field label { display: block; font-weight: 600; margin-bottom: var(--space-1); color: var(--color-ink); }
.cap-field .opt { color: var(--color-muted); font-weight: 400; }
.cap-field input {
  width: 100%;
  min-height: 52px;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-md);           /* 16px — no iOS zoom */
  border: 2px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
}
.cap-field input:focus { border-color: var(--funnel-accent); }

/* ── Consent: SEPARATE sms/email rows, never bundled ───────────────────────── */
.consent { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-6); }
.consent-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  cursor: pointer;
}
.consent-row input {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  margin: 2px 0 0;
  accent-color: var(--funnel-accent);
}
.consent-text { color: var(--color-muted); font-size: var(--text-sm); line-height: var(--leading-snug); }

/* ── The single primary CTA — the ONLY other accent surface ────────────────── */
.cta {
  display: block;
  width: 100%;
  min-height: 56px;
  margin-top: var(--space-2);
  padding: var(--space-4) var(--space-5);
  background: var(--funnel-accent);
  color: var(--funnel-on-accent);
  border: 0;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 120ms ease, filter 120ms ease;
}
@media (hover: hover) { .cta:hover { filter: brightness(0.95); } }
.cta:active { transform: translateY(1px); }
.cta[disabled] { opacity: 0.6; cursor: default; }

/* ── The reveal (peak-curiosity gate, immediately after capture) ───────────── */
.reveal { text-align: center; padding-top: var(--space-10); }
.reveal-title { font-family: var(--font-display); color: var(--color-ink); font-size: clamp(1.8rem, 8vw, 2.6rem); margin: 0 0 var(--space-3); }
.reveal-sub { color: var(--color-muted); font-size: var(--text-lg); margin: 0 auto; max-width: 28rem; }

/* ── a11y utilities ────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: var(--z-toast);
  background: var(--color-ink); color: var(--color-on-brand);
  padding: var(--space-3) var(--space-4); border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }
/* honeypot: off-screen, never shown to a real user */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Turnstile widget spacing (only present once provisioned) */
.cf-turnstile { margin: 0 0 var(--space-4); }

/* error line */
.form-error {
  margin: var(--space-3) 0 0;
  color: var(--color-danger);
  background: var(--color-danger-bg);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}
.form-error[hidden] { display: none; }

/* ── Motion budget: only tap-feedback / progress / one-time reveal, all <=400ms.
   prefers-reduced-motion freezes every transition + animation. ─────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
