/* metanoIA — "Como Utilizar": o tutorial da plataforma (15/10/2026).

   Uma folha de estilo para dois papéis:
     - na Web: página com sumário fixo à esquerda;
     - na apostila (html.apostila, montada pelo Paged.js em tutorial/gerar-pdf.mjs):
       A4 com capa, sumário com número de página, cabeçalho e rodapé corridos.
   As regras da apostila ficam todas no fim, separadas. */

:root {
  --ink: #22272F;
  --ink-soft: #4D5560;
  --muted: #7C838C;
  --faint: #A8A199;
  --line: #F2ECE5;
  --line-strong: #EDE3D7;
  --cream: #FFFDF9;
  --cream-2: #FFF8F1;
  --peach: #FFF1E2;
  --peach-2: #FFF4E9;
  --brand-300: #F7B183;
  --brand-500: #F17F36;
  --brand-600: #D95A18;
  --brand-700: #A8420F;
  --moss-100: #E4F1DE;
  --moss-700: #0D7346;
  --sombra: 0 8px 24px rgba(65, 45, 30, .06), 0 2px 6px rgba(65, 45, 30, .04);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 16px/1.65 'Figtree', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--brand-600); }
b, strong { font-weight: 650; color: var(--ink); }

/* ---------------------------------------------------------------- topo -- */
.capa { display: none; }

.topo {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(255, 253, 249, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topo__marca img { height: 30px; display: block; }
.topo__acoes { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
  transition: background .2s, color .2s;
}
.btn--linha { border: 1.5px solid #F2D6BB; color: var(--brand-600); background: #fff; }
.btn--linha:hover { background: var(--peach-2); }
.btn--cheio { background: linear-gradient(135deg, #E95016, #F27222); color: #fff; }
.btn--cheio:hover { filter: brightness(1.05); }

/* ------------------------------------------------------------- moldura -- */
.moldura {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

/* ------------------------------------------------------------- sumário -- */
.sumario {
  position: sticky; top: 76px;
  align-self: start;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  padding: 36px 0 40px;
  font-size: 14px;
}
.sumario__t {
  margin: 0 0 12px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint);
}
.sumario ol { list-style: none; margin: 0; padding: 0; }
.sumario > ol > li { margin-bottom: 4px; }
.sumario a {
  display: flex; gap: 10px;
  padding: 6px 10px; border-radius: 10px;
  color: var(--ink-soft); text-decoration: none; line-height: 1.35;
}
.sumario a:hover { background: var(--peach-2); color: var(--brand-700); }
.sumario a.is-on { background: var(--peach); color: var(--brand-700); font-weight: 600; }
.sumario a .n { flex: none; min-width: 18px; color: var(--brand-600); font-weight: 700; }
.sumario > ol > li > a { font-weight: 600; color: var(--ink); }
.sumario li ol { margin: 2px 0 8px 18px; display: none; }
.sumario li.is-aberto ol { display: block; }
.sumario li ol a { font-size: 13.5px; padding: 4px 10px; }
.sumario li ol a .n { color: var(--faint); font-weight: 600; min-width: 28px; }
.sumario .pg { display: none; }

/* --------------------------------------------------------------- texto -- */
.texto { max-width: 820px; padding: 36px 0 80px; min-width: 0; }

.abertura { padding-bottom: 8px; }
.selo {
  display: inline-block; margin: 0 0 14px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--peach); color: var(--brand-700);
  font-size: 12.5px; font-weight: 600;
}
.abertura h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 5vw, 52px); line-height: 1.05; letter-spacing: -.03em; font-weight: 700;
}
.lead { font-size: 18.5px; color: var(--ink-soft); margin: 0 0 28px; max-width: 680px; }

.papeis {
  margin: 0 0 22px; padding: 22px 24px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--sombra);
}
.papeis__t { margin: 0 0 14px; font-size: 17px; letter-spacing: -.01em; }
.papeis dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.papeis dt { font-weight: 700; color: var(--brand-700); margin-bottom: 2px; }
.papeis dd { margin: 0; font-size: 14.5px; color: var(--ink-soft); line-height: 1.55; }

.cap { padding-top: 56px; }
.cap h2 {
  display: flex; align-items: center; gap: 16px;
  margin: 0 0 12px;
  font-size: clamp(27px, 3.4vw, 34px); line-height: 1.15; letter-spacing: -.025em; font-weight: 700;
}
.cap h2 .n {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 50px; height: 50px; border-radius: 16px;
  background: linear-gradient(135deg, #E95016, #F27222); color: #fff;
  font-size: 24px; letter-spacing: 0;
}
.cap__intro { font-size: 17.5px; color: var(--ink-soft); margin: 0 0 8px; }
.cap h3 {
  margin: 40px 0 10px;
  font-size: 21px; letter-spacing: -.015em; font-weight: 700;
}
.cap h3 .n { color: var(--brand-600); margin-right: 8px; font-weight: 700; }
.texto p { margin: 0 0 14px; }
.texto ul { margin: 0 0 16px; padding-left: 22px; }
.texto ul li { margin-bottom: 6px; }
.texto ul li::marker { color: var(--brand-500); }

/* --------------------------------------------------------------- prints -- */
.tela {
  margin: 18px 0 14px;
  padding: 16px;
  background: var(--cream-2);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  text-align: center;
}
.tela__quadro {
  position: relative;
  display: inline-block;
  max-width: min(100%, var(--larg, 100%));
  vertical-align: top;
}
.tela img {
  display: block;
  width: 100%; height: auto;
  border-radius: 10px;
  box-shadow: 0 1px 0 var(--line-strong), 0 10px 28px rgba(65, 45, 30, .10);
  background: #fff;
}
.tela figcaption { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tela--estreita .tela__quadro { max-width: min(100%, var(--larg, 100%), 560px); }
.tela--mini { display: flex; align-items: center; justify-content: center; }
.tela--mini .tela__quadro { max-width: min(100%, var(--larg, 100%), 380px); }

.tela__pinos {
  position: absolute; inset: 0; z-index: 2;
  container-type: size;
  pointer-events: none;
  --pd: 2.2;   /* diâmetro em % da largura do print (vem do capturar.mjs) */
}
/* só a bolinha laranja com borda branca: sem sombra (no PDF a sombra virava
   um quadrado cinza em volta do número) */
.pino {
  position: absolute;
  width: max(16px, calc(var(--pd) * 1cqw));
  height: max(16px, calc(var(--pd) * 1cqw));
  transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--brand-600); color: #fff;
  border: max(1.5px, calc(var(--pd) * .09cqw)) solid #fff;
  font: 700 max(9px, calc(var(--pd) * .5cqw))/1 'Figtree', sans-serif;
}
.setor {
  position: absolute;
  border: 2.5px dashed var(--brand-600);
  border-radius: 12px;
  background: rgba(241, 127, 54, .06);
}

.legenda {
  list-style: none; counter-reset: leg var(--inicio, 0);
  margin: 0 0 18px; padding: 0;
  display: grid; gap: 9px;
}
.legenda li {
  counter-increment: leg;
  position: relative;
  padding-left: 38px;
  font-size: 15px; line-height: 1.55; color: var(--ink-soft);
}
.legenda li::before {
  content: counter(leg);
  position: absolute; left: 0; top: 0;
  width: 25px; height: 25px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-600); color: #fff;
  font-size: 12px; font-weight: 700;
}

.lado {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 22px; align-items: center;
  margin: 18px 0;
}
.lado .tela { margin: 0; }
.lado .legenda { margin: 0; }

.dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0 14px; }
.dupla .tela { margin: 0; padding: 12px; }

