/* =========================================================================
   RESET — substitui o Reboot do Bootstrap
   Carregar DEPOIS de tokens.css e ANTES de components.css
   ========================================================================= */

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

* { margin: 0; }

/* [hidden] precisa vencer componentes com display próprio (.notice, .field…) */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--color-text-primary);
  background-color: var(--color-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ui);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-base); }
h5, h6 { font-size: var(--fs-sm); }

p, li { text-wrap: pretty; }

a {
  color: var(--color-text-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

ul, ol { padding-left: 1.25em; }
ul[role="list"], ol[role="list"] { list-style: none; padding-left: 0; }

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

button, input, select, textarea, optgroup {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button { background: none; border: 0; padding: 0; cursor: pointer; }
textarea { resize: vertical; min-height: 5rem; }

table { border-collapse: collapse; border-spacing: 0; }
th { text-align: left; font-weight: var(--fw-semibold); }

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

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

fieldset { border: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

/* Foco global — nunca remover sem substituto */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }
:target, :focus-visible { scroll-margin-top: calc(var(--topbar-height) + var(--space-4)); }

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

::placeholder { color: var(--color-field-placeholder); opacity: 1; }

/* Utilitário obrigatório para leitores 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;
}
.sr-only-focusable:focus {
  position: static;
  width: auto; height: auto;
  margin: 0;
  clip-path: none;
  white-space: normal;
}

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