/* =========================================================================
   Quiz Juliano — Design System
   Paleta: preto profundo · dourado · branco
   ========================================================================= */

:root {
  /* Surfaces */
  --ink:          #08080a;
  --surface:      #111114;
  --surface-2:    #17171c;
  --surface-3:    #1e1e24;

  /* Brand */
  --gold:         #d4af37;
  --gold-soft:    #e8c766;
  --gold-bright:  #f5de93;
  --gold-deep:    #a8842a;
  --gold-glow:    rgba(212, 175, 55, 0.16);

  /* Text */
  --text:         #f5f5f6;
  --text-muted:   #a5a5ae;
  --text-faint:   #6f6f7a;
  --on-gold:      #0a0a0b;

  /* Lines */
  --line:         rgba(255, 255, 255, 0.09);
  --line-strong:  rgba(255, 255, 255, 0.16);

  /* Feedback */
  --success:      #3ecf8e;
  --danger:       #f0616d;

  /* Spacing scale (4/8) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* Radius */
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px; --r-full: 999px;

  /* Elevation */
  --e-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --e-2: 0 8px 24px rgba(0, 0, 0, 0.45);
  --e-3: 0 24px 64px rgba(0, 0, 0, 0.55);

  /* Motion */
  --dur-fast: 140ms;
  --dur:      220ms;
  --dur-slow: 320ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:  cubic-bezier(0.4, 0, 1, 1);

  /* Layout */
  --shell: 620px;

  --font-display: "Sora", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Ambient gold light — decorative, non-interactive. */
body::before {
  content: "";
  position: fixed;
  inset: -20% -20% auto -20%;
  height: 70vh;
  background:
    radial-gradient(58% 62% at 50% 0%, var(--gold-glow), transparent 70%),
    radial-gradient(40% 40% at 88% 8%, rgba(212, 175, 55, 0.07), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.028em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; }

button { font: inherit; color: inherit; }

img, svg { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: var(--gold); color: var(--on-gold); }

/* Títulos recebem foco programático na troca de tela (leitores de tela).
   Não são controles interativos, então não exibem anel de foco. */
h1[tabindex="-1"]:focus,
h2[tabindex="-1"]:focus { outline: none; }

.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;
}

[hidden] { display: none !important; }

/* --------------------------------------------------------------- layout */

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding:
    max(var(--s-5), env(safe-area-inset-top))
    var(--s-5)
    max(var(--s-6), env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .shell { padding-block: var(--s-7) var(--s-7); justify-content: center; }
}

/* --------------------------------------------------------------- screen */

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  animation: screen-in var(--dur-slow) var(--ease-out) both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translate3d(0, 14px, 0); }
  to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- intro */

.intro { gap: var(--s-5); justify-content: center; }

.hero {
  position: relative;
  margin: 0; /* <figure> traz margin: 1em 40px por padrão */
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--e-2);
  aspect-ratio: 16 / 10;
}

/* Enquadra um pouco acima do centro: mantém o palestrante e corta o piso. */
.hero img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(8, 8, 10, 0.72));
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  align-self: flex-start;
  padding: 7px 14px 7px 10px;
  border-radius: var(--r-full);
  border: 1px solid rgba(212, 175, 55, 0.32);
  background: rgba(212, 175, 55, 0.08);
  color: var(--gold-soft);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.eyebrow .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.18);
}

.headline {
  font-size: clamp(30px, 7.4vw, 46px);
}

.headline .accent {
  background: linear-gradient(100deg, var(--gold-bright), var(--gold) 55%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subheadline {
  color: var(--text-muted);
  font-size: clamp(15.5px, 3.9vw, 17.5px);
  line-height: 1.6;
  max-width: 52ch;
}

.disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

.disclaimer svg { flex: none; color: var(--text-faint); }

/* -------------------------------------------------------------- buttons */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 56px;
  padding: 0 var(--s-6);
  border: 0;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur) var(--ease-out),
    background-color var(--dur) var(--ease-out),
    opacity var(--dur) var(--ease-out);
}

.btn-gold {
  width: 100%;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold) 60%, var(--gold-deep));
  color: var(--on-gold);
  box-shadow: 0 10px 30px -10px rgba(212, 175, 55, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-gold:hover { box-shadow: 0 14px 38px -10px rgba(212, 175, 55, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.btn-gold:active { transform: scale(0.985); }

.btn-ghost {
  min-height: 48px;
  padding: 0 var(--s-4);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 15px;
}

.btn-ghost:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.03); }
.btn-ghost:active { transform: scale(0.985); }

.btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ------------------------------------------------------------- progress */

.quiz-head {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-bottom: var(--s-6);
}

.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.quiz-meta .step { color: var(--gold-soft); }

.progress {
  height: 4px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold) 45%, var(--gold-bright));
  transform-origin: left;
  transition: width var(--dur-slow) var(--ease-out);
}

/* ---------------------------------------------------------------- quiz */

.quiz { justify-content: center; }

.question {
  font-size: clamp(23px, 5.6vw, 30px);
  margin-bottom: var(--s-2);
}

.question-hint {
  color: var(--text-faint);
  font-size: 14px;
  margin-bottom: var(--s-5);
}

