/* ══════════════════════════════════════════════════════════════
   Cartografia — Manual de utilização (/ajuda)
   ──────────────────────────────────────────────────────────────
   Complementa public.css (cabeçalho, rodapé, botões, foco).
   Mobile first: uma coluna com índice desdobrável; a partir de
   960 px o índice fica fixo à esquerda. Corpo do texto a 17–18 px
   e linhas de ~68 caracteres. Sem estilos inline (CSP).
   Impressão: @media print no fim (A4, sem navegação, sem quebras
   dentro de caixas, endereços das ligações visíveis).
   ═════════════════════════════════════════════════════════════ */

.help-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}
.help-main:focus { outline: none; }

/* ── Cabeçalho da página ────────────────────────────────────── */
.help-hero {
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}
.help-hero .public-lede { font-size: 20px; }
.help-audience {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 24px;
}
.help-audience a {
  display: flex; flex-direction: column; gap: 2px;
  min-height: 44px;
  padding: 12px 16px;
  border: 1px solid var(--rule-strong);
  border-left: 4px solid var(--consensus);
  background: var(--paper-2);
  color: var(--ink);
  text-decoration: none;
}
.help-audience a:hover { background: var(--paper-3); }
.help-audience strong { font-weight: 600; font-size: 16px; }
.help-audience span { font-size: 14px; color: var(--ink-2); }

.print-only { display: none; }

/* ── Layout: índice + conteúdo ──────────────────────────────── */
.help-layout { display: block; }

/* Índice desdobrável (telemóvel) */
.help-toc-m {
  margin-bottom: 28px;
  border: 1px solid var(--rule-strong);
  background: var(--paper-2);
}
.help-toc-m summary {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 48px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.help-toc-m summary::-webkit-details-marker { display: none; }
.help-toc-m summary::after {
  content: "+";
  font-family: var(--f-mono);
  font-size: 20px;
  line-height: 1;
}
.help-toc-m[open] summary::after { content: "−"; }
.help-toc-m summary:hover { background: var(--paper-3); }
.help-toc-m ol { padding: 4px 8px 12px; }

.help-toc-d { display: none; }

.help-toc ol {
  list-style: none;
  counter-reset: toc;
}
.help-toc li { counter-increment: toc; }
.help-toc a {
  display: flex; gap: 10px; align-items: baseline;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.35;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.help-toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--ink-3);
  flex: none;
}
.help-toc a:hover {
  color: var(--ink);
  background: var(--paper-2);
  border-left-color: var(--rule-strong);
}
.help-toc-title {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
  padding-left: 13px;
}

@media (min-width: 960px) {
  .help-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 56px;
    align-items: start;
  }
  .help-toc-m { display: none; }
  .help-toc-d {
    display: block;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding-bottom: 16px;
  }
  .help-audience { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1180px) {
  .help-audience { grid-template-columns: repeat(4, 1fr); }
}

/* ── Tipografia do conteúdo ─────────────────────────────────── */
.help-content {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  min-width: 0;
}
@media (min-width: 720px) {
  .help-content { font-size: 18px; }
}

.help-content p,
.help-content ul,
.help-content ol,
.help-content dl {
  max-width: 68ch;
  margin-bottom: 1em;
}
.help-content ul,
.help-content ol { padding-left: 1.4em; }
.help-content li { margin-bottom: .4em; }
.help-content li > ul,
.help-content li > ol { margin-top: .4em; margin-bottom: .4em; }
.help-content strong { font-weight: 600; }
.help-content em { font-style: italic; }

.help-content a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--consensus);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.help-content a:hover { text-decoration-color: var(--ink); }
.help-content a:focus-visible {
  outline: 3px solid var(--consensus);
  outline-offset: 2px;
}

.help-section {
  padding-top: 8px;
  margin-bottom: 64px;
}
.help-section + .help-section {
  border-top: 1px solid var(--rule);
  padding-top: 40px;
}
.help-eyebrow {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.help-content h2 {
  font-family: var(--f-display);
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 450;
  line-height: 1.15;
  letter-spacing: -.015em;
  margin-bottom: 14px;
}
.help-content h2 em { font-style: italic; }
.help-lead {
  font-family: var(--f-display);
  font-size: 1.15em;
  line-height: 1.5;
  color: var(--ink-2);
  font-weight: 350;
}
.help-content h3 {
  font-family: var(--f-display);
  font-size: clamp(21px, 3.4vw, 25px);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -.01em;
  margin: 2em 0 .5em;
  max-width: 34em;
}
.help-content h4 {
  font-size: 1em;
  font-weight: 600;
  margin: 1.4em 0 .3em;
}
.help-content h2,
.help-content h3,
.help-content h4 { text-wrap: balance; }

.help-content code,
.help-content .mono {
  font-family: var(--f-mono);
  font-size: .86em;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 1px 6px;
  overflow-wrap: anywhere;
}

/* Botões e nomes de ecrãs no texto */
.ui {
  font-weight: 600;
  white-space: nowrap;
}
.ui-wrap { font-weight: 600; }

/* Teclas */
.help-content kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 1px 7px 2px;
  font-family: var(--f-mono);
  font-size: .82em;
  line-height: 1.4;
  text-align: center;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink-3);
  border-bottom-width: 3px;
  border-radius: 5px;
  white-space: nowrap;
}

