/* Via Connect — Base: reset, tipografia, grid e componentes */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
/* Âncoras param abaixo da nav fixa (16px + 64px de barra) */
[id] { scroll-margin-top: 96px; }
/* No toque: sem o flash cinza do iOS e sem atraso de toque duplo */
a, button, summary, [role="button"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bege);
  color: var(--marrom);
  font-family: var(--font-body);
  font-size: var(--fs-corpo);
  line-height: var(--lh-corpo);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip; /* impede rolagem lateral no iOS sem criar contêiner de rolagem */
}

img, video, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; }

:focus-visible { outline: 2px solid var(--acento); outline-offset: 4px; }

/* ---------- Seção e container ---------- */
.secao {
  background: var(--bg);
  color: var(--fg);
  padding-block: var(--secao-py);
}
.secao.tema-escuro { --bg: var(--marrom); }
.secao.bg-floresta { --bg: var(--floresta); }
.secao.bg-grafite { --bg: var(--grafite); }
.secao.bg-apoio { --bg: var(--bege-apoio); }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: var(--space-2);
}
@media (min-width: 768px) {
  .grid { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--space-3); }
}

/* ---------- Tipografia ----------
   Padrão do site original: manchetes em Garamond Bold; hero e CTA final em Bold Itálico (.italico) */
.display-xl, .display-l, .display-m {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.display-xl { font-size: var(--fs-display-xl); line-height: var(--lh-display-xl); }
.display-l  { font-size: var(--fs-display-l);  line-height: var(--lh-display-l); }
.display-m  { font-size: var(--fs-display-m);  line-height: var(--lh-display-m); }

.display-xl em, .display-l em, .display-m em {
  font-style: italic;
  color: var(--acento);
}

.italico { font-style: italic; }
.italico em { font-style: italic; }

.titulo-s {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-titulo-s);
  line-height: var(--lh-titulo);
}

.corpo { max-width: var(--medida); color: var(--fg-suave); }

.label {
  font-family: var(--font-body);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  line-height: 1.2;
}

/* Kicker: label com linha à esquerda */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.kicker::before {
  content: "";
  width: 32px;
  height: 1px;
  background: currentColor;
}

/* ---------- Botão ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 14px 28px;
  border: 1px solid transparent;
  border-radius: var(--radius-pilula);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  cursor: pointer;
  transition: opacity var(--dur-hover) ease;
}
/* Celular: botão mais justo para caber em uma linha; se não couber (320px), quebra centralizado */
@media (max-width: 419px) {
  .btn { padding-inline: 18px; gap: 8px; text-align: center; line-height: 1.3; justify-content: center; }
}
@media (hover: hover) { .btn:hover { opacity: 0.9; } }
.btn .seta { transition: transform var(--dur-hover) ease; }
@media (hover: hover) { .btn:hover .seta { transform: translateX(4px); } }

.btn-contorno {
  background: transparent;
  color: var(--fg);
  border-color: var(--borda);
}
@media (hover: hover) { .btn-contorno:hover { opacity: 1; border-color: var(--fg); } }

/* ---------- Link com sublinhado que desenha ---------- */
.link {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--dur-hover) ease;
}
@media (hover: hover) { .link:hover, .link:focus-visible { background-size: 100% 1px; } }

/* ---------- Divisor ---------- */
.divisor { height: 1px; background: var(--borda); border: 0; }

/* ---------- Placeholder de asset ---------- */
.placeholder {
  position: relative;
  display: flex;
  align-items: flex-end;
  background: var(--bege-apoio);
  color: rgb(49 27 23 / 0.6);
  padding: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow: hidden;
}
.tema-escuro .placeholder { background: rgb(239 230 218 / 0.08); color: rgb(239 230 218 / 0.6); }
.placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top right, transparent calc(50% - 0.5px), var(--borda) 50%, transparent calc(50% + 0.5px)),
    linear-gradient(to bottom right, transparent calc(50% - 0.5px), var(--borda) 50%, transparent calc(50% + 0.5px));
}
.placeholder span { position: relative; }
.ratio-4-5 { aspect-ratio: 4 / 5; }
.ratio-9-16 { aspect-ratio: 9 / 16; }
.ratio-16-9 { aspect-ratio: 16 / 9; }
.ratio-1-1 { aspect-ratio: 1 / 1; }

/* ---------- Marquee (duplicar o conteúdo da .marquee-trilha para loop contínuo) ---------- */
.marquee { overflow: hidden; }
.marquee-trilha {
  display: flex;
  width: max-content;
  gap: var(--space-2);
  animation: marquee 60s linear infinite;
}
.marquee:hover .marquee-trilha,
.marquee:focus-within .marquee-trilha { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee { overflow-x: auto; }
  .marquee-trilha { animation: none; }
}

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

