/* ==========================================================================
   TRAMA — a edição pública da documentação (trama.site/documentacao/)
   --------------------------------------------------------------------------
   A página é GERADA (scripts/rastreio/trama-site/gerar-documentacao.py); esta
   folha é escrita à mão e só veste o que o gerador escreve. A paleta, as
   fontes, a barra do alto, os botões e o rodapé vêm de ../style.css — aqui
   entram o que um documento longo pede e a vitrine não tem: títulos do
   tamanho de um texto, o sumário, as tabelas, as figuras e a impressão.
   Sem script nenhum: a página se lê inteira sem JavaScript.
   Fundo sempre LISO atrás de texto (nada de degradê): o `ver-pagina.mjs`
   só mede o contraste do texto que está sobre cor lisa.
   ========================================================================== */

/* --- a capa ---------------------------------------------------------------- */
.doc-capa { padding: clamp(44px, 7vw, 92px) 0 clamp(28px, 4vw, 44px); background: var(--fundo-2); }
.doc-capa h1 { font-size: clamp(2.2rem, 5.2vw, 3.7rem); max-width: 18ch; }
.doc-capa .lede { max-width: 64ch; }
.doc-dados { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-top: 24px; padding: 0; list-style: none; }
.doc-dados li {
  font-size: .9rem; color: var(--tinta-2); padding: 6px 12px; border-radius: var(--r-pilula);
  background: var(--superficie); box-shadow: inset 0 0 0 1px var(--borda);
}
.doc-dados b { color: var(--tinta); font-weight: 650; }
.doc-capa .acoes { margin-top: 28px; }
/* o botão que leva a um lugar DESTA página não leva a seta de quem sai dela */
.bt-interno::after { content: none; }

.doc-marcas { background: var(--fundo-2); padding: 0 0 clamp(28px, 4vw, 44px); border-bottom: 1px solid var(--borda-sutil); }
.doc-marcas p {
  max-width: 78ch; font-size: .98rem; color: var(--tinta-2);
  padding: 14px 18px; border-left: 3px solid var(--acento); background: var(--superficie);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.doc-marcas strong { color: var(--tinta); }

/* --- o corpo: o sumário ao lado, o texto no meio ---------------------------- */
.doc-corpo { display: grid; gap: clamp(28px, 4vw, 56px); padding-block: clamp(32px, 5vw, 64px); align-items: start; }
@media (min-width: 1040px) { .doc-corpo { grid-template-columns: 250px minmax(0, 1fr); } }

.sumario-titulo {
  font-family: var(--fonte-mono); font-weight: 600; font-size: .75rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--acento-forte);
}
.sumario-lista { margin-top: 16px; padding: 0; list-style: none; }
.sumario ul.subs { list-style: none; margin: 2px 0 8px 10px; padding: 0 0 0 8px; border-left: 1px solid var(--borda); }
.sumario a {
  display: block; padding: 9px 10px; border-radius: var(--r-md); text-decoration: none;
  color: var(--tinta-2); font-size: .93rem; line-height: 1.35;
}
.sumario .cap > a { color: var(--tinta); font-weight: 650; }
.sumario .subs a { padding: 6px 10px; font-size: .88rem; }
@media (hover: hover) { .sumario a:hover { background: var(--fundo-2); color: var(--tinta); } }
@media (min-width: 1040px) {
  .sumario {
    position: sticky; top: calc(var(--topo-h) + 20px);
    max-height: calc(100vh - var(--topo-h) - 40px); overflow-y: auto; padding: 4px 6px 12px 0;
  }
}
/* no celular e no tablet o sumário é um cartão só com os capítulos: 28 subtítulos empurrariam o texto para longe */
@media (max-width: 1039.98px) {
  .sumario { background: var(--superficie); border-radius: var(--r-lg); padding: 18px 12px 10px; box-shadow: inset 0 0 0 1px var(--borda); }
  .sumario-titulo { padding: 0 10px; }
  .sumario ul.subs { display: none; }
  .sumario a { padding: 12px 10px; }
}

