/* =========================================================
   PortalSUS — Landing page institucional
   CSS puro, mobile-first, sem dependências externas.
   ========================================================= */

/* ----------------------------- Tokens ----------------------------- */
:root {
  /* Cores */
  --blue-900: #0D47A1;
  --blue-700: #1565C0;
  --blue-400: #42A5F5;
  --green-600: #2E9E5B;
  --green-700: #237b46;

  --ink: #1A2330;          /* texto principal (alto contraste) */
  --ink-soft: #4a5567;     /* texto secundário */
  --bg: #ffffff;
  --bg-soft: #f5f7fa;      /* cinza-claro / seções alternadas */
  --surface: #ffffff;      /* cartões e superfícies elevadas */
  --surface-hover: #d3deef;/* borda de cartão em hover */
  --border: #e3e9f2;
  --white: #ffffff;
  --link: var(--blue-700); /* cor de links/realces sobre o fundo da página */
  --header-bg: rgba(255, 255, 255, .9);
  --hero-bg:
    radial-gradient(1200px 500px at 80% -10%, rgba(66, 165, 245, .14), transparent 60%),
    linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);

  /* Tipografia */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Raios e sombras */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(16, 38, 76, .06);
  --shadow: 0 8px 24px rgba(16, 38, 76, .08);
  --shadow-lg: 0 18px 48px rgba(16, 38, 76, .14);

  /* Espaçamento / layout */
  --container: 1140px;
  --gap: 24px;
  --section-y: clamp(28px, 4vw, 48px);
}

/* ----------------------------- Reset base ----------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}

img, svg { max-width: 100%; display: block; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; color: var(--ink); margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); letter-spacing: -.01em; }
h3 { font-size: 1.18rem; }
p { margin: 0 0 1rem; }

:focus-visible {
  outline: 3px solid var(--blue-400);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ----------------------------- Utilitários ----------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

.eyebrow {
  display: inline-block;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--link);
  background: rgba(21, 101, 192, .08);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.section { padding-block: var(--section-y); }
.section-alt { background: var(--bg-soft); }

.section-head { max-width: 720px; margin: 0 auto clamp(20px, 3vw, 36px); text-align: center; }
.section-lead { font-size: 1.1rem; color: var(--ink-soft); margin: 0; }
.section-lead-light { color: rgba(255, 255, 255, .85); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--blue-700);
  color: #fff;
  padding: 10px 16px;
  z-index: 200;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* Ícones de linha genéricos */
.ico {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

/* ----------------------------- Botões ----------------------------- */
.btn {
  --btn-bg: var(--blue-700);
  --btn-fg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  padding: 14px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--blue-700); color: #fff; }
.btn-primary:hover { background: var(--blue-900); }

.btn-ghost {
  background: transparent;
  color: var(--link);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--blue-400); background: rgba(21, 101, 192, .04); }

