/* ─────────────────────────────────────────────────────────────
   Talhão mockup v4 — base: reset, tipografia, grade, botões,
   utilidades, reveal e transições. Só tokens de css/tokens.css.
   ───────────────────────────────────────────────────────────── */

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

html {
  scrollbar-gutter: stable; /* reserva o espaço da barra de rolagem: o navbar não anda ao trocar mapa / cards / tabela nem ao abrir modal */
}
@media (min-width: 761px) { /* vista Mapa: o mapa ocupa a tela toda (sem faixa da barra) e o navbar compensa a largura dela */
  html.is-fazendas { scrollbar-gutter: auto; }
  html.is-fazendas .site-header { padding-right: var(--sbw, 0px); }
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--fz-paper);
  color: var(--fz-ink);
  font-family: var(--fz-body), system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--fz-text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1;
}

html:has(dialog[open]) { overflow: hidden; }

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

h1, h2, h3, h4, p, figure, blockquote, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; }
ul[class], ol[class] { list-style: none; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
:where(button, a, [role="tab"], summary) { -webkit-tap-highlight-color: transparent; }

::selection { background: var(--fz-accent-soft); color: var(--fz-ink); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--fz-ring); outline-offset: 2px; }
#main:focus-visible { outline: none; }

/* ── Tipografia ─────────────────────────────────────────── */
h1, h2, h3, h4, .title-xl, .title-lg, .title-md {
  font-family: var(--fz-display), system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: inherit;
  text-wrap: balance;
  overflow-wrap: break-word;
}
h1, .title-xl { font-size: clamp(2.75rem, 6vw, 4.75rem); line-height: 1.02; font-weight: 700; letter-spacing: -0.03em; }
h2, .title-lg { font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.06; letter-spacing: -0.02em; }
h3, .title-md { font-size: var(--fz-text-title); line-height: 1.18; letter-spacing: -0.02em; }
h4 { font-size: 1.1rem; line-height: 1.25; letter-spacing: -0.015em; }
.title-compact { font-size: var(--fz-text-display); line-height: 1.05; }

p, li, dd { text-wrap: pretty; }
.lead { font-size: 1.2rem; line-height: 1.5; color: var(--fz-ink-soft); max-width: 60ch; }
.muted { color: var(--fz-ink-soft); }
.small { font-size: var(--fz-text-body-sm); line-height: 1.55; }
.caption { font-size: var(--fz-text-caption); line-height: 1.5; color: var(--fz-ink-soft); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--fz-mono), sans-serif; font-weight: 600; font-variant-numeric: tabular-nums; }
strong, b { font-weight: 600; }

.demo-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--fz-line);
  border-radius: var(--fz-r-full);
  background: var(--fz-white);
  font-family: var(--fz-mono), sans-serif;
  font-size: var(--fz-text-label-sm);
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--fz-ink-soft);
  white-space: nowrap;
  vertical-align: middle;
}
.demo-note::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid currentColor;
}
.on-dark .demo-note, .stage .demo-note, .site-footer .demo-note {
  background: transparent;
  border-color: var(--fz-hair-strong);
  color: var(--fz-on-dark-soft);
}