/* --- o texto ----------------------------------------------------------------- */
.doc-texto { min-width: 0; overflow-wrap: break-word; }
.doc-texto .cap + .cap { margin-top: clamp(48px, 7vw, 84px); padding-top: clamp(36px, 5vw, 56px); border-top: 1px solid var(--borda); }
.doc-texto h2 { font-size: clamp(1.65rem, 3.1vw, 2.3rem); line-height: 1.14; max-width: 26ch; }
.doc-texto h3 { font-size: clamp(1.2rem, 1.9vw, 1.42rem); line-height: 1.22; margin-top: clamp(36px, 5vw, 52px); max-width: 40ch; }
.doc-texto p, .doc-texto ul, .doc-texto ol { max-width: 74ch; }
.doc-texto p { margin-top: 1.05em; }
.doc-texto h2 + p, .doc-texto h3 + p { margin-top: .9em; }
.doc-texto ul, .doc-texto ol { margin: 1.05em 0 0; padding-left: 1.35em; }
.doc-texto li { margin-top: .6em; padding-left: .15em; }
.doc-texto li::marker { color: var(--acento-forte); font-weight: 600; }
.doc-texto strong { font-weight: 650; }
.doc-texto code, .doc-marcas code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: .88em;
  background: var(--fundo-2); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere;
}
.doc-texto a.ref { color: var(--marca); white-space: nowrap; }
.nota-doc {
  margin: 1.3em 0 0; padding: 14px 18px; max-width: 74ch;
  border-left: 3px solid var(--acento); background: var(--acento-tenue); border-radius: 0 var(--r-md) var(--r-md) 0;
}
.nota-doc p { margin-top: .8em; }
.nota-doc p:first-child { margin-top: 0; }
.volta { margin-top: 2em; font-size: .9rem; }
.volta a { color: var(--tinta-3); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
@media (hover: hover) { .volta a:hover { color: var(--tinta); text-decoration: underline; } }

/* --- as tabelas: na mesa, tabela; no celular, cada linha vira um cartão --------
   (uma tabela de três colunas de texto não cabe em 320 px, e a que passa da
   borda é cortada pelo `main` sem abrir rolagem — somiria em silêncio) */
.tabela {
  margin-top: 1.4em; background: var(--superficie); border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px var(--borda); overflow: hidden;
}
/* `table-layout: fixed`: a largura de cada coluna é a que a folha dá, pela forma da tabela (a classe que o
   gerador põe). Deixada ao navegador, a coluna de texto mais longo espremia as outras em tiras de três palavras. */
.tb { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .93rem; line-height: 1.5; }
.tb th, .tb td { text-align: left; vertical-align: top; padding: 12px 14px; border-top: 1px solid var(--borda-sutil); overflow-wrap: anywhere; }
.tb thead th, .tb thead td { border-top: 0; background: var(--fundo-2); }
.tb thead th { font-size: .76rem; letter-spacing: .07em; text-transform: uppercase; color: var(--tinta-2); font-weight: 650; }
.tb tbody th { font-weight: 650; color: var(--tinta); }
.tb td { color: var(--tinta-2); }
.tb td strong { color: var(--tinta); }
.tb-canto thead td:first-child { width: 17%; }                /* o nome da linha; as outras dividem o resto por igual */
.tb-marcas thead th:first-child { width: 9.5em; }             /* a marca; o resto é o que */
.tb-c3 thead th:nth-child(1) { width: 21%; }                  /* o número, a conta, a tela dona */
.tb-c3 thead th:nth-child(3) { width: 24%; }
.m {
  display: inline-block; padding: 2px 10px; border-radius: var(--r-pilula); white-space: nowrap;
  font-size: .8rem; font-weight: 650; letter-spacing: .01em;
}
.m-nao { background: var(--fundo-2); color: var(--tinta); box-shadow: inset 0 0 0 1px var(--borda); }
.m-limite { background: var(--acento-tenue); color: var(--acento-forte); box-shadow: inset 0 0 0 1px var(--borda); }
.m-funciona { background: var(--superficie); color: var(--tinta); box-shadow: inset 0 0 0 1px var(--borda); }
@media (max-width: 760px) {
  /* o nome da coluna sai do alto e passa a vir escrito em cada célula (o `data-rotulo` que o gerador põe) */
  .tb thead { display: none; }
  .tb, .tb tbody, .tb tr, .tb tbody th, .tb td { display: block; width: auto; }
  .tb tr { padding: 14px 14px 16px; border-top: 1px solid var(--borda-sutil); }
  .tb tbody tr:first-child { border-top: 0; }
  .tb tbody th, .tb td { padding: 0; border: 0; }
  .tb tbody th { font-size: 1rem; }
  .tb td { margin-top: 10px; }
  .tb td[data-rotulo]::before {
    content: attr(data-rotulo); display: block; margin-bottom: 2px;
    font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 650; color: var(--tinta-3);
  }
  .tb-marcas td[data-rotulo]::before { content: none; }
  .tb-marcas td { margin-top: 8px; }
}

/* --- as figuras: a foto abre sozinha, no tamanho dela, num toque -------------- */
.fig { margin: 1.5em 0 0; }
.doc-texto li > .fig { margin-top: 1.1em; }
.fig-abre {
  display: block; overflow: hidden; border-radius: var(--r-lg); background: var(--superficie);
  box-shadow: inset 0 0 0 1px var(--borda), var(--sombra);
}
.fig-abre img { width: 100%; }
.fig figcaption { margin-top: 10px; font-size: .9rem; line-height: 1.5; color: var(--tinta-3); max-width: 74ch; }
.fig-estreita .fig-abre { max-width: 620px; }
.fig-folha .fig-abre { max-width: 560px; }
.fig-fila { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 860px; }
.fig-cel .fig-abre { border-radius: 18px; }
.fig-um .fig-abre { max-width: 270px; }
@media (max-width: 620px) { .fig-fila { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --- sobre este manual, e o fim ------------------------------------------------ */
.doc-sobre { background: var(--fundo-2); border-top: 1px solid var(--borda-sutil); padding: clamp(40px, 6vw, 72px) 0; }
.doc-sobre h2 { font-size: clamp(1.5rem, 2.8vw, 2rem); line-height: 1.15; }
.doc-sobre-lista { margin-top: 22px; padding: 0; list-style: none; display: grid; gap: 12px; max-width: 78ch; }
.doc-sobre-lista li { padding-left: 18px; border-left: 3px solid var(--borda); color: var(--tinta-2); font-size: 1rem; }
.doc-sobre-lista b { color: var(--tinta); font-weight: 650; }
.doc-fim { padding: clamp(56px, 8vw, 110px) 0; text-align: center; }
.doc-fim h2 { font-size: clamp(1.9rem, 4.4vw, 3rem); }
.doc-fim .lede { margin-inline: auto; }
.doc-fim .acoes { justify-content: center; }

/* --- no papel: só o texto e as fotos -------------------------------------------- */
@media print {
  .topo, .pular, .sumario, .doc-capa .acoes, .doc-fim, .rodape, .volta { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .doc-capa, .doc-marcas, .doc-sobre { background: none; padding: 0 0 12pt; border: 0; }
  .doc-corpo { display: block; padding: 0; width: auto; }
  .doc-texto .cap + .cap { margin-top: 18pt; padding-top: 12pt; }
  .doc-texto h2, .doc-texto h3 { break-after: avoid; }
  .fig, .tabela, .tb tr { break-inside: avoid; }
  .fig-abre { box-shadow: none; border: 1px solid #999; }
  .doc-texto a.ref { color: inherit; text-decoration: none; }
}
