/* ============================================================
   Megamix — Fontes, reset e elementos base
   specs/design.md §3 (tipografia) e §11 (elementos a evitar)
   ============================================================ */

/* ---- Fontes self-hosted. Proibida CDN externa (design.md §3.2) ----
   NOTA: arquivos ainda em .ttf. A conversão para woff2 + subset
   latin está pendente e exige uma ferramenta de build — ver
   memoria.md. Em produção isso precisa ser feito. */

@font-face {
  font-family: "Retail";
  src: url("../fonts/RetailVariable.ttf") format("truetype-variations");
  /* O eixo wght da Retail vai de 0 a 1000: Semibold = 600, Bold = 800.
     A faixa precisa chegar a 800, senão o Bold real fica inacessível. */
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Halyard Text";
  src: url("../fonts/Halyard-Text-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Halyard Text";
  src: url("../fonts/Halyard-Text-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---- Reset ---- */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-altura) + var(--sp-4));
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink-900);
  background-color: var(--surface);
  -webkit-font-smoothing: antialiased;
  /* Proíbe o navegador de falsificar peso/itálico — design.md §3.4 */
  font-synthesis: none;
  overflow-x: hidden;
}

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

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

/* ---- Tipografia — design.md §3.3 ---- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  /* opsz 1000 = corte Display da Retail, desenhado para título.
     O padrão do arquivo é 0 (corte Text), aberto demais nesses tamanhos. */
  font-variation-settings: "opsz" 1000;
  /* Tracking levemente positivo: o corte Display é ~2,8% mais fechado que o
     Text, e um pouco de ar devolve o respiro sem soltar o título. design.md §3.3 */
  letter-spacing: 0.015em;
  color: var(--brand-900);
  text-wrap: balance;
}

h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--brand-900);
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 700; }
h4 { font-size: var(--fs-h4); line-height: var(--lh-h4); }

p { text-wrap: pretty; }

/* Largura de leitura: 68 caracteres — design.md §3.4 */
p, li { max-width: 62ch; }

a { color: var(--brand-700); text-underline-offset: 0.2em; }
a:hover { color: var(--brand-900); }

ul, ol { padding-left: 1.25rem; }

strong, b { font-weight: 700; }

/* ---- Foco visível em todo elemento interativo — site.md §12 ---- */

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

/* Sobre fundos escuros, o anel de foco vira branco — design.md §2.4 */
.bloco-cor :focus-visible,
.hero :focus-visible,
.cabecalho :focus-visible,
.menu-lateral :focus-visible,
.rodape :focus-visible {
  outline-color: var(--focus-sobre-cor);
}

/* ---- Pular para o conteúdo — site.md §12 ---- */

.pular-conteudo {
  position: absolute;
  left: var(--sp-4);
  top: var(--sp-4);
  z-index: 200;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  color: var(--brand-900);
  font-weight: 700;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  transform: translateY(-200%);
  transition: transform var(--t-padrao) var(--ease);
}
.pular-conteudo:focus { transform: translateY(0); }

/* ---- Acessível só para leitor de tela ---- */

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

/* ---- Movimento reduzido: desliga TUDO — design.md §9 ---- */

@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;
    scroll-behavior: auto !important;
  }
}
