/* =========================================================================
   Template Ads — home v3
   Herda v2 → v2.1 → v2.2 e acrescenta:
   1) entrada "o site se montando" (tela escura → logo → peças vindo do fundo)
   2) mapa causal no hero + janela "Seu projeto"
   3) marcador "bloco com dobra" (logo final M2) no lugar da base de escudo
   ========================================================================= */

:root {
  --fold: #A9441F;            /* cor da dobra na logo final M2 */
  --veil: #1E1E1C;
}

/* ---------- Marcador "bloco com dobra" (linguagem da logo final M2: página com cantos de app
   + dobra reta no canto, igual ao bloco do "ADS"). Sai toda a base de escudo da v2.x. ---------- */
.mark { border-radius: 6px; }
.brasao, .num-block {
  -webkit-mask: none !important; mask: none !important;
  border-radius: 6px;
  --f: 10px;
  clip-path: polygon(0 0, calc(100% - var(--f)) 0, 100% var(--f), 100% 100%, 0 100%);
  background-image: linear-gradient(225deg, transparent 50%, var(--fold) 50%) !important;
  background-size: var(--f) var(--f) !important;
  background-position: top right !important;
  background-repeat: no-repeat !important;
}
.brasao { padding-bottom: 0.08em !important; }
.num-block { height: var(--step-size); padding-bottom: 0; }
.q-list li::before {
  -webkit-mask: none; mask: none; height: 30px; padding-bottom: 0; border-radius: 5px;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
}

/* =========================== 1. ENTRADA =========================== */
.intro-veil { display: none; }
html.intro .intro-veil {
  display: flex; position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(120% 90% at 50% 45%, #15100e 0%, #060606 58%, #000 100%);
  align-items: center; justify-content: center; pointer-events: none;
  perspective: 1000px;
  animation: veil-out 0.75s 2.15s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
/* halo de energia (vermelho) atrás do T */
html.intro .intro-veil::before {
  content: ""; position: absolute; width: 400px; height: 400px; border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 52, 38, 0.55) 0%, rgba(226, 52, 38, 0) 70%);
  opacity: 0; animation: halo 1.7s 0.4s ease-out forwards;
}
/* anel que "estoura" quando o T chega à frente e para */
html.intro .intro-veil::after {
  content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%;
  border: 2px solid rgba(226, 52, 38, 0.9);
  opacity: 0; transform: scale(0.3); animation: burst 0.9s 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes veil-out { to { opacity: 0; visibility: hidden; } }
@keyframes halo  { 0% { opacity: 0; transform: scale(0.55); } 60% { opacity: 1; } 100% { opacity: 0.75; transform: scale(1.15); } }
@keyframes burst { 0% { opacity: 0; transform: scale(0.3); } 30% { opacity: 0.9; } 100% { opacity: 0; transform: scale(2.9); } }

/* ---- FUNDO: tudo preto com leve nuance vermelha ---- */
html.intro .intro-veil { background: radial-gradient(circle at 50% 48%, #1a0705 0%, #000 68%); }

/* ---- BURACO DE MINHOCA: a grade curvada é SUGADA pra dentro do buraco (vira ao avesso),
   atravessa a garganta e EVERTE (avesso do avesso); é daí que o T sai (ver .t-hero). ---- */
html.intro .wormhole {
  position: absolute; inset: 0; z-index: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
html.intro .wormhole svg {
  width: 170vmax; height: 170vmax; overflow: visible; transform-origin: 50% 50%;
  filter: drop-shadow(0 0 3px rgba(255, 80, 40, 0.75));
  animation: worm 2.3s cubic-bezier(0.5, 0, 0.3, 1) both;
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent 0 2%, #000 10%, #000 52%, transparent 74%);
          mask: radial-gradient(circle at 50% 50%, transparent 0 2%, #000 10%, #000 52%, transparent 74%);
}
html.intro .wormhole circle, html.intro .wormhole line {
  fill: none; stroke: rgba(255, 92, 46, 0.6); stroke-width: 1.2; vector-effect: non-scaling-stroke;
}
/* clarão na "garganta" do buraco no momento da inversão */
html.intro .wormhole::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 46vmin; height: 46vmin; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 150, 90, 0.8) 0%, rgba(226, 52, 38, 0.3) 38%, transparent 70%);
  opacity: 0; animation: throat 2.3s ease-in-out both;
}
@keyframes worm {
  0%   { transform: scale(0.86) rotate(0deg);  opacity: 0; }
  16%  { opacity: 0.95; }
  40%  { transform: scale(1) rotate(8deg);     opacity: 1; }   /* aberto, PARADO, de frente pro cliente */
  100% { transform: scale(3.8) rotate(46deg);  opacity: 0; }   /* everte: o buraco vira do avesso vindo pra frente e trazendo o T */
}
@keyframes throat { 0%, 34% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }

/* ---- SALA DE ESPELHOS: o T refletido recuando ao fundo (túnel de T's) que voa pra frente
   junto com a inversão do funil e converge no T grande. ---- */
html.intro .t-mirror {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center;
  perspective: 680px;
}
html.intro .t-stack { position: relative; transform-style: preserve-3d; animation: mirror-fly 2.3s cubic-bezier(0.5, 0, 0.3, 1) both; }
html.intro .t-echo {
  position: absolute; left: 50%; top: 50%; width: 26vmin; height: auto;
  transform: translate(-50%, -50%) translateZ(calc(var(--i) * -150px));
  opacity: max(0.05, calc(0.85 - var(--i) * 0.085));
  filter: saturate(2) hue-rotate(-16deg) drop-shadow(0 0 12px rgba(226, 52, 38, 0.5));
  -webkit-box-reflect: below 4px linear-gradient(transparent 52%, rgba(255, 255, 255, 0.18));
}
@keyframes mirror-fly {
  0%   { transform: translateZ(-520px) rotate(0deg);  opacity: 0; }
  16%  { opacity: 1; }
  40%  { transform: translateZ(-300px) rotate(6deg);  opacity: 1; }
  100% { transform: translateZ(680px)  rotate(30deg); opacity: 0; }
}

/* ---- O T FINAL: converge de dentro do buraco e cresce até quase tomar a tela, para e brilha vermelho ----
   Só depois o véu abre (veil-out em 2,15s) e o site entra. */
html.intro .t-hero {
  position: absolute; left: 50%; top: 50%; z-index: 2;
  width: min(58vh, 44vw); height: auto;
  -webkit-box-reflect: below 8px linear-gradient(transparent 46%, rgba(255, 255, 255, 0.22));
  animation: t-arrive 2.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes t-arrive {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.04); filter: saturate(1.8) hue-rotate(-15deg) blur(10px) drop-shadow(0 0 0 rgba(226, 52, 38, 0)); }
  34%  { opacity: 0; transform: translate(-50%, -50%) scale(0.07); filter: saturate(1.8) hue-rotate(-15deg) blur(8px)  drop-shadow(0 0 0 rgba(226, 52, 38, 0)); }
  48%  { opacity: 1;                                               filter: saturate(1.9) hue-rotate(-16deg) blur(4px)  drop-shadow(0 0 36px rgba(226, 52, 38, 0.75)); }
  82%  { opacity: 1; transform: translate(-50%, -50%) scale(1.08); filter: saturate(2) hue-rotate(-17deg) blur(0)     drop-shadow(0 0 80px rgba(226, 52, 38, 1)); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1);    filter: saturate(2) hue-rotate(-17deg) blur(0)     drop-shadow(0 0 64px rgba(226, 52, 38, 0.95)); }
}

