/* Table Intelligence · aplicação
   Monocromático com um único acento (caramelo, herdado da Table). */

/* Tokens em /intelligence/assets/tokens.css (compartilhados com o site). */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
::selection { background: var(--accent); color: #25190f; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* Grade sutil de fundo: sensação de sistema, sem virar enfeite. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(242,235,228,.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(242,235,228,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
}

.shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Topo ─────────────────────────────────────────────────────────────── */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
  flex: none;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 500; font-size: 14px; letter-spacing: -.01em; }
.brand-mark { width: 18px; height: 18px; fill: none; stroke: var(--text); stroke-width: 1.2; }
.brand-mark circle { fill: var(--bg); }
.brand-mark circle:last-of-type { fill: var(--accent); stroke: var(--accent); }

.progress { display: flex; align-items: center; gap: 12px; opacity: 0; transition: opacity .4s var(--ease); }
.progress.on { opacity: 1; }
.progress-label { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .04em; white-space: nowrap; }
.progress-track { width: 96px; height: 2px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width .6s var(--ease); }

/* ── Palco ────────────────────────────────────────────────────────────── */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 0 32px;
  outline: none;
}
.screen { width: 100%; max-width: 620px; margin: 0 auto; }
.screen.enter { animation: enter .55s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(14px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
.screen.leave { animation: leave .22s ease-in both; }
@keyframes leave { to { opacity: 0; transform: translateY(-8px); } }

.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px; display: flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.context { color: var(--accent); font-size: 14px; margin: 0 0 14px; max-width: 520px; }

.q {
  font-size: clamp(26px, 5.4vw, 38px);
  line-height: 1.12;
  letter-spacing: -.035em;
  font-weight: 500;
  margin: 0;
  text-wrap: balance;
}
.q em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; color: var(--accent); }
.helper { color: var(--muted); margin: 14px 0 0; font-size: 15px; max-width: 520px; }
.body { margin-top: 32px; }

/* ── Abertura ─────────────────────────────────────────────────────────── */
.intro { max-width: 1080px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.intro h1 {
  font-size: clamp(38px, 6.4vw, 68px);
  line-height: 1.02;
  letter-spacing: -.045em;
  font-weight: 500;
  margin: 0;
  text-wrap: balance;
}
.intro h1 em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.02em; color: var(--accent); }
.intro .sub { font-size: clamp(17px, 2.2vw, 20px); color: var(--soft); margin: 22px 0 0; max-width: 560px; letter-spacing: -.01em; }
.intro .text { color: var(--muted); margin: 18px 0 0; max-width: 520px; font-size: 15px; }
.intro .cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 36px; }
.intro .micro { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.intro .micro svg { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 1.5; }
.resume { margin-top: 16px; font-size: 13px; color: var(--muted); }
.resume button { background: none; border: 0; padding: 0; color: var(--soft); text-decoration: underline; text-underline-offset: 3px; }

.author { display: flex; align-items: center; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); max-width: 520px; }
.author img { width: 40px; height: 40px; border-radius: 50%; filter: grayscale(1) contrast(1.05); border: 1px solid var(--line-2); }
.author b { display: block; font-weight: 500; font-size: 14px; }
.author span { color: var(--muted); font-size: 13px; }

.visual { position: relative; aspect-ratio: 1; width: 100%; max-width: 440px; justify-self: end; }
.graph { width: 100%; height: 100%; overflow: visible; }
.graph .edge { stroke: var(--line-2); stroke-width: 1; fill: none; }
.graph .flow { stroke: var(--accent); stroke-width: 1.2; fill: none; stroke-dasharray: 4 120; animation: flow 6s linear infinite; opacity: .9; }
.graph .node { fill: var(--bg); stroke: var(--line-2); stroke-width: 1; transition: fill .6s var(--ease), stroke .6s var(--ease); }
.graph .node.lit { fill: var(--accent); stroke: var(--accent); }
.graph .halo { fill: none; stroke: var(--accent); opacity: 0; transform-box: fill-box; transform-origin: center; }
.graph .node.lit + .halo { animation: halo 2.4s var(--ease) 1; }
.graph .core { fill: var(--accent); }
.graph .core-ring { fill: none; stroke: var(--accent); opacity: .35; transform-box: fill-box; transform-origin: center; animation: breathe 4s ease-in-out infinite; }
.graph .tick { fill: none; stroke: #25190f; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 30; stroke-dashoffset: 30; }
.graph.done .tick { animation: draw .6s .5s var(--ease) forwards; }
.graph.done .core { animation: pop .5s var(--ease); }
@keyframes flow { to { stroke-dashoffset: -248; } }
@keyframes halo { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(3); } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .35; } 50% { transform: scale(1.35); opacity: .08; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
.graph .core { transform-box: fill-box; transform-origin: center; }

/* ── Botões ───────────────────────────────────────────────────────────── */
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 22px; border-radius: 999px; font-size: 15px; font-weight: 500;
  letter-spacing: -.01em; transition: background .2s, color .2s, border-color .2s, transform .15s var(--ease), opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--text); color: #25190f; border: 0; }
