/* ═══════════════════════════════════════════════
   CONSTRUTAX — FORMULÁRIO · style.css
   ═══════════════════════════════════════════════ */

/* ── TOKENS: LIGHT ── */
:root,
[data-theme="light"] {
  --ink: #1e1e1e;
  --graphite: #3a3a3a;
  --muted: #6b6b66;
  --green: #2f7a3e;
  --green-dark: #1f5c2c;
  --green-light: #eaf3ea;
  --paper: #f5f4ef;
  --surface: #ffffff;
  --line: #ddd9d0;
  --line-subtle: #e8e5df;
  --error: #b3432f;

  /* dot grid background */
  --bg-dot-color: rgba(0,0,0,0.10);
  --bg-dot-size: 1.5px;
  --bg-dot-gap: 24px;

  /* loader */
  --loader-bg: #f5f4ef;
}

/* ── TOKENS: DARK ── */
[data-theme="dark"] {
  --ink: #e8e6e0;
  --graphite: #c8c5be;
  --muted: #8a8880;
  --green: #3d9e50;
  --green-dark: #52c46a;
  --green-light: #0f2415;
  --paper: #141414;
  --surface: #1e1e1e;
  --line: #2e2e2e;
  --line-subtle: #262626;
  --error: #e05a42;

  --bg-dot-color: rgba(255,255,255,0.07);
  --bg-dot-size: 1.5px;
  --bg-dot-gap: 24px;

  --loader-bg: #141414;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* elimina o delay de ~300ms de toque no mobile em elementos clicáveis */
.opt, .scale-btn, .btn, .theme-toggle {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ── BODY + DOT GRID ── */
body {
  font-family: 'Inter', sans-serif;
  background-color: var(--paper);
  /* refined dot grid — clean, not distracting */
  background-image: radial-gradient(circle, var(--bg-dot-color) var(--bg-dot-size), transparent var(--bg-dot-size));
  background-size: var(--bg-dot-gap) var(--bg-dot-gap);
  background-position: center center;
  color: var(--ink);
  min-height: 100vh;
  padding: 28px 16px 72px;
  transition: background-color 0.3s, color 0.3s;
}

/* ═══════════ LOADER ═══════════ */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--loader-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.loader-logo {
  width: 220px;
  height: auto;
  object-fit: contain;
  animation: loaderPop 0.6s cubic-bezier(.22,1,.36,1) both;
}
@keyframes loaderPop {
  from { opacity: 0; transform: scale(0.88) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.loader-bar {
  width: 180px;
  height: 3px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.loader-fill {
  height: 100%;
  width: 0%;
  background: var(--green);
  border-radius: 999px;
  animation: loaderFill 1.6s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes loaderFill {
  0%   { width: 0%; }
  60%  { width: 75%; }
  100% { width: 100%; }
}

/* ═══════════ APP FADE-IN ═══════════ */
#app {
  transition: opacity 0.4s ease;
}
#app.visible {
  opacity: 1 !important;
}

/* ═══════════ LAYOUT ═══════════ */
.wrap {
  max-width: 720px;
  margin: 0 auto;
}

/* ═══════════ TOPBAR ═══════════ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.logo-wrap img {
  height: 52px;
  width: auto;
  display: block;
  object-fit: contain;
  transition: opacity 0.2s;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.eyebrow {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green-dark);
  background: var(--green-light);
  padding: 6px 12px;
  border-radius: 100px;
  white-space: nowrap;
  transition: background 0.3s, color 0.3s;
}

/* ── THEME TOGGLE ── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--green);
  transform: scale(1.08);
}
.theme-toggle:active { transform: scale(0.95); }

/* show correct icon per theme */
[data-theme="light"] .theme-icon--sun  { display: none; }
[data-theme="light"] .theme-icon--moon { display: block; }
[data-theme="dark"]  .theme-icon--sun  { display: block; }
[data-theme="dark"]  .theme-icon--moon { display: none; }

/* ═══════════ PROGRESS ═══════════ */
.ruler {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.tick {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  transition: background 0.35s;
}
.tick.done, .tick.active { background: var(--green); }

.step-caption {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--muted);
  margin-bottom: 24px;
}

/* ═══════════ CARD ═══════════ */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-subtle);
  border-radius: 6px;
  padding: 36px 32px 28px;
  transition: background 0.3s, border-color 0.3s;
  /* subtle shadow instead of dashed border */
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
}
[data-theme="dark"] .card {
  box-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 20px rgba(0,0,0,0.3);
}

/* corner brackets */
.corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--green);
  transition: border-color 0.3s;
}
.corner.tl { top: -1px; left: -1px; border-right: none; border-bottom: none; border-radius: 2px 0 0 0; }
.corner.tr { top: -1px; right: -1px; border-left: none; border-bottom: none; border-radius: 0 2px 0 0; }
.corner.bl { bottom: -1px; left: -1px; border-right: none; border-top: none; border-radius: 0 0 0 2px; }
.corner.br { bottom: -1px; right: -1px; border-left: none; border-top: none; border-radius: 0 0 2px 0; }

