/* ---------- Reset basico ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; }
img, canvas { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; }

/* ---------- Tokens ---------- */
:root {
  --bg: #f7f8fb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --text: #14181f;
  --text-muted: #565f6e;
  --border: #e2e5ec;
  --brand: #1d4ed8;
  --brand-dark: #1636a3;
  --brand-contrast: #ffffff;
  --accent-good: #15803d;
  --accent-bad: #b91c1c;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(20, 24, 31, 0.08);
  --font-head: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-alt: #151822;
  --surface: #1a1e29;
  --text: #eef1f6;
  --text-muted: #a2abbb;
  --border: #2a2f3d;
  --brand: #5b8bf4;
  --brand-dark: #7ba1f7;
  --brand-contrast: #0b1020;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --bg-alt: #151822;
    --surface: #1a1e29;
    --text: #eef1f6;
    --text-muted: #a2abbb;
    --border: #2a2f3d;
    --brand: #5b8bf4;
    --brand-dark: #7ba1f7;
    --brand-contrast: #0b1020;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--brand); color: var(--brand-contrast);
  padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Botoes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 2px solid transparent; border-radius: 999px; cursor: pointer;
  font-weight: 600; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  padding: 12px 22px; font-size: 15px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-lg { padding: 15px 28px; font-size: 16.5px; }
.btn-sm { padding: 9px 16px; font-size: 14px; }
.btn-block { width: 100%; margin-top: 6px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding-block: 14px; }
.logo { display: flex; align-items: center; gap: .5em; font-family: var(--font-head); font-weight: 800; font-size: 19px; text-decoration: none; }
.logo-mark { font-size: 22px; }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 44px; text-align: center; }
.hero h1 { font-size: clamp(28px, 6vw, 46px); max-width: 820px; margin-inline: auto; }
.hl { color: var(--brand); }
.hero-sub { max-width: 620px; margin: 0 auto 28px; color: var(--text-muted); font-size: 17px; }
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.hero-badges { display: flex; gap: 10px 18px; flex-wrap: wrap; justify-content: center; color: var(--text-muted); font-size: 14px; }
.hero-badges li { background: var(--surface); border: 1px solid var(--border); padding: 7px 13px; border-radius: 999px; }

/* ---------- Secoes gerais ---------- */
.section { padding: 56px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-title { font-size: clamp(24px, 4vw, 32px); text-align: center; }
.section-sub { text-align: center; color: var(--text-muted); max-width: 560px; margin: 0 auto 32px; }

/* ---------- Como funciona ---------- */
.steps { display: grid; gap: 20px; grid-template-columns: 1fr; margin-top: 32px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.step-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 14px;
}
.step h3 { font-size: 18px; margin-bottom: 8px; }
.step p { color: var(--text-muted); margin: 0; font-size: 15px; }

/* ---------- Gerador ---------- */
.generator-grid { display: grid; gap: 24px; grid-template-columns: 1fr; align-items: start; }

.form-card, .preview-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}

.field-group { border: 0; padding: 0; margin: 0 0 26px; }
.field-group legend {
  font-family: var(--font-head); font-weight: 700; font-size: 14px; letter-spacing: .03em;
  text-transform: uppercase; color: var(--brand); padding: 0 0 12px; width: 100%;
  border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.field-group:last-of-type { margin-bottom: 12px; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
}
.field textarea { resize: vertical; min-height: 64px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: 12.5px; color: var(--text-muted); margin: 6px 0 0; }

.conditional-fields[hidden] { display: none; }

.theme-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-swatch {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px;
  border: 2px solid var(--border); background: var(--bg); cursor: pointer; font-size: 13.5px; font-weight: 600;
}
.theme-swatch::before {
  content: ""; width: 20px; height: 20px; border-radius: 50%; background: var(--sw); display: block; flex: none;
}
.theme-swatch.is-active { border-color: var(--sw); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sw) 22%, transparent); }

/* ---------- Preview ---------- */
.preview-card { position: sticky; top: 84px; text-align: center; }
.canvas-wrap {
  background: repeating-conic-gradient(var(--bg) 0% 25%, var(--bg-alt) 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 12px;
}
#posterCanvas { width: 100%; height: auto; }
.preview-status { font-size: 13.5px; color: var(--text-muted); min-height: 1.4em; margin: 0 0 14px; }
.download-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.download-row .btn { flex: 1 1 auto; }

/* ---------- Comparacao ---------- */
.compare-grid { display: grid; gap: 18px; grid-template-columns: 1fr; margin-top: 28px; }
.compare-card { border-radius: var(--radius); padding: 22px; border: 1.5px solid var(--border); }
.compare-card h3 { font-size: 17px; margin-bottom: 12px; }
.compare-card ul { display: grid; gap: 10px; font-size: 14.5px; }
.compare-bad { background: color-mix(in srgb, var(--accent-bad) 6%, var(--surface)); }
.compare-bad li::before { content: "✕ "; color: var(--accent-bad); font-weight: 700; }
.compare-good { background: color-mix(in srgb, var(--accent-good) 8%, var(--surface)); }
.compare-good li::before { content: "✓ "; color: var(--accent-good); font-weight: 700; }
.privacy-note {
  margin-top: 26px; text-align: center; color: var(--text-muted); font-size: 14px;
  max-width: 640px; margin-inline: auto;
}

/* ---------- FAQ ---------- */
.faq { display: grid; gap: 10px; max-width: 760px; margin: 28px auto 0; }
.faq details {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 18px;
}
.faq summary { cursor: pointer; font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; font-size: 20px; color: var(--brand); }
.faq details[open] summary::after { content: "−"; }
.faq p { color: var(--text-muted); margin: 10px 0 0; font-size: 14.5px; }

/* ---------- Footer ---------- */
.site-footer { padding: 32px 0 44px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.footer-fine { margin-top: 6px; }

/* ---------- Responsivo: telas maiores ---------- */
@media (min-width: 640px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .compare-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  .generator-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
}

/* respeita usuarios que preferem menos movimento */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: .01ms !important; }
}
