/* --------------------------------------------------------------------------
   Site institucional JMJTech (jmjtech.com.br) — landing chat-first.
   Tokens de marca herdados de ../../assets/styles.css (mesma paleta).
   -------------------------------------------------------------------------- */

:root {
  --brand: #153cf6;
  --black: #000103;
  --gray-light: #e0dfe5;

  --blue-50: #e9f4ff;
  --blue-100: #d7eaff;
  --blue-200: #b7d7ff;
  --blue-300: #8bbcff;
  --blue-400: #5d94ff;
  --blue-500: #396eff;
  --blue-600: #1643ff;
  --blue-700: #153cf6;
  --blue-800: #0e30c5;
  --blue-900: #15319a;
  --blue-950: #0d1b59;

  --bg: #f2f1f5;
  --surface: #ffffff;
  --surface-soft: #f7f7f9;
  --surface-muted: #e0dfe5;
  --border: #e0dfe5;
  --border-strong: #c9c8d2;
  --text: #000103;
  --text-soft: #4a4a55;
  --text-muted: #8a8a96;
  --blue-soft: var(--blue-50);
  --white: #ffffff;
  --danger-bg: #fde8e8;
  --danger-text: #b81c1c;

  --font: "Geist", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Geist", ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(.2,.8,.2,1);
  --bar-h: 104px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  /* dvh = viewport realmente visível. No Safari iOS, 100vh mede a viewport
     GRANDE (sem as barras do navegador), o que empurrava a barra do chat pra
     baixo da dobra no iPhone. O vh fica como fallback pra browsers antigos. */
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  /* Base neutra + brilhos discretos (fallback sem JS). A atmosfera em
     movimento vem do #bgCanvas (assets/bg.js), que pinta por cima disto. */
  background:
    radial-gradient(circle at 14% -8%, rgba(21, 60, 246, .10), transparent 46%),
    radial-gradient(circle at 100% 6%, rgba(13, 27, 89, .06), transparent 42%),
    linear-gradient(180deg, #f2f3fa 0%, var(--bg) 44%, #e5e4ec 100%);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  display: flex;
  flex-direction: column;
}

button, input, textarea { font: inherit; }
button { border: 0; cursor: pointer; background: none; }
a { color: inherit; }

/* Fundo vivo (malha de pontos + auroras), atrás de todo o conteúdo.
   z-index negativo: fica acima do background do body e abaixo do resto. */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 40px);
  /* Sem bloco de fundo: só o frost (blur do que passa por trás) e uma linha
     fina separando do conteúdo. */
  background: transparent;
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid rgba(13, 27, 89, .08);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-brand img {
  height: 32px;
  width: auto;
  display: block;
}

.site-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 160ms var(--ease), background 160ms var(--ease), transform 160ms var(--ease);
}

.site-contact:hover {
  border-color: var(--brand);
  background: var(--blue-soft);
  transform: translateY(-1px);
}

/* ---------- Main / chat root ---------- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: min(760px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 0 0 24px;
}

body.is-active .main {
  padding-bottom: calc(var(--bar-h) + 24px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Hero (estado ocioso, tipo landing do Claude/ChatGPT) ---------- */

/* Sem min-height fixo: a hero é um flex item que cresce pra ocupar o que
   sobrar entre header e barra do chat. Assim tudo cabe na primeira dobra em
   qualquer altura de tela, sem depender de conta com vh. */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 0;
  padding: 40px 8px 8px;
  text-align: center;
}

body.is-active .hero { display: none; }

.hero-title {
  margin: 0;
  max-width: 34ch;
  font-family: var(--font-display);
  font-size: clamp(24px, 3.6vw, 38px);
  line-height: 1.16;
  letter-spacing: -.02em;
  font-weight: 600;
  white-space: nowrap;
  /* Gradiente sutil navy → azul da marca no próprio texto */
  color: var(--blue-950);
  background: linear-gradient(100deg, var(--blue-950) 30%, var(--blue-800) 72%, var(--blue-700) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  margin: 0;
  max-width: 52ch;
  color: var(--text-soft);
  font-size: clamp(15px, 1.6vw, 17px);
  line-height: 1.55;
}

/* ---------- Log de conversa ---------- */

.chat-log {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 28px 4px 8px;
}

body.is-active .chat-log { display: flex; }

.chat-msg {
  max-width: 88%;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.6;
  word-wrap: break-word;
}

.chat-msg p { margin: 0 0 8px; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul { margin: 6px 0; padding-left: 20px; }
.chat-msg strong { font-weight: 680; }

.chat-msg.is-user {
  align-self: flex-end;
  background: var(--blue-950);
  color: var(--white);
  border-bottom-right-radius: 3px;
  white-space: pre-wrap;
}

.chat-msg.is-bot {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 3px;
  width: 100%;
}

.chat-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 14px;
  border: 1px solid rgba(21, 60, 246, .25);
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue-950);
  font-size: 12.5px;
  font-weight: 650;
  text-decoration: none;
  transition: background 150ms var(--ease), transform 150ms var(--ease);
}

