/* ---------------------------------------------------------------------------
   POPgest · base
   Reset enxuto, tipografia base e primitivas de acessibilidade.
   A paleta e os componentes ficam em vision.css (design system do doc 05).
--------------------------------------------------------------------------- */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

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

* {
  margin: 0;
}

/* O atributo `hidden` sempre vence os `display` declarados pelos componentes. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light;
  /* O app não é um documento de leitura: sem "puxar para atualizar" no meio de
     uma gravação ou de um arrasto de marcação. */
  overscroll-behavior: none;
  /* Remove o flash cinza do toque — cada controle tem feedback próprio. */
  -webkit-tap-highlight-color: transparent;
}

body {
  /* dvh acompanha a barra do navegador no celular; 100vh ficava alto demais. */
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: #1e293b;
  background: #f8fafc;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-optical-sizing: auto;
  text-wrap: balance;
}

/* Tracking e leading acompanham o tamanho: títulos grandes pedem letras mais
   próximas e entrelinha curta. */
h1 {
  letter-spacing: -0.026em;
}

h2 {
  letter-spacing: -0.02em;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* Controles: sem seleção acidental no toque longo e sem atraso de 300 ms. */
button,
[role="button"],
summary,
label[for] {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Texto de conteúdo continua selecionável. */
p,
li,
td,
dd,
h1,
h2,
h3,
h4,
h5,
h6 {
  -webkit-user-select: text;
  user-select: text;
}

/* O iOS dá zoom ao focar um campo com fonte menor que 16px. Corrigir a causa
   é melhor que desabilitar o zoom (user-scalable=no é falha de acessibilidade). */
@media (pointer: coarse) {
  input,
  select,
  textarea {
    font-size: 16px;
  }
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

/* Foco visível e consistente em toda a aplicação. */
:focus-visible {
  outline: 2px solid #0284c7;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Sobre fundos escuros o anel azul some: troca para o ciano suave da paleta. */
.cabecalho-app :focus-visible,
.login__painel :focus-visible {
  outline-color: #e0f2fe;
}

/* Só para leitores de tela. */
.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;
}

/* Link de salto para o conteúdo principal. */
.pular-conteudo {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  transform: translateY(-200%);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  background: #133854;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.pular-conteudo:focus {
  transform: translateY(0);
}

[x-cloak] {
  display: none !important;
}

/* Rolagem discreta e coerente com a paleta. */
@supports (scrollbar-color: auto) {
  html {
    scrollbar-color: #cbd5e1 transparent;
    scrollbar-width: thin;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  /* Movimento reduzido não é "nenhum feedback": cor, opacidade e sombra
     continuam suaves; deslocamento, escala e animações param. */
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-property: color, background-color, border-color, box-shadow, opacity,
      outline-color !important;
    transition-duration: 120ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body {
    background: #fff;
  }

  .cabecalho-app,
  .rodape-app,
  .toasts,
  .acoes,
  .pular-conteudo {
    display: none !important;
  }
}