.btn-light { background: #fff; color: var(--blue-900); }
.btn-light:hover { background: #f0f5ff; }

.btn-sm { padding: 10px 18px; font-size: .92rem; }
.btn-block { width: 100%; }

/* ----------------------------- Grids ----------------------------- */
.grid { display: grid; gap: var(--gap); }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

@media (min-width: 640px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 980px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ----------------------------- Header ----------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  transition: background-color .25s ease, border-color .25s ease;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo:hover { text-decoration: none; }
.logo-img { width: auto; height: 48px; }
/* Troca do logo conforme o tema (contorno claro fica legível no escuro). */
.logo-on-dark { display: none; }
html[data-theme="dark"] .logo-on-light { display: none; }
html[data-theme="dark"] .logo-on-dark { display: block; }
.logo-light .logo-img { height: 64px; }
.logo-text { font-size: 1.25rem; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.logo-text strong { color: var(--blue-700); font-weight: 800; }
.logo-light .logo-text { color: #fff; }
.logo-light .logo-text strong { color: var(--blue-400); }

.main-nav { display: flex; align-items: center; gap: 10px; }

.nav-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0;
  padding: 0;
}
.nav-menu a { color: var(--ink); font-weight: 500; font-size: .98rem; }
.nav-menu a:hover { color: var(--link); text-decoration: none; }
/* "Acesso restrito" — botão de login destacado e separado à direita */
.nav-menu .nav-cta { margin-left: 8px; }
.nav-menu .nav-cta a { color: var(--link); }
.nav-menu .nav-cta a:hover { color: var(--link); }
.nav-menu .nav-cta .ico { width: 16px; height: 16px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  width: 20px; height: 2px;
  margin-inline: auto;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Botão de alternância de tema (claro/escuro) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.theme-toggle:hover { border-color: var(--blue-400); color: var(--link); }
.theme-toggle svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 8px 20px 20px;
    display: none;
  }
  .nav-menu.open { display: flex; }
  .nav-menu li { padding: 6px 0; }
  .nav-menu .nav-cta { padding-top: 12px; }
  .nav-menu .nav-cta a { display: block; text-align: center; }
}

/* ----------------------------- Hero ----------------------------- */
.hero {
  background: var(--hero-bg);
  padding-top: clamp(20px, 2.5vw, 36px);
  padding-bottom: clamp(20px, 3vw, 40px);
}
/* A primeira seção após o hero fica mais junta dele. */
.hero + .section { padding-top: clamp(12px, 2vw, 24px); }
.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(32px, 5vw, 56px);
  align-items: center;
}
@media (min-width: 900px) {
  /* Coluna da imagem mais larga (estende-se para a direita). */
  .hero-inner { grid-template-columns: 1fr 1.05fr; }
  /* Topo da arte alinhado ao H1 ("Garanta"): o eyebrow ocupa ~47px acima do
     título, então deslocamos a imagem para baixo desse valor e a ancoramos no
     topo da coluna. A altura do SVG (proporção mais alta) leva a base até o
     fim do subtítulo. */
  .hero-art { align-self: start; margin-top: 47px; }
}

.hero-subtitle { font-size: 1.15rem; color: var(--ink-soft); max-width: 56ch; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin: 26px 0 24px; }

.hero-art {
  filter: drop-shadow(var(--shadow-lg));
}
.hero-art img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

/* ----------------------------- Cards de soluções ----------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--surface-hover); }

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue-400), var(--blue-700));
  color: #fff;
  margin-bottom: 18px;
}
.card-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.card p { margin: 0; color: var(--ink-soft); }

/* ----------------------------- Benefícios ----------------------------- */
.benefit { text-align: left; }
.benefit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px; height: 50px;
  border-radius: 14px;
  background: rgba(21, 101, 192, .12);
  color: var(--blue-700);
  margin-bottom: 14px;
}
.benefit-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.benefit h3 { margin-bottom: 6px; }
.benefit p { margin: 0; color: var(--ink-soft); font-size: .96rem; }

/* ----------------------------- Como funciona ----------------------------- */
.steps {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
  counter-reset: step;
}
@media (min-width: 640px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .steps { grid-template-columns: repeat(4, 1fr); } }

.step {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--blue-700);
  color: #fff;
  font-weight: 700;
  margin-bottom: 14px;
}
.step h3 { margin-bottom: 6px; font-size: 1.08rem; }
.step p { margin: 0; color: var(--ink-soft); font-size: .95rem; }

/* ----------------------------- Estatísticas ----------------------------- */
.section-stats {
  background: linear-gradient(135deg, var(--blue-900), var(--blue-700));
  color: #fff;
}
.section-stats h2 { color: #fff; }
.stats { text-align: center; }
.stat {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
}
.stat-num {
  display: block;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
}
.stat-label { display: block; margin-top: 10px; color: rgba(255, 255, 255, .85); font-weight: 500; }

/* ----------------------------- CTA band ----------------------------- */
.cta-band {
  background:
    radial-gradient(700px 300px at 10% 120%, rgba(46, 158, 91, .25), transparent 60%),
    linear-gradient(135deg, var(--blue-700), var(--blue-900));
  color: #fff;
}
.cta-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: clamp(40px, 6vw, 64px);
}
.cta-inner h2 { color: #fff; margin-bottom: 6px; }
.cta-inner p { margin: 0; color: rgba(255, 255, 255, .9); }

/* ----------------------------- Contato ----------------------------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(32px, 5vw, 56px);
  align-items: start;
}
@media (min-width: 900px) { .contact-grid { grid-template-columns: .85fr 1.15fr; align-items: flex-end; } }

.contact-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 14px; }
.contact-list li { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); }
.contact-list .ico { color: var(--link); }

/* Cartão de contato via WhatsApp */
.contact-cta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 28px);
  box-shadow: var(--shadow);
  text-align: center;
}
.whats-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(37, 211, 102, .12);
  color: #25D366;
  margin-bottom: 12px;
}
.whats-badge svg { width: 26px; height: 26px; fill: currentColor; }
.contact-cta h3 { font-size: 1.18rem; margin-bottom: 6px; }
.contact-cta p { color: var(--ink-soft); margin: 0 auto 16px; max-width: 40ch; font-size: .95rem; }