.chat-cta:hover {
  background: #d7eaff;
  transform: translateY(-1px);
}

.chat-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 5px;
  padding: 15px 18px;
  border-radius: 10px;
  border-bottom-left-radius: 3px;
  background: var(--white);
  border: 1px solid var(--border);
}

.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chatDot 1.1s var(--ease) infinite;
}

.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes chatDot {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- Barra de input ---------- */

/* Vidro fosco: fundo translúcido + blur do que passa por trás (pontos e
   auroras do bg.js aparecem difusos através da barra). */
.chat-bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 14px 14px 18px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, .38));
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  box-shadow:
    0 24px 64px rgba(13, 27, 89, .16),
    inset 0 1px 0 rgba(255, 255, 255, .85);
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease);
}

.chat-bar:focus-within {
  border-color: rgba(21, 60, 246, .38);
  transform: translateY(-2px);
  box-shadow:
    0 30px 76px rgba(13, 27, 89, .2),
    0 0 0 4px rgba(21, 60, 246, .08),
    inset 0 1px 0 rgba(255, 255, 255, .9);
}

body.is-active .chat-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 15;
  width: min(760px, calc(100vw - 32px));
}

/* Faísca de IA à esquerda do input; pulsa devagar enquanto espera. */
.chat-bar-icon {
  align-self: center;
  color: var(--blue-700);
  font-size: 19px;
  line-height: 1;
  animation: sparklePulse 2.8s var(--ease) infinite;
  user-select: none;
}

@keyframes sparklePulse {
  0%, 100% { opacity: .45; transform: scale(.94); }
  50% { opacity: 1; transform: scale(1.06); }
}

.chat-bar-input {
  flex: 1;
  min-height: 56px;
  max-height: 180px;
  padding: 16px 12px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

.chat-bar-input::placeholder { color: rgba(74, 74, 85, .62); }

.chat-bar-send {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-800));
  color: var(--white);
  font-size: 19px;
  box-shadow: 0 8px 20px rgba(21, 60, 246, .32);
  transition: box-shadow 150ms var(--ease), transform 150ms var(--ease), filter 150ms var(--ease);
}

.chat-bar-send:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 12px 26px rgba(21, 60, 246, .4);
}
.chat-bar-send:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }

/* ---------- Footer (só no estado ocioso) ---------- */

.site-footer {
  padding: 20px clamp(16px, 4vw, 40px) 30px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(13, 27, 89, .42);
}

body.is-active .site-footer { display: none; }

@media (max-width: 600px) {
  /* Tudo precisa caber na primeira dobra (iPhone com barras do Safari
     visíveis ≈ 660px úteis): paddings e tipografia mais enxutos. */
  .site-header { padding: 12px 16px; }
  .site-brand img { height: 28px; }
  .site-contact { height: 38px; padding: 0 15px; font-size: 13px; }

  .hero { gap: 14px; padding: 12px 4px 4px; }
  .hero-title { white-space: normal; font-size: clamp(21px, 6.2vw, 27px); }
  .hero-sub { font-size: 14.5px; line-height: 1.5; }

  .chat-bar { padding: 10px 10px 10px 14px; gap: 8px; }
  /* Espaço para DUAS linhas (24px cada + 26px de padding): as frases que
     passam no placeholder quebram em 2 linhas na largura do celular, e com
     altura de 1 linha só a segunda ficava cortada dentro do input. */
  .chat-bar-input { min-height: 74px; padding: 13px 10px; font-size: 16px; }
  .chat-bar-icon { align-self: flex-start; margin-top: 15px; }
  .chat-bar-send { width: 46px; height: 46px; font-size: 17px; }

  .site-footer { padding: 14px 16px 18px; }

  body.is-active .chat-bar { bottom: 10px; }
}

/* Telas muito baixas (iPhone SE / paisagem): comprime mais e esconde o
   subtítulo, que é o elemento mais dispensável pra manter o chat visível. */
@media (max-width: 600px) and (max-height: 700px) {
  .hero { gap: 10px; }
  .hero-sub { font-size: 13.5px; }
}

@media (max-width: 600px) and (max-height: 620px) {
  .hero-sub { display: none; }
  .site-footer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-typing span,
  .chat-cta,
  .chat-bar,
  .chat-bar-icon,
  .chat-bar-send { transition: none; animation: none; }
}