.options {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.option {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  width: 100%;
  min-height: 62px;
  padding: var(--s-4) var(--s-4);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color var(--dur) var(--ease-out),
    background-color var(--dur) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur) var(--ease-out);
  animation: option-in var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

@keyframes option-in {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to   { opacity: 1; transform: none; }
}

.option:hover {
  border-color: rgba(212, 175, 55, 0.45);
  background: var(--surface-2);
}

.option:active { transform: scale(0.99); }

.option[aria-checked="true"],
.option[aria-pressed="true"] {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.13), rgba(212, 175, 55, 0.05));
  box-shadow: 0 0 0 1px var(--gold), 0 10px 28px -14px rgba(212, 175, 55, 0.6);
}

.option__mark {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: var(--on-gold);
  transition: background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}

.option--multi .option__mark { border-radius: 7px; }

.option__mark svg { opacity: 0; transform: scale(0.6); transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur) var(--ease-out); }

.option[aria-checked="true"] .option__mark,
.option[aria-pressed="true"] .option__mark {
  background: var(--gold);
  border-color: var(--gold);
}

.option[aria-checked="true"] .option__mark svg,
.option[aria-pressed="true"] .option__mark svg { opacity: 1; transform: none; }

.option__label { flex: 1; }

/* Opção discreta ("Não sou lojista") — presente, mas sem peso visual. */
.option--subtle {
  min-height: 48px;
  margin-top: var(--s-1);
  background: transparent;
  border-color: transparent;
  color: var(--text-faint);
  font-size: 14.5px;
  font-weight: 400;
  justify-content: center;
  gap: var(--s-2);
}

.option--subtle .option__mark { display: none; }
.option--subtle .option__label { flex: none; }
.option--subtle:hover { background: rgba(255, 255, 255, 0.03); border-color: var(--line); color: var(--text-muted); }
.option--subtle[aria-checked="true"] {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-strong);
  box-shadow: none;
  color: var(--text-muted);
}

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

.quiz-foot .btn-gold {
  flex: 1;
  padding-inline: var(--s-4);
  white-space: nowrap;
}

/* ------------------------------------------------------------ formulário */

.form { display: flex; flex-direction: column; gap: var(--s-4); }

.field { display: flex; flex-direction: column; gap: var(--s-2); }

.field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.label-optional { font-weight: 400; color: var(--text-faint); }

.input {
  width: 100%;
  min-height: 54px;
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* evita o zoom automático do iOS */
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.input::placeholder { color: var(--text-faint); }

.input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(240, 97, 109, 0.2); }

.input-prefixed { position: relative; }

.input-prefixed__at {
  position: absolute;
  left: var(--s-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 16px;
  pointer-events: none;
}

.input-prefixed .input { padding-left: 34px; }

.field__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--danger);
  font-size: 13.5px;
  line-height: 1.45;
}

/* Alinha o ícone com a primeira linha da mensagem, não com o bloco todo. */
.field__error svg { flex: none; margin-top: 3px; }

/* ------------------------------------------------------------- loading */

.loading, .thanks {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: var(--s-5);
}

.ring { position: relative; width: 96px; height: 96px; }

.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring__track { stroke: rgba(255, 255, 255, 0.08); }

.ring__fill {
  stroke: url(#goldStroke);
  stroke-linecap: round;
  transition: stroke-dashoffset var(--dur-slow) linear;
}

.ring__value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}

.loading__title { font-size: clamp(20px, 5vw, 26px); }

.loading__status {
  color: var(--text-muted);
  font-size: 15px;
  min-height: 24px;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  width: 100%;
  max-width: 340px;
  margin-top: var(--s-2);
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--text-faint);
  font-size: 14.5px;
  text-align: left;
  transition: color var(--dur) var(--ease-out);
}

.steps li[data-state="active"] { color: var(--text); }
.steps li[data-state="done"] { color: var(--text-muted); }

.steps .tick {
  flex: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: var(--on-gold);
  transition: background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}

.steps .tick svg { opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.steps li[data-state="done"] .tick { background: var(--gold); border-color: var(--gold); }
.steps li[data-state="done"] .tick svg { opacity: 1; }
.steps li[data-state="active"] .tick { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.14); }

/* -------------------------------------------------------------- thanks */

.seal {
  width: 88px; height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold) 60%, var(--gold-deep));
  color: var(--on-gold);
  box-shadow: 0 18px 44px -14px rgba(212, 175, 55, 0.65);
  animation: pop var(--dur-slow) var(--ease-out) both;
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: none; }
}

.thanks__title { font-size: clamp(26px, 6.4vw, 34px); }

.thanks__text { color: var(--text-muted); max-width: 42ch; }

.countdown {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.countdown strong { color: var(--gold-soft); font-weight: 600; }

.link-plain {
  color: var(--text-faint);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none;
  border: 0;
  cursor: pointer;
}

.link-plain:hover { color: var(--gold-soft); }

/* --------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  z-index: 100;
  max-width: min(92vw, 420px);
  padding: 13px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  box-shadow: var(--e-3);
  color: var(--text);
  font-size: 14.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}

.toast[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }
.toast[data-tone="error"] { border-color: rgba(240, 97, 109, 0.5); }

/* ------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