.btn-primary:hover { background: #fffaf5; }
.btn-primary:active { transform: scale(.98); }
.btn-primary[disabled] { opacity: .45; cursor: default; }
.btn-primary svg, .btn-ghost svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--ease); }
.btn-primary:hover svg { transform: translateX(2px); }
.btn-primary.big { height: 54px; padding: 0 28px; font-size: 16px; }
.btn-ghost { background: transparent; color: var(--soft); border: 1px solid var(--line-2); }
.btn-ghost:hover { color: var(--text); border-color: var(--dim); }
.btn-primary.small, .btn-ghost.small { height: 36px; padding: 0 16px; font-size: 13px; }
.btn-primary.loading span { opacity: .6; }
.btn-primary.loading svg { display: none; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,.25); border-top-color: #25190f; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Navegação inferior ───────────────────────────────────────────────── */
.nav {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0 calc(16px + env(safe-area-inset-bottom));
  max-width: 620px; width: 100%; margin: 0 auto;
  background: linear-gradient(to top, var(--bg) 70%, rgba(37,25,15,0));
}
.nav[hidden] { display: none; }
.nav-right { display: flex; align-items: center; gap: 16px; }
.kbd-hint { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.kbd-hint kbd { font-family: inherit; border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; margin: 0 2px; color: var(--muted); }

/* ── Campos ───────────────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 22px; }
.field-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.field-label .opt { color: var(--dim); }
.input, .textarea {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line-2);
  padding: 10px 0 12px; font-size: clamp(20px, 4vw, 24px); letter-spacing: -.02em; border-radius: 0;
  transition: border-color .25s;
}
.input::placeholder, .textarea::placeholder { color: var(--dim); }
.input:focus, .textarea:focus { outline: none; border-bottom-color: var(--accent); }
.textarea {
  font-size: 17px; line-height: 1.6; letter-spacing: -.005em; resize: none; min-height: 150px;
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 16px 18px; background: var(--surface);
}
.textarea:focus { border-color: var(--accent); }
.counter { font-family: var(--mono); font-size: 11px; color: var(--dim); text-align: right; margin-top: 8px; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 0; }
.error:empty { display: none; }
.field.invalid .input { border-bottom-color: var(--danger); }
.field.invalid .textarea { border-color: var(--danger); }

/* Escolha única / múltipla em lista */
.options { display: grid; gap: 10px; }
.opt-btn {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 15px 16px; font-size: 16px; letter-spacing: -.01em; color: var(--soft);
  transition: border-color .2s, background .2s, color .2s, transform .15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.opt-btn:focus-visible, .card-btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--soft); outline-offset: 2px; border-radius: 12px; }
