/* =============================================================================
   RETOMALEAD — CORE
   Tokens de design + reset + componentes compartilhados (landing e app).
   ============================================================================= */

:root {
  /* --- Cor principal (sobrescrita em runtime por config.PRIMARY_COLOR) --- */
  --brand: #4B3BD6;
  --brand-strong: #3B2CB8;
  --brand-soft: #EEECFD;
  --brand-softer: #F7F6FE;
  --brand-ring: rgba(75, 59, 214, .28);

  /* --- Neutros quentes --- */
  --ink: #14151A;
  --ink-2: #3A3D47;
  --ink-3: #616572;
  --ink-4: #666A75;
  --line: #E6E4DF;
  --line-2: #F0EEE9;
  --surface: #FFFFFF;
  --bg: #FAF9F6;
  --bg-2: #F4F2EC;

  /* --- Sinais --- */
  --ok: #087A56;
  --ok-soft: #E6F5EF;
  --warn: #805600;
  --warn-soft: #FCF2E2;
  --danger: #C4363B;

  /* --- Raio --- */
  --r-sm: 8px;
  --r: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* --- Sombra (extremamente sutil) --- */
  --sh-1: 0 1px 2px rgba(20, 21, 26, .04), 0 1px 1px rgba(20, 21, 26, .03);
  --sh-2: 0 2px 6px rgba(20, 21, 26, .05), 0 8px 20px -12px rgba(20, 21, 26, .12);
  --sh-3: 0 4px 12px rgba(20, 21, 26, .06), 0 24px 48px -24px rgba(20, 21, 26, .18);

  /* --- Espaçamento --- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 88px;

  /* --- Tipografia --- */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Text',
          'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-num: 'Inter', 'Segoe UI', system-ui, sans-serif;

  --maxw: 1120px;
  --maxw-narrow: 720px;
}

/* ----------------------------------------------------------------- reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3, h4 { color: var(--ink); margin: 0 0 .5em; line-height: 1.15; letter-spacing: -.021em; font-weight: 700; }
h1 { font-size: clamp(31px, 6.4vw, 54px); letter-spacing: -.032em; font-weight: 800; }
h2 { font-size: clamp(25px, 4.6vw, 38px); letter-spacing: -.028em; }
h3 { font-size: clamp(19px, 2.6vw, 22px); }
p  { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0 0 1em; padding-left: 1.2em; }
li { margin-bottom: .35em; }
strong, b { color: var(--ink); font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-6) 0; }

/* foco visível e consistente (acessibilidade) */
:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--brand-soft); color: var(--ink); }

/* --------------------------------------------------------------- layout --- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 20px; }
.wrap-narrow { max-width: var(--maxw-narrow); }
.section { padding-block: clamp(48px, 8vw, 88px); }
.section--tight { padding-block: clamp(36px, 6vw, 64px); }
.section--alt { background: var(--bg-2); }
.section--surface { background: var(--surface); }
.center { text-align: center; }
.stack > * + * { margin-top: var(--sp-4); }

/* ---------------------------------------------------------------- texto --- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brand); background: var(--brand-soft);
  padding: 6px 12px; border-radius: var(--r-pill); margin-bottom: var(--sp-4);
}
.lead { font-size: clamp(17px, 2.2vw, 20px); color: var(--ink-2); }
.muted { color: var(--ink-3); }
.small { font-size: 14px; }
.tiny { font-size: 13px; color: var(--ink-3); }
.balance { text-wrap: balance; }
.pretty { text-wrap: pretty; }

/* --------------------------------------------------------------- botões --- */
.btn {
  --btn-bg: var(--brand);
  --btn-fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 14px 26px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid transparent; border-radius: var(--r-md);
  font-size: 17px; font-weight: 650; line-height: 1.25; letter-spacing: -.01em;
  text-align: center; text-decoration: none; cursor: pointer;
  transition: transform .16s cubic-bezier(.2,.7,.3,1), box-shadow .16s ease, background-color .16s ease, border-color .16s ease;
  box-shadow: var(--sh-2);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--brand-strong); text-decoration: none; transform: translateY(-1px); box-shadow: var(--sh-3); }
.btn:active { transform: translateY(0); box-shadow: var(--sh-1); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn--lg { min-height: 60px; padding: 18px 32px; font-size: 19px; border-radius: var(--r-lg); }
.btn--block { display: flex; width: 100%; }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--ink); border-color: var(--line); box-shadow: none; }
.btn--ghost:hover { --btn-bg: var(--surface); border-color: var(--ink-4); box-shadow: var(--sh-1); }
.btn--soft { --btn-bg: var(--brand-soft); --btn-fg: var(--brand-strong); box-shadow: none; }
.btn--soft:hover { --btn-bg: #E4E1FB; }
.btn--quiet {
  --btn-bg: var(--surface); --btn-fg: var(--ink-2);
  border-color: var(--line); box-shadow: none; min-height: 44px; padding: 10px 16px;
  font-size: 15px; font-weight: 600; border-radius: var(--r);
}
.btn--quiet:hover { --btn-bg: var(--bg-2); border-color: var(--ink-4); }
.btn__note { display: block; font-size: 13px; font-weight: 500; opacity: .82; margin-top: 3px; }

/* ---------------------------------------------------------------- cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--sh-1);
}
.card--flat { box-shadow: none; }
.card--pad-lg { padding: clamp(20px, 4vw, 40px); }
.grid { display: grid; gap: var(--sp-4); }
@media (min-width: 620px)  { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 620px)  { .grid--3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 940px)  { .grid--3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 620px)  { .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }

/* --------------------------------------------------------------- chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--bg-2); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.chip--ok { background: var(--ok-soft); border-color: rgba(14,143,99,.2); color: var(--ok); }
.chip--brand { background: var(--brand-soft); border-color: rgba(75,59,214,.16); color: var(--brand-strong); }

/* ------------------------------------------------------------ formulário -- */
.field { display: block; margin-bottom: var(--sp-4); }
.field__label { display: block; font-size: 14px; font-weight: 650; color: var(--ink); margin-bottom: 6px; }
.field__hint { font-size: 13px; color: var(--ink-3); margin-top: 5px; }
.input, .textarea, .select {
  width: 100%; min-height: 50px; padding: 13px 14px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r);
  font-size: 16px; /* nunca menor que 16px: evita zoom automático no iPhone */
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23616572' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 40px;
}

/* --------------------------------------------------------------- rodapé --- */
.footer { background: var(--ink); color: rgba(255,255,255,.72); padding-block: var(--sp-7) var(--sp-6); }
.footer a { color: #fff; opacity: .82; }
.footer a:hover { opacity: 1; }
.footer__grid { display: flex; flex-wrap: wrap; gap: var(--sp-5); justify-content: space-between; align-items: flex-start; }
.footer__brand { font-weight: 750; color: #fff; font-size: 19px; letter-spacing: -.02em; }
.footer__links { display: flex; flex-wrap: wrap; gap: var(--sp-4); font-size: 15px; }
.footer__legal { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; line-height: 1.6; }

/* ------------------------------------------------------------- utilidade -- */
.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: 12px; top: -100px; z-index: 999;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--r);
}
.skip-link:focus { top: 12px; }
[hidden] { display: none !important; }

/* logo */
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 750; font-size: 19px; letter-spacing: -.028em; color: var(--ink); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo__mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
}
.logo__mark svg { width: 18px; height: 18px; }

/* toast (feedback "Copiado!") */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600; box-shadow: var(--sh-3);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  z-index: 200; max-width: calc(100vw - 32px); text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 720px) { .toast { bottom: 84px; } }