/* ── Grade ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: calc(1360px + 64px);
  margin-inline: auto;
  padding-inline: 32px;
}
.section { padding-block: var(--fz-sp-section); }
.section.alt, .surface-alt { background: var(--fz-paper-2); }
.section + .section.alt, .section.alt + .section { border-top: 1px solid var(--fz-line); }
.section-head { display: grid; gap: 16px; max-width: 760px; margin-bottom: 48px; }
.section-head.center { margin-inline: auto; text-align: center; justify-items: center; }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; }
.rule { height: 1px; border: 0; margin: 0; background: var(--fz-line); }
.on-dark { background: var(--fz-bg-deep); color: var(--fz-on-dark); }
.on-dark .muted, .on-dark .lead { color: var(--fz-on-dark-soft); }

/* ── Botões (receita fz) ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--fz-h-btn);
  padding: 0 24px;
  background: var(--fz-primary);
  color: var(--fz-on-primary);
  border: 1px solid var(--fz-primary);
  border-radius: var(--fz-r-xs);
  font-family: var(--fz-body), system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform .16s var(--fz-ease), filter .16s ease, box-shadow .16s ease,
              background-color .16s ease, border-color .16s ease, color .16s ease;
}
.btn svg { width: 18px; height: 18px; transition: transform .2s var(--fz-ease); }
.btn:hover { filter: brightness(1.18); transform: translateY(-1px); box-shadow: 0 6px 20px -8px rgba(0, 62, 32, .55); }
.btn:hover svg { transform: translateX(2px); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--fz-accent-deep); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn.sm { min-height: var(--fz-h-btn-sm); padding: 0 16px; font-size: var(--fz-text-ui); gap: 8px; }
.btn.sm svg { width: 16px; height: 16px; }
.btn.block { width: 100%; }

.btn.ghost { background: transparent; color: var(--fz-ink); border-color: var(--fz-line-strong); }
.btn.ghost:hover { border-color: var(--fz-accent-deep); background: var(--fz-accent-dim); filter: none; transform: none; box-shadow: none; }

.btn.text {
  min-height: 44px;
  padding: 0;
  background: transparent;
  border-color: transparent;
  color: var(--fz-primary);
  font-weight: 600;
}
.btn.text span { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 5px; text-decoration-thickness: 1px; transition: text-decoration-color .16s ease; }
.btn.text:hover { filter: none; transform: none; box-shadow: none; }
.btn.text:hover span { text-decoration-color: currentColor; }

.btn.on-dark { background: var(--fz-accent); color: var(--fz-accent-ink); border-color: var(--fz-accent); }
.btn.on-dark:hover { filter: brightness(1.08); box-shadow: 0 8px 24px -10px rgba(0, 161, 81, .55); }
.btn.on-dark:focus-visible { outline-color: var(--fz-accent-soft); }
.btn.ghost.on-dark, .on-dark .btn.ghost, .stage .btn.ghost { background: transparent; color: var(--fz-on-dark); border-color: var(--fz-hair-strong); }
.btn.ghost.on-dark:hover, .on-dark .btn.ghost:hover, .stage .btn.ghost:hover { background: var(--fz-hair); border-color: var(--fz-on-dark-soft); box-shadow: none; filter: none; }
.btn.text.on-dark, .on-dark .btn.text { background: transparent; border-color: transparent; color: var(--fz-on-dark); box-shadow: none; }

.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }

/* ── Utilidades ─────────────────────────────────────────── */
.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: 16px; top: -100px; z-index: 100;
  padding: 10px 16px; border: 1px solid var(--fz-line-strong); border-radius: var(--fz-r-xs);
  background: var(--fz-white); color: var(--fz-ink); font-size: var(--fz-text-ui);
  transition: top .16s var(--fz-ease);
}
.skip-link:focus-visible { top: 12px; }

/* Páginas da SPA (scripts/lib/casca.mjs spa()): o conteúdo de SEO do HTML fica invisível enquanto js/app.js monta a tela
   por cima (troca o <main>), e ocupa a tela para o rodapé estático não piscar. Sem JS ele aparece; com JS, se a tela não
   montar em 3 s, também. */
@media (scripting: enabled) {
  .seo-base { min-height: 100vh; opacity: 0; animation: seo-base-mostra 0s 3s forwards; }
}
@keyframes seo-base-mostra { to { opacity: 1; } }

.review-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 32px;
  padding: 6px 24px;
  background: var(--fz-paper-2);
  border-bottom: 1px solid var(--fz-line);
  font-family: var(--fz-mono), sans-serif;
  font-size: var(--fz-text-label-sm);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fz-ink-soft);
}
.review-strip > span:first-child::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px;
  border-radius: 50%; background: var(--fz-warn); vertical-align: 1px;
}

/* Status: sempre dot + rótulo neutro */
.status { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fz-text-ui); color: var(--fz-ink-soft); line-height: 1.3; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--fz-accent); flex: none; }
.status.good::before { background: var(--fz-good); }
.status.warn::before { background: var(--fz-warn); }
.status.bad::before { background: var(--fz-bad); }
.status.idle::before { background: transparent; border: 1px solid var(--fz-line-strong); }

/* ── Reveal + transições ────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .55s var(--fz-ease), transform .55s var(--fz-ease);
}
.reveal.is-in { opacity: 1; transform: none; }

@keyframes fz-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fz-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; animation-timing-function: var(--fz-ease); }
#header { view-transition-name: site-header; }

/* ── Responsivo ─────────────────────────────────────────── */
@media (max-width: 1080px) {
  .section-head { margin-bottom: 40px; }
}
@media (max-width: 760px) {
  .container { padding-inline: 16px; }
  .section { padding-block: var(--fz-sp-section-sm); }
  .section-head { margin-bottom: 32px; gap: 12px; }
  .lead { font-size: 1.125rem; }
  .review-strip { padding-inline: 16px; }
  .review-strip .rs-long { display: none; }
  .btn-row > .btn:not(.text) { flex: 1 1 auto; }
  .btn { white-space: normal; text-align: center; padding-block: 10px; line-height: 1.25; }
}

/* ── Movimento reduzido: tudo desligado ─────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
  .reveal { opacity: 1; transform: none; }
  .btn:hover, .btn:hover svg { transform: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