.btn-whats { background: #25D366; color: #fff; }
.btn-whats:hover { background: #1ebe5b; }
.btn-whats-ico { width: 18px; height: 18px; fill: currentColor; }


/* ----------------------------- Rodapé ----------------------------- */
.site-footer {
  background: #0f1a2b;
  color: #c4cdda;
  padding-top: clamp(48px, 6vw, 72px);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding-bottom: 40px;
}
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }

.footer-brand p { margin-top: 14px; color: #93a1b5; max-width: 36ch; font-size: .95rem; }

.footer-col h3 { color: #fff; font-size: 1rem; margin-bottom: 14px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-col a { color: #c4cdda; font-size: .95rem; }
.footer-col a:hover { color: #fff; }

.footer-social { display: flex; gap: 12px; }
.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
}
.footer-social a:hover { background: var(--blue-700); }
.footer-social svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  padding-block: 22px;
  font-size: .86rem;
  color: #8595aa;
}
.footer-bottom p { margin: 0; }

/* ----------------------------- Animações de scroll ----------------------------- */
/* Fail-safe: o conteúdo só é escondido para animar quando o JS adiciona
   .js-anim ao <html>. Sem JS (ou se ele falhar), tudo permanece visível. */
.js-anim .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s ease, transform .6s ease;
  will-change: opacity, transform;
}
.js-anim .reveal.is-visible { opacity: 1; transform: none; }

/* Pequeno escalonamento entre itens irmãos revelados */
.js-anim .grid .reveal:nth-child(2) { transition-delay: .08s; }
.js-anim .grid .reveal:nth-child(3) { transition-delay: .16s; }
.js-anim .grid .reveal:nth-child(4) { transition-delay: .24s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .js-anim .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .card:hover { transform: none; }
  * { animation: none !important; }
}

/* ----------------------------- Tema escuro ----------------------------- */
/* Apenas os tokens mudam; os componentes seguem usando as variáveis, então
   tudo permanece visível e com contraste adequado em ambos os temas.
   O rodapé, as faixas de estatísticas e o CTA já são escuros por design e
   funcionam igualmente bem nos dois temas. */
html[data-theme="dark"] {
  --ink: #e7edf5;          /* texto principal */
  --ink-soft: #a9b6c8;     /* texto secundário (contraste AA sobre o fundo) */
  --bg: #0f1620;           /* fundo da página */
  --bg-soft: #16202e;      /* seções alternadas */
  --surface: #18222f;      /* cartões / superfícies elevadas */
  --surface-hover: #34465a;
  --border: #283443;
  --link: #6db0f7;         /* azul mais claro p/ contraste sobre o escuro */
  --header-bg: rgba(15, 22, 32, .85);
  --hero-bg:
    radial-gradient(1200px 500px at 80% -10%, rgba(66, 165, 245, .12), transparent 60%),
    linear-gradient(180deg, #121b27 0%, #0f1620 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 8px 24px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .5);
}

/* Ajustes pontuais de realces que usavam tons claros fixos */
html[data-theme="dark"] .eyebrow { background: rgba(109, 176, 247, .14); }
/* No tema escuro, os botões cheios (azul, branco e verde) destoam do fundo
   escuro; igualamos sua aparência ao botão "fantasma" (.btn-ghost) — contorno
   discreto. */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-whats {
  background: transparent;
  color: var(--link);
  border-color: var(--border);
}
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] .btn-light:hover,
html[data-theme="dark"] .btn-whats:hover {
  background: rgba(109, 176, 247, .10);
  border-color: var(--blue-400);
}
html[data-theme="dark"] .btn-ghost:hover {
  background: rgba(109, 176, 247, .10);
  border-color: var(--blue-400);
}
html[data-theme="dark"] .benefit-icon {
  background: rgba(109, 176, 247, .14);
  color: var(--link);
}

/* Faixas de estatísticas e CTA: no tema escuro o azul vibrante destoa do resto
   da página, então usamos tons escuros condizentes com o fundo. */
html[data-theme="dark"] .section-stats {
  background: linear-gradient(135deg, #121b27, #18222f);
  border-block: 1px solid var(--border);
}
html[data-theme="dark"] .cta-band {
  background:
    radial-gradient(700px 300px at 10% 120%, rgba(46, 158, 91, .18), transparent 60%),
    linear-gradient(135deg, #16202e, #0f1620);
  border-block: 1px solid var(--border);
}
