/* ==========================================================
   Diagnóstico de fluxo — UMA tela: formulário + desenho (Graphite & Amber)
   ========================================================== */

/* A seção "sobe" por cima das camadas fixas (vídeo, cartões, CTA) como uma cortina preta.
   A altura acompanha o formulário: nada fica cortado na borda da tela. */
.diag {
  position: relative; z-index: 9; background: var(--black);
  box-sizing: border-box;
  height: auto; min-height: 100vh; min-height: 100dvh;
  padding: 5rem 3vw 2.5rem;
  box-shadow: 0 -90px 110px 10px rgba(0, 0, 0, .92);
  border-top: 1px solid var(--graphite);
}
.diag { --alert: #ff6b4a; }
.diag-inner {
  min-height: calc(100dvh - 7.5rem); max-width: 1400px; margin: 0 auto;
  display: flex; flex-direction: column; gap: clamp(.8rem, 1.6vh, 1.2rem);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.diag-head { flex: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 3rem; flex-wrap: wrap; }
.diag-title {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(1.9rem, 3vw, 2.9rem);
  line-height: 1; letter-spacing: -.035em; margin: .45rem 0 0; color: var(--white);
}
.diag-title em { font-style: normal; color: var(--amber); }
.diag-intro { font-size: .92rem; line-height: 1.5; color: var(--body-text); max-width: 58ch; }
.diag.submitted .diag-intro { display: none; }

/* ---------- compositor (estilo chat): o texto é a entrada, o fluxo é a resposta ---------- */
.composer { flex: none; width: 100%; max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: .7rem; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .6rem; font-size: .78rem; color: var(--silver); }
.examples button {
  font: inherit; font-size: .78rem; color: var(--body-text); background: transparent; cursor: pointer;
  border: 1px solid var(--graphite); border-radius: 99px; padding: .32rem .8rem; transition: border-color .2s, color .2s, background .2s;
}
.examples button:hover { border-color: var(--amber); color: var(--amber); background: rgba(255,179,71,.06); }
.composer-box {
  background: #17171a; border: 1px solid #2c2c32; border-radius: 16px; padding: .85rem 1rem .6rem;
  box-shadow: 0 10px 40px rgba(0,0,0,.45); transition: border-color .2s, box-shadow .2s;
}
.composer-box:focus-within { border-color: var(--amber); box-shadow: 0 10px 40px rgba(0,0,0,.45), 0 0 0 3px rgba(255,179,71,.12); }
.composer-field { display: block; }
.composer-field textarea {
  display: block; width: 100%; font: inherit; font-size: 1rem; line-height: 1.55; color: var(--white);
  background: transparent; border: 0; resize: none; padding: 0; min-height: 3.1rem; max-height: 11rem; overflow-y: auto;
}
.composer-field textarea::placeholder { color: rgba(161,161,170,.7); }
.composer-field textarea:focus { outline: none; }
.composer-field textarea:disabled { opacity: .55; cursor: not-allowed; }
.composer-foot { display: flex; align-items: center; gap: .9rem; margin-top: .4rem; }
.counter { font-family: var(--font-mono); font-size: .66rem; color: var(--silver); }
.composer-hint { flex: 1; font-size: .74rem; color: var(--silver); opacity: .92; transition: opacity .2s; }
.composer-hint.ready { opacity: 0; }
.wa-btn {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--white); background: transparent; border: 1px solid #3a3a42; border-radius: 99px; padding: .55rem 1rem; transition: border-color .2s, color .2s, background .2s;
}
.wa-btn .wa-ico { color: #25d366; flex: none; }
.wa-btn:hover:not(:disabled) { border-color: #25d366; background: rgba(37,211,102,.08); }
.wa-btn:disabled { opacity: .45; cursor: not-allowed; }
.wa-btn[hidden], .wa-alt[hidden] { display: none; }
.wa-alt { display: flex; align-items: center; justify-content: center; gap: .9rem; flex-wrap: wrap; font-size: .8rem; color: var(--silver); }
.composer.open .composer-foot .wa-btn { display: none; }
.composer-go {
  margin-left: auto; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
  background: var(--amber); color: var(--black); border: 0; border-radius: 99px; padding: .6rem 1.15rem; font-weight: 700;
  transition: opacity .2s, transform .2s, background .2s;
}
.composer-go:hover:not(:disabled) { transform: translateX(2px); }
.composer-go:disabled { background: var(--graphite); color: var(--silver); cursor: not-allowed; opacity: .8; }
.composer.open .composer-go, .composer.open .composer-hint, .composer.open .examples { display: none; }

/* passo 2: contato, abre abaixo do compositor depois que o fluxo já existe */
.contact { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s cubic-bezier(.2,.7,.2,1); }
.contact-inner { overflow: hidden; min-height: 0; display: flex; flex-direction: column; gap: .7rem; opacity: 0; transition: opacity .3s .1s; }
.composer.open .contact { grid-template-rows: 1fr; }
.composer.open .contact-inner { opacity: 1; padding-top: .2rem; }
.contact-lead { font-size: .86rem; color: var(--white); }
.diag.submitted .examples, .diag.submitted .composer-box, .diag.submitted .contact { display: none; }

.field { display: flex; flex-direction: column; gap: .35rem; position: relative; min-width: 0; }
.field > span { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--silver); }
.field > span i { font-style: normal; opacity: .85; text-transform: none; letter-spacing: .03em; }
.field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.field input {
  width: 100%; font: inherit; font-size: .95rem; font-weight: 400; color: var(--white);
  background: var(--graphite); border: 1px solid transparent; border-bottom: 1px solid var(--silver);
  border-radius: 2px; padding: .62rem .85rem; transition: border-color .2s, background .2s;
}
.field input::placeholder { color: rgba(161,161,170,.55); }
.field input:focus { outline: none; border-color: var(--amber); background: #26262b; }
.field input:disabled { opacity: .55; cursor: not-allowed; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.consent { display: flex; gap: .65rem; align-items: flex-start; font-size: .78rem; line-height: 1.45; color: var(--body-text); cursor: pointer; }
.consent input {
  appearance: none; -webkit-appearance: none; margin-top: .1rem; width: 1.05rem; height: 1.05rem; flex-shrink: 0; cursor: pointer;
  border: 1.5px solid var(--silver); border-radius: 4px; background: var(--graphite); display: grid; place-content: center; transition: border-color .2s, background .2s;
}
.consent input::after { content: ""; width: .5rem; height: .28rem; border: solid var(--black); border-width: 0 0 2px 2px; transform: rotate(-45deg) scale(0); transition: transform .15s; margin-top: -2px; }
.consent input:checked { background: var(--amber); border-color: var(--amber); }
.consent input:checked::after { transform: rotate(-45deg) scale(1); }
.form-error { color: var(--amber); font-size: .84rem; line-height: 1.4; }
.form-error:empty { display: none; }
button.cta-button { border: 0; cursor: pointer; }
.contact .cta-button { flex: none; width: 100%; padding: .95rem 1.4rem; }
.cta-button:disabled { opacity: .6; cursor: wait; }
.cta-button[hidden], .ghost-button[hidden], .send-status[hidden], .stage-overlay[hidden] { display: none; }

.send-status { flex: none; padding: .8rem 1rem; border-left: 2px solid var(--silver); background: var(--graphite); font-size: .85rem; line-height: 1.45; color: var(--white); }
.send-status.ok { border-color: var(--amber); }
.send-status.warn { border-color: #ff6b4a; }
.send-status.busy { border-color: var(--amber); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { background: #2a2a2f; } }
.result-actions { flex: none; display: flex; flex-wrap: wrap; gap: .6rem; }
.result-actions:not(:has(:not([hidden]))) { display: none; }
.ghost-button {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
  color: var(--white); background: transparent; border: 1px solid var(--silver); border-radius: 2px; padding: .8rem 1.1rem; transition: border-color .2s, color .2s;
}
.ghost-button:hover { border-color: var(--amber); color: var(--amber); }
.result-actions .cta-button { padding: .8rem 1.1rem; font-size: .72rem; }

/* ---------- palco do fluxo ---------- */
.diag-stage { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.stage-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem 1.2rem; margin-bottom: .6rem; min-height: 2rem; }
.badge {
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--silver);
  border: 1px solid var(--graphite); padding: .4rem .8rem; border-radius: 99px; display: inline-flex; align-items: center; gap: .55rem;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--silver); }
.badge[data-state="live"] { color: var(--amber); border-color: rgba(255,179,71,.45); }
.badge[data-state="live"]::before { background: var(--amber); animation: blink 1.2s ease-in-out infinite; }
.badge[data-state="busy"] { color: var(--amber); border-color: var(--amber); }
.badge[data-state="busy"]::before { background: var(--amber); animation: blink .5s ease-in-out infinite; }
.badge[data-state="done"] { color: var(--black); background: var(--amber); border-color: var(--amber); }
.badge[data-state="done"]::before { background: var(--black); }
@keyframes blink { 50% { opacity: .25; } }
.stage-title { font-family: var(--font-display); font-weight: 600; font-size: .98rem; color: var(--white); }

.flow-scroll {
  position: relative; flex: 1; min-height: clamp(20rem, 46vh, 40rem); overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: .75rem;
  border: 1px solid var(--graphite); transition: border-color .5s, box-shadow .5s;
  background: radial-gradient(circle at 1px 1px, rgba(161,161,170,.16) 1px, transparent 0) 0 0 / 22px 22px, #0d0d0f;
}
.diag-stage:has(.badge[data-state="live"]) .flow-scroll, .diag-stage:has(.badge[data-state="busy"]) .flow-scroll { border-color: rgba(255,179,71,.4); box-shadow: 0 0 60px rgba(255,179,71,.07) inset; }
.flow-stage { position: absolute; inset: 0 0 34px 0; display: flex; align-items: center; justify-content: center; }
.flow-stage svg { display: block; overflow: visible; flex: none; }
.stage-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; pointer-events: none;
  padding: 2rem; font-family: var(--font-mono); font-size: .85rem; line-height: 1.8; letter-spacing: .08em; color: var(--silver);
  text-shadow: 0 0 14px #000, 0 0 28px #000;
}
.flow-stage .shape { fill: rgba(32,32,36,.95); stroke: var(--silver); stroke-width: 1.5; transition: stroke .5s, fill .5s; }
.flow-stage .node .tag { font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; fill: var(--silver); }
.flow-stage .node .title { font-family: var(--font-display); font-weight: 600; font-size: 13px; fill: var(--white); }
.flow-stage .t-automacao .shape { stroke: var(--amber); }
.flow-stage .t-automacao .tag { fill: var(--amber); }
.flow-stage .t-ia .shape { stroke: var(--amber); fill: rgba(255,179,71,.14); stroke-width: 2; filter: drop-shadow(0 0 8px rgba(255,179,71,.45)); }
.flow-stage .t-ia .tag { fill: var(--amber); }
.flow-stage .t-dor .shape { stroke: var(--alert); fill: rgba(255,107,74,.12); stroke-width: 2; animation: pain 1.8s ease-in-out infinite; }
.flow-stage .t-dor .tag { fill: var(--alert); font-weight: 700; }
@keyframes pain { 0%, 100% { filter: drop-shadow(0 0 2px rgba(255,107,74,.25)); } 50% { filter: drop-shadow(0 0 12px rgba(255,107,74,.7)); } }
.flow-stage .t-decisao .shape { stroke-dasharray: 5 4; }
.flow-stage .t-entrada .shape, .flow-stage .t-saida .shape { stroke: var(--white); }
.flow-stage .node.chaos .shape { stroke: #6b6b73; fill: rgba(32,32,36,.7); filter: none; stroke-dasharray: none; }
.flow-stage .node.chaos .title { fill: #9a9aa3; }
.flow-stage .node.ghost .shape { stroke: #55555c; fill: rgba(32,32,36,.45); filter: none; stroke-dasharray: 4 4; }
.flow-stage .edge { fill: none; stroke: var(--amber); stroke-width: 1.6; opacity: .85; }
.flow-stage .edge-label rect { fill: var(--black); stroke: var(--graphite); }
.flow-stage .edge-label text { font-family: var(--font-mono); font-size: 10px; fill: var(--amber); }
.flow-stage .pulse { fill: #fff; filter: drop-shadow(0 0 5px var(--amber)) drop-shadow(0 0 2px var(--amber)); }
.diag-stage.analyzing .flow-stage .node .shape { animation: analyze 1s ease-in-out infinite; }
.diag-stage.analyzing .flow-stage .node:nth-child(odd) .shape { animation-delay: -.5s; }
@keyframes analyze { 50% { stroke: var(--amber); } }

.ai-toggle {
  display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font: inherit; color: var(--silver);
  background: transparent; border: 1px solid var(--graphite); border-radius: 99px; padding: .3rem .85rem .3rem .4rem;
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; transition: border-color .2s, color .2s;
}
.ai-toggle em { font-style: normal; opacity: .85; text-transform: none; letter-spacing: .02em; }
.ai-toggle:hover:not(:disabled) { border-color: var(--amber); color: var(--white); }
.ai-toggle.attn { color: var(--amber); border-color: var(--amber); animation: attn 1.4s ease-in-out infinite; }
.ai-toggle.attn .ai-track { border-color: var(--amber); }
@keyframes attn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,179,71,0); background: transparent; }
  50% { box-shadow: 0 0 0 5px rgba(255,179,71,.22), 0 0 16px rgba(255,179,71,.45); background: rgba(255,179,71,.08); }
}
.ai-toggle:disabled { opacity: .5; cursor: not-allowed; }
.ai-track { position: relative; width: 30px; height: 17px; border-radius: 99px; background: var(--graphite); border: 1px solid var(--silver); transition: background .25s, border-color .25s; flex: none; }
.ai-track i { position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--silver); transition: transform .25s, background .25s; }
.ai-toggle[aria-checked="true"] { color: var(--amber); border-color: rgba(255,179,71,.55); }
.ai-toggle[aria-checked="true"] .ai-track { background: rgba(255,179,71,.25); border-color: var(--amber); }
.ai-toggle[aria-checked="true"] .ai-track i { transform: translateX(13px); background: var(--amber); }
.flow-legend { position: absolute; left: .75rem; right: .75rem; bottom: .7rem; margin: 0; flex: none; list-style: none; display: flex; flex-wrap: wrap; gap: .3rem 1.3rem; justify-content: center; font-family: var(--font-mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--silver); }
.flow-legend li { display: flex; align-items: center; gap: .5rem; }
.flow-legend li::before { content: ""; width: 14px; height: 10px; border: 1.5px solid var(--silver); border-radius: 3px; }
.flow-legend [data-t="entrada"]::before { border-color: var(--white); border-radius: 6px; }
.flow-legend [data-t="dor"]::before { border-color: var(--alert); background: rgba(255,107,74,.25); }
.flow-legend [data-t="decisao"]::before { border-style: dashed; }
.flow-legend [data-t="automacao"]::before { border-color: var(--amber); }
.flow-legend [data-t="ia"]::before { border-color: var(--amber); background: rgba(255,179,71,.25); }

/* ---------- rodapé ---------- */
.site-footer {
  position: relative; z-index: 9; background: var(--black);
  display: flex; align-items: center; justify-content: center; gap: .8rem;
  padding: 1.6rem 0 1.8rem; border-top: 1px solid var(--graphite);
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; color: var(--silver);
}
.site-footer .brand-mark { width: auto; height: 28px; }

.in-lead .phases { opacity: 0 !important; }
.site-header { transition: padding .25s; }
.header-solid .site-header { background: rgba(10, 10, 11, .96); padding-bottom: 1rem; border-bottom: 1px solid var(--graphite); }
.diag button:focus-visible, .diag input:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

/* ---------- telas baixas (notebooks) ---------- */
@media (min-width: 1024px) and (max-height: 760px) {
  .diag { padding-top: 4.3rem; padding-bottom: .8rem; }
  .diag-title { font-size: clamp(1.6rem, 2.6vw, 2.3rem); }
  .diag-intro { font-size: .84rem; }
  .flow-scroll { min-height: 16rem; }
}
@media (max-width: 1023px) {
  .diag { height: auto; min-height: 0; padding-bottom: 2rem; }
  .diag-inner { min-height: 0; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .diag { padding-left: 5vw; padding-right: 5vw; }
  .diag-title { font-size: 2.2rem; }
  .field-grid { grid-template-columns: 1fr; }
  .flow-scroll { min-height: 17rem; }
  .composer-hint { display: none; }
  .result-actions > * { width: 100%; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .badge::before, .ai-toggle.attn, .send-status.busy, .flow-stage .t-dor .shape, .diag-stage.analyzing .flow-stage .node .shape { animation: none !important; }
}


/* ---------- SEO: FAQ visível (mesmo conteúdo do FAQPage em JSON-LD) e rodapé ---------- */
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 10000; background: var(--amber); color: var(--black); padding: .7rem 1rem; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; transition: top .2s; }
.skip-link:focus { top: 1rem; }
.faq { position: relative; z-index: 9; background: var(--black); padding: clamp(3rem, 9vh, 5.5rem) 5vw; border-top: 1px solid var(--graphite); }
.faq-inner { max-width: 880px; margin: 0 auto; }
.faq-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 2.6vw, 2.3rem); line-height: 1.1; letter-spacing: -.03em; color: var(--white); margin: .5rem 0 1.6rem; }
.faq-item { border-bottom: 1px solid var(--graphite); }
.faq-item summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.05rem 0; font-weight: 500; font-size: 1rem; line-height: 1.4; color: var(--white); transition: color .2s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; flex: none; font-family: var(--font-mono); font-size: 1.2rem; color: var(--amber); transition: transform .25s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { color: var(--amber); }
.faq-item summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.faq-item p { padding: 0 2rem 1.2rem 0; font-size: .94rem; line-height: 1.65; color: var(--body-text); }
.site-footer { flex-wrap: wrap; }
.site-footer a { color: var(--silver); text-decoration: none; transition: color .2s; }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--amber); }
.footer-sep { opacity: .4; }
