/* =====================================================================
   Base: reset, tipografia, foco acessivel, grid e utilitarios.
   Comum ao portal publico e ao painel.
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font: var(--texto-md)/1.6 var(--fonte-base);
  color: var(--cor-texto);
  background: var(--cor-fundo);
  overflow-wrap: anywhere;
}

img, svg { max-width: 100%; }
a { color: var(--cor-primaria); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { color: var(--cor-titulo); line-height: 1.25; margin: 0 0 var(--esp-3); }
p { margin: 0 0 var(--esp-3); }

/* Foco sempre visivel (teclado) */
:focus-visible { outline: 3px solid var(--cor-destaque); outline-offset: 3px; }

/* Link "pular para o conteudo" */
.skip {
  position: absolute; left: 8px; top: -60px; z-index: 1000;
  background: #fff; color: var(--cor-primaria-escura);
  padding: 10px 14px; border-radius: var(--raio-sm); font-weight: 700;
}
.skip:focus { top: 8px; }

/* Container e grids */
.container { width: 100%; max-width: var(--largura-max); margin: 0 auto; padding: 0 28px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Utilitarios */
.muted { color: var(--cor-texto-suave); }
.small { font-size: var(--texto-sm); }
.tiny { font-size: var(--texto-xs); }
.center { text-align: center; }
.pre-wrap { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-3 { margin-top: var(--esp-3); } .mt-4 { margin-top: var(--esp-4); } .mt-5 { margin-top: var(--esp-5); }
.hr { height: 1px; background: var(--cor-borda); margin: var(--esp-5) 0; border: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

@media (max-width: 950px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .grid-2, .grid-3, .grid-4.empilha-mobile { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
