/* ==========================================================
   animacoes.css — polimento das seções abaixo da sala (04/11/2026).
   Tema único do site: "a luz acendendo". A luz quente (--luz, ~3000K) é o sinal de "ligado",
   igual ao LED da tecla e às lâmpadas da sala. O JavaScript que liga tudo está em js/animacoes.js.
   Tudo some (ou fica direto) com "reduzir movimento" ligado no sistema.
   ========================================================== */

:root { --ease-saida: cubic-bezier(0.22, 1, 0.36, 1); }

/* ---------- 1. Entradas em cascata: cada item do grupo chega um pouco depois do anterior ---------- */
.js .revelar {
  opacity: 0; transform: translateY(22px); filter: blur(6px);
  transition: opacity 0.8s var(--ease-saida), transform 0.9s var(--ease-saida), filter 0.8s var(--ease-saida);
  transition-delay: calc(var(--ordem, 0) * 90ms);
}
.js .revelar.visivel { opacity: 1; transform: none; filter: none; }

/* ---------- 2. Linha de luz no topo: mostra quanto da página já foi rolado ---------- */
.topo::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, rgba(255, 184, 114, 0.15), var(--luz));
  box-shadow: 0 0 10px rgba(255, 184, 114, 0.5);
  transform: scaleX(var(--rolagem, 0)); transform-origin: left;
  pointer-events: none;
}

/* ---------- 3. LED nos títulos: um pontinho que acende quando a seção chega ---------- */
.secao h2::before {
  content: ""; display: inline-block; vertical-align: 0.32em;
  width: 0.24em; height: 0.24em; margin-right: 0.42em; border-radius: 50%;
  background: rgba(134, 171, 201, 0.35);
  transition: background-color 0.6s ease 0.35s, box-shadow 0.8s ease 0.35s;
}
.secao .visivel h2::before, .secao h2.visivel::before {
  background: var(--luz);
  box-shadow: 0 0 0.35em 0.06em rgba(255, 184, 114, 0.75), 0 0 1.2em rgba(255, 184, 114, 0.35);
}

/* ---------- 4. Soluções: o ícone se desenha e a luz quente segue o mouse ---------- */
.solucao__icone .traco {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.3s var(--ease-saida), stroke 0.3s ease;
  transition-delay: calc(var(--ordem, 0) * 90ms + 250ms);
}
.solucao.visivel .solucao__icone .traco { stroke-dashoffset: 0; }
.solucao::before {
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 184, 114, 0.16), transparent 70%);
}
.solucao::after {               /* fio fino que acende na borda de cima ao passar o mouse */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; pointer-events: none;
  background: radial-gradient(160px circle at var(--mx, 50%) 0, rgba(255, 184, 114, 0.9), transparent 70%);
  opacity: 0; transition: opacity 0.4s ease;
}
.solucao:hover::after { opacity: 1; }
.solucao { transition: background-color 0.4s ease; }
.solucao:hover { background: rgba(255, 255, 255, 0.045); }

/* ---------- 5. Diferenciais: um filete de luz se desenha acima de cada motivo, um de cada vez ---------- */
.motivo { position: relative; padding-top: 26px; }
.motivo::before, .motivo::after { content: ""; position: absolute; left: 0; top: 0; height: 1px; }
.motivo::before { right: 0; background: var(--linha); }
.motivo::after {
  width: 64px; background: var(--luz); box-shadow: 0 0 10px rgba(255, 184, 114, 0.6);
  transform: scaleX(0); transform-origin: left;
  transition: transform 1s var(--ease-saida); transition-delay: calc(var(--ordem, 0) * 160ms + 300ms);
}
.motivo.visivel::after { transform: scaleX(1); }

