/* Seção 04 — Contato (index.html + js/home/briefing-studio.js). Nome interno: Briefing Studio.
   O diagrama é o formulário: uma carta em paisagem no centro e cinco pequenos
   painéis (01–02 acima, 03–05 abaixo) ligados a ela por curvas em SVG. Os campos
   só aparecem na janela do painel; ao concluir, a janela fecha, um sinal corre
   pela conexão e o trecho entra na carta.

   Sem moldura: a cena fica direto sobre o fundo da home (marfim + grade fina de
   style.css, body.page-home). Os painéis são superfícies em azul noturno, como
   ferramentas flutuando sobre a página; a carta é o papel claro no centro.

   Arranjos (o script lê --bs-layout na área de trabalho):
   - cena (≥ 1180px): carta de margem a margem, painéis acima e abaixo,
     janelas abrindo do próprio painel, por cima da cena;
   - tablet (720–1179px): carta em cima, os cinco painéis numa fileira;
   - celular (< 720px): a cena numa coluna (01–02, carta, 03–05) com um
     barramento ligando as linhas à carta.
   Fora da cena, a janela vira um painel que sobe da base da tela.
   Media queries (não container queries): um contêiner viraria o bloco de
   referência do position: fixed e o painel do celular grudaria na seção. */

.bstudio {
  --bs-ink: #10233f;
  --bs-ink-2: #142b4c;
  --bs-ink-deep: #0b192e;
  --bs-wine: #a32d32;
  /* vinho clareado: foco e estados sobre o azul (4,8:1) */
  --bs-wine-light: #e0676c;
  --bs-paper: #f0ece5;
  /* papel da carta: o marfim um pouco mais claro, para se destacar do fundo marfim */
  --bs-sheet: #faf8f3;
  --bs-slate: #6f8198;
  --bs-sand: #c7b49a;
  /* texto secundário sobre o azul noturno (7,5:1) */
  --bs-soft: #a9b5c4;
  --bs-line: rgba(240, 236, 229, 0.12);
  /* = --home-gutter (style.css): 5,25 módulos da grade de 47 dentro do quadro de 1440px */
  --bs-gutter: calc((100cqw - min(100cqw, 1440px)) / 2 + min(11.170212766cqw, 160.851064px));
  --bs-ease: cubic-bezier(0.2, 0.75, 0.2, 1);
  position: relative;
  color: var(--bs-ink);
}

.bstudio [hidden] { display: none !important; }
.bstudio button,
.bstudio a,
.bstudio label { -webkit-tap-highlight-color: transparent; }

.bstudio__inner { padding: 120px var(--bs-gutter) 128px; }

/* Só para leitores de tela (pergunta e estado de cada painel, avisos) */
.bstudio-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------
   Abertura editorial
   --------------------------------------------- */
.bstudio-intro .section-label { margin-bottom: 26px; }

.bstudio-intro h2 {
  margin: 0;
  color: var(--bs-ink);
  font-size: clamp(36px, 2.9cqw + 22px, 64px);
  font-weight: 350;
  line-height: 1.06;
  letter-spacing: -0.018em;
  text-wrap: balance;
}
.bstudio-intro h2 em { color: var(--bs-wine); font-style: italic; }
/* a parte em itálico começa a 2ª linha do título (telas médias e grandes) */
@media (min-width: 720px) { .bstudio-intro h2 em { display: block; } }

.bstudio-intro__copy { max-width: 620px; margin: 32px 0 0 56px; }
.bstudio-intro__copy p {
  margin: 0;
  color: var(--bs-ink);
  font-size: clamp(17px, 0.3cqw + 15px, 19px);
  line-height: 1.5;
  text-wrap: pretty;
}

/* ---------------------------------------------
   Área de trabalho: sem moldura, só a cena
   --------------------------------------------- */
.bstudio-ws {
  /* lido pelo script: "compact" ou "stage" */
  --bs-layout: compact;
  position: relative;
  margin-top: 48px;
}

/* Base (compacto): carta em cima, painéis em grade embaixo */
.bstudio-stage {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 10px;
}
.bstudio-stage__col { display: contents; }

/* ---------------------------------------------
   Painel (módulo): botão (posição) › flutuação › painel
   --------------------------------------------- */
.bmod {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  color: var(--bs-paper);
  font-family: var(--ff-ui);
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

.bmod__float { display: block; height: 100%; }

.bmod__card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bs-ink-2), var(--bs-ink) 46%);
  border: 1px solid rgba(16, 35, 63, 0.9);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(240, 236, 229, 0.08),
    0 14px 28px -18px rgba(16, 35, 63, 0.55),
    0 2px 6px -2px rgba(16, 35, 63, 0.3);
  transition: transform 0.35s var(--bs-ease), box-shadow 0.35s var(--bs-ease), border-color 0.25s ease;
}

/* Barra de título do painel: número, nome e o LED de estado */
.bmod__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 9px 12px 8px;
  border-bottom: 1px solid var(--bs-line);
}

.bmod__num {
  flex: none;
  padding: 2px 5px 1px;
  color: var(--bs-sand);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.08em;
  border: 1px solid rgba(199, 180, 154, 0.45);
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.bmod__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--bs-paper);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  /* no compacto, em caixa baixa e sem espaçamento (cabe no painel estreito);
     na cena volta ao rótulo em versalete */
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* LED: apagado (pendente), meio (em andamento), aceso pulsando (aberto), vinho com ✓ (concluído) */
.bmod__led {
  position: relative;
  flex: none;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(169, 181, 196, 0.6);
  border-radius: 50%;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s var(--bs-ease);
}

.bmod__body {
  display: block;
  padding: 10px 12px 4px;
}

.bmod__summary {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(169, 181, 196, 0.85);
  font-family: var(--ff-heading);
  font-size: 14px;
  font-style: italic;
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  transition: color 0.3s ease;
}

.bmod__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 6px 12px 10px;
}

/* Medidor: um segmento por campo do painel (acende quando preenchido) */
.bmod__meter { display: flex; gap: 3px; }
.bmod__meter i {
  width: 14px;
  height: 3px;
  background: rgba(240, 236, 229, 0.14);
  border-radius: 2px;
  transition: background-color 0.35s ease, transform 0.35s var(--bs-ease);
}
.bmod__meter i.is-on { background: var(--bs-wine-light); }

.bmod__icon { margin-left: auto; color: rgba(169, 181, 196, 0.55); font-size: 14px; line-height: 1; transition: color 0.25s ease, opacity 0.25s ease; }

/* Seta "abrir/editar": aparece no hover, no lugar do ícone */
.bmod__go {
  position: absolute;
  right: 10px;
  bottom: 7px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--bs-paper);
  font-size: 13px;
  background: var(--bs-wine);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.6) rotate(-45deg);
  transition: opacity 0.25s ease, transform 0.35s var(--bs-ease);
}