/* ── Passos numerados ───────────────────────────────────────── */
.help-content ol.steps {
  list-style: none;
  padding-left: 0;
  counter-reset: step;
}
.help-content ol.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 48px;
  margin-bottom: 1em;
  min-height: 34px;
}
.help-content ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 1px;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: 14px;
  font-weight: 500;
}

/* ── Caixas de destaque ─────────────────────────────────────── */
.callout {
  max-width: 68ch;
  margin: 1.4em 0;
  padding: 16px 18px 6px;
  border: 1px solid var(--rule-strong);
  border-left: 5px solid var(--ink-3);
  background: var(--paper-2);
  font-size: .95em;
  line-height: 1.55;
  break-inside: avoid;
}
.callout > :last-child { margin-bottom: 10px; }
.callout p,
.callout ul,
.callout ol { max-width: none; margin-bottom: .7em; }
.callout-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: .5em;
}
.callout-title::before {
  content: "";
  flex: none;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: currentColor;
}
.callout-key   { border-left-color: var(--bridge);    background: var(--bridge-soft); border-color: var(--bridge); border-left-width: 6px; }
.callout-privacy { border-left-color: var(--consensus); background: var(--consensus-soft); }
.callout-warn  { border-left-color: var(--dissent);   background: var(--dissent-soft); }
.callout-tip   { border-left-color: var(--ink-3); }
.callout-key   .callout-title::before { background: var(--bridge); }
.callout-privacy .callout-title { color: var(--consensus-hover); }
.callout-privacy .callout-title::before { background: var(--consensus); }
.callout-warn  .callout-title { color: var(--dissent-hover); }
.callout-warn  .callout-title::before { background: var(--dissent); }

/* ── Ideias-chave e cartões ─────────────────────────────────── */
.help-cards {
  list-style: none;
  padding: 0 !important;
  max-width: none !important;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 1.2em 0 1.6em;
}
.help-cards > li {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  border-top: 3px solid var(--ink);
  break-inside: avoid;
}
.help-cards h4 {
  font-family: var(--f-display);
  font-size: 19px;
  font-weight: 500;
  margin: 0 0 4px;
}
.help-cards p { margin: 0; font-size: .92em; line-height: 1.5; color: var(--ink-2); }
@media (min-width: 640px) {
  .help-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1180px) {
  .help-cards.cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ── Tabelas ────────────────────────────────────────────────── */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 1.2em 0 1.6em;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
}
.table-wrap:focus-visible { outline: 3px solid var(--consensus); outline-offset: 2px; }
.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9em;
  line-height: 1.45;
}
.help-table caption {
  text-align: left;
  padding: 10px 14px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule-strong);
}
.help-table th,
.help-table td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}
.help-table thead th {
  background: var(--paper-2);
  font-weight: 600;
  border-bottom: 1px solid var(--rule-strong);
}
.help-table tbody th { font-weight: 600; }
.help-table tr:last-child > * { border-bottom: 0; }
.help-table td p,
.help-table td ul { margin-bottom: .4em; }

/* Etiquetas de categoria e de voto (ícone + texto: a cor nunca é o único sinal) */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono);
  font-size: max(.78em, 12.5px);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 9px;
  border: 1px solid;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.chip-consensus { color: var(--consensus-hover); border-color: var(--consensus); background: var(--consensus-soft); }
.chip-bridge    { color: var(--ink);             border-color: var(--bridge);    background: var(--bridge-soft); }
.chip-bridge::before { background: var(--bridge); }
.chip-dissent   { color: var(--dissent-hover);   border-color: var(--dissent);   background: var(--dissent-soft); }
.chip-undecided { color: var(--ink-2);           border-color: var(--ink-4);     background: var(--paper-2); }
.chip-undecided::before { background: var(--ink-4); }
.chip-agree     { color: var(--consensus-hover); border-color: var(--consensus); background: var(--consensus-soft); }
.chip-agree::before { content: "+"; width: auto; height: auto; background: none; font-weight: 700; }
.chip-pass      { color: var(--ink-2);           border-color: var(--ink-4);     background: var(--paper-2); }
.chip-pass::before { content: "·"; width: auto; height: auto; background: none; font-weight: 700; }
.chip-disagree  { color: var(--dissent-hover);   border-color: var(--dissent);   background: var(--dissent-soft); }
.chip-disagree::before { content: "−"; width: auto; height: auto; background: none; font-weight: 700; }

