/* SafeSP - doc.css
   Folha unica das paginas de texto do SafeSP (ajuda.html e as paginas de
   documento que usam o mesmo contrato). Criada em 21/09/2026.

   CONTRATO
   Esta folha estiliza ELEMENTOS (h1 h2 h3 h4 p ul ol li table caption th td
   dl dt dd blockquote figure figcaption details summary a) e SO estas classes:
     topo       <header> fixo no alto, com a marca e o botao de voltar
     marca      o logo "SafeSP" (link para o mapa)
     sumario    <nav> com o indice da pagina
     doc        <main>, a coluna de leitura
     atualizado <p> com a data de atualizacao
     aviso      <aside> para aviso real (no maximo um por secao)
     numero     <figure> ou <dl> com um dado numerico
                  figure.numero: o 1o filho e o numero; figcaption traz o
                  rotulo, a data e a fonte.
                  dl.numero: dt = rotulo; o 1o dd = numero; um 2o dd traz a
                  data e a fonte.
     acao       link-botao primario ("Abrir o mapa")
     rodape     <footer>
     refs       lista de referencias
   Dois ids tem regra propria: #pular (atalho "Ir para o conteudo") e
   #btn-close (o botao de voltar que o close-btn.js escuta).

   TEMA
   (a) escuro, a identidade do app: e o padrao, no :root.
   (b) claro, para leitura: <html lang="pt-BR" data-tema="claro">.
   Os tokens sao os do app.css (:root). Um token novo: --sobre-police, a cor
   do texto sobre o fundo ciano (o mesmo #06121f do botao do app).

   FONTE
   Texto e titulos na fonte do sistema: nao baixa nada, tem acento e italico
   de verdade em qualquer aparelho e le bem em corpo pequeno. A Rajdhani
   (fontes/fontes.css) fica so na marca, como no cabecalho do app. */

:root {
  color-scheme: dark;
  --bg: #060c1a;
  --card: #0d1526;
  --border: #1a2a45;
  --text: #c4cfe0;
  --muted: #7a91b5;
  --police: #00d4ff;
  --danger: #ff3b5c;
  --warn: #ffb830;
  --safe: #00e676;
  --r: 4px;
  --sobre-police: #06121f;

  /* medidas da pagina */
  --medida: 36rem;      /* coluna de leitura: ~66 a 72 caracteres a 17 px */
  --lateral: 13rem;     /* indice lateral no computador */
  --vao: 3rem;          /* espaco entre indice e texto */
  --topo-altura: 48px;  /* a mesma altura do cabecalho do app */
}

/* (b) variante clara de leitura. Contraste medido sobre --bg (WCAG):
   texto 15,05:1 · apoio 6,76:1 · links 6,80:1 · branco sobre o botao 7,04:1 */
:root[data-tema="claro"] {
  color-scheme: light;
  --bg: #fbfbf9;
  --card: #eef1f5;
  --border: #c9d1dd;
  --text: #1b2433;
  --muted: #4a5a72;
  --police: #005f86;
  --danger: #b42318;
  --warn: #9a5b00;
  --safe: #1d7a3a;
  --sobre-police: #ffffff;
}

/* ---- base ---------------------------------------------------------- */

html {
  font-size: 106.25%; /* 17 px quando o navegador esta no padrao de 16 px */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

[id] { scroll-margin-top: calc(var(--topo-altura) + 1rem); }

/* ---- titulos ------------------------------------------------------- */

h1, h2, h3, h4 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}

h1 { font-size: 2rem; margin: 2rem 0 .5rem; }

h2 {
  font-size: 1.5rem;
  margin: 3.5rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

h3 { font-size: 1.1875rem; margin: 2.25rem 0 .5rem; }

h4 { font-size: 1rem; margin: 1.75rem 0 .25rem; }

/* ---- texto --------------------------------------------------------- */

p { margin: 0 0 1rem; }

ul, ol { margin: 0 0 1rem; padding-left: 1.5em; }
ol[type="I"], ol[type="i"] { padding-left: 2.75em; }

li { margin-bottom: .4em; }
li > ul, li > ol { margin: .4em 0 0; }

strong, b { font-weight: 700; color: var(--text); }

a {
  color: var(--police);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
a:hover { text-decoration-thickness: 2px; }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--police);
  outline-offset: 2px;
  border-radius: var(--r);
}

blockquote {
  margin: 1.5rem 0;
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}

code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
}

/* ---- tabelas ------------------------------------------------------- */

table {
  width: 100%;
  margin: 1rem 0 1.5rem;
  border-collapse: collapse;
  font-size: .9375rem;
  line-height: 1.5;
}

caption {
  text-align: left;
  font-weight: 700;
  padding-bottom: .5rem;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: .5rem .75rem .5rem 0;
  border-bottom: 1px solid var(--border);
}
th:last-child, td:last-child { padding-right: 0; }

thead th {
  border-bottom: 2px solid var(--muted);
  color: var(--muted);
  font-weight: 700;
}

tbody th { font-weight: 700; }

/* ---- listas de definicao, figuras, sanfona ------------------------- */

dl { margin: 0 0 1rem; }
dt { font-weight: 700; }
dd { margin: 0 0 .75rem; }