.opt-btn:hover { border-color: var(--line-2); color: var(--text); background: var(--surface-2); }
.opt-btn:active { transform: scale(.995); }
.opt-btn[aria-checked="true"] { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.opt-key {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px;
  border: 1px solid var(--line-2); font-family: var(--mono); font-size: 11px; color: var(--muted);
  transition: all .2s;
}
.opt-btn[aria-checked="true"] .opt-key { background: var(--accent); border-color: var(--accent); color: #25190f; }
.opt-btn .opt-check { margin-left: auto; width: 16px; height: 16px; stroke: var(--accent); fill: none; stroke-width: 2; opacity: 0; transform: scale(.6); transition: all .25s var(--ease); }
.opt-btn[aria-checked="true"] .opt-check { opacity: 1; transform: none; }
.other-wrap { margin-top: 14px; display: none; }
.other-wrap.on { display: block; animation: enter .35s var(--ease) both; }

/* Cards com ícone (áreas) */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  color: var(--soft); transition: border-color .2s, background .2s, color .2s, transform .15s var(--ease);
  -webkit-tap-highlight-color: transparent; position: relative;
}
.card-btn:hover { border-color: var(--line-2); background: var(--surface-2); color: var(--text); }
.card-btn[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.card-btn .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.card-btn[aria-checked="true"] .ico { stroke: var(--accent); }
.card-btn b { font-weight: 500; font-size: 14.5px; line-height: 1.3; letter-spacing: -.01em; }
.card-btn small { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.card-btn .opt-check { position: absolute; top: 14px; right: 14px; width: 14px; height: 14px; stroke: var(--accent); fill: none; stroke-width: 2.2; opacity: 0; transform: scale(.6); transition: all .25s var(--ease); }
.card-btn[aria-checked="true"] .opt-check { opacity: 1; transform: none; }
.card-btn.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; }
.card-btn.wide small { margin-left: 4px; }

/* Chips (ferramentas) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--soft); font-size: 14px;
  transition: all .2s;
}
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip[aria-checked="true"] { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }

.note {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; padding: 14px 16px;
  border: 1px dashed var(--line-2); border-radius: 12px; color: var(--muted); font-size: 13.5px;
}
.note svg { flex: none; width: 16px; height: 16px; margin-top: 2px; fill: none; stroke: var(--accent); stroke-width: 1.5; }

.check-row { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: var(--muted); cursor: pointer; margin-top: 6px; }
.check-row input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
  flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px; border: 1px solid var(--line-2);
  display: grid; place-items: center; transition: all .2s; background: var(--surface);
}
.check-box svg { width: 12px; height: 12px; stroke: #25190f; fill: none; stroke-width: 2.6; opacity: 0; }
.check-row input:checked + .check-box { background: var(--accent); border-color: var(--accent); }
.check-row input:checked + .check-box svg { opacity: 1; }
.check-row input:focus-visible + .check-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-row a { color: var(--soft); text-underline-offset: 3px; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Alerta de envio */
.alert {
  margin-top: 20px; padding: 14px 16px; border-radius: 12px; font-size: 14px;
  background: rgba(240,144,122,.08); border: 1px solid rgba(240,144,122,.35); color: #f6c1b4;
}
.alert[hidden] { display: none; }

/* ── Conclusão ────────────────────────────────────────────────────────── */
.done { text-align: center; max-width: 560px; }
.done .visual { margin: 0 auto 28px; width: 180px; max-width: 180px; justify-self: center; }
.done h1 { font-size: clamp(30px, 5.6vw, 46px); line-height: 1.08; letter-spacing: -.04em; font-weight: 500; margin: 0; text-wrap: balance; }
.done h1 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--accent); }
.done p { color: var(--soft); margin: 18px auto 0; max-width: 500px; }
.done p.muted { color: var(--muted); }
.done .sign { margin-top: 28px; font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--text); }

/* ── Consentimento ────────────────────────────────────────────────────── */
.consent {
  position: fixed; z-index: 20; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 14px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
  display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; color: var(--soft);
  animation: enter .5s var(--ease) both;
}
.consent[hidden] { display: none; }
.consent p { margin: 0; }
.consent-actions { display: flex; justify-content: flex-end; gap: 8px; }

.foot-links { font-size: 12px; color: var(--dim); display: flex; gap: 16px; padding: 0 0 20px; }
.foot-links a { color: var(--dim); text-decoration: none; }
.foot-links a:hover { color: var(--muted); }

.noscript { padding: 40px 20px; text-align: center; color: var(--soft); }

/* ── Responsivo ───────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; gap: 0; }
  .intro .visual { position: absolute; top: -6px; right: -60px; width: 260px; opacity: .55; z-index: -1; pointer-events: none; }
  .intro .copy { padding-top: 120px; }
}
@media (max-width: 560px) {
  .shell { padding: 0 18px; }
  .top { height: 60px; }
  .progress-track { width: 56px; }
  .stage { justify-content: flex-start; padding-top: 28px; }
  .cards { grid-template-columns: 1fr; }
  .card-btn { flex-direction: row; align-items: center; padding: 14px 16px; }
  .card-btn small { display: none; }
  .card-btn .opt-check { position: static; margin-left: auto; }
  .intro .cta-row .btn-primary { width: 100%; }
  .kbd-hint { display: none; }
  .nav .btn-primary { flex: 1; }
  .nav-right { flex: 1; justify-content: flex-end; }
  .author { margin-top: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .graph .flow { display: none; }
}
