/*
 * BASE
 * Responsabilidade: estilos de elementos crus (body, links, títulos, foco).
 * Aplica os tokens nos elementos HTML nativos. Componentes vêm depois.
 */

html {
  font-family: var(--font-sans);
  font-size: 100%;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  /* Transição suave ao alternar tema, sem animar tudo na página. */
  transition: background-color 0.15s ease, color 0.15s ease;
}

h1, h2, h3, h4, h5, h6 {
  line-height: var(--leading-tight);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p {
  color: var(--color-text);
}

small {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Links de texto: cor do texto + sublinhado discreto (estilo clean).
   Itens de menu/nav usam outro padrão (fundo no hover), definido no
   componente de navegação. */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--color-link);
  text-decoration-color: var(--color-text-muted);
}

code,
pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* Foco acessível e consistente em toda a aplicação. */
:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

/* Remove foco visível para clique de mouse, mantém para teclado. */
:focus:not(:focus-visible) {
  outline: none;
}

/* Skip link: o primeiro foco da página. Fica fora da tela até receber foco
   pelo teclado (Tab), quando desce ao topo para pular a navegação e ir direto
   ao conteúdo principal (#conteudo). */
.skip-link {
  position: fixed;
  top: -4rem;
  left: var(--space-3);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background-color: var(--color-surface);
  color: var(--color-text);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: var(--space-3);
}

/* Container central da aplicação: largura máxima legível + respiro lateral.
   Estrutura global de layout, usada pelo <main> do layout principal. */
.app-container {
  width: 100%;
  max-width: var(--max-width-content);
  margin-inline: auto;
  padding: var(--space-6) var(--space-5);
}