/* =========================================================
   BASE
   ---------------------------------------------------------
   Regras gerais: reset, tipografia, links, foco do teclado,
   fundo do site (brilhos de luz), moldura dupla dos
   cards e utilitários.
   ========================================================= */

/* ---------- RESET SIMPLES ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Ao clicar num link do menu, a seção não fica escondida atrás do menu */
  scroll-padding-top: calc(var(--header-h) + 1rem);
  /* Reserva espaço da barra de rolagem: a página não "pula" ao abrir o painel */
  scrollbar-gutter: stable;
  color-scheme: dark;          /* no tema claro vira "light" (variables.css) */
  background: var(--bg);
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text-body);
  /* sem fundo próprio: assim os brilhos fixos (.ambient) aparecem por trás.
     A cor de fundo fica no <html>. */
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

/* Rolagem suave (biblioteca Lenis): ela mesma cuida da suavidade,
   então desligamos a do CSS para as duas não brigarem */
html.lenis,
html.lenis body { height: auto; }
html.lenis { scroll-behavior: auto; }
.lenis.lenis-stopped { overflow: clip; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }

/* Trava a rolagem do fundo quando o menu ou o painel estão abertos */
html.is-locked {
  overflow: hidden;
}

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

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

/* :where() deixa esta regra "fraca": qualquer classe consegue sobrescrever */
:where(ul, ol)[role='list'] {
  list-style: none;
  padding: 0;
}

/* ---------- FUNDO DO SITE ---------- */
/* Luz de fundo bem fraca em verde-água, fixa atrás de tudo.
   Fica "parada" enquanto o conteúdo rola por cima. */
.ambient {
  position: fixed;
  inset: 0;
  z-index: var(--z-ambient);
  pointer-events: none;
  background:
    radial-gradient(55vw 45vw at 95% -5%, rgba(var(--teal-rgb), calc(0.16 * var(--glow-k))), transparent 60%),
    radial-gradient(60vw 50vw at -10% 30%, rgba(var(--navy-rgb), 0.9), transparent 65%),
    radial-gradient(50vw 40vw at 50% 120%, rgba(var(--navy-rgb), 0.8), transparent 70%),
    var(--bg);
}

/* TEXTURA 1: grão de filme por cima de tudo (bem leve).
   É um "ruído" desenhado pelo próprio SVG (feTurbulence). Tira a
   cara de tela lisa e deixa o fundo com aspecto de papel/foto. */
.ambient::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* No tema claro o grão é escuro (o mesmo ruído, com pontos pretos) */
[data-theme='light'] .ambient::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* TEXTURA 2: grade de pontos (usada no hero e nos serviços).
   Coloque a classe .dot-grid numa seção; os pontos somem nas bordas. */
.dot-grid {
  position: relative;
  isolation: isolate;
}

.dot-grid::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(var(--dot-color) 1px, transparent 1.2px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
}

/* ---------- TIPOGRAFIA ---------- */
h1,
h2,
h3,
h4 {
  color: var(--text);
  font-weight: 600;
  font-stretch: 112%;          /* levemente expandida */
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;          /* quebra de linha equilibrada nos títulos */
}

h1 { font-size: var(--fs-2xl); line-height: 1; letter-spacing: -0.04em; }
h2 { font-size: var(--fs-xl); letter-spacing: -0.035em; }
h3 { font-size: var(--fs-lg); letter-spacing: -0.015em; }

p {
  text-wrap: pretty;           /* evita uma palavra sozinha na última linha */
}

strong {
  color: var(--text);
  font-weight: 600;
}

a {
  color: var(--accent-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--dur-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    color: var(--text);
  }
}

/* Destaque de palavra em azul claro (sem degradê) */
.ink {
  color: var(--accent-ink);
}

/* Rótulo monoespaçado: só em códigos e números ("CASO 01", etapas) */
.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- FOCO DO TECLADO ---------- */
:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: 6px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- DETALHES DO NAVEGADOR ---------- */
::selection {
  background: var(--accent);
  color: var(--on-accent);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface) transparent;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 10px;
  border: 2px solid var(--bg);
}

/* ---------- MOLDURA DUPLA (cards "de vidro") ---------- */
/* Casca externa fina + núcleo interno com cantos concêntricos.
   Uso: <div class="bezel"><div class="bezel__core"> ... </div></div> */
.bezel {
  padding: var(--bezel);
  border-radius: var(--radius-shell);
  background: rgba(var(--ink-rgb), 0.025);
  border: 1px solid var(--hairline);
}

.bezel__core {
  height: 100%;
  border-radius: var(--radius-core);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: var(--highlight);
}

/* ---------- UTILITÁRIOS ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section-y);
  position: relative;
  /* Corta o que passa das laterais (ex.: cards que entram deslizando
     de lado). Sem isso, no celular a página ficava mais larga que a tela. */
  overflow-x: clip;
}

/* Cabeçalho padrão das seções: título + parágrafo */
.section-head {
  max-width: 44rem;
  margin-bottom: clamp(2.5rem, 2rem + 2vw, 4rem);
}

.section-head p {
  margin-top: var(--space-5);
  font-size: var(--fs-md);
  color: var(--text-muted);
  max-width: 38rem;
}

/* Texto visível só para leitores de tela */
.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;
}

/* Link "Pular para o conteúdo": aparece ao apertar Tab */
.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus { top: var(--space-3); }
.skip-link:hover { color: var(--bg); }

/* Etiqueta para informações provisórias (ex.: e-mail ainda não confirmado) */
.placeholder-tag {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.1rem 0.5rem;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  vertical-align: middle;
  white-space: nowrap;
}

/* ---------- MOVIMENTO REDUZIDO ---------- */
/* Quem ativou "reduzir movimento" no sistema não vê deslocamentos.
   Cor e opacidade continuam; o que move, gira ou flutua é desligado.
   O JavaScript também respeita essa escolha (função reduzirMovimento). */
/* Antes era @media (prefers-reduced-motion: reduce). Agora só vale com a
   classe "respeitar-movimento" no <html>, que o script do <head> coloca
   APENAS se CONFIG.animacoesSempre for false E o sistema pedir para
   reduzir movimento. Com animacoesSempre = true, estas regras dormem. */
html.respeitar-movimento {
  scroll-behavior: auto;
}

html.respeitar-movimento *,
html.respeitar-movimento *::before,
html.respeitar-movimento *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
}

/* ---------- TROCA DE TEMA (claro/escuro) ----------
   A página inteira "esmaece" de um tema para o outro (View
   Transitions API, chamada em js/components.js, parte 9).
   Sem "clarão": a imagem antiga some enquanto a nova aparece. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 450ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Durante a troca, as outras transições de cor ficam desligadas
   (o ícone sol/lua continua girando) */
.trocando-tema *:not(.theme-toggle__icon),
.trocando-tema *::before,
.trocando-tema *::after {
  transition: none !important;
}

/* Plano B (navegador sem View Transitions): cortina na cor do novo fundo */
.tema-cortina {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
}
