/* ============================================================
   Reset moderno
   Base: Andy Bell + Josh Comeau, adaptado pro nosso uso.
   Carregar SEMPRE depois de tokens.css e antes de base.css.
   ============================================================ */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  /* Containment raiz: o documento NUNCA gera scroll horizontal.
     `clip` é preferível a `hidden` porque NÃO cria contexto de
     rolagem nem afeta stacking contexts dos filhos. Resolve casos
     de overflow induzido por scrollbar vertical + sub-pixel
     rounding (típico em notebooks com Windows scaling 125%). */
  overflow-x: clip;
}

body {
  min-height: 100vh;
  min-height: 100svh; /* small viewport — evita pulo com barra do mobile */
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

img,
svg {
  height: auto;
}

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

button {
  background: none;
  border: 0;
  cursor: pointer;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* Foco visível, mas elegante — importante porque crianças vão
   usar dedo, mas pais/devs/testes usam teclado. */
:focus-visible {
  outline: 3px solid var(--color-barn);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* iOS — remove highlight cinza no toque (usamos nosso próprio feedback) */
* {
  -webkit-tap-highlight-color: transparent;
}

/* Texto não selecionável dentro do app — criança esfregando o dedo
   não deve disparar seleção. UI textual de adultos (legais, etc.)
   pode reativar com .selectable. */
body {
  user-select: none;
  -webkit-user-select: none;
}

.selectable {
  user-select: text;
  -webkit-user-select: text;
}

/* Respeita preferência de movimento reduzido — animações viram quase
   nada. Combina com os overrides de --duration-* em tokens.css. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* Utilitário acessível: visualmente escondido, lido pelo leitor 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;
}
