/* ==========================================================================
   MontPDF — MODO EMBED (?embed=1) · F3 · Builder B-PDF
   Casca aditiva/reversível. TUDO escopado sob body.mont-embed → fora do embed,
   ZERO efeito. Reverter = apagar este arquivo + o <link> em index.html.
   Ref: _shared/docs/f3-embed-spec.md §2.2.
   ========================================================================== */

/* 1) Esconde o "chrome" do site inteiro — sobra só o editor. */
body.mont-embed #header-slot,
body.mont-embed #footer-slot,
body.mont-embed footer.montf {
  display: none !important;
}

/* Reforço defensivo: se o catálogo/home vazar, some (a rota fica travada no
   editor em embed, mas isto blinda o flash de home ANTES do openFromDrive trocar
   o #app pelo editor). Inclui .hero2 (a home real usa .hero2, não .hero) e os
   blocos de anúncio (.ad-slot/.ad-banner) — nada de chrome no embed. */
body.mont-embed .tool-grid,
body.mont-embed .section-title,
body.mont-embed .hero,
body.mont-embed .hero2,
body.mont-embed .ad-slot,
body.mont-embed .ad-banner {
  display: none !important;
}

/* 2) O editor ocupa a viewport inteira do modal (sem o header de 64px acima).
   A barra embed (injetada por embed.js) entra como 1º filho flex de .reader;
   .reader-main mantém flex:1, então tudo cabe em 100dvh. */
body.mont-embed #app { min-height: 100dvh; }
body.mont-embed .reader { height: 100dvh; height: 100vh; }
@supports (height: 100dvh) { body.mont-embed .reader { height: 100dvh; } }

/* 3) Ferramentas que não fazem sentido embutido são escondidas em JS (Trocar,
   Compartilhar) — aqui só o reforço p/ o #shareBtn caso o JS ainda não rodou. */
body.mont-embed .reader-top .rt-actions #shareBtn { display: none !important; }

/* ==========================================================================
   4) Barra de ação embed — "Salvar e voltar" + Fechar (injetada por embed.js)
   ========================================================================== */
.mont-embedbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line, #e6e6ec);
  background: var(--surface, #fff);
  flex: 0 0 auto;
}
.mont-embedbar__name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 700;
  color: var(--ink, #222);
}
.mont-embedbar__name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46vw;
}
.mont-embedbar__spacer { flex: 1 1 auto; }
.mont-embedbar__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line, #e6e6ec);
  background: transparent;
  color: var(--ink, #444);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}
.mont-embedbar__close:hover { background: rgba(0, 0, 0, .06); }

/* Telas estreitas: colapsa o texto do "Salvar e voltar" (fica só o ícone) e
   encolhe o nome do documento. */
@media (max-width: 560px) {
  .mont-embedbar__name span { max-width: 34vw; }
  .mont-embedbar__save .mont-embedbar__savetxt { display: none; }
  .mont-embedbar__save { padding-left: 12px; padding-right: 12px; }
}