/* ---------- 6. Como trabalhamos: a linha acende acompanhando a rolagem (js põe --fio e data-aceso) ---------- */
.passos .passo::after { transform: scaleX(var(--fio, 0)); transition: transform 0.15s linear; transition-delay: 0s !important; }
.passos .passo__ponto { transition-delay: 0s !important; }
.passos .passo[data-aceso] .passo__ponto {
  border-color: var(--luz); background: var(--luz);
  box-shadow: 0 0 14px rgba(255, 184, 114, 0.55);
}
.passos .passo h3, .passos .passo p { transition: color 0.5s ease, opacity 0.5s ease; }
.passos .passo:not([data-aceso]) h3 { color: var(--texto-2); }
.passos .passo:not([data-aceso]) p { opacity: 0.8; }

/* ---------- 7. Projetos: a sala chega apagada e ACENDE quando entra na tela ---------- */
.projetos__luz { position: relative; overflow: hidden; border-radius: 6px; }
.projetos__luz img { display: block; width: 100%; height: auto; transform: scale(1.06); transition: transform 2.6s var(--ease-saida); }
.projetos__luz .projetos__apagada { position: absolute; inset: 0; height: 100%; object-fit: cover; transition: transform 2.6s var(--ease-saida), opacity 1.6s ease 0.6s; }
.visivel .projetos__luz img { transform: none; }
.visivel .projetos__luz .projetos__apagada { opacity: 0; }

/* ---------- 8. Orçamento: a troca entre as perguntas desliza; a barra brilha ---------- */
.orc__progresso span {
  background: linear-gradient(90deg, var(--marca-clara), var(--luz));
  box-shadow: 0 0 12px rgba(255, 184, 114, 0.45);
  transition: width 0.6s var(--ease-saida);
}
.orc__passo[data-entrando="frente"] { animation: orc-entra-frente 0.45s var(--ease-saida) both; }
.orc__passo[data-entrando="tras"] { animation: orc-entra-tras 0.45s var(--ease-saida) both; }
@keyframes orc-entra-frente { from { opacity: 0; transform: translateX(26px); } }
@keyframes orc-entra-tras { from { opacity: 0; transform: translateX(-26px); } }
.opcao span { transition: border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.3s; }
.opcao input:checked + span { box-shadow: 0 0 0 1px var(--marca-clara), 0 6px 20px -10px rgba(134, 171, 201, 0.6); }

/* ---------- 9. Contato: seta que anda e luz que segue o mouse; o WhatsApp "respira" de leve ---------- */
.contato { position: relative; overflow: hidden; }
.contato::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.07), transparent 70%);
  opacity: 0; transition: opacity 0.3s ease;
}
.contato:hover::before { opacity: 1; }
.contato::after {
  content: "→"; position: absolute; top: 26px; right: 28px;
  font: 500 1.2rem/1 var(--fonte-texto); color: var(--texto-2);
  transition: transform 0.35s var(--ease-saida), color 0.2s ease;
}
.contato:hover::after { transform: translateX(6px); color: #fff; }
.contato--principal::after { content: "↗"; }
.contato--principal.visivel { animation: respira 3.6s ease-in-out 1.2s infinite; }
@keyframes respira {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
  50% { box-shadow: 0 0 0 1px rgba(37, 211, 102, 0.28), 0 0 34px -6px rgba(37, 211, 102, 0.35); }
}

/* ---------- 10. Botões: a luz passa por cima do botão principal ao passar o mouse ---------- */
.botao:not(.botao--fantasma) { position: relative; overflow: hidden; isolation: isolate; }
.botao:not(.botao--fantasma)::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
  transform: translateX(-110%);
}
.botao:not(.botao--fantasma):hover::after { transform: translateX(110%); transition: transform 0.75s var(--ease-saida); }

/* ---------- 11. Abelha 3D no fundo (js/fundo3d.js): aparece devagar quando fica pronta ---------- */
.fundo__3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 2.4s ease; }
.fundo__3d[data-pronto] { opacity: calc(0.52 + 0.3 * var(--guia, 0)); }   /* discreta: o texto passa por cima;
   ao lado de um título (abelha guia, --guia = 1) fica mais nítida */
