/* ════════════════════════════════════════════════════════════════════════
   Páginas legais públicas — /legal/privacidade.html e /legal/termos.html.

   Ficheiro próprio (sem <style> nem style="" nas páginas) para a CSP poder
   ficar com style-src 'self'. Cores da marca tiradas de src/styles/tokens.css:
   papel #F8F7F5, tinta #16181C, linha #E4E1DC, laranja #FF5A1F.

   Contraste (WCAG AA):
     texto  #16181C / #F8F7F5 = 16,6:1   ·  escuro #F8F7F5 / #16181C = 16,6:1
     suave  #4A4E52 / #F8F7F5 =  7,8:1   ·  escuro #9AA0A8 / #16181C =  6,7:1
     links  #B23A12 / #F8F7F5 =  5,6:1   ·  escuro #FF5A1F / #16181C =  5,7:1
   O laranja vivo #FF5A1F sobre papel dá só 2,9:1, por isso no tema claro fica
   em elementos decorativos (traços, marcadores) e nunca em texto.

   As páginas não correm JavaScript: o tema escuro vem só de
   prefers-color-scheme (o data-theme da app não chega aqui).
   ════════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
  --bg: #F8F7F5;
  --surface: #F0EFEA;
  --fg: #16181C;
  --fg-muted: #4A4E52;
  --line: #E4E1DC;
  --line-strong: #D3CFC7;
  --link: #B23A12;
  --link-hover: #8A2C0D;
  --accent: #FF5A1F;
  --focus: #B23A12;
  --col: 68ch;
  --gutter: clamp(1rem, 0.6rem + 2vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #16181C;
    --surface: #1B1E23;
    --fg: #F8F7F5;
    --fg-muted: #9AA0A8;
    --line: #2A2E35;
    --line-strong: #363C46;
    --link: #FF5A1F;
    --link-hover: #FF7A4A;
    --accent: #FF5A1F;
    --focus: #FF5A1F;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Links e foco ─────────────────────────────────────────────────────── */

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ── Saltar para o conteúdo ───────────────────────────────────────────── */

.saltar {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--fg);
  color: var(--bg);
  font-weight: 700;
  text-decoration: none;
  border-radius: 6px;
}

.saltar:focus,
.saltar:focus-visible {
  top: 0.75rem;
  color: var(--bg);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Barra de topo ────────────────────────────────────────────────────── */

.topo {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.topo__wrap {
  max-width: calc(var(--col) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0.5rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.topo__marca {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1rem;
  line-height: 1.2;
}

.topo__marca::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  background: var(--accent);
  border-radius: 2px;
  flex: none;
}

.topo__nome {
  font-weight: 800;
  letter-spacing: -0.01em;
}

.topo__assina {
  color: var(--fg-muted);
  font-weight: 500;
}

.topo__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.25rem;
  margin-right: -0.6rem;
}

.topo__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.6rem;
  color: var(--fg);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
}

.topo__nav a:hover {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.topo__nav a[aria-current="page"] {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.35em;
}

.topo__nav .topo__voltar {
  color: var(--link);
}

/* ── Documento ────────────────────────────────────────────────────────── */

.doc {
  max-width: calc(var(--col) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 4rem;
}

.cabeca {
  margin-bottom: 2rem;
}

.etiqueta {
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.etiqueta::before {
  content: "";
  width: 1.75rem;
  height: 3px;
  background: var(--accent);
  flex: none;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 1.5rem + 2.6vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.meta {
  margin: 0.9rem 0 0;
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

.resumo {
  margin: 2rem 0;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
}

.resumo h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
}

.resumo ul {
  margin: 0;
}

/* ── Índice ───────────────────────────────────────────────────────────── */

.indice {
  margin: 0 0 1rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.indice h2 {
  margin: 0 0 0.5rem;
  color: var(--fg-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.indice ol {
  margin: 0;
  padding-left: 1.75rem;
  columns: 2 16rem;
  column-gap: 2rem;
  font-size: 0.9375rem;
}

.indice li {
  break-inside: avoid;
  padding: 0.15rem 0;
}

.indice li::marker {
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Secções ──────────────────────────────────────────────────────────── */

section {
  margin-top: 3rem;
  scroll-margin-top: 1rem;
}

h2 {
  margin: 0 0 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.n {
  flex: none;
  color: var(--link);
  font-size: 0.8em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

section:target > h2 {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.3em;
}

h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
  scroll-margin-top: 1rem;
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}

li {
  margin: 0 0 0.45rem;
}

li:target {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

ul > li::marker {
  color: var(--accent);
}

strong {
  font-weight: 700;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  padding: 0.1em 0.35em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.nota {
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

.aviso {
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

/* ── Tabelas ──────────────────────────────────────────────────────────── */

.tabela {
  width: 100%;
  margin: 0 0 1.25rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.tabela th,
.tabela td {
  padding: 0.7rem 0.75rem 0.7rem 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.tabela th:last-child,
.tabela td:last-child {
  padding-right: 0;
}

.tabela thead th {
  color: var(--fg-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--line-strong);
}

.tabela tbody th {
  font-weight: 700;
}

/* Em ecrãs estreitos cada linha vira um bloco; o nome da coluna aparece
   antes de cada célula a partir do atributo data-label. */
@media (max-width: 40rem) {
  .tabela thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .tabela,
  .tabela tbody,
  .tabela tr,
  .tabela th,
  .tabela td {
    display: block;
    width: 100%;
  }

  .tabela tr {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--line);
  }

  .tabela th,
  .tabela td {
    padding: 0.15rem 0;
    border: 0;
  }

  .tabela tbody th {
    padding-bottom: 0.3rem;
  }

  .tabela td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-top: 0.35rem;
    color: var(--fg-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
}

/* ── Rodapé ───────────────────────────────────────────────────────────── */

.rodape {
  border-top: 1px solid var(--line);
  color: var(--fg-muted);
  font-size: 0.875rem;
}

.rodape__wrap {
  max-width: calc(var(--col) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 2.5rem;
}

.rodape p {
  margin: 0 0 0.4rem;
}

.rodape a {
  color: var(--fg-muted);
}

.rodape a:hover {
  color: var(--link);
}

/* ── Impressão ────────────────────────────────────────────────────────── */

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --fg: #000;
    --fg-muted: #333;
    --link: #000;
  }

  .saltar,
  .topo__nav,
  .indice {
    display: none;
  }

  .doc {
    padding-top: 0;
  }

  section {
    break-inside: auto;
  }

  h2,
  h3 {
    break-after: avoid;
  }
}
