/* =========================================================================
   BASE — reset, tipografia padrão e elementos nativos
   =========================================================================
   Define como um HTML sem classe nenhuma já deve se parecer.
   Só consome tokens semânticos.
   ========================================================================= */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Compensa a nav fixa quando se navega por âncora */
  scroll-padding-top: calc(var(--nav-height) + var(--space-4));
}

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

body {
  /* Pintados explicitamente: a página nunca herda o fundo do host. */
  background-color: var(--color-bg);
  color: var(--color-text);

  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* ---- Títulos -----------------------------------------------------------
   Serifa, peso semibold, entrelinha fechada. Os tamanhos ficam por conta
   das classes utilitárias de display — aqui só o padrão sensato. */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
  text-wrap: balance; /* evita a última linha órfã em títulos */
}

h1 { font-size: var(--text-4xl); line-height: var(--leading-tight); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl);  }
h4 { font-size: var(--text-lg);  }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

@media (min-width: 768px) {
  h1 { font-size: var(--text-5xl); }
  h2 { font-size: var(--text-4xl); }
  h3 { font-size: var(--text-2xl); }
}

p {
  text-wrap: pretty; /* distribui melhor as últimas linhas do parágrafo */
}

/* ---- Links -------------------------------------------------------------
   Sublinhado por padrão: em site institucional, link que não parece link
   custa clique. O offset e a espessura evitam que o traço encoste na letra. */

a {
  color: var(--color-accent-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-primary);
}

/* ---- Foco --------------------------------------------------------------
   Um único anel para o site inteiro. :focus-visible mostra só para quem
   navega por teclado, sem poluir o clique de mouse. */

:focus-visible {
  outline: var(--border-width-thick) solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Sobre fundo escuro o anel bronze continua legível (4.59:1),
   mas ganha um halo claro para não sumir contra o navy. */
.is-inverse :focus-visible,
.section--inverse :focus-visible {
  outline-color: var(--color-accent-on-dark);
}

/* O atributo hidden vem de [hidden] { display: none } na folha do próprio
   navegador, e perde para QUALQUER display declarado aqui — .form-grid com
   display: grid, por exemplo, continua visível mesmo com hidden aplicado.
   Sem esta linha, esconder elemento por hidden simplesmente não funciona. */
[hidden] {
  display: none !important;
}

/* ---- Mídia -------------------------------------------------------------- */

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

/* ---- Listas ------------------------------------------------------------- */

ul, ol {
  padding-left: var(--space-5);
}

li + li {
  margin-top: var(--space-2);
}

/* ---- Formulário --------------------------------------------------------- */

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

textarea {
  resize: vertical;
}

/* ---- Tabela ------------------------------------------------------------- */

table {
  border-collapse: collapse;
  width: 100%;
}

th {
  text-align: left;
  font-weight: var(--weight-semibold);
}

/* ---- Diversos ----------------------------------------------------------- */

hr {
  border: 0;
  border-top: var(--border-width) solid var(--color-border);
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

::selection {
  background-color: var(--color-accent-subtle);
  color: var(--color-text);
}

/* Pula direto para o conteúdo — primeiro item do Tab na página. */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: 999;
  padding: var(--space-3) var(--space-5);
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--color-on-primary);
}

/* Visível só para leitor de tela. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
