/* ==========================================================================
   base.css — reset e estilos de elementos HTML
   Somente seletores de elemento e atributos globais. Sem classes de
   componente e sem decisões de layout de seção.
   ========================================================================== */

/* --------------------------------------------------------------------
   Reset básico
   -------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

/* --------------------------------------------------------------------
   html e body
   -------------------------------------------------------------------- */
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Rolagem suave nas âncoras, só para quem não pediu movimento reduzido */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-family-base);
  font-size: var(--text-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}

/* --------------------------------------------------------------------
   Containers
   A classe .container é definida uma única vez, em components.css.
   -------------------------------------------------------------------- */

/* --------------------------------------------------------------------
   Headings
   Tamanhos não são definidos aqui: serão decididos por componente/seção
   e registrados em docs/design-system.md.
   -------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-family-heading);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  overflow-wrap: break-word;
  text-wrap: balance;
}

/* Títulos de seção: 700. Subtítulos e títulos de componente (h3 em diante): 600. */
h1,
h2 {
  font-weight: var(--font-weight-bold);
}

/* --------------------------------------------------------------------
   Parágrafos
   -------------------------------------------------------------------- */
p {
  overflow-wrap: break-word;
  text-wrap: pretty;
}

/* --------------------------------------------------------------------
   Links
   O sublinhado padrão é mantido em links de texto (acessibilidade);
   componentes com classe podem sobrescrevê-lo.
   -------------------------------------------------------------------- */
a {
  color: inherit;
}

a:not([class]) {
  text-decoration-thickness: from-font;
  text-underline-offset: 0.15em;
}

/* --------------------------------------------------------------------
   Botões e campos de formulário
   Reset neutro; a aparência vem de .button (components.css).
   -------------------------------------------------------------------- */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

/* --------------------------------------------------------------------
   Imagens e mídia
   -------------------------------------------------------------------- */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

/* --------------------------------------------------------------------
   Listas
   Listas de navegação/UI devem usar role="list" para remover o marcador
   sem perder a semântica em leitores de tela (Safari/VoiceOver).
   Listas de texto corrido mantêm o estilo padrão do navegador.
   :where() mantém especificidade zero: qualquer classe de componente
   consegue redefinir padding/estilo sem precisar de seletor maior.
   -------------------------------------------------------------------- */
:where(ul[role="list"], ol[role="list"]) {
  padding: 0;
  list-style: none;
}

/* --------------------------------------------------------------------
   Acessibilidade
   -------------------------------------------------------------------- */
:focus-visible {
  outline: var(--border-width-strong) solid var(--color-focus);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

/* Alvos de foco programático (ex.: <main> depois do skip link) não precisam de contorno */
[tabindex="-1"]:focus {
  outline: none;
}

/* Compensação de âncoras para o header fixo (valor em tokens.css) */
section[id] {
  scroll-margin-top: var(--scroll-offset);
}

/* --------------------------------------------------------------------
   prefers-reduced-motion
   -------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
