/* ============================================================
   IA Serviços & Treinamentos — Folha de estilos principal
   - Tokens (cores, sombras, raios) via CSS variables
   - Suporte a dark/light mode via [data-theme] no <html>
   - Tailwind cobre layout; este arquivo cobre tema, animações,
     modal, barra de progresso e detalhes finos.
   ============================================================ */

/* ---------- 1. Tokens base (Light) ---------- */
:root {
  --bg-page:        #FFFFFF;
  --bg-surface:     #FFFFFF;
  --bg-elevated:    #FFFFFF;
  --bg-muted:       #F8FAFC;
  --bg-inverse:     #0F172A;

  --fg-primary:     #0F172A;
  --fg-secondary:   #475569;
  --fg-muted:       #64748B;
  --fg-faint:       #94A3B8;
  --fg-on-brand:    #FFFFFF;

  --border-subtle:  #E2E8F0;
  --border-default: #CBD5E1;
  --border-strong:  #94A3B8;

  --brand-50:  #F0F7FF;
  --brand-100: #E0EFFE;
  --brand-200: #BAE0FD;
  --brand-300: #7CC8FB;
  --brand-400: #36ABF7;
  --brand-500: #0E91E8;
  --brand-600: #0273C6;
  --brand-700: #055CA0;
  --brand-800: #0A4E84;
  --brand-900: #0E416D;

  --shadow-soft:   0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -8px rgba(15, 23, 42, .08);
  --shadow-card:   0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -12px rgba(15, 23, 42, .14);
  --shadow-cardHv: 0 2px 4px rgba(15, 23, 42, .06), 0 20px 48px -16px rgba(14, 145, 232, .22);
  --shadow-glow:   0 0 0 1px rgba(14, 145, 232, .10), 0 8px 32px -8px rgba(14, 145, 232, .30);

  --grid-line: rgba(15, 23, 42, .05);
  --dot-color: rgba(14, 145, 232, .18);

  --modal-backdrop: rgba(7, 14, 28, .60);

  --transition-theme: background-color .35s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease;
}

/* ---------- 2. Tokens Dark ---------- */
:root[data-theme="dark"] {
  --bg-page:        #070E1C;
  --bg-surface:     #0F172A;
  --bg-elevated:    #131D33;
  --bg-muted:       #0B1326;
  --bg-inverse:     #F1F5F9;

  --fg-primary:     #F1F5F9;
  --fg-secondary:   #CBD5E1;
  --fg-muted:       #94A3B8;
  --fg-faint:       #64748B;

  --border-subtle:  #1E293B;
  --border-default: #334155;
  --border-strong:  #475569;

  --shadow-soft:   0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px -8px rgba(0, 0, 0, .50);
  --shadow-card:   0 1px 2px rgba(0, 0, 0, .40), 0 12px 32px -12px rgba(0, 0, 0, .55);
  --shadow-cardHv: 0 2px 4px rgba(0, 0, 0, .45), 0 20px 48px -16px rgba(14, 145, 232, .35);
  --shadow-glow:   0 0 0 1px rgba(54, 171, 247, .20), 0 8px 32px -8px rgba(54, 171, 247, .35);

  --grid-line: rgba(148, 163, 184, .07);
  --dot-color: rgba(54, 171, 247, .25);

  --modal-backdrop: rgba(2, 6, 14, .78);
}

/* ---------- 3. Reset + base tipográfica ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg-page);
  color: var(--fg-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: var(--transition-theme);
}

.font-display { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; }

/* Acessibilidade — foco visível ---------- */
:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Sr-only (compatível com Tailwind) — já vem do Tailwind, mas reforça */
.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;
}

/* ---------- 4. Fundos decorativos ---------- */
.grid-bg {
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
}

.dots-bg {
  background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
  background-size: 22px 22px;
}

.blob {
  position: absolute;
  filter: blur(56px);
  opacity: .55;
  border-radius: 9999px;
  pointer-events: none;
}
:root[data-theme="dark"] .blob { opacity: .35; }