/* Estados — só visuais; o texto do estado existe apenas para leitores de tela */
.bmod.is-partial .bmod__led { background: linear-gradient(90deg, var(--bs-soft) 50%, transparent 50%); border-color: var(--bs-soft); }

.bmod.is-done .bmod__summary { color: var(--bs-paper); font-style: normal; font-family: var(--ff-ui); font-size: 13px; }
.bmod.is-done .bmod__num { color: var(--bs-ink); background: var(--bs-sand); border-color: var(--bs-sand); }
.bmod.is-done .bmod__led { width: 13px; height: 13px; background: var(--bs-wine); border-color: var(--bs-wine); }
.bmod.is-done .bmod__led::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1.6px;
  width: 3px;
  height: 6px;
  border: solid var(--bs-paper);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.bmod.is-done .bmod__card { border-color: rgba(163, 45, 50, 0.55); }

.bmod.is-active .bmod__card,
.bmod.is-demo .bmod__card {
  border-color: var(--bs-wine-light);
  box-shadow:
    inset 0 1px 0 rgba(240, 236, 229, 0.08),
    0 0 0 3px rgba(224, 103, 108, 0.22),
    0 22px 40px -20px rgba(16, 35, 63, 0.7);
}
.bmod.is-active .bmod__card::before,
.bmod.is-demo .bmod__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--bs-wine-light), var(--bs-wine));
}
.bmod.is-active:not(.is-done) .bmod__led,
.bmod.is-demo:not(.is-done) .bmod__led { background: var(--bs-wine-light); border-color: var(--bs-wine-light); animation: bs-led 1.4s ease-in-out infinite; }

@keyframes bs-led {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 103, 108, 0.55); }
  50% { box-shadow: 0 0 0 5px rgba(224, 103, 108, 0); }
}

/* Falta para enviar: tracejado e LED piscando */
.bmod.is-missing .bmod__card { border: 1px dashed var(--bs-wine-light); }
.bmod.is-missing:not(.is-active) .bmod__led { background: var(--bs-wine-light); border-color: var(--bs-wine-light); animation: bs-led 1s ease-in-out infinite; }
.bmod__card.is-nudge { animation: bs-nudge 0.5s ease; }

/* Clique: pequena antecipação antes da janela abrir */
.bmod.is-press .bmod__card { transform: scale(0.965) !important; transition-duration: 0.12s; }

.bmod:focus-visible { outline: none; }
.bmod:focus-visible .bmod__card { outline: 2px solid var(--bs-wine); outline-offset: 3px; }
.bmod:focus-visible .bmod__go { opacity: 1; transform: none; }

.bmod.is-pulse .bmod__card { animation: bs-pulse 0.85s ease-out; }
.bmod.is-pulse .bmod__led { transform: scale(1.35); }

