/* legal-print.css — ação de imprimir + folha de impressão dos documentos de /legal/.
 *
 * Carregado só pelos 11 docs de legal/ (não é site-wide). Serve em legal.otimiza.pro
 * porque o handler do subdomínio busca .css na raiz (worker/index.js:210-221).
 *
 * O identificador do rodapé impresso vem de data-print-footer no <article>, por doc.
 */

/* ---- Ação de impressão (somente tela) ---- */
.doc-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.25rem;
}
.doc-actions__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}
.doc-actions__btn svg {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
}

@media print {
  @page {
    size: A4;
    margin: 18mm 16mm 16mm;
  }

  /* Fora do papel: navegação, rodapé, selos e CTAs.
     #cookie-consent, .sticky-cta e .exit-overlay vêm do widgets.js (carregado nestes docs):
     são position:fixed e, sem isto, caem no meio do contrato impresso e chegam a cobrir cláusulas.
     #otz-promo/.ana-fab não chegam a /legal (worker/index.js:36-38 + o handler de legal.otimiza.pro
     retorna antes da injeção) — ocultos por segurança. */
  .header,
  .footer,
  .doc-actions,
  #cookie-consent,
  .sticky-cta,
  .exit-overlay,
  #otz-promo,
  .ana-fab,
  [data-footer-seals] {
    display: none !important;
  }

  /* Bloco de CTA ("Dúvidas sobre X?" + Fale com a ANA). O seletor exige .button dentro:
     o mesmo --bg-secondary é usado em <tr> de tabelas de conteúdo contratual
     (ex.: termos-vt-pro.html:533, tabela de taxas por operadora) — sem o :has, a impressão
     perderia a tabela. .doc-cta é a marcação explícita, o :has é a rede de segurança. */
  .doc-cta,
  .article-content > div[style*='--bg-secondary']:has(.button) {
    display: none !important;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10.5pt;
    line-height: 1.45;
  }

  /* Preto no papel não se herda: o tema pinta p/li/td com tokens claros que sobrescrevem
     a cor do body. Sem isto, o cabeçalho de tabela sai texto claro sobre cinza (ilegível). */
  .article-content,
  .article-content p,
  .article-content li,
  .article-content ul,
  .article-content ol,
  .article-content h2,
  .article-content h3,
  .article-content h4,
  .article-content strong,
  .article-content em,
  .article-content td,
  .article-content th,
  .article-content span,
  .article-content div {
    color: #000 !important;
  }

  /* O cabeçalho usa gradiente escuro + texto branco (articles.css:202-204).
     Navegador não imprime fundo por padrão → sem isto o título sai branco no branco. */
  .article-header {
    background: none !important;
    color: #000 !important;
    margin-top: 0 !important;
    padding: 0 0 0.75rem !important;
    border-bottom: 2px solid #000;
    overflow: visible !important;
  }
  .article-header::before {
    display: none !important;
  }
  .article-header__content {
    max-width: none !important;
  }
  .article-header__title {
    font-size: 17pt !important;
    color: #000 !important;
  }
  .article-header p,
  .article-header__meta,
  .article-header__meta span,
  .article-header__badge {
    color: #000 !important;
    opacity: 1 !important;
    background: none !important;
  }
  .article-breadcrumb {
    display: none !important;
  }

  .article-content {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Título não pode ficar órfão no pé da página */
  h2 {
    font-size: 12.5pt !important;
    margin: 1.1em 0 0.4em !important;
    break-after: avoid-page;
    page-break-after: avoid;
  }
  h3 {
    font-size: 11pt !important;
    break-after: avoid-page;
    page-break-after: avoid;
  }
  p,
  li {
    orphans: 3;
    widows: 3;
  }
  li {
    margin-bottom: 0.25em;
  }
  .lead {
    font-size: 10.5pt !important;
  }

  /* Callout laranja: o fundo some na impressão, então vira moldura */
  .doc-callout,
  .article-content > div[style*='border-left: 4px solid #ff6b35'] {
    background: none !important;
    border: 1pt solid #000 !important;
    border-radius: 0 !important;
    padding: 8pt !important;
    margin-bottom: 1em !important;
    break-inside: avoid;
  }

  table {
    font-size: 9.5pt !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  thead {
    display: table-header-group;
  }
  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  th,
  td {
    border: 0.5pt solid #666 !important;
    padding: 4pt 6pt !important;
  }
  th {
    background: #eee !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Em papel o link morre: imprime o href ao lado */
  .article-content a {
    color: #000 !important;
    text-decoration: underline;
  }
  .article-content a[href^='http']::after {
    content: ' <' attr(href) '>';
    font-size: 8pt;
    font-weight: 400;
    color: #444;
    word-break: break-all;
  }

  /* Identifica a peça impressa. Conteúdo vem do data-print-footer de cada documento. */
  .article-content[data-print-footer]::after {
    content: attr(data-print-footer);
    display: block;
    margin-top: 1.5em;
    padding-top: 6pt;
    border-top: 0.5pt solid #999;
    font-size: 8pt;
    color: #444;
  }
}