/* ---------- 5. Animações utilitárias ---------- */
@keyframes floaty   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes shimmer  { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes pulseDot { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .35; } }

.floaty { animation: floaty 6s ease-in-out infinite; }

.shimmer-text {
  background: linear-gradient(90deg, var(--brand-800) 0%, var(--brand-500) 50%, var(--brand-800) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 8s linear infinite;
}
:root[data-theme="dark"] .shimmer-text {
  background: linear-gradient(90deg, var(--brand-300) 0%, var(--brand-500) 50%, var(--brand-300) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .floaty, .shimmer-text { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- 6. Nav e link anim ---------- */
.nav-blur {
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}

.link-anim { position: relative; }
.link-anim::after {
  content: '';
  position: absolute; left: 0; bottom: -6px;
  height: 2px; width: 0;
  background: var(--brand-500);
  border-radius: 2px;
  transition: width .3s ease;
}
.link-anim:hover::after { width: 100%; }
.link-anim.is-active { color: var(--brand-600); }
:root[data-theme="dark"] .link-anim.is-active { color: var(--brand-300); }
.link-anim.is-active::after { width: 100%; }

/* ---------- 7. Barra de progresso de scroll ---------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--brand-400), var(--brand-600), var(--brand-800));
  box-shadow: 0 0 12px rgba(14, 145, 232, .55);
  z-index: 60;
  transition: width .12s linear;
  border-radius: 0 3px 3px 0;
}

/* ---------- 8. Card lift ---------- */
.lift {
  transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease, background-color .35s ease;
}
.lift:hover { transform: translateY(-4px); }

/* ---------- 9. Cards "soltos" (missão / como atuamos) ---------- */
.loose-card {
  position: relative;
  border-radius: 28px;
  padding: 2.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  transition: var(--transition-theme), transform .35s ease, box-shadow .35s ease;
}
.loose-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 29px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(14,145,232,.4), transparent 40%, transparent 60%, rgba(14,145,232,.25));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s ease;
}
.loose-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.loose-card:hover::before { opacity: 1; }

.loose-card .pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .8rem;
  border-radius: 9999px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
:root[data-theme="dark"] .loose-card .pill {
  background: rgba(54, 171, 247, .12);
  color: var(--brand-300);
}

/* ---------- 10. Theme toggle button ---------- */
.theme-toggle {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--fg-primary);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition-theme), transform .25s ease;
  overflow: hidden;
}
.theme-toggle:hover { transform: rotate(12deg); border-color: var(--brand-400); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  width: 18px; height: 18px;
  transition: transform .45s cubic-bezier(.65,.05,.36,1), opacity .35s ease;
}
.theme-toggle .icon-sun  { transform: rotate(0deg) scale(1);    opacity: 1; }
.theme-toggle .icon-moon { transform: rotate(-90deg) scale(.3); opacity: 0; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { transform: rotate(90deg) scale(.3); opacity: 0; }
:root[data-theme="dark"] .theme-toggle .icon-moon { transform: rotate(0deg) scale(1);   opacity: 1; }

/* ---------- 11. Modal ---------- */
.modal {
  position: fixed; inset: 0;
  z-index: 80;
  display: none;
  align-items: center; justify-content: center;
  padding: 1.25rem;
}
.modal.is-open { display: flex; }

.modal__backdrop {
  position: absolute; inset: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  opacity: 0;
  transition: opacity .45s ease, backdrop-filter .45s ease;
}
.modal.is-open .modal__backdrop {
  opacity: 1;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.modal__dialog {
  position: relative;
  width: min(960px, 100%);
  max-height: 90vh;
  border-radius: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(.85) translateY(28px) rotateX(8deg);
  opacity: 0;
  transition: transform .55s cubic-bezier(.2,.9,.25,1.2), opacity .35s ease;
  transform-style: preserve-3d;
  perspective: 1200px;
}
.modal.is-open .modal__dialog {
  transform: scale(1) translateY(0) rotateX(0);
  opacity: 1;
}

.modal__close {
  position: absolute; top: 1rem; right: 1rem;
  z-index: 4;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--fg-primary);
  cursor: pointer;
  transition: var(--transition-theme), transform .25s ease;
}
.modal__close:hover { transform: rotate(90deg); border-color: var(--brand-400); color: var(--brand-600); }

/* Wrapper do conteúdo injetado — precisa participar do flex para o scroll funcionar */
[data-modal-content] {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;        /* essencial: permite que o filho encolha dentro do flex */
  overflow: hidden;
}

.modal__hero {
  position: relative;
  flex: 0 0 auto;
  padding: 2.25rem 2.25rem 2rem;
  background:
    radial-gradient(800px 280px at 80% -40%, rgba(54,171,247,.35), transparent 60%),
    linear-gradient(135deg, var(--brand-700) 0%, var(--brand-900) 70%);
  color: #fff;
  overflow: hidden;
}
.modal__hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: .35;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at top right, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse at top right, #000 30%, transparent 75%);
}

