/* =========================================================================
   MathMaker — Base
   Reset moderno + tipografia + elementos base. Presume tokens.css carregado.
   ========================================================================= */

/* ── Reset ────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--fonte-ui);
  font-size: var(--fs-16);
  line-height: var(--lh-corpo);
  color: var(--cor-texto);
  background-color: var(--cor-fundo);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ── Mídia ────────────────────────────────────────────────────────────── */
img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  font-style: italic; /* fallback elegante quando a imagem quebra */
}

/* ── Tipografia ───────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--fonte-display);
  font-weight: var(--peso-semibold);
  line-height: var(--lh-titulo);
  color: var(--cor-texto);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-48); }
h2 { font-size: var(--fs-36); }
h3 { font-size: var(--fs-28); }
h4 { font-size: var(--fs-22); }
h5 { font-size: var(--fs-18); }
h6 { font-size: var(--fs-16); }

@media (max-width: 768px) {
  h1 { font-size: var(--fs-36); }
  h2 { font-size: var(--fs-28); }
  h3 { font-size: var(--fs-22); }
}

p {
  margin-bottom: var(--esp-4);
}

a {
  color: var(--cor-primaria);
  text-decoration: none;
  transition: color var(--transicao);
}

a:hover {
  color: var(--cor-primaria-forte);
}

strong, b {
  font-weight: var(--peso-semibold);
}

small {
  font-size: var(--fs-14);
  color: var(--cor-texto-fraco);
}

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

code {
  font-size: 0.9em;
  background: var(--carvao-100);
  padding: 0.1em 0.4em;
  border-radius: var(--raio-sm);
}

/* ── Listas ───────────────────────────────────────────────────────────── */
ul, ol {
  padding-left: var(--esp-5);
  margin-bottom: var(--esp-4);
}

li {
  margin-bottom: var(--esp-2);
}

/* ── Separador / foco ─────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--cor-borda-suave);
  margin: var(--esp-6) 0;
}

:focus-visible {
  outline: 3px solid var(--madeira-500);
  outline-offset: 2px;
  border-radius: var(--raio-sm);
}

/* Acessibilidade: esconder visualmente, manter para leitores de tela */
.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;
}

/* ── Utilidades de layout ─────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--largura-max);
  margin-inline: auto;
  padding-inline: var(--esp-5);
}

.container--estreito {
  max-width: var(--largura-max-estreita);
}

.section {
  padding-block: var(--esp-9);
}

.section--sombra {
  background: var(--cor-superficie);
}

.section__eyebrow {
  display: inline-block;
  font-family: var(--fonte-ui);
  font-size: var(--fs-14);
  font-weight: var(--peso-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--madeira-700);
  margin-bottom: var(--esp-3);
}

.section__title {
  margin-bottom: var(--esp-4);
  max-width: 22ch;
}

.section__lead {
  font-size: var(--fs-18);
  color: var(--cor-texto-suave);
  max-width: 60ch;
  margin-bottom: var(--esp-6);
}

.text-center { text-align: center; }
.text-center .section__title,
.text-center .section__lead { margin-inline: auto; }

.mt-1 { margin-top: var(--esp-1); }
.mt-2 { margin-top: var(--esp-2); }
.mt-3 { margin-top: var(--esp-3); }
.mt-4 { margin-top: var(--esp-4); }
.mt-5 { margin-top: var(--esp-5); }
.mt-6 { margin-top: var(--esp-6); }

/* Redução de movimento (respeito a prefers-reduced-motion) */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