@keyframes bs-pulse {
  0% { box-shadow: 0 0 0 0 rgba(224, 103, 108, 0.6), 0 14px 28px -18px rgba(16, 35, 63, 0.55); }
  100% { box-shadow: 0 0 0 14px rgba(224, 103, 108, 0), 0 14px 28px -18px rgba(16, 35, 63, 0.55); }
}
@keyframes bs-nudge {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* Ponto de ligação no arranjo compacto (topo do painel, voltado para a carta) */
.bmod::before {
  content: '';
  position: absolute;
  z-index: 2;
  top: -4px;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  background: var(--bs-sheet);
  border: 1px solid var(--bs-slate);
  border-radius: 50%;
}
.bmod.is-done::before { background: var(--bs-wine); border-color: var(--bs-wine); }
.bmod.is-active::before { background: var(--bs-wine-light); border-color: var(--bs-wine-light); }
.bmod.is-sending::before { animation: bs-port 0.7s ease-out; }

@keyframes bs-port {
  0% { box-shadow: 0 0 0 0 rgba(163, 45, 50, 0.6); }
  100% { box-shadow: 0 0 0 10px rgba(163, 45, 50, 0); }
}

/* ---------------------------------------------
   Conexões (só na cena), desenhadas sobre o marfim
   --------------------------------------------- */
.bstudio-ws__wires {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: none;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.bwire__path {
  fill: none;
  stroke: rgba(111, 129, 152, 0.8);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-dasharray: 0.1 6;
  transition: stroke 0.35s ease, stroke-width 0.35s ease;
}
.bwire__glow {
  fill: none;
  stroke: var(--bs-wine-light);
  stroke-width: 8;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.bwire__start,
.bwire__end {
  fill: var(--bs-sheet);
  stroke: var(--bs-slate);
  stroke-width: 1.3;
  transform-box: fill-box;
  transform-origin: center;
  transition: fill 0.35s ease, stroke 0.35s ease, transform 0.35s var(--bs-ease);
}
.bwire__ring {
  fill: none;
  stroke: var(--bs-wine);
  stroke-width: 1.4;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
.bwire__signal,
.bwire__spark {
  fill: none;
  stroke: var(--bs-wine);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0;
}
.bwire__spark { stroke: rgba(163, 45, 50, 0.55); stroke-width: 2.2; }

.bwire.is-hover .bwire__path { stroke: var(--bs-wine-light); stroke-dasharray: 3 5; }
.bwire.is-hover .bwire__start { fill: var(--bs-wine-light); stroke: var(--bs-wine-light); transform: scale(1.5); }

.bwire.is-partial .bwire__path { stroke: rgba(111, 129, 152, 0.95); }

.bwire.is-done .bwire__path { stroke: var(--bs-wine); stroke-dasharray: none; stroke-width: 1.6; }
.bwire.is-done .bwire__start,
.bwire.is-done .bwire__end { fill: var(--bs-wine); stroke: var(--bs-wine); }

.bwire.is-active .bwire__path { stroke: var(--bs-wine-light); stroke-dasharray: none; stroke-width: 1.9; }
.bwire.is-active .bwire__glow { opacity: 0.22; }
.bwire.is-active .bwire__start,
.bwire.is-active .bwire__end { fill: var(--bs-wine-light); stroke: var(--bs-wine-light); }
.bwire.is-active .bwire__start { animation: bs-origin 1.6s ease-in-out infinite; }

@keyframes bs-origin { 50% { transform: scale(1.5); } }

.bstudio-ws.is-sent .bwire .bwire__path { stroke: var(--bs-wine); stroke-dasharray: none; stroke-width: 1.8; }
.bstudio-ws.is-sent .bwire .bwire__start,
.bstudio-ws.is-sent .bwire .bwire__end { fill: var(--bs-wine); stroke: var(--bs-wine); }

/* ---------------------------------------------
   Carta: documento em paisagem
   --------------------------------------------- */
.bletter {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  color: var(--bs-ink);
  background: var(--bs-sheet);
  border: 1px solid rgba(16, 35, 63, 0.12);
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 40px 70px -46px rgba(16, 35, 63, 0.55), 0 6px 18px -10px rgba(16, 35, 63, 0.18);
}

/* Filete vinho na margem: detalhe de papel de carta */
.bletter::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 16px;
  width: 1px;
  background: rgba(163, 45, 50, 0.22);
  pointer-events: none;
}

.bletter__draft {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-height: 0;
  padding: 18px 20px 16px 32px;
}

.bletter__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(16, 35, 63, 0.12);
}

.bletter__eyebrow,
.bletter__tag {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-family: var(--ff-ui);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.bletter__eyebrow { color: var(--bs-wine); }
.bletter__eyebrow [data-bs-phase] { white-space: nowrap; }
.bletter__tag { color: rgba(16, 35, 63, 0.6); font-weight: 500; }

.bletter__pulse {
  width: 6px;
  height: 6px;
  margin-left: 4px;
  background: var(--bs-wine);
  border-radius: 50%;
  opacity: 0.3;
  transition: opacity 0.3s ease;
}
.bletter.is-typing .bletter__pulse { opacity: 1; animation: bs-blink 0.9s ease-in-out infinite; }
@keyframes bs-blink { 50% { opacity: 0.25; } }

.bletter__main { display: flex; flex-direction: column; min-height: 0; }

.bletter__title {
  margin: 14px 0 0;
  color: var(--bs-ink);
  font-family: var(--ff-heading);
  font-size: clamp(26px, 1.2vw + 14px, 34px);
  font-weight: 350;
  line-height: 1.08;
}

/* Corpo: a carta mantém o tamanho; o texto rola por dentro */
.bletter__body {
  position: relative;
  flex: 1;
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 0;
  max-height: 280px;
  margin-top: 12px;
  padding: 2px 12px 8px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 35, 63, 0.28) transparent;
  -webkit-mask-image: linear-gradient(transparent, #000 10px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(transparent, #000 10px, #000 calc(100% - 14px), transparent);
}
.bletter__body:focus-visible { outline: 2px solid rgba(16, 35, 63, 0.5); outline-offset: 2px; border-radius: 2px; }

.bletter__part {
  position: relative;
  margin: 0 -6px;
  padding: 0 6px;
  color: var(--bs-ink);
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  border-radius: 3px;
}
.bletter__part--idea {
  margin-left: 0;
  padding-left: 12px;
  white-space: pre-line;
  border-left: 2px solid rgba(163, 45, 50, 0.4);
  border-radius: 0 3px 3px 0;
}
.bletter__part.is-demo { color: rgba(16, 35, 63, 0.9); }

.bmsg__val {
  color: var(--bs-ink);
  font-weight: 500;
  background: linear-gradient(transparent 64%, rgba(199, 180, 154, 0.55) 64%);
}
.bmsg__nb { white-space: nowrap; }
.bmsg__pending {
  display: inline-block;
  min-width: 5.5em;
  padding: 0 0.3em;
  color: rgba(16, 35, 63, 0.62);
  font-family: var(--ff-ui);
  font-size: 0.82em;
  letter-spacing: 0.02em;
  line-height: 1.3;
  border-bottom: 1.5px dashed rgba(111, 129, 152, 0.9);
}

/* Entrada de trecho: revela e assenta; ao chegar o sinal, uma "tinta" passa sobre ele */
.bletter__part.is-new { animation: bs-reveal 0.55s var(--bs-ease) both; }
.bletter__part.is-fresh {
  background-image: linear-gradient(90deg, rgba(163, 45, 50, 0.16), rgba(163, 45, 50, 0.07));
  background-repeat: no-repeat;
  animation: bs-ink 1.7s var(--bs-ease) both, bs-settle 0.6s var(--bs-ease) both;
}

@keyframes bs-reveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes bs-ink {
  0% { background-size: 0% 100%; }
  35% { background-size: 100% 100%; }
  75% { background-size: 100% 100%; background-position: 0 0; }
  100% { background-size: 100% 100%; background-position: 0 3em; }
}
@keyframes bs-settle {
  from { letter-spacing: 0.02em; opacity: 0.55; filter: blur(1.5px); }
  to { letter-spacing: normal; opacity: 1; filter: none; }
}

.bletter__hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  color: rgba(16, 35, 63, 0.62);
  font-family: var(--ff-ui);
  font-size: 13px;
  line-height: 1.45;
}
.bletter__hint::before { content: '↓'; color: var(--bs-wine); }
.bstudio-ws.is-demo .bletter__hint { visibility: hidden; }

/* Fólio: o progresso como numeração editorial */
.bletter__folio {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-top: 12px;
}
.bletter__count {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 0;
  color: var(--bs-ink);
  font-family: var(--ff-heading);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.bletter__count small { color: rgba(16, 35, 63, 0.5); font-family: var(--ff-ui); font-size: 11px; letter-spacing: 0.08em; }
.bletter__count-label {
  margin: 0;
  color: rgba(16, 35, 63, 0.62);
  font-family: var(--ff-ui);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.bletter__ticks { display: flex; gap: 3px; align-self: center; }
.bletter__ticks i { width: 14px; height: 3px; background: rgba(16, 35, 63, 0.14); border-radius: 2px; transition: background-color 0.4s ease; }
.bletter__ticks i.is-on { background: var(--bs-wine); }

.bletter__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(16, 35, 63, 0.12);
}

.bletter__status {
  flex: 1 1 220px;
  min-width: 0;
  color: rgba(16, 35, 63, 0.82);
  font-family: var(--ff-ui);
  font-size: 13px;
  line-height: 1.45;
}
.bletter__status p { margin: 0; }
.bletter__status .is-error { color: #8f2328; }
.bletter__fixes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bletter__fix {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 3px 10px 3px 4px;
  color: var(--bs-ink);
  font-family: var(--ff-ui);
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(163, 45, 50, 0.07);
  border: 1px dashed rgba(163, 45, 50, 0.6);
  border-radius: 6px;
  cursor: pointer;
}
.bletter__fix b {
  padding: 2px 5px 1px;
  color: var(--bs-paper);
  font-size: 10px;
  letter-spacing: 0.06em;
  background: var(--bs-wine);
  border-radius: 3px;
}
.bletter__fix:focus-visible { outline: 2px solid var(--bs-ink); outline-offset: 2px; }
.bletter__status .bstudio-btn { margin-top: 8px; }

/* Enviar: a ação final do documento */
.bletter__send {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  margin-left: auto;
  padding: 9px 9px 9px 22px;
  color: #fff;
  font-family: var(--ff-ui);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--bs-wine);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 10px 22px -12px rgba(163, 45, 50, 0.8);
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.3s ease, transform 0.3s var(--bs-ease);
}
.bletter__send i {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  transition: transform 0.35s var(--bs-ease);
}
.bletter__send:focus-visible { outline: 2px solid var(--bs-ink); outline-offset: 3px; }
.bletter__send[disabled] { cursor: progress; opacity: 0.8; }
.bletter__send .is-spin { animation: bs-spin 0.9s linear infinite; }
@keyframes bs-spin { to { transform: rotate(360deg); } }

/* Confirmação dentro da mesma carta */
.bletter__done {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 24px;
  padding: 28px 34px 28px 44px;
}
.bletter__done:focus { outline: none; }
.bletter__done-mark { flex: none; width: 60px; height: 60px; }
.bletter__done-mark circle,
.bletter__done-mark path { fill: none; stroke: var(--bs-wine); stroke-linecap: round; stroke-linejoin: round; }
.bletter__done-mark circle { stroke-width: 2; stroke-dasharray: 183; animation: bs-draw 0.7s ease-out both; }
.bletter__done-mark path { --len: 40; stroke-width: 3; stroke-dasharray: 40; animation: bs-draw 0.45s 0.45s ease-out both; }
@keyframes bs-draw { from { stroke-dashoffset: var(--len, 183); } to { stroke-dashoffset: 0; } }

.bletter__done-copy { display: grid; gap: 12px; justify-items: start; }
.bletter__done h3 {
  margin: 0;
  color: var(--bs-ink);
  font-family: var(--ff-heading);
  font-size: clamp(30px, 1.5vw + 14px, 40px);
  font-weight: 350;
  line-height: 1.08;
}
.bletter__done p { max-width: 44ch; margin: 0 0 4px; color: rgba(16, 35, 63, 0.82); font-size: 16px; line-height: 1.55; }
.bletter__done.is-in .bletter__done-copy > * { animation: bs-reveal 0.6s var(--bs-ease) both; }
.bletter__done.is-in .bletter__done-copy > :nth-child(2) { animation-delay: 0.12s; }
.bletter__done.is-in .bletter__done-copy > :nth-child(3) { animation-delay: 0.22s; }

/* ---------------------------------------------
   Janela de edição — painel de propriedades
   (base = painel que sobe da base da tela)
   --------------------------------------------- */
.bpop {
  position: fixed;
  z-index: 1100;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  max-width: 640px;
  max-height: 88dvh;
  margin-inline: auto;
  color: var(--bs-paper);
  background: var(--bs-ink);
  border: 1px solid rgba(240, 236, 229, 0.16);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -24px 60px -20px rgba(11, 25, 46, 0.6);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.34s var(--bs-ease), visibility 0s linear 0.34s;
}
.bpop.is-open { transform: none; visibility: visible; transition: transform 0.34s var(--bs-ease); }

.bpop__caret { display: none; }

/* Barra de título da janela, como a do painel que a abriu */
.bpop__head {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 20px 16px 12px 18px;
  background: linear-gradient(180deg, var(--bs-ink-2), var(--bs-ink));
  border-bottom: 1px solid var(--bs-line);
}
.bpop__head::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  width: 36px;
  height: 4px;
  margin-left: -18px;
  background: rgba(240, 236, 229, 0.22);
  border-radius: 4px;
}
.bpop__head::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--bs-wine-light), var(--bs-wine));
}