figure { margin: 1.5rem 0; }
figcaption { color: var(--muted); font-size: .9375rem; }

details {
  margin: 1.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

summary {
  cursor: pointer;
  font-weight: 700;
  padding: .75rem 0;
  min-height: 44px;
}

details[open] > summary { margin-bottom: .5rem; }

/* ---- atalho para o conteudo --------------------------------------- */

#pular {
  position: absolute;
  left: 16px;
  top: -200px;
  z-index: 20;
  padding: .5rem 1rem;
  background: var(--police);
  color: var(--sobre-police);
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 var(--r) var(--r);
}
#pular:focus { top: 0; }

/* ---- topo ---------------------------------------------------------- */

.topo {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topo-altura);
  padding: 0 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.marca {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: Rajdhani, "Arial Narrow", sans-serif;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--police);
  text-decoration: none;
}
.marca span { color: var(--text); }

.topo button,
.topo noscript a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 .875rem;
  font: inherit;
  font-size: .9375rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-decoration: none;
  cursor: pointer;
}
.topo button:hover,
.topo noscript a:hover {
  color: var(--police);
  border-color: var(--police);
}

/* ---- coluna de leitura -------------------------------------------- */

.doc {
  max-width: var(--medida);
  margin: 0 auto;
  padding: 0 16px 1rem;
  box-sizing: content-box;
}

.atualizado {
  color: var(--muted);
  font-size: .9375rem;
  margin: 0 0 1.5rem;
}
h1 + .atualizado { margin-top: 0; }

/* ---- sumario ------------------------------------------------------- */

.sumario {
  margin: 1.5rem 0 0;
  padding: .75rem 0 0;
  border-top: 1px solid var(--border);
}

.sumario + section > h2:first-child { margin-top: 2.5rem; }

.sumario h2 {
  font-size: .9375rem;
  color: var(--muted);
  margin: 0 0 .25rem;
  padding: 0;
  border: 0;
}

.sumario ol, .sumario ul { margin: 0; padding-left: 1.5em; }
.sumario li { margin: 0; }

.sumario a {
  display: block;
  padding: .5rem 0;
  text-decoration: none;
}
.sumario a:hover { text-decoration: underline; }

/* ---- aviso --------------------------------------------------------- */

.aviso {
  margin: 1.5rem 0;
  padding: .25rem 0 .25rem 1rem;
  border-left: 4px solid var(--warn);
}
.aviso > :last-child { margin-bottom: 0; }

/* ---- numero -------------------------------------------------------- */

.numero {
  margin: 1.5rem 0;
  padding: .75rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

figure.numero > :first-child,
.numero dt + dd {
  display: block;
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.numero dt {
  font-weight: 400;
  color: var(--muted);
  font-size: .9375rem;
}

.numero dd { margin: 0; }
.numero dd + dt { margin-top: .75rem; }  /* varios pares rotulo-numero no mesmo dl */

.numero dd + dd,
.numero figcaption {
  margin-top: .25rem;
  color: var(--muted);
  font-size: .9375rem;
}

/* ---- acao ---------------------------------------------------------- */

.acao {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.25rem;
  background: var(--police);
  color: var(--sobre-police);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--r);
}
.acao:hover { text-decoration: underline; }

/* ---- referencias --------------------------------------------------- */

.refs { font-size: .9375rem; color: var(--muted); }
.refs li { margin-bottom: .6em; }

/* ---- rodape -------------------------------------------------------- */

.rodape {
  max-width: var(--medida);
  margin: 4rem auto 0;
  padding: 1.5rem 16px 3rem;
  box-sizing: content-box;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .9375rem;
}

.rodape ul {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
}

.rodape li { margin: 0; }

.rodape a {
  display: inline-block;
  padding: .35rem 0;
}

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

/* ---- computador: indice lateral fixo ------------------------------ */

@media (min-width: 1100px) {
  .doc,
  .rodape {
    margin-left: calc(50% - (var(--lateral) + var(--vao) + var(--medida)) / 2
      + var(--lateral) + var(--vao));
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }

  .sumario {
    position: fixed;
    top: calc(var(--topo-altura) + 2rem);
    left: calc(50% - (var(--lateral) + var(--vao) + var(--medida)) / 2);
    width: var(--lateral);
    max-height: calc(100vh - var(--topo-altura) - 4rem);
    overflow-y: auto;
    margin: 0;
    padding: 0;
    border: 0;
    font-size: .9375rem;
  }

  .sumario ol, .sumario ul { padding-left: 1.25em; }
  .sumario a { padding: .3rem 0; }

  /* a marca e o botao de voltar alinham com as bordas do indice e do texto */
  .topo {
    padding-left: calc(50% - (var(--lateral) + var(--vao) + var(--medida)) / 2);
    padding-right: calc(50% - (var(--lateral) + var(--vao) + var(--medida)) / 2);
  }
}

/* ---- impressao ----------------------------------------------------- */

@media print {
  :root {
    --bg: #fff; --card: #fff; --border: #999;
    --text: #000; --muted: #333; --police: #000;
  }
  .topo, .sumario, #pular { display: none; }
  .doc, .rodape { max-width: none; margin: 0; padding: 0; }
  h2, h3, h4 { break-after: avoid; }
  table, figure, .aviso { break-inside: avoid; }
}
