/* ==========================================================================
   AgroTerra — Reset, tipografia base e utilitários de acessibilidade
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Compensa o cabeçalho fixo ao navegar por âncoras */
  scroll-padding-top: calc(var(--header-h) + 16px);
  /* Trava contra rolagem horizontal aplicada aqui, e não no body:
     overflow-x no body cria um contexto de rolagem que quebra
     position: fixed e position: sticky em Safari e Chrome. */
  overflow-x: hidden;
}

@supports (overflow: clip) {
  /* clip não gera caixa de rolagem, então o header fixo e o botão
     flutuante continuam ancorados na viewport. */
  html { overflow-x: clip; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bone);
  color: var(--tx);
  font-family: var(--ff-text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

body.is-locked {
  overflow: hidden;
  /* iOS: evita o "scroll bleed" do fundo com o drawer aberto */
  position: fixed;
  inset: 0;
  width: 100%;
}

h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--ff-display);
  color: var(--tx-strong);
  font-weight: 700;
  line-height: var(--lh-head);
  letter-spacing: var(--tr-head);
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--d-fast) var(--e-out);
}

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

/* <picture> sai da árvore de layout: sem isso o <img> herda uma caixa
   inline de altura automática e todo height:100% dentro de .media,
   .hero__bg ou .product__media deixa de resolver. */
picture { display: contents; }

img, video { height: auto; }

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

button { background: none; border: 0; cursor: pointer; }

table { border-collapse: collapse; width: 100%; }

hr { border: 0; border-top: 1px solid var(--line); margin: 0; }

::selection { background: var(--terra); color: #fff; }

/* ---- Foco visível e consistente ---- */
:focus { outline: none; }

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

.on-dark :focus-visible,
.is-dark :focus-visible { outline-color: var(--clay); }

/* ---- Acessibilidade ---- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0; left: 50%;
  transform: translate(-50%, -140%);
  z-index: 200;
  background: var(--ink);
  color: var(--tx-on-dark);
  padding: 0.85rem 1.35rem;
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 0 0 var(--r-md) var(--r-md);
  transition: transform var(--d-base) var(--e-out);
}

.skip-link:focus-visible { transform: translate(-50%, 0); }

/* ==========================================================================
   Tipografia utilitária
   ========================================================================== */

.display {
  font-size: var(--fs-display);
  font-weight: 800;
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-tight);
  font-stretch: 112%;
  text-transform: uppercase;
}

.h1 { font-size: var(--fs-h1); font-weight: 800; line-height: var(--lh-snug); letter-spacing: var(--tr-tight); }
.h2 { font-size: var(--fs-h2); font-weight: 700; line-height: var(--lh-snug); letter-spacing: var(--tr-tight); }
.h3 { font-size: var(--fs-h3); font-weight: 700; }
.h4 { font-size: var(--fs-h4); font-weight: 600; }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.56;
  color: var(--tx-mute);
  font-weight: 400;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--ff-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--terra);
}

.eyebrow::before {
  content: "";
  width: 1.9rem;
  height: 1px;
  background: currentColor;
  opacity: .55;
  flex: none;
}

.on-dark .eyebrow { color: var(--clay); }

.mono {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
}

.tx-mute { color: var(--tx-mute); }
.accent  { color: var(--terra); }
.on-dark .accent { color: var(--clay); }

/* Quebra tipográfica controlada em telas largas */
.measure       { max-width: 62ch; }
.measure-tight { max-width: 46ch; }