.bpop__num {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--bs-soft);
  font-family: var(--ff-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.bpop__q {
  grid-column: 1;
  margin: 0;
  color: var(--bs-paper);
  font-family: var(--ff-heading);
  font-size: 21px;
  font-weight: 350;
  line-height: 1.2;
}
.bpop__close {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--bs-soft);
  font-size: 17px;
  background: rgba(240, 236, 229, 0.04);
  border: 1px solid var(--bs-line);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.bpop__close:focus-visible { outline: 2px solid var(--bs-paper); outline-offset: 2px; }

.bpop__body {
  display: grid;
  gap: 14px;
  min-height: 0;
  padding: 14px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 236, 229, 0.25) transparent;
}
.bpop.is-open .bpop__body > * { animation: bs-reveal 0.38s var(--bs-ease) both; animation-delay: 0.06s; }
.bpop.is-open .bpop__body > :nth-child(2) { animation-delay: 0.1s; }
.bpop.is-open .bpop__body > :nth-child(3) { animation-delay: 0.14s; }
.bpop.is-open .bpop__body > :nth-child(4) { animation-delay: 0.18s; }

.bpop__lead { margin: 0; color: var(--bs-soft); font-family: var(--ff-ui); font-size: 13px; line-height: 1.45; }
.bpop__groups { display: grid; gap: 12px 18px; }

.bpop__privacy { margin: 0; color: var(--bs-soft); font-family: var(--ff-ui); font-size: 12px; line-height: 1.5; }
.bpop__privacy a { margin-left: 3px; color: var(--bs-paper); text-decoration: underline; text-underline-offset: 3px; }

.bpop__foot {
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px max(16px, env(safe-area-inset-bottom));
  background: rgba(11, 25, 46, 0.45);
  border-top: 1px solid var(--bs-line);
}
.bpop__foot .bstudio-btn { flex: 1 1 auto; }

.bpop.is-shake { animation: bs-nudge 0.4s ease; }