/* ---------- Estados iniciais de motion (só com JS e sem reduced-motion) ---------- */
.js-motion [data-reveal="linhas"] .linha { display: block; overflow: hidden; }
.js-motion [data-reveal="linhas"] .linha > span { display: block; transform: translateY(105%); }
.js-motion [data-reveal="bloco"] > * { opacity: 0; transform: translateY(24px); }
.js-motion [data-reveal="imagem"] { overflow: hidden; }
.js-motion [data-reveal="imagem"] > * { transform: scale(1.05); }


/* ---------- A via: estrada contínua que passa pelo botão de cada seção (desenhada pelo motion.js) ----------
   Vermelha nas seções bege; bege nas seções vermelhas (vermelho sobre vermelho some). */
[data-via] { position: relative; isolation: isolate; }
.via-caminho {
  position: absolute;
  top: 0; left: 0;
  z-index: -1;             /* atrás do conteúdo, na frente do fundo da seção */
  overflow: visible;
  pointer-events: none;
}
.via-caminho path {
  fill: none;
  stroke: var(--vermelho);
  stroke-opacity: 0.4;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.via-caminho--clara path { stroke: var(--bege); stroke-opacity: 0.35; }

/* ---------- Fecho de seção: botão centralizado (no celular ocupa a largura toda) ---------- */
.secao-fecho {
  display: grid;
  justify-items: center;
  margin-top: clamp(40px, 5vw, 64px);
}
@media (max-width: 599px) {
  .secao-fecho .btn { width: 100%; justify-content: center; }
}

/* ---------- Popup de contato (aberto por qualquer botão com data-popup) ----------
   Usa <dialog> nativo: o navegador já cuida de Esc, foco preso dentro e fundo inerte. */
.popup {
  /* centraliza sem depender do estilo padrão de <dialog>, que muda de navegador */
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--linha);
  border-radius: 18px;
  background: var(--bege);
  color: var(--marrom);
  overflow: auto;
  overscroll-behavior: contain;
}
.popup::backdrop { background: rgb(21 12 10 / 0.72); }
@supports (backdrop-filter: blur(2px)) {
  .popup::backdrop { backdrop-filter: blur(3px); }
}
.popup[open] { animation: popup-entra 0.28s var(--ease-saida); }
@keyframes popup-entra { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) { .popup[open] { animation: none; } }

.popup__corpo { padding: clamp(24px, 4vw, 36px); }

.popup__fechar {
  position: absolute;
  top: 10px; right: 10px;
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--marrom);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
@media (hover: hover) { .popup__fechar:hover { background: rgb(49 27 23 / 0.08); } }

.popup__titulo {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 20ch;
  margin: 0 0 8px;
}
.popup__titulo em { color: var(--vermelho); font-style: italic; }
.popup__apoio {
  margin: 0 0 var(--space-3);
  color: var(--fg-suave);
  font-size: 0.9375rem;
  line-height: 1.5;
  max-width: 42ch;
}

.popup__campos { display: grid; gap: 14px; }
.popup__campo { display: grid; gap: 5px; }
.popup__campo label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-suave);
}
.popup__campo input,
.popup__campo select {
  width: 100%;
  min-height: 48px;                 /* alvo de toque confortável no celular */
  padding: 10px 14px;
  border: 1px solid var(--linha);
  border-radius: 10px;
  background: #fff;
  color: var(--marrom);
  font: inherit;
  font-size: 1rem;                  /* 16px: abaixo disso o iPhone dá zoom sozinho */
}
.popup__campo select { appearance: none; background-image: none; }
.popup__campo input:focus-visible,
.popup__campo select:focus-visible {
  outline: 2px solid var(--vermelho);
  outline-offset: 1px;
  border-color: var(--vermelho);
}
.popup__campo--erro input,
.popup__campo--erro select { border-color: var(--vermelho); }
.popup__erro { color: var(--vermelho); font-size: 0.8125rem; }

.popup__aviso {
  margin: 14px 0 0;
  color: var(--fg-suave);
  font-size: 0.75rem;
  line-height: 1.5;
}
.popup .btn { width: 100%; justify-content: center; margin-top: var(--space-3); }
.popup__enviando { opacity: 0.6; pointer-events: none; }

/* Tela de confirmação, depois do envio */
.popup__ok { display: none; text-align: center; }
.popup--ok .popup__form { display: none; }
.popup--ok .popup__ok { display: block; }
.popup__ok-marca {
  width: 56px; height: 56px;
  margin: 0 auto var(--space-2);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--vermelho);
  color: var(--bege);
  font-size: 1.5rem;
}

/* Armadilha de robô do popup: fora da tela, sem display:none — robô esperto
   ignora campo com display:none, mas preenche este. */
.popup__isca {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}