/* ── Exemplos bom / mau ─────────────────────────────────────── */
.examples {
  list-style: none;
  padding: 0 !important;
  max-width: 68ch;
}
.examples li {
  display: flex; gap: 12px; align-items: baseline;
  padding: 10px 14px;
  margin: 0 0 8px;
  border: 1px solid var(--rule);
  background: var(--paper);
  break-inside: avoid;
}
.examples .tag {
  flex: none;
  min-width: 4.6em;
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.examples .good .tag { color: var(--consensus-hover); }
.examples .bad  .tag { color: var(--dissent-hover); }
.examples .good { border-left: 4px solid var(--consensus); }
.examples .bad  { border-left: 4px solid var(--dissent); }
.examples small { display: block; color: var(--ink-3); font-size: .85em; margin-top: 2px; }

/* ── Perguntas frequentes ───────────────────────────────────── */
.faq-index {
  columns: 1;
  max-width: none !important;
  list-style: none;
  padding-left: 0 !important;
  font-size: .95em;
  margin-bottom: 2em;
}
.faq-index li { break-inside: avoid; margin-bottom: 0; }
.faq-index a {
  display: inline-block;
  padding: 5px 0;
  min-height: 32px;
}
@media (min-width: 720px) { .faq-index { columns: 2; column-gap: 32px; } }

.faq-item {
  padding: 4px 0 6px;
  border-top: 1px solid var(--rule);
}
.faq-item h3 { margin-top: 1.1em; }

/* ── Glossário ──────────────────────────────────────────────── */
.glossary { max-width: 68ch; }
.glossary dt {
  font-weight: 600;
  margin-top: 1em;
  break-after: avoid;
}
.glossary dd { margin: 0 0 .3em; color: var(--ink-2); }

/* ── Vários ─────────────────────────────────────────────────── */
.to-top {
  margin-top: 1.6em;
  font-size: 14px;
}
.to-top a { display: inline-flex; align-items: center; min-height: 32px; }

.help-note {
  font-size: .9em;
  color: var(--ink-3);
}
.role-tag {
  display: inline-block;
  vertical-align: 2px;
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border: 1px solid var(--rule-strong);
  background: var(--paper-2);
  color: var(--ink-2);
}

/* ══════════════════════════════════════════════════════════════
   Impressão / Guardar como PDF
   ═════════════════════════════════════════════════════════════ */
@page { size: A4; margin: 18mm 16mm; }

@media print {
  html, body {
    background: #fff !important;
    color: #000 !important;
  }
  .skip-link,
  .public-header,
  .crumbs,
  .public-footer,
  .help-toc-m,
  .help-toc-d,
  .help-audience,
  .to-top,
  .no-print { display: none !important; }

  .print-only { display: block; }
  .print-banner {
    font-family: var(--f-mono);
    font-size: 9pt;
    color: #333;
    border-bottom: 1px solid #999;
    padding-bottom: 6pt;
    margin-bottom: 14pt;
  }

  .help-main { max-width: none; padding: 0; }
  .help-layout { display: block; }
  .help-content { font-size: 10.5pt; line-height: 1.5; color: #000; }
  .help-hero { border: 0; padding-bottom: 0; margin-bottom: 14pt; }
  .public-title { font-size: 26pt; }
  .help-hero .public-lede { font-size: 12pt; }

  .help-content p,
  .help-content ul,
  .help-content ol,
  .help-content dl,
  .callout,
  .examples,
  .glossary { max-width: none; }

  .help-section { margin-bottom: 20pt; padding-top: 0; }
  .help-section + .help-section { border-top: 0; padding-top: 0; }
  .help-content h2 { font-size: 20pt; break-after: avoid; margin-top: 16pt; }
  .help-content h3 { font-size: 13.5pt; break-after: avoid; margin-top: 14pt; }
  .help-content h4 { break-after: avoid; }
  .help-content p,
  .help-content li { orphans: 3; widows: 3; }

  .callout,
  .help-cards > li,
  .examples li,
  .faq-item,
  .help-table tr,
  .table-wrap,
  ol.steps > li { break-inside: avoid; }

  .callout,
  .chip,
  .help-content ol.steps > li::before,
  .help-content kbd {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .callout { background: #f4f1e8 !important; }

  .table-wrap { overflow: visible; border-color: #999; }
  .help-table th, .help-table td { border-color: #bbb; }

  /* Mostrar para onde vão as ligações (endereços relativos começam no
     domínio indicado no cabeçalho impresso). */
  .help-content a { text-decoration: underline; color: #000; }
  .help-content a[href^="/"]::after,
  .help-content a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-family: var(--f-mono);
    font-size: 8.5pt;
    color: #333;
    overflow-wrap: anywhere;
  }
  .help-content a[href^="#"]::after { content: none; }
  .help-audience a::after { content: none !important; }
}

/* Cartões de entrada com a mesma altura na grelha */
.help-audience li { display: flex; }
.help-audience li > a { flex: 1; }