.bsheet-backdrop {
  position: fixed;
  z-index: 1090;
  inset: 0;
  background: rgba(11, 25, 46, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.bsheet-backdrop.is-open { opacity: 1; }

/* ---------------------------------------------
   Campos (como linhas de propriedades)
   --------------------------------------------- */
.bfield { display: grid; gap: 6px; min-width: 0; }
.bfield label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  color: var(--bs-soft);
  font-family: var(--ff-ui);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.bfield__tag { color: rgba(169, 181, 196, 0.7); font-size: 10px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; }
.bfield__tag--req { color: var(--bs-sand); }

.bfield input,
.bfield textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--bs-paper);
  font-family: var(--ff-ui);
  font-size: 16px;
  line-height: 1.4;
  background: var(--bs-ink-deep);
  border: 1px solid rgba(240, 236, 229, 0.16);
  border-radius: 6px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.bfield textarea { min-height: 108px; resize: vertical; }
.bfield input::placeholder,
.bfield textarea::placeholder { color: rgba(240, 236, 229, 0.4); opacity: 1; }
.bfield input:focus,
.bfield textarea:focus {
  outline: none;
  border-color: var(--bs-wine-light);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(224, 103, 108, 0.25);
}
.bfield [aria-invalid='true'] { border-color: #f0898d; }

.bfield__err { margin: 0; color: #f6b0b2; font-family: var(--ff-ui); font-size: 12.5px; line-height: 1.4; }
.bfield__count,
.bfield__hint { margin: 0; color: var(--bs-soft); font-family: var(--ff-ui); font-size: 11.5px; }
.bfield__count { justify-self: end; font-variant-numeric: tabular-nums; }

.bfield__money { position: relative; max-width: 240px; }
.bfield__currency {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--bs-sand);
  font-family: var(--ff-ui);
  font-size: 14px;
  transform: translateY(-50%);
  pointer-events: none;
}
.bfield__money input { padding-left: 48px; font-variant-numeric: tabular-nums; }

/* Opções em chips: o input fica por cima do chip (clicável e com foco), invisível */
.bchips {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.bchips legend {
  float: left;
  width: 100%;
  margin-bottom: 2px;
  padding: 0;
  color: var(--bs-soft);
  font-family: var(--ff-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.bchips legend .bfield__tag { margin-left: 6px; }

.bchip { position: relative; display: inline-flex; transition: transform 0.2s var(--bs-ease); }
.bchip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.bchip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 12px;
  color: rgba(240, 236, 229, 0.88);
  font-family: var(--ff-ui);
  font-size: 13.5px;
  line-height: 1.2;
  background: rgba(240, 236, 229, 0.03);
  border: 1px solid rgba(240, 236, 229, 0.18);
  border-radius: 6px;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.bchip span::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 2px;
  opacity: 0.6;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}
.bchip input[type='radio'] + span::before { border-radius: 50%; }
.bchip input:checked + span { color: #fff; background: var(--bs-wine); border-color: #c4474d; }
.bchip input:checked + span::before { background: currentColor; opacity: 1; box-shadow: inset 0 0 0 2px var(--bs-wine); }
.bchip:active { transform: scale(0.96); }
.bchip input:focus-visible + span { outline: 2px solid var(--bs-paper); outline-offset: 2px; }

/* ---------------------------------------------
   Botões
   --------------------------------------------- */
.bstudio-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 18px;
  font-family: var(--ff-ui);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.bstudio-btn i { font-size: 1.1em; line-height: 1; transition: transform 0.3s var(--bs-ease); }
.bstudio-btn--accent { color: #fff; background: var(--bs-wine); border-color: var(--bs-wine); }
.bstudio-btn--ink { color: var(--bs-paper); background: var(--bs-ink); border-color: var(--bs-ink); }
.bstudio-btn--quiet { color: var(--bs-ink); background: transparent; border-color: rgba(16, 35, 63, 0.35); }
.bstudio-btn:focus-visible { outline: 2px solid var(--bs-paper); outline-offset: 3px; }
.bletter .bstudio-btn:focus-visible { outline-color: var(--bs-ink); }

@media (hover: hover) and (pointer: fine) {
  .bstudio-btn--accent:hover { background: #b8353a; border-color: #b8353a; }
  .bstudio-btn--accent:hover i { transform: translateX(3px); }
  .bstudio-btn--ink:hover { background: #1b3760; border-color: #1b3760; }
  .bstudio-btn--quiet:hover { border-color: var(--bs-ink); }
  .bpop__close:hover { color: var(--bs-paper); border-color: rgba(240, 236, 229, 0.35); background: rgba(240, 236, 229, 0.08); }
  .bchip:hover input:not(:checked) + span { background: rgba(240, 236, 229, 0.08); border-color: rgba(240, 236, 229, 0.42); }
  .bletter__fix:hover { background: rgba(163, 45, 50, 0.14); }
  .bletter__send:not([disabled]):hover { background: #b8353a; box-shadow: 0 14px 26px -12px rgba(163, 45, 50, 0.85); }
  .bletter__send:not([disabled]):hover i { transform: translateX(2px) rotate(-12deg); }
}

/* Robôs preenchem; pessoas não veem */
.bstudio-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Cursor da demonstração (o cursor real continua normal) = Cursor do Design
   System. Sobre o azul-noturno dos painéis, o padrão do DS para esse fundo:
   marfim com contorno azul-noturno (7% do tamanho, mínimo 2px, por baixo do
   preenchimento). O ponto (0,0) do elemento é a ponta da seta / do dedo. */
.bstudio-cursor {
  --cursor: 30px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 25;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.bstudio-cursor__icon {
  position: absolute;
  width: var(--cursor);
  height: var(--cursor);
  overflow: visible;
  fill: var(--bs-paper);
  stroke: var(--bs-ink);
  stroke-width: 17;
  stroke-linejoin: round;
  paint-order: stroke fill;
  transition: opacity 0.16s ease;
}
.bstudio-cursor__icon--seta { left: calc(var(--cursor) * -0.125); top: calc(var(--cursor) * -0.125); }
.bstudio-cursor__icon--mao { left: calc(var(--cursor) * -0.4375); top: calc(var(--cursor) * -0.07); opacity: 0; }
.bstudio-cursor.is-hand .bstudio-cursor__icon--seta { opacity: 0; }
.bstudio-cursor.is-hand .bstudio-cursor__icon--mao { opacity: 1; }
/* O clique: um anel vinho sai da ponta */
.bstudio-cursor::after {
  content: '';
  position: absolute;
  top: -11px;
  left: -11px;
  width: 22px;
  height: 22px;
  box-sizing: border-box;
  border: 1.5px solid var(--bs-wine);
  border-radius: 50%;
  opacity: 0;
}
.bstudio-cursor.is-click::after { animation: bs-click 0.55s ease-out; }
@keyframes bs-click {
  from { opacity: 1; transform: scale(0.3); }
  to { opacity: 0; transform: scale(1.4); }
}

/* ---------------------------------------------
   Sem JavaScript: as janelas ficam visíveis, empilhadas, e o envio é direto
   --------------------------------------------- */
.bstudio-ws:not(.is-ready) .bpop {
  position: static;
  max-width: none;
  max-height: none;
  margin-top: 16px;
  border-bottom: 1px solid rgba(240, 236, 229, 0.16);
  border-radius: 10px;
  opacity: 1;
  transform: none;
  visibility: visible;
}
.bstudio-ws:not(.is-ready) .bpop__close,
.bstudio-ws:not(.is-ready) .bpop__foot,
.bstudio-ws:not(.is-ready) .bletter__hint,
.bstudio-ws:not(.is-ready) .bstudio-cursor,
.bstudio-ws:not(.is-ready) .bpop__head::before { display: none; }

/* Envio: tudo travado até a resposta do servidor */
.bstudio-ws[data-view='sending'] .bmod,
.bstudio-ws[data-view='done'] .bmod { pointer-events: none; }

/* Entrada (uma vez, quando a cena aparece) */
.bstudio-ws.is-pre .bmod,
.bstudio-ws.is-pre .bletter,
.bstudio-ws.is-pre .bstudio-ws__wires { opacity: 0; }

.bstudio-ws.is-entering .bmod,
.bstudio-ws.is-entering .bletter {
  animation: bs-enter 0.8s var(--bs-ease) both;
  animation-delay: calc(var(--bs-i, 0) * 90ms);
}
@keyframes bs-enter {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------
   Tablet: painéis numa fileira de cinco, ligados à carta por fios curtos
   --------------------------------------------- */
@media (min-width: 720px) {
  .bstudio-stage { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 30px 12px; }
  .bmod::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    height: 26px;
    border-left: 1px dashed rgba(111, 129, 152, 0.85);
  }
  .bmod.is-done::after { border-left: 1px solid var(--bs-wine); }
  .bmod.is-active::after { border-left: 1.5px solid var(--bs-wine-light); }
  .bletter__draft {
    grid-template-columns: minmax(0, 1fr) 150px;
    grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: 28px;
    padding: 22px 26px 18px 40px;
  }
  .bletter::before { left: 20px; }
  .bletter__head,
  .bletter__foot { grid-column: 1 / -1; }
  .bletter__main { grid-column: 1; grid-row: 2; }
  /* Fólio na margem direita, como numeração de página */
  .bletter__folio {
    grid-column: 2;
    grid-row: 2;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 6px;
    margin-top: 16px;
    text-align: right;
  }
  .bletter__count { font-size: 46px; letter-spacing: -0.02em; }
  .bletter__count small { font-size: 12px; }
  .bletter__count-label { max-width: 12ch; line-height: 1.35; }
  .bletter__ticks { align-self: flex-end; margin-top: 6px; }
  .bletter__body { max-height: 240px; }
  .bpop__groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [data-bs-pop='1'] .bpop__body,
  [data-bs-pop='5'] .bpop__body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [data-bs-pop='5'] .bpop__privacy { grid-column: 1 / -1; }
  .bpop__foot .bstudio-btn { flex: 0 0 auto; }
}

/* ---------------------------------------------
   Celular: a mesma cena numa coluna — 01–02 acima da carta, 03–05 abaixo,
   como linhas de um painel de camadas. Um barramento pontilhado, alinhado ao
   filete vinho da margem da carta, liga cada linha à carta; ao concluir, o
   trecho daquela linha fica vinho e um ponto corre até a carta (script).
   A carta tem altura fixa (o texto rola por dentro): a cena cabe numa tela.
   --------------------------------------------- */
@media (max-width: 719.98px) {
  .bstudio__inner { padding: 88px 20px 96px; }
  .bstudio-intro h2 { font-size: 36px; line-height: 1.08; }
  .bstudio-intro__copy { margin: 28px 0 0; }
  .bstudio-intro__copy p { font-size: 17px; }

  .bstudio-ws {
    --bs-row: 58px; /* altura de cada linha */
    --bs-rgap: 8px; /* entre linhas */
    --bs-lgap: 24px; /* entre as linhas e a carta */
    --bs-bus: 16px; /* x do barramento = x do filete da carta */
    --bs-indent: 32px; /* recuo das linhas */
    --bs-stub: 16px; /* ramal (recuo − barramento); o script lê para o ponto que corre */
    margin-top: 36px;
  }

  .bstudio-stage { grid-template-columns: minmax(0, 1fr); gap: var(--bs-lgap); }
  .bstudio-stage__col {
    position: relative;
    display: grid;
    gap: var(--bs-rgap);
    padding-left: var(--bs-indent);
  }
  .bletter { grid-row: auto; }

  /* Barramento: pontilhado, como as conexões da cena */
  .bstudio-stage__col::before {
    content: '';
    position: absolute;
    left: calc(var(--bs-bus) - 1.5px);
    width: 3px;
    background: radial-gradient(circle, rgba(111, 129, 152, 0.85) 0.9px, transparent 1.3px) center top / 3px 6px repeat-y;
  }
  .bstudio-stage__col--top::before { top: calc(var(--bs-row) / 2); bottom: calc(var(--bs-lgap) * -1); }
  .bstudio-stage__col--bottom::before { top: calc(var(--bs-lgap) * -1); bottom: calc(var(--bs-row) / 2); }

  /* Porta na borda da carta (acende quando algo daquele lado já chegou) */
  .bstudio-stage__col::after {
    content: '';
    position: absolute;
    z-index: 2;
    left: calc(var(--bs-bus) - 3.5px);
    width: 7px;
    height: 7px;
    background: var(--bs-sheet);
    border: 1px solid var(--bs-slate);
    border-radius: 1.5px;
    transition: background-color 0.35s ease, border-color 0.35s ease;
  }
  .bstudio-stage__col--top::after { bottom: calc(var(--bs-lgap) * -1 - 3.5px); }
  .bstudio-stage__col--bottom::after { top: calc(var(--bs-lgap) * -1 - 3.5px); }
  .bstudio-stage__col:has(.bmod.is-done)::after { background: var(--bs-wine); border-color: var(--bs-wine); }
  .bstudio-stage__col.is-hit::after { animation: bs-port 0.7s ease-out; }
  .bstudio-ws.is-sent .bstudio-stage__col::before { left: calc(var(--bs-bus) - 0.75px); width: 1.5px; background: var(--bs-wine); }

  /* Linha (painel recolhido): número | nome e resumo | LED e medidor | seta */
  .bmod { height: var(--bs-row); }
  .bmod__card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-rows: 1fr 1fr;
    grid-template-areas: 'num label led go' 'num summary meter go';
    align-items: center;
    gap: 3px 12px;
    padding: 0 10px 0 9px;
    border-radius: 7px;
  }
  .bmod__bar,
  .bmod__body,
  .bmod__foot { display: contents; }
  .bmod__num {
    grid-area: num;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 11px;
    border-radius: 6px;
  }
  .bmod__label { grid-area: label; align-self: end; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; }
  .bmod__summary {
    grid-area: summary;
    align-self: start;
    display: block;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .bmod.is-done .bmod__summary { font-size: 13px; line-height: 1.4; }
  .bmod__led { grid-area: led; justify-self: end; }
  .bmod__meter { grid-area: meter; justify-self: end; align-self: start; margin-top: 6px; }
  .bmod__meter i { width: 9px; }
  .bmod__icon { display: none; }
  .bmod__go {
    grid-area: go;
    position: static;
    width: 30px;
    height: 30px;
    margin-left: 2px;
    color: var(--bs-soft);
    background: transparent;
    border: 1px solid rgba(240, 236, 229, 0.14);
    opacity: 1;
    transform: none;
  }
  .bmod.is-active .bmod__go { color: #fff; background: var(--bs-wine); border-color: var(--bs-wine); }

  /* Porta na borda da linha e ramal até o barramento */
  .bmod::before { top: 50%; left: -4px; margin: -3.5px 0 0; }
  .bmod::after {
    content: '';
    position: absolute;
    top: 50%;
    left: calc(var(--bs-stub) * -1);
    width: calc(var(--bs-stub) - 4px);
    height: 3px;
    margin-top: -1.5px;
    background: radial-gradient(circle, rgba(111, 129, 152, 0.85) 0.9px, transparent 1.3px) left center / 6px 3px repeat-x;
  }
  .bmod.is-done::after,
  .bmod.is-active::after,
  .bmod.is-demo::after { height: 1.5px; margin-top: -0.75px; background: var(--bs-wine); }
  .bmod.is-active::after,
  .bmod.is-demo::after { background: var(--bs-wine-light); }

  /* Concluída: o trecho do barramento até a carta fica vinho (cresce da linha para a carta) */
  .bmod__float { position: relative; }
  .bmod__float::before {
    content: '';
    position: absolute;
    left: calc(var(--bs-stub) * -1 - 0.75px);
    width: 1.5px;
    height: calc(var(--bs-n, 0) * (var(--bs-row) + var(--bs-rgap)) + var(--bs-row) / 2 + var(--bs-lgap));
    background: var(--bs-wine);
    transform: scaleY(0);
    transition: transform 0.6s var(--bs-ease) 0.18s;
  }
  .bstudio-stage__col--top .bmod__float::before { top: 50%; transform-origin: top; }
  .bstudio-stage__col--bottom .bmod__float::before { bottom: 50%; transform-origin: bottom; }
  .bmod.is-done .bmod__float::before { transform: none; }
  /* quantas linhas há entre esta e a carta */
  #bmod-1,
  #bmod-4 { --bs-n: 1; }
  #bmod-5 { --bs-n: 2; }

  /* Carta: protagonista no meio, altura fixa; o fólio vira numeração ao lado da saudação */
  /* altura da tela − barra do topo − as cinco linhas e os vãos: a cena inteira cabe numa tela */
  .bletter { height: clamp(330px, calc(100svh - 444px), 400px); }
  .bletter__draft {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    column-gap: 12px;
    padding: 14px 16px 14px 32px;
  }
  .bletter::before { left: var(--bs-bus); }
  .bletter__head { grid-column: 1 / -1; grid-row: 1; }
  .bletter__tag { display: none; }
  .bletter__main { display: contents; }
  .bletter__title { grid-column: 1; grid-row: 2; align-self: end; margin-top: 14px; font-size: 27px; }
  .bletter__folio {
    grid-column: 2;
    grid-row: 2;
    align-self: end;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 5px;
    margin: 0 0 2px;
  }
  .bletter__count { font-size: 27px; letter-spacing: -0.02em; }
  .bletter__count small { font-size: 10px; letter-spacing: 0.08em; }
  .bletter__count-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .bletter__ticks i { width: 9px; }
  .bletter__body {
    grid-column: 1 / -1;
    grid-row: 3;
    max-height: none;
    margin-top: 6px;
    padding-top: 8px;
    overscroll-behavior: auto;
    -webkit-mask-image: linear-gradient(transparent, #000 18px, #000 calc(100% - 16px), transparent);
    mask-image: linear-gradient(transparent, #000 18px, #000 calc(100% - 16px), transparent);
  }
  .bletter__part { font-size: 15.5px; line-height: 1.55; }
  .bletter__hint::before { content: '↕'; }
  .bletter__foot { grid-column: 1 / -1; grid-row: 4; margin-top: 10px; }
  .bletter__send { flex: 1 1 100%; justify-content: space-between; }

  .bletter__done { flex-direction: column; align-items: flex-start; justify-content: center; gap: 16px; padding: 24px 22px 24px 36px; }
  .bletter__done-mark { width: 48px; height: 48px; }
  .bletter__done h3 { font-size: 30px; }
  .bletter__done p { font-size: 15.5px; }

  /* Entrada: o barramento aparece depois das linhas */
  .bstudio-ws.is-pre .bstudio-stage__col::before,
  .bstudio-ws.is-pre .bstudio-stage__col::after { opacity: 0; }
  .bstudio-ws.is-entering .bstudio-stage__col::before,
  .bstudio-ws.is-entering .bstudio-stage__col::after { animation: bs-fade 0.6s ease 0.55s both; }

  .bsheet-backdrop { background: rgba(11, 25, 46, 0.42); }
}

@keyframes bs-fade { from { opacity: 0; } }

/* O ponto que corre pelo barramento no celular (script) */
.bstudio-signal {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  background: var(--bs-wine);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(163, 45, 50, 0.16), 0 0 12px 2px rgba(224, 103, 108, 0.6);
  opacity: 0;
  pointer-events: none;
}

/* Telas de toque: o dedo, não uma seta de mouse — só a mão do Design System */
@media not all and (hover: hover) and (pointer: fine) {
  .bstudio-cursor__icon--seta { display: none; }
  .bstudio-cursor__icon--mao { opacity: 1; }
}

/* ---------------------------------------------
   Desktop: a cena — 01–02 acima, carta em paisagem, 03–05 abaixo
   --------------------------------------------- */
@media (min-width: 1180px) {
  .bstudio-intro {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 24px;
    align-items: end;
  }
  .bstudio-intro .section-label { grid-column: 1 / -1; }
  /* título em duas linhas ("Toda boa ideia começa" / "com uma conversa.")
     e o texto embaixo dele, em 2 linhas */
  .bstudio-intro h2 { grid-column: 1 / -1; }
  .bstudio-intro__copy { grid-column: 1 / span 9; max-width: 74ch; margin: 26px 0 0; padding-bottom: 0; }
  .bstudio-intro__copy p { text-wrap: balance; }

  .bstudio-ws { --bs-layout: stage; margin-top: 56px; }
  .bstudio-ws__wires { display: block; }

  /* 24 colunas: posições levemente deslocadas, composição e não grade rígida */
  .bstudio-stage {
    grid-template-columns: repeat(24, minmax(0, 1fr));
    grid-template-rows: auto 62px auto 62px auto;
    gap: 0;
  }
  .bstudio-stage__col { display: contents; }

  #bmod-1 { grid-column: 3 / span 5; grid-row: 1; align-self: end; margin-top: 24px; }
  #bmod-2 { grid-column: 16 / span 5; grid-row: 1; align-self: end; }
  /* A carta vai de margem a margem (o recuo da home, 5,25 módulos de cada lado) */
  .bletter { grid-column: 1 / -1; grid-row: 3; height: clamp(330px, 23.5vw, 350px); }
  #bmod-3 { grid-column: 1 / span 5; grid-row: 5; align-self: start; margin-top: 28px; }
  #bmod-4 { grid-column: 10 / span 5; grid-row: 5; align-self: start; }
  #bmod-5 { grid-column: 20 / span 5; grid-row: 5; align-self: start; margin-top: 16px; }

  .bmod::before,
  .bmod::after { display: none; }
  .bmod__card { min-height: 104px; }
  .bmod__bar { gap: 9px; }
  .bmod__label { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }

  /* Flutuação: lenta, pequena, com leve deriva lateral e fora de sincronia */
  .bmod__float {
    animation: bs-float var(--fd, 5.4s) ease-in-out var(--fdl, 0s) infinite alternate;
    will-change: transform;
  }
  #bmod-1 { --fd: 5.2s; --fdl: -1.3s; --fa: 4px; --fx: 1.5px; --fr: -0.35deg; }
  #bmod-2 { --fd: 6.6s; --fdl: -3.4s; --fa: 5px; --fx: -1px; --fr: 0.3deg; }
  #bmod-3 { --fd: 4.7s; --fdl: -0.6s; --fa: 3px; --fx: -1.5px; --fr: 0.25deg; }
  #bmod-4 { --fd: 6.1s; --fdl: -2.2s; --fa: 4px; --fx: 1px; --fr: -0.2deg; }
  #bmod-5 { --fd: 5.7s; --fdl: -4.1s; --fa: 5px; --fx: 1.5px; --fr: 0.35deg; }
  .bstudio-ws:not(.is-inview) .bmod__float,
  .bmod.is-active .bmod__float { animation-play-state: paused; }

  .bletter__draft {
    grid-template-columns: minmax(0, 1fr) 190px;
    column-gap: 56px;
    padding: 22px 34px 18px 50px;
  }
  .bletter::before { left: 24px; }
  .bletter__body { max-height: none; padding-right: 18px; }
  .bletter__count { font-size: 56px; }
  .bletter__hint::before { content: '↕'; }

  /* Janela: abre do próprio painel, por cima da cena */
  .bpop {
    position: absolute;
    z-index: 20;
    top: 0;
    right: auto;
    bottom: auto;
    left: 0;
    width: 340px;
    max-width: none;
    max-height: 520px;
    margin: 0;
    border-bottom: 1px solid rgba(240, 236, 229, 0.16);
    border-radius: 10px;
    box-shadow: 0 40px 70px -28px rgba(11, 25, 46, 0.65), 0 8px 20px -10px rgba(11, 25, 46, 0.4);
    opacity: 0;
    transform: translateY(var(--dy, -8px)) scale(0.92);
    transform-origin: var(--ox, 50%) var(--oy, 0);
    filter: blur(2px);
    transition: opacity 0.2s ease, transform 0.32s var(--bs-ease), filter 0.25s ease, visibility 0s linear 0.32s;
  }
  .bpop.is-open {
    opacity: 1;
    transform: none;
    filter: none;
    transition: opacity 0.22s ease, transform 0.34s cubic-bezier(0.2, 1.15, 0.3, 1), filter 0.25s ease;
  }
  .bpop[data-side='bottom'] { --dy: 8px; }
  .bpop--mid { width: 380px; }
  .bpop--wide { width: 430px; }
  .bpop__head { padding: 14px 12px 12px 16px; }
  .bpop__head::before { display: none; }
  .bpop__q { font-size: 19px; }
  .bpop__body { padding: 14px 16px; }
  [data-bs-pop='1'] .bpop__body,
  [data-bs-pop='5'] .bpop__body { grid-template-columns: minmax(0, 1fr); }
  .bpop__groups { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
  .bpop .bchip span { min-height: 32px; padding: 5px 10px; font-size: 13px; }
  .bpop__foot { padding: 10px 16px 12px; }

  /* Seta apontando para o painel de origem */
  .bpop__caret {
    position: absolute;
    left: var(--caret-x, 50%);
    display: block;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    background: var(--bs-ink-2);
    border: 1px solid rgba(240, 236, 229, 0.16);
    transform: rotate(45deg);
  }
  .bpop[data-side='top'] .bpop__caret { top: -7px; border-right: 0; border-bottom: 0; }
  .bpop[data-side='bottom'] .bpop__caret { bottom: -7px; background: #0e1f38; border-top: 0; border-left: 0; }
  .bpop[data-side='none'] .bpop__caret { display: none; }

  .bsheet-backdrop { display: none; }

  @media (hover: hover) and (pointer: fine) {
    .bmod:hover .bmod__float { animation-play-state: paused; }
    .bmod:hover .bmod__card {
      border-color: rgba(224, 103, 108, 0.75);
      box-shadow:
        inset 0 1px 0 rgba(240, 236, 229, 0.1),
        0 0 0 1px rgba(224, 103, 108, 0.25),
        0 26px 44px -20px rgba(16, 35, 63, 0.7);
      transform: translateY(-4px) scale(1.02);
    }
    .bmod:hover .bmod__led { border-color: var(--bs-wine-light); box-shadow: 0 0 8px 1px rgba(224, 103, 108, 0.55); }
    .bmod:hover .bmod__meter i { transform: scaleY(1.6); }
    .bmod:hover .bmod__icon { opacity: 0; }
    .bmod:hover .bmod__go { opacity: 1; transform: none; }

    /* Arrastado: o painel "sai da mesa" — sobe mais, sombra mais longa */
    .bmod.is-grabbed .bmod__card {
      border-color: rgba(224, 103, 108, 0.9);
      box-shadow:
        inset 0 1px 0 rgba(240, 236, 229, 0.12),
        0 0 0 1px rgba(224, 103, 108, 0.32),
        0 44px 64px -26px rgba(16, 35, 63, 0.78);
      transform: translateY(-8px) scale(1.04);
      transition-duration: 0.2s;
    }
  }

  /* Arrastar (o deslocamento e a inclinação vêm do script, em translate/rotate) */
  .bmod { -webkit-user-select: none; user-select: none; }
  .bmod.is-loose { z-index: 3; }
  .bmod.is-grabbed .bmod__float { animation-play-state: paused; }
  .bstudio-ws.is-dragging,
  .bstudio-ws.is-dragging .bmod { cursor: grabbing; }
}

@keyframes bs-float {
  from { transform: translate(calc(var(--fx, 0px) * -1), calc(var(--fa, 4px) * -1)) rotate(calc(var(--fr, 0deg) * -1)); }
  to { transform: translate(var(--fx, 0px), var(--fa, 4px)) rotate(var(--fr, 0deg)); }
}

/* Âncora #contato: o rótulo da seção não fica sob a barra fixa (desconta o respiro do topo) */
#contato { scroll-margin-top: max(0px, calc(var(--nav-height, 64px) + 1rem - 120px)); }
@media (max-width: 719.98px) {
  #contato { scroll-margin-top: max(0px, calc(var(--nav-height, 64px) + 1rem - 88px)); }
}

@media (prefers-reduced-motion: reduce) {
  .bstudio-ws.is-pre .bmod,
  .bstudio-ws.is-pre .bletter,
  .bstudio-ws.is-pre .bstudio-ws__wires { opacity: 1; }
  .bmod__float { animation: none !important; }
  .bstudio-cursor { display: none; }
  .bpop { filter: none !important; }
  .bletter.is-typing .bletter__pulse,
  .bwire.is-active .bwire__start,
  .bmod__led { animation: none !important; }
}

/* o cursor da demonstração passa perto da borda direita no celular e saía da
   tela por um instante (rolagem lateral): a seção recorta só na horizontal.
   Ela ocupa a largura toda, então só o que passa da tela é cortado. */
.bstudio { overflow-x: clip; }