/* peças da página: vêm do fundo para a frente (profundidade + desfoque → nítido) */
html.intro [data-build] {
  animation: build 0.9s var(--d, 1s) cubic-bezier(0.16, 1, 0.3, 1) both;
  transform-origin: 50% 60%;
}
html.intro [data-build="lcp"] { animation-name: build-lcp; }   /* o título não fica com opacidade 0 (conta para o LCP) */
@keyframes build {
  from { opacity: 0; transform: perspective(900px) translateZ(-220px) scale(0.96); filter: blur(12px); }
  to   { opacity: 1; transform: none; filter: none; }
}
@keyframes build-lcp {
  from { transform: perspective(900px) translateZ(-220px) scale(0.96); filter: blur(14px); }
  to   { transform: none; filter: none; }
}
html.intro .causal-lines line { animation: draw 0.7s var(--d, 1.3s) cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
html.intro-skip .intro-veil { display: none !important; }

/* =========================== 2. HERO + MAPA CAUSAL =========================== */
.hero { padding-top: clamp(40px, 5vw, 72px); }
@media (min-width: 1100px) { .hero .wrap { grid-template-columns: 0.95fr 1.05fr !important; } }
@media (max-width: 1099px) {
  .hero .wrap { grid-template-columns: 1fr !important; }
  .causal-wrap { justify-self: center; width: 100%; max-width: 580px; }
}

.causal-wrap { margin: 0; }
.causal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.causal-head b { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.causal-head .todo { font-size: 11px; }
.causal {
  position: relative; width: 100%; aspect-ratio: 1 / 0.92;
}
.causal-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.causal-lines line {
  stroke: var(--stone-300); stroke-width: 1.5; vector-effect: non-scaling-stroke;
  stroke-dasharray: 1; stroke-dashoffset: 0;
  transition: stroke 0.3s var(--ease), stroke-width 0.3s var(--ease);
}
.causal.has-focus .causal-lines line { stroke: var(--stone-200); }
.causal .causal-lines line.is-on { stroke: var(--brand); stroke-width: 2.5; }

.causal-core {
  position: absolute; left: 50%; top: 50%; width: 27%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--paper-100);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 0 0 10px rgba(216, 90, 48, 0.08), 0 24px 48px -22px rgba(44, 44, 42, 0.4);
  z-index: 1;
}
.causal-core img { width: 42%; height: auto; }
.causal-core span { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }

.causal-nodes { list-style: none; position: absolute; inset: 0; z-index: 2; }
.causal-nodes li { position: absolute; left: var(--x); top: var(--y); width: 32%; transform: translate(-50%, -50%); }
html.intro .causal-nodes li[data-build] { animation-name: build-node; }
@keyframes build-node {
  from { opacity: 0; transform: translate(-50%, -50%) perspective(900px) translateZ(-220px) scale(0.9); filter: blur(10px); }
  to   { opacity: 1; transform: translate(-50%, -50%); filter: none; }
}
.node {
  width: 100%; display: flex; flex-direction: column; gap: 5px; text-align: left; cursor: pointer;
  background: #FFFFFF; border: 1.5px solid var(--ink-900); color: var(--text); font: inherit;
  padding: 12px 14px 11px; position: relative; border-radius: 8px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease);
}
.node::after {  /* a "dobra" */
  content: ""; position: absolute; top: -1px; right: -1px; width: 12px; height: 12px;
  background: linear-gradient(225deg, transparent 50%, var(--fold) 50%);
}
.node-effect { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1.2; }
.node-causes { font-size: 12.5px; line-height: 1.35; color: var(--text-muted); }
.node-causes .via { font-weight: 700; color: var(--action); text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.08em; }
.causal.has-focus .node { opacity: 0.55; }
.causal .node.is-on, .node:hover, .node:focus-visible { opacity: 1; background: var(--ink-900); color: var(--paper-100); }
.node.is-on .node-causes, .node:hover .node-causes, .node:focus-visible .node-causes { color: var(--stone-300); }
.node.is-on .via, .node:hover .via, .node:focus-visible .via { color: var(--accent-on-dark); }
.node:active { transform: scale(0.98); }
.causal-hint { margin-top: 56px; font-size: 14px; color: var(--text-muted); text-align: center; }
@media (max-width: 699px) { .causal-hint { margin-top: 14px; } }