/* --------------------------------------------------------------- caixas -- */
.nota {
  margin: 18px 0; padding: 16px 20px;
  background: var(--moss-100); border: 1px solid #CFE7DA; border-radius: 14px;
  font-size: 15px; line-height: 1.6; color: #24452F;
}
.nota b { color: #0D5A38; }
.nota--atencao { background: var(--peach-2); border-color: #F6DCC4; color: #6B3A1C; }
.nota--atencao b { color: var(--brand-700); }

.quadro {
  width: 100%; margin: 18px 0; border-collapse: separate; border-spacing: 0;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden;
  font-size: 14.5px; line-height: 1.5;
}
.quadro th, .quadro td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.quadro tr:last-child th, .quadro tr:last-child td { border-bottom: 0; }
.quadro thead th { background: var(--cream-2); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.quadro tbody th { font-weight: 650; color: var(--ink); white-space: nowrap; }
.quadro td { color: var(--ink-soft); }
.quadro--teclas tbody th { width: 34%; }
kbd {
  display: inline-block; padding: 1px 7px; border-radius: 6px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--cream-2);
  font: 600 12.5px/1.5 'Figtree', sans-serif; color: var(--ink);
}

.dicas { list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.dicas li {
  margin: 0 !important; padding: 14px 18px 14px 46px; position: relative;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 14px;
  font-size: 15px; color: var(--ink-soft);
}
.dicas li::before {
  content: ''; position: absolute; left: 18px; top: 19px;
  width: 14px; height: 14px; border-radius: 4px; transform: rotate(45deg);
  background: linear-gradient(135deg, #E95016, #F7B183);
}

.fim {
  margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line-strong);
  text-align: center; color: var(--muted); font-size: 14px;
}
.fim img { height: 26px; margin-bottom: 8px; }
.fim p { margin: 4px 0; }

/* ----------------------------------------------------------- telas menores -- */
@media (max-width: 960px) {
  .moldura { grid-template-columns: minmax(0, 1fr); }
  .sumario {
    position: static; max-height: none; padding: 24px 0 0;
    border-bottom: 1px solid var(--line-strong);
  }
  .sumario li ol { display: none !important; }
  .texto { padding-top: 24px; }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .topo__marca img { height: 24px; }
  .topo .btn--cheio { display: none; }
  .btn { padding: 9px 14px; font-size: 13px; }
  .papeis dl, .lado, .dupla { grid-template-columns: minmax(0, 1fr); }
  .tela { padding: 10px; border-radius: 14px; }
  .cap h2 .n { width: 40px; height: 40px; font-size: 19px; border-radius: 12px; }
  .quadro { font-size: 13.5px; }
  .quadro th, .quadro td { padding: 9px 10px; }
  .quadro tbody th { white-space: normal; }
}

/* ======================================================================
   IMPRESSÃO
   ====================================================================== */
@page {
  size: A4;
  margin: 20mm 17mm 20mm 17mm;
}

/* impressão direta do navegador (Ctrl+P na Web). A apostila de verdade é a
   do gerar-pdf.mjs — o Paged.js também lê este bloco, daí o :not(.apostila). */
@media print {
  .topo, html:not(.apostila) .sumario { display: none; }
  .moldura { display: block; padding: 0; }
  .texto { max-width: none; padding: 0; }
  .cap { break-before: page; padding-top: 0; }
  .tela, .lado, .dupla, .quadro, .nota, .dicas li { break-inside: avoid; }
  .tela { break-after: avoid; }
  .legenda, .par { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  /* só têm efeito na apostila (o Paged.js lê este bloco; as quebras com o
     prefixo html.apostila ele não enxerga) */
  #texto { break-before: page; }
  .abertura { break-after: page; }
}

/* ---------------------------------------------- a apostila (Paged.js) --
   tutorial/gerar-pdf.mjs abre a página com ?apostila, que põe a classe
   .apostila no <html>, e roda o Paged.js por cima. */
html.apostila { scroll-behavior: auto; }
html.apostila body { background: #fff; font-size: 10.6pt; line-height: 1.55; }
html.apostila .topo { display: none; }
html.apostila .moldura { display: block; max-width: none; padding: 0; }
html.apostila .texto { max-width: none; padding: 0; break-before: page; page: corpo; }
html.apostila .moldura { display: none; }

@page {
  @top-left {
    content: 'Como utilizar a metanoIA';
    font: 600 8pt 'Figtree', sans-serif; color: #A8A199; letter-spacing: .04em;
    vertical-align: bottom; padding-bottom: 4mm;
  }
  @top-right {
    content: string(capitulo);
    font: 600 8pt 'Figtree', sans-serif; color: #D95A18;
    vertical-align: bottom; padding-bottom: 4mm;
  }
  @bottom-right {
    content: counter(page);
    font: 700 9pt 'Figtree', sans-serif; color: #22272F;
    vertical-align: top; padding-top: 4mm;
  }
  @bottom-left {
    content: 'ia.metanoia.com.br';
    font: 500 8pt 'Figtree', sans-serif; color: #A8A199;
    vertical-align: top; padding-top: 4mm;
  }
}
@page :first {
  margin: 0;
  @top-left { content: none; } @top-right { content: none; }
  @bottom-left { content: none; } @bottom-right { content: none; }
}

/* o corpo é uma página nomeada: é o que faz o Paged.js virar a página depois
   do sumário (break-before sozinho ele ignora ali) */
@page corpo { }

/* capa */
html.apostila .capa {
  display: flex; flex-direction: column;
  width: 210mm; height: 296mm;
  padding: 22mm 20mm 14mm;
  background:
    radial-gradient(circle at 105% -5%, rgba(241, 127, 54, .30) 0, rgba(241, 127, 54, 0) 46%),
    radial-gradient(circle at -10% 105%, rgba(99, 188, 79, .16) 0, rgba(99, 188, 79, 0) 40%),
    #FFF8F1;
  break-after: page;
  overflow: hidden;
}
html.apostila .capa__logo { width: 62mm; }
html.apostila .capa__meio { margin-top: 26mm; }
html.apostila .capa__selo {
  display: inline-block; margin: 0 0 7mm; padding: 2mm 5mm; border-radius: 99px;
  background: #fff; color: #A8420F; font-size: 10pt; font-weight: 700; letter-spacing: .04em;
  border: 1px solid #F2D6BB;
}
html.apostila .capa__titulo {
  margin: 0 0 6mm; font-size: 40pt; line-height: 1.02; letter-spacing: -.035em; font-weight: 700; color: #22272F;
}
html.apostila .capa__titulo span { color: #D95A18; }
html.apostila .capa__sub { margin: 0; font-size: 14pt; color: #4D5560; max-width: 140mm; }
html.apostila .capa__print {
  margin: auto -6mm 0 auto; width: 138mm;
  border-radius: 4mm; border: 1px solid #EDE3D7;
  box-shadow: 0 6mm 16mm rgba(65, 45, 30, .16);
  transform: rotate(-2deg);
}
html.apostila .capa__pe { margin: 9mm 0 0; font-size: 9pt; color: #7C838C; font-weight: 600; }

/* sumário com número de página */
html.apostila .sumario {
  position: static; max-height: none; overflow: visible; padding: 0;
  break-after: page;
  font-size: 10.5pt;
}
html.apostila .sumario__t {
  font-size: 26pt; font-weight: 700; letter-spacing: -.02em; text-transform: none; color: #22272F;
  margin: 0 0 8mm;
}
html.apostila .sumario li ol { display: block; margin: 1mm 0 3mm 9mm; }
html.apostila .sumario > ol > li { margin-bottom: 1mm; break-inside: avoid; }
html.apostila .sumario a { padding: 1.3mm 0; border-radius: 0; background: none !important; }
html.apostila .sumario > ol > li > a { font-size: 12pt; border-bottom: 1px solid #F2ECE5; padding: 2.4mm 0; }
html.apostila .sumario a .t { flex: 1; display: flex; }
html.apostila .sumario a .t::after {
  content: ''; flex: 1; margin: 0 2mm 1.4mm; border-bottom: 1px dotted #D8CFC4;
}
html.apostila .sumario .pg { display: inline; font-weight: 700; color: #22272F; min-width: 7mm; text-align: right; }
html.apostila .sumario .pg::after { content: target-counter(attr(data-alvo), page); }

/* corpo */
html.apostila .abertura { break-after: page; }
html.apostila .abertura h1 { font-size: 30pt; }
html.apostila .lead { font-size: 13pt; }
html.apostila .cap { break-before: page; padding-top: 0; }
html.apostila .cap h2 .tt { string-set: capitulo content(text); }
html.apostila .cap h2 { font-size: 24pt; margin-bottom: 4mm; }
html.apostila .cap h2 .n { width: 13mm; height: 13mm; font-size: 17pt; border-radius: 4mm; }
html.apostila .cap__intro { font-size: 12pt; }
html.apostila .cap h3 { font-size: 14.5pt; margin: 8mm 0 2.5mm; break-after: avoid; }
html.apostila .tela { margin: 4mm 0 3mm; padding: 3.5mm; border-radius: 4mm; break-inside: avoid; }
html.apostila .tela img { width: 100%; height: auto; box-shadow: 0 0 0 1px #EDE3D7; }
html.apostila .tela__quadro { max-width: min(100%, var(--larg, 100%), calc(118mm * var(--asp, 2))); }
html.apostila .tela--alta .tela__quadro { max-width: min(100%, var(--larg, 100%), calc(150mm * var(--asp, 1))); }
html.apostila .legenda { gap: 1.6mm; margin-bottom: 4mm; break-inside: avoid; }
html.apostila .tela { break-after: avoid; }
html.apostila .legenda li { font-size: 10pt; padding-left: 8.5mm; break-inside: avoid; }
html.apostila .legenda li::before { width: 5.6mm; height: 5.6mm; font-size: 8pt; }
html.apostila .lado { break-inside: avoid; }
html.apostila .dupla { break-inside: avoid; }
html.apostila .dupla .tela__quadro { max-width: min(100%, calc(70mm * var(--asp, 1.6))); }
html.apostila .quadro { font-size: 9.5pt; break-inside: avoid; }
html.apostila .nota { font-size: 10pt; break-inside: avoid; }
html.apostila .dicas li { font-size: 10pt; break-inside: avoid; }
html.apostila .papeis dd { font-size: 10pt; }
html.apostila .fim { break-before: avoid; }