.block-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--graphite);
  margin: 0 0 4px;
  transition: color 0.3s;
}
.block-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 28px;
}

/* ═══════════ QUESTIONS ═══════════ */
.question { margin-bottom: 26px; }
.question:last-child { margin-bottom: 6px; }

.q-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 4px;
  display: block;
  line-height: 1.45;
  transition: color 0.3s;
}
.q-optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 13px;
}
.q-help {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  display: block;
}

/* ═══════════ TEXT INPUTS ═══════════ */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 5px;
  padding: 11px 13px;
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, background 0.15s, color 0.3s;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus {
  border-color: var(--green);
  background: var(--surface);
}
input.err, textarea.err { border-color: var(--error); }

/* ═══════════ OPTION PILLS ═══════════ */
.opt-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.opt {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 100px;
  padding: 9px 16px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: auto;
  color: var(--ink);
}
.opt * { pointer-events: none; }

.opt .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  flex: none;
  transition: background 0.15s, border-color 0.15s;
}
.opt:hover { border-color: var(--green); }

.opt.checked {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green-dark);
  font-weight: 600;
}
.opt.checked .dot {
  background: var(--green);
  border-color: var(--green);
}

.other-input { margin-top: 10px; display: none; }
.other-input.show { display: block; }

/* ═══════════ SCALE ═══════════ */
.scale-row { display: flex; gap: 8px; margin-bottom: 8px; }
.scale-btn {
  flex: 1;
  text-align: center;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 6px;
  padding: 12px 0;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
  color: var(--ink);
}
.scale-btn:hover { border-color: var(--green); }
.scale-btn.checked {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.scale-caption {
  font-size: 12px;
  color: var(--green-dark);
  font-weight: 600;
  min-height: 18px;
  margin-top: 2px;
  transition: opacity 0.2s;
}
.scale-caption--hint {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

/* ═══════════ CONSENT ═══════════ */
.consent-box {
  background: var(--green-light);
  border: 1px solid var(--green);
  border-radius: 6px;
  padding: 16px;
  font-size: 13px;
  color: var(--graphite);
  line-height: 1.6;
  margin-bottom: 16px;
  transition: background 0.3s, color 0.3s;
}

/* ═══════════ ERRORS ═══════════ */
.error-msg {
  color: var(--error);
  font-size: 12px;
  margin-top: 5px;
  display: none;
}
.error-msg.show { display: block; }

/* ═══════════ NAV ═══════════ */
.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line-subtle);
}
.btn {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
  border-radius: 6px;
  padding: 11px 22px;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--green);
  color: #fff;
  letter-spacing: .02em;
}
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding-left: 4px;
}
.btn-ghost:hover { color: var(--ink); }
.btn-ghost.invisible { visibility: hidden; }

/* ═══════════ DONE SCREEN ═══════════ */
.done-screen {
  text-align: center;
  padding: 52px 16px;
}
.done-screen .check {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
  animation: checkPop 0.4s cubic-bezier(.22,1,.36,1) both;
}
@keyframes checkPop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.done-screen h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  color: var(--graphite);
  margin: 0 0 12px;
}
.done-screen p {
  color: var(--muted);
  font-size: 14px;
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 520px) {
  body { padding: 20px 12px 60px; }
  .card { padding: 24px 18px 20px; }
  .logo-wrap img { height: 42px; }
  .eyebrow { font-size: 10px; }
  .opt { padding: 8px 13px; font-size: 13px; }
  .scale-btn { font-size: 14px; padding: 10px 0; }
  .block-title { font-size: 18px; }
}