@media (max-width: 1250px) and (min-width: 700px) {
  .node-effect { font-size: 15px; }
  .node-causes { font-size: 12px; }
}

/* celular: o mapa vira árvore vertical legível */
@media (max-width: 699px) {
  .causal { aspect-ratio: auto; }
  .causal-lines { display: none; }
  .causal-core {
    position: static; transform: none; width: auto; aspect-ratio: auto; border-radius: 0; box-shadow: none;
    flex-direction: row; justify-content: flex-start; gap: 12px; background: transparent; margin-bottom: 8px;
  }
  .causal-core img { width: 40px; }
  .causal-nodes { position: static; display: grid; gap: 10px; padding-left: 20px; border-left: 2px solid var(--stone-300); margin-left: 19px; }
  .causal-nodes li { position: relative; left: auto; top: auto; width: auto; transform: none; }
  .causal-nodes li::before { content: ""; position: absolute; left: -20px; top: 26px; width: 18px; height: 2px; background: var(--stone-300); }
  html.intro .causal-nodes li[data-build] { animation-name: build; }
  .node-effect { font-size: 17px; }
  .node-causes { font-size: 13px; }
  .causal-hint { text-align: left; }
}

/* =========================== 3. JANELA "SEU PROJETO" =========================== */
.builder {
  width: min(1040px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  margin: auto; padding: 0; border: 0; background: var(--bg); color: var(--text);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.55);
}
.builder::backdrop { background: rgba(30, 30, 28, 0.72); backdrop-filter: blur(4px); }
.builder[open] { display: flex; flex-direction: column; animation: dlg-in 0.45s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.builder-top {
  display: flex; align-items: center; gap: 14px; padding: 16px 24px; background: var(--ink-900); color: var(--paper-100);
}
.builder-top img { width: 26px; height: auto; }
.builder-top p { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone-300); }
.builder-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.builder-close {
  margin-left: auto; background: transparent; border: 1px solid rgba(246, 244, 238, 0.35); color: var(--paper-100);
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.builder-close .i { width: 18px; height: 18px; }
.builder-body { display: grid; grid-template-columns: 1.15fr 0.85fr; min-height: 0; overflow: auto; }
.quiz, .fim { padding: 36px 36px 40px; }
.quiz-step { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--action); }
.quiz-bar { height: 4px; background: var(--stone-200); margin: 12px 0 26px; }
.quiz-bar span { display: block; height: 100%; background: var(--brand); transition: width 0.4s var(--ease); }
.quiz-q { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.2; margin-bottom: 24px; outline: none; }
.quiz-opts { display: grid; gap: 10px; }
.opt {
  text-align: left; font: inherit; font-size: 17px; font-weight: 500; padding: 16px 18px; cursor: pointer;
  background: #FFFFFF; border: 1.5px solid var(--stone-300); color: var(--text);
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.opt:hover, .opt:focus-visible { border-color: var(--ink-900); }
.opt.is-picked { background: var(--ink-900); color: var(--paper-100); border-color: var(--ink-900); transform: scale(0.99); }
.quiz-back { margin-top: 18px; background: none; border: 0; font: inherit; font-weight: 600; color: var(--action); cursor: pointer; padding: 6px 0; }

.projeto { background: var(--bg-alt); padding: 32px 28px 36px; border-left: 1px solid var(--line); }
.projeto h4 { font-family: var(--font-display); font-size: 22px; margin-bottom: 4px; }
.projeto > p { font-size: 14px; color: var(--text-muted); margin-bottom: 18px; }
.projeto-lista { list-style: none; display: grid; gap: 8px; }
.item {
  background: var(--bg); padding: 11px 14px; display: grid; gap: 2px; border-left: 3px solid var(--brand);
  opacity: 0; transform: perspective(700px) translateZ(-120px) translateY(8px); filter: blur(6px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), filter 0.5s var(--ease);
}
.item.is-in { opacity: 1; transform: none; filter: none; }
.item-k { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.item-v { font-weight: 600; font-size: 15px; }
.item-goal { background: var(--ink-900); color: var(--paper-100); border-left-color: var(--brand); }
.item-goal .item-k { color: var(--stone-300); }
.item-final { border-left-color: var(--ink-900); }
@media (prefers-reduced-motion: reduce) { .item { transition: none; opacity: 1; transform: none; filter: none; } }

.fim h3 { font-size: clamp(24px, 2.6vw, 32px); outline: none; }
.fim > p { color: var(--text-muted); margin-top: 8px; }
.preco { margin: 22px 0 26px; padding: 16px 18px; border: 1.5px dashed var(--action); background: #FBE3D6; }
.preco b { display: block; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #7A2E12; }
.preco-valor { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: #7A2E12; }
.saidas { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.saida { background: #FFFFFF; border: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.saida h4 { font-family: var(--font-display); font-size: 19px; }
.saida p { font-size: 14px; color: var(--text-muted); }
.saida .btn { align-self: stretch; }
.saida .btn .btn-label { flex: 1; white-space: normal; font-size: 15px; padding: 13px 14px; }
.saida .btn[aria-disabled="true"] { opacity: 0.85; }
.saida .link-arrow { font-size: 15px; }
.todo-inline { font-size: 12px; font-weight: 700; color: #7A2E12; }
.msg-preview-wrap summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--action); }
.msg-preview { white-space: pre-wrap; font-size: 12.5px; background: var(--bg-alt); padding: 10px; margin-top: 8px; max-width: none; }
.restart { margin-top: 20px; background: none; border: 0; font: inherit; font-weight: 600; color: var(--action); cursor: pointer; }

@media (max-width: 800px) {
  .builder { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; }
  .builder-body { grid-template-columns: 1fr; }
  .projeto { border-left: 0; border-top: 1px solid var(--line); order: 2; padding: 22px 20px 28px; }
  .quiz, .fim { padding: 24px 20px 28px; }
  .saidas { grid-template-columns: 1fr; }
  .builder-top { padding: 12px 16px; }
}

/* reunião com hora marcada (fechamento) */
.path-live .todo { font-size: 12px; }

/* logo final M2 é mais larga (lockup ~5,3:1): um pouco mais alta no header */
.brand-logo img { height: 44px; }
@media (max-width: 768px) { .brand-logo img { height: 34px; } }