.modal__body {
  padding: 2rem 2.25rem 2.25rem;
  padding-right: 1rem; /* dá folga para o thumb não encostar no texto */
  overflow-y: scroll;  /* força a barra a aparecer sempre que houver conteúdo */
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-gutter: stable;
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--brand-500) var(--bg-muted);
}

/* WebKit / Blink (Chrome, Edge, Safari) — barra moderna e bem visível */
.modal__body::-webkit-scrollbar {
  width: 12px;
}
.modal__body::-webkit-scrollbar-track {
  background: var(--bg-muted);
  border-radius: 999px;
  margin-block: 12px;
}
.modal__body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--brand-400), var(--brand-600));
  border-radius: 999px;
  min-height: 60px;
  transition: background .25s ease;
}
.modal__body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--brand-500), var(--brand-700));
}
.modal__body::-webkit-scrollbar-thumb:active {
  background: var(--brand-700);
}

/* Stagger entrada nos blocos internos do modal */
.modal__block {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .45s ease, transform .45s ease;
}
.modal.is-open .modal__block { opacity: 1; transform: translateY(0); }
.modal.is-open .modal__block:nth-child(1) { transition-delay: .15s; }
.modal.is-open .modal__block:nth-child(2) { transition-delay: .25s; }
.modal.is-open .modal__block:nth-child(3) { transition-delay: .35s; }
.modal.is-open .modal__block:nth-child(4) { transition-delay: .45s; }
.modal.is-open .modal__block:nth-child(5) { transition-delay: .55s; }

@media (prefers-reduced-motion: reduce) {
  .modal__dialog,
  .modal__backdrop,
  .modal__block { transition: none !important; }
  .modal__dialog { transform: none; }
}

/* Bloqueia scroll quando modal aberto */
body.modal-open { overflow: hidden; }

/* ---------- Formulário de contato ---------- */

/* Honeypot: fora da tela, zero dimensão, sem interação */
.form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  tab-index: -1;
}

/* Botão em estado de loading */
#contact-form [type="submit"].is-loading {
  opacity: 0.72;
  cursor: not-allowed;
  pointer-events: none;
}

/* Spinner animado dentro do botão */
.btn-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.65s linear infinite;
  flex-shrink: 0;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .btn-spinner { animation: none; opacity: 0.6; }
}

/* ---------- 12. Acessibilidade — alto contraste em focus dentro do modal ---------- */
.modal__dialog :focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
}

/* ---------- 13. Tema dark overrides para utilitários Tailwind comuns ----------
   Tailwind via CDN não tem todas as classes dark configuradas; aqui reforçamos
   o que precisa virar token de tema. */

