/* Base: reset, tipografia, utilitários */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-top) + var(--header-nav) + var(--header-faixa) + 16px);
  /* Rolagem limpa: reserva a barra (sem salto de layout ao travar o fundo) e barra discreta */
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* Rolagem suave nativa (âncoras, "voltar ao topo"); desligada com reduzir movimento */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--white);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  /* Decorações que sangram para fora do container nunca geram rolagem lateral */
  overflow-x: clip;
  display: flex;
  flex-direction: column;
}

/* Camada logo abaixo do <body> no site novo (layout raiz único, com o tipo de página em data-page):
   repete o arranjo do body para o <main> continuar crescendo e contendo as margens como antes. */
body > div[data-page] {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.is-locked {
  overflow: hidden;
}

main {
  flex: 1 0 auto;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  line-height: 1.2;
  margin: 0 0 var(--s-3);
  color: var(--text);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-h1); font-weight: 700; }
h2 { font-size: var(--fs-h2); font-weight: 700; }
h3 { font-size: var(--fs-h3); font-weight: 600; }

p {
  margin: 0 0 var(--s-4);
}

a {
  color: var(--green-600);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--green-700);
}

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

img {
  height: auto;
}

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

button {
  cursor: pointer;
}

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

:focus-visible {
  outline: 3px solid var(--green-600);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--green-50);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  margin-block: var(--section-gap);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.section-head h2 {
  margin: 0;
}

.section-head a {
  font-weight: 600;
  font-size: var(--fs-small);
  white-space: nowrap;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 200;
  background: var(--graphite-900);
  color: var(--on-dark);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: var(--s-3);
  color: var(--on-dark);
}

.muted {
  color: var(--text-muted);
}

.code {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

[hidden] {
  display: none !important;
}

/* Revelar ao rolar (classe aplicada por js/components/reveal.js) */
.has-reveal .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.55s var(--ease),
    transform 0.65s var(--ease);
  transition-delay: calc(var(--i, 0) * 70ms);
}

/* Só o que ainda vai animar ganha camada própria; ao terminar, libera a GPU */
.has-reveal .reveal:not(.is-visible) {
  will-change: opacity, transform;
}

.has-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
}

.has-reveal .card.reveal,
.has-reveal li.reveal {
  transform: translateY(20px) scale(0.98);
}

.has-reveal li.reveal.is-visible {
  transform: none;
}

@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;
  }
}
