/* ==========================================================================
   Mattera Lab — base: reset, fontes, tipografia, acessibilidade
   Depende de tokens.css.
   ========================================================================== */

/* --- Fontes -------------------------------------------------------------
   Barlow Semi Condensed, SIL OFL, self-hosted. Nada de Google Fonts por link.
   Ed Checa é só o logotipo, que é SVG vetorizado — não tem @font-face aqui.
   ------------------------------------------------------------------------ */
@font-face {
  font-family: "Barlow Semi Condensed";
  src: url("../assets/fonts/barlow-semicondensed-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Semi Condensed";
  src: url("../assets/fonts/barlow-semicondensed-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Semi Condensed";
  src: url("../assets/fonts/barlow-semicondensed-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Semi Condensed";
  src: url("../assets/fonts/barlow-semicondensed-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto; /* sem smooth-scroll de biblioteca, nem nativo */
}

body {
  min-height: 100vh;
  background-color: var(--cor-fundo);
  color: var(--cor-texto);
  font-family: var(--fonte);
  font-size: var(--fs-corpo);
  font-weight: var(--peso-leve);
  line-height: var(--altura-linha);
  letter-spacing: var(--tracking-corpo);
  /* Nunca deixar o navegador inventar negrito ou itálico: só os pesos reais. */
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

ul, ol { list-style: none; padding: 0; }

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

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

/* --- Tipografia ---------------------------------------------------------- */
h1, h2, h3 {
  font-weight: var(--peso-leve);
  line-height: var(--altura-linha-titulo);
  letter-spacing: var(--tracking-titulo);
  /* pretty, não balance: em coluna estreita o balance igualava as linhas
     quebrando a frase em lugares errados ("de autor, em" sozinho em 1440). */
  text-wrap: pretty;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-corpo); font-weight: var(--peso-medio); }

p { text-wrap: pretty; }
p + p { margin-top: var(--esp-2); }

/* Só existe itálico em peso 400; pedir itálico em 300 faz o navegador cair no
   400 e criar um salto de peso dentro do mesmo parágrafo. Declarado explícito. */
em, i { font-style: italic; font-weight: var(--peso-normal); }
strong, b { font-weight: var(--peso-medio); } /* peso 500 existe em arquivo; 700 não */

/* Sem text-transform: lowercase. O tom minúsculo destas linhas já vem escrito
   no HTML, e o transform só fazia estrago onde a língua exige maiúscula —
   'English and Portuguese' aparecia minúsculo na página de contato em inglês. */
small {
  font-size: var(--fs-nav);
  letter-spacing: var(--tracking-nav);
  color: var(--cor-texto-suave);
}

/* --- Links ---------------------------------------------------------------
   Hover não faz nada, como na referência: sem opacidade, sem transform.
   A distinção do link é o sublinhado permanente, não um efeito de mouse. */
a {
  color: var(--cor-link);
  text-decoration: none;
  cursor: pointer;
}

a.link,
main p a,
footer p a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--cor-link-linha);
  text-underline-offset: 0.25em;
}

/* Alvo de toque (WCAG 2.5.8): 44×44 de área clicável nos links que vivem
   sozinhos num parágrafo — os de dentro da prosa ficam de fora porque padding
   ali invadiria as linhas vizinhas (e a exceção "inline" da norma cobre eles). */
p > a.link:only-child {
  display: inline-block;
  padding-block: max(0px, calc((44px - 1.5em) / 2));
}

/* --- Foco ----------------------------------------------------------------
   Anel duplo: azul do azulejo + contra-anel cru, para sobreviver tanto no
   fundo claro quanto por cima de foto escura. */
:focus-visible {
  outline: 2px solid var(--cor-foco);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--cor-foco-contra);
  border-radius: 1px;
}
:focus:not(:focus-visible) { outline: none; }

.pular-para-conteudo {
  position: absolute;
  left: -9999px;
  top: var(--esp-2);
  z-index: 100;
  padding: 0.625rem var(--esp-2); /* 10px em cima e embaixo: fecha os 44px de alvo */
  background: var(--cor-fundo);
  color: var(--cor-texto);
}
.pular-para-conteudo:focus { left: var(--esp-2); }

/* --- Seleção -------------------------------------------------------------- */
::selection {
  background-color: var(--cor-selecao);
  color: var(--cor-texto); /* mostarda sob marrom: 7,51:1 */
}

/* --- Movimento ------------------------------------------------------------
   Único efeito do site: opacidade 0 → 1, 2s, ease. Sem translate, sem parallax. */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.aparece {
  animation: fadeIn var(--dur-fade) var(--curva) both;
}

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

/* --- Imagem responsiva ---------------------------------------------------- */
.figura { margin: 0; }

.figura img {
  width: 100%;
  background-color: var(--cor-fundo-alt); /* segura o layout enquanto o webp carrega */
}

.retrato img  { aspect-ratio: 2 / 3; object-fit: cover; }
.paisagem img { aspect-ratio: 3 / 2; object-fit: cover; }

.legenda {
  margin-top: var(--esp-1);
  color: var(--cor-texto-suave); /* a referência não separa corpo de legenda no tamanho */
}

.visualmente-oculto {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