/* Superfícies de cards "white" devem virar surface no dark */
:root[data-theme="dark"] .bg-white { background-color: var(--bg-surface) !important; }
:root[data-theme="dark"] .text-ink-900 { color: var(--fg-primary) !important; }
:root[data-theme="dark"] .text-ink-800 { color: var(--fg-primary) !important; }
:root[data-theme="dark"] .text-ink-700 { color: var(--fg-secondary) !important; }
:root[data-theme="dark"] .text-ink-600 { color: var(--fg-secondary) !important; }
:root[data-theme="dark"] .text-ink-500 { color: var(--fg-muted) !important; }
:root[data-theme="dark"] .text-ink-400 { color: var(--fg-faint) !important; }
:root[data-theme="dark"] .border-ink-100 { border-color: var(--border-subtle) !important; }
:root[data-theme="dark"] .border-ink-200 { border-color: var(--border-subtle) !important; }
:root[data-theme="dark"] .bg-ink-50 { background-color: var(--bg-muted) !important; }
:root[data-theme="dark"] .bg-ink-50\/50 { background-color: var(--bg-muted) !important; }
:root[data-theme="dark"] .bg-white\/70 { background-color: rgba(15, 23, 42, .75) !important; }
:root[data-theme="dark"] .bg-white\/80 { background-color: rgba(15, 23, 42, .85) !important; }
:root[data-theme="dark"] .bg-brand-50 { background-color: rgba(54, 171, 247, .10) !important; }
:root[data-theme="dark"] .text-brand-700 { color: var(--brand-300) !important; }
:root[data-theme="dark"] .text-brand-600 { color: var(--brand-300) !important; }
:root[data-theme="dark"] .border-brand-200 { border-color: rgba(54, 171, 247, .35) !important; }
:root[data-theme="dark"] .hover\:border-brand-300:hover { border-color: var(--brand-400) !important; }
:root[data-theme="dark"] .hover\:text-brand-700:hover { color: var(--brand-300) !important; }
:root[data-theme="dark"] .hover\:text-ink-900:hover  { color: var(--fg-primary)  !important; }
:root[data-theme="dark"] .bg-emerald-50 { background-color: rgba(16, 185, 129, .12) !important; }
:root[data-theme="dark"] .text-emerald-700 { color: #6ee7b7 !important; }
:root[data-theme="dark"] .text-emerald-600 { color: #34d399 !important; }

/* Inputs em dark */
:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea {
  background-color: var(--bg-muted) !important;
  border-color: var(--border-subtle) !important;
  color: var(--fg-primary) !important;
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder { color: var(--fg-faint) !important; }
:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] textarea:focus {
  background-color: var(--bg-elevated) !important;
  border-color: var(--brand-500) !important;
}

/* Footer dark */
:root[data-theme="dark"] footer { background: var(--bg-surface) !important; border-top-color: var(--border-subtle) !important; }
:root[data-theme="dark"] footer .border-ink-100 { border-color: var(--border-subtle) !important; }

/* Garantir transição suave de tudo */
body, header, footer, section, article, .lift, .loose-card, .modal__dialog, input, textarea, button, a {
  transition: var(--transition-theme);
}
/* Mas não em transformes */
.lift, .loose-card, .theme-toggle, .modal__close, .floaty { transition-property: background-color, color, border-color, box-shadow, transform; }
var(--border-subtle) !important;
  color: var(--fg-primary) !important;
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder { color: var(--fg-faint) !important; }
:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] textarea:focus {
  background-color: var(--bg-elevated) !important;
  border-color: var(--brand-500) !important;
}

/* Footer dark */
:root[data-theme="dark"] footer { background: var(--bg-surface) !important; border-top-color: var(--border-subtle) !important; }
:root[data-theme="dark"] footer .border-ink-100 { border-color: var(--border-subtle) !important; }

/* Garantir transição suave de tudo */
body, header, footer, section, article, .lift, .loose-card, .modal__dialog, input, textarea, button, a {
  transition: var(--transition-theme);
}
/* Mas não em transforms */
.lift, .loose-card, .theme-toggle, .modal__close, .floaty { transition-property: background-color, color, border-color, box-shadow, transform; }