.fundo__3d[data-solto] { transition: none; }   /* depois de aparecer, o --guia muda a cada quadro: sem atraso */

/* Abertura (só na 1ª visita): tela escura por cima de tudo; a abelha fica num canvas acima dela.
   O cedo.js põe "com-abertura" antes de pintar; o fundo3d.js põe "abertura-saindo" no fim. */
html.com-abertura { overflow: hidden; }
/* Durante a abertura o CONTEÚDO do site fica invisível (a abelha já está no fundo, atrás dele) e,
   depois do pouso ("abertura-saindo"), aparece por cima dela com um fade suave: sem troca de camada. */
html.com-abertura body > *:not(.fundo) { transition: opacity 1.4s cubic-bezier(0.4, 0, 0.2, 1); }
html.com-abertura:not(.abertura-saindo) body > *:not(.fundo) { opacity: 0; }
.fundo__3d--abertura { opacity: 1 !important; transition: opacity 1.4s cubic-bezier(0.4, 0, 0.2, 1); }
.fundo__3d--abertura.fundo__3d--saindo { opacity: 0.52 !important; }

/* ---------- 12. Luz que segue o cursor (animacoes.js): lanterna quente bem suave no fundo ---------- */
.luz-cursor {
  position: absolute; left: 0; top: 0; width: 900px; height: 900px; margin: -450px 0 0 -450px;
  border-radius: 50%; pointer-events: none; will-change: transform;
  background: radial-gradient(closest-side, rgba(255, 184, 114, 0.075), rgba(134, 171, 201, 0.035) 45%, transparent 75%);
  opacity: 0; transition: opacity 0.8s ease;
}
.luz-cursor[data-ativa] { opacity: 1; }

/* ---------- 13. Abelha pequena que pousa ao lado da logo do rodapé (fundo3d.js) ---------- */
.rodape__assinatura { display: flex; align-items: center; gap: 4px; margin-bottom: 14px; }
.rodape__assinatura img { margin: 0 !important; }
.rodape__abelha { width: 76px; height: 76px; display: block; opacity: 0; transition: opacity 0.4s ease; }

/* ---------- 14. Frases que acendem palavra por palavra (animacoes.js põe --a em cada palavra) ---------- */
.palavras .palavra {
  opacity: calc(0.5 + 0.5 * var(--a, 0));   /* apagada = 50%: ainda legível (contraste, PageSpeed 06/11/2026) */
  text-shadow: 0 0 14px rgba(255, 184, 114, calc(var(--a, 0) * (1 - var(--a, 0)) * 2.4));
  transition: opacity 0.25s linear, text-shadow 0.25s linear;
}

/* ---------- 15. Fio de luz ligando as seções (animacoes.js: posição, --fio e nós acesos) ---------- */
main { position: relative; }
.fio {
  position: absolute; z-index: 1; width: 2px; pointer-events: none;
  left: max(9px, calc((100vw - 1320px) / 2 - 6px));
  background: linear-gradient(180deg, transparent, rgba(134, 171, 201, 0.16) 4%, rgba(134, 171, 201, 0.16) 96%, transparent);
}
.fio__aceso {
  position: absolute; inset: 0; transform: scaleY(var(--fio, 0)); transform-origin: top;
  background: linear-gradient(180deg, rgba(134, 171, 201, 0.15), var(--marca-clara) 30%, var(--luz));
  box-shadow: 0 0 10px rgba(255, 184, 114, 0.35);
}
.fio__faisca {
  position: absolute; left: 50%; top: calc(var(--fio, 0) * 100%); width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: #fff3e6;
  box-shadow: 0 0 8px 2px rgba(255, 184, 114, 0.9), 0 0 26px 6px rgba(255, 184, 114, 0.35);
  opacity: calc(min(1, var(--fio, 0) * 30) * min(1, (1 - var(--fio, 0)) * 30));
}
.fio__no {
  position: absolute; left: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%;
  background: #0b1424; border: 1px solid rgba(134, 171, 201, 0.4);
  transition: background-color 0.5s ease, border-color 0.5s ease, box-shadow 0.6s ease;
}
.fio__no[data-aceso] { background: var(--luz); border-color: var(--luz); box-shadow: 0 0 12px rgba(255, 184, 114, 0.75); }
.fio__no--fim { width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; }
.fio__no--fim[data-aceso] { animation: fio-chegou 2.4s ease-in-out infinite; }
@keyframes fio-chegou { 50% { box-shadow: 0 0 0 6px rgba(255, 184, 114, 0.12), 0 0 26px rgba(255, 184, 114, 0.8); } }
/* Ao chegar no fim, o quadro do orçamento "liga" */
#orcamento .orc { transition: border-color 0.8s ease, box-shadow 0.8s ease; }
#orcamento[data-fio-chegou] .orc { border-color: rgba(255, 184, 114, 0.4); box-shadow: 0 0 0 1px rgba(255, 184, 114, 0.12), 0 24px 70px -30px rgba(255, 184, 114, 0.45); }
@media (max-width: 767px) { .fio { left: 7px; width: 1.5px; } .fio__no { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; } }

/* ---------- Menos movimento: tudo aparece direto ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .revelar { transform: none; filter: none; transition: opacity 0.2s; transition-delay: 0s; }
  .solucao__icone .traco { stroke-dashoffset: 0; transition: none; }
  .motivo::after { transform: scaleX(1); transition: none; }
  .projetos__luz img, .projetos__luz .projetos__apagada { transform: none; transition: opacity 0.3s; }
  .orc__passo[data-entrando] { animation: none; }
  .contato--principal.visivel { animation: none; }
  .botao::after { display: none; }
  .passos .passo::after { transition: none; }
  .fio__no--fim[data-aceso] { animation: none; }
  .fio__faisca { display: none; }
}

/* ---------- 16. Luz passando nos títulos (05/11/2026) ----------
   Quando a seção chega, uma faixa de luz quente atravessa o título uma vez, da esquerda para a direita,
   como o reflexo de um spot. O texto é pintado pelo fundo (background-clip: text); o LED (::before) não muda. */
.secao h2, .noite__cabecalho h2 {
  background-image: linear-gradient(100deg, #fff 0 42%, #ffe2c2 47%, #ffb872 50%, #ffe2c2 53%, #fff 58% 100%);
  background-size: 260% 100%; background-position: 100% 0; background-repeat: no-repeat;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.secao .visivel h2, .secao h2.visivel, .noite__cabecalho h2 { animation: titulo-luz 1.8s cubic-bezier(0.45, 0, 0.2, 1) 0.45s both; }
@keyframes titulo-luz { from { background-position: 100% 0; } to { background-position: 0 0; } }
/* (o LED do título continua com a sua própria cor: o fundo pintado só vale para o texto) */
.secao h2::before { -webkit-background-clip: border-box; background-clip: border-box; }

/* ---------- 17. Divisórias entre as seções: um fio fino que se acende do centro para fora ---------- */
main > .secao { position: relative; }
main > .secao + .secao::after, main > .noite + .secao::after {
  content: ""; position: absolute; left: 28px; right: 28px; top: 0; height: 1px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 184, 114, 0.55), rgba(134, 171, 201, 0.22) 55%, transparent);
  transform: scaleX(0.15); opacity: 0.4;
  transition: transform 1.4s var(--ease-saida), opacity 1.4s ease;
}
main > .secao:has(.visivel)::after { transform: scaleX(1); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .secao .visivel h2, .secao h2.visivel, .noite__cabecalho h2 { animation: none; background-position: 0 0; }
  main > .secao::after { transform: none !important; opacity: 1 !important; transition: none; }
}
